/* ═══════════════════════════════════════════════════════════
   PeptidePal: Research Companion — Design System
   Brand blue: #0B7FFF | Fonts: Syne (display) + DM Sans (body)
   4pt spacing grid | Ionicons via CDN
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --brand:          #0B7FFF;
  --brand-dark:     #0060D6;
  --brand-bg:       #E5F1FF;
  --brand-bg-deep:  #D0E6FF;

  /* Surfaces */
  --bg:             #F2F2F7;
  --surface:        #FFFFFF;
  --surface-2:      #EBEBF0;
  --surface-3:      #E0E0E8;

  /* Text */
  --text:           #0C0C0E;
  --text-sub:       #48485C;
  --text-muted:     #8E8EA0;

  /* Borders */
  --border:         #D1D1DB;
  --border-light:   #E5E5F0;

  /* Status */
  --success:        #22C55E;
  --warning:        #F59E0B;
  --danger:         #EF4444;

  /* Category colors (from app) */
  --cat-weightloss: #34D399;
  --cat-recovery:   #EF4444;
  --cat-skin:       #F472B6;
  --cat-gh:         #FB923C;
  --cat-longevity:  #4ADE80;
  --cat-cognitive:  #60A5FA;
  --cat-sexual:     #A78BFA;
  --cat-sleep:      #C084FC;

  /* Spacing (4pt grid) */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  32px;
  --sp-2xl: 48px;
  --sp-3xl: 64px;

  /* Radius */
  --r-sm:   8px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);

  /* Font — matches iOS app (DM Sans throughout) */
  --font-display: 'DM Sans', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--brand); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--brand-dark); }

img { max-width: 100%; display: block; }

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
h4 { font-size: 1.1rem; }

p { color: var(--text-sub); max-width: 64ch; }

.text-muted { color: var(--text-muted); }
.text-brand { color: var(--brand); }

/* ── Layout ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.section {
  padding: var(--sp-3xl) 0;
}

.section--tight {
  padding: var(--sp-2xl) 0;
}

/* ── Nav ───────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.nav__logo-img {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--sp-xl);
  list-style: none;
}

.nav__links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-sub);
  transition: color 0.2s;
}

.nav__links a:hover { color: var(--brand); }

.nav__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand);
  color: #fff !important;
  padding: 10px 20px;
  border-radius: var(--r-full);
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.2s, transform 0.15s;
}

.nav__cta:hover {
  background: var(--brand-dark);
  color: #fff !important;
  transform: translateY(-1px);
}

.nav__hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text);
  cursor: pointer;
  padding: var(--sp-sm);
}

/* Mobile nav */
.nav__mobile {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99;
  padding: var(--sp-xl) var(--sp-lg);
}

.nav__mobile.is-open { display: flex; flex-direction: column; gap: var(--sp-lg); }

.nav__mobile a {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  padding: var(--sp-md) 0;
  border-bottom: 1px solid var(--border-light);
}

.nav__mobile .nav__cta {
  text-align: center;
  justify-content: center;
  margin-top: var(--sp-md);
  font-size: 1rem;
  padding: 14px 24px;
}

@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__hamburger { display: block; }
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  padding: var(--sp-3xl) 0 var(--sp-2xl);
  text-align: left;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3xl);
  align-items: center;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-bg);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--r-full);
  margin-bottom: var(--sp-lg);
}

.hero h1 {
  margin-bottom: var(--sp-lg);
}

.hero h1 span { color: var(--brand); }

.hero__desc {
  font-size: 1.125rem;
  line-height: 1.7;
  margin-bottom: var(--sp-xl);
  max-width: 48ch;
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.hero__visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero__phone-frame {
  width: 280px;
  height: 560px;
  background: var(--surface);
  border-radius: 40px;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-light);
  overflow: hidden;
  position: relative;
}

.hero__phone-screen {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--brand) 0%, #0960C0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-xl);
  color: #fff;
}

.hero__phone-screen .phone-logo {
  font-size: 48px;
  margin-bottom: var(--sp-md);
}

.hero__phone-screen .phone-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--sp-sm);
}

.hero__phone-screen .phone-subtitle {
  font-size: 0.85rem;
  opacity: 0.8;
  text-align: center;
}

.hero__phone-stats {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--sp-md);
}

.hero__phone-stat {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border-radius: var(--r-md);
  padding: 12px 16px;
  text-align: center;
}

.hero__phone-stat strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
}

.hero__phone-stat span {
  font-size: 0.7rem;
  opacity: 0.7;
}

@media (max-width: 768px) {
  .hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero__desc { margin-left: auto; margin-right: auto; }
  .hero__actions { justify-content: center; }
  .hero__visual { order: -1; }
  .hero__phone-frame { width: 220px; height: 440px; border-radius: 32px; }
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: var(--r-lg);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
}
.btn--primary:hover {
  background: var(--brand-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--secondary:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--brand);
  padding: 14px 16px;
}
.btn--ghost:hover { background: var(--brand-bg); }

/* ── Feature Cards ─────────────────────────────────────────── */
.features { background: var(--surface); }

.features__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-lg);
}

.feature-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--sp-xl);
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: var(--sp-md);
}

.feature-card h3 { margin-bottom: var(--sp-sm); }

.feature-card p {
  font-size: 0.9rem;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .features__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .features__grid { grid-template-columns: 1fr; }
}

/* ── Categories ────────────────────────────────────────────── */
.categories__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-md);
}

.category-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 14px var(--sp-md);
  transition: transform 0.15s, box-shadow 0.15s;
}

.category-chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.category-chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-chip__label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.category-chip__count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 700px) {
  .categories__grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Stats Banner ──────────────────────────────────────────── */
.stats-banner {
  background: var(--brand);
  color: #fff;
}

.stats-banner__inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  text-align: center;
  flex-wrap: wrap;
  gap: var(--sp-xl);
}

.stats-banner__item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.1;
}

.stats-banner__item span {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ── CTA Section ───────────────────────────────────────────── */
.cta-section {
  text-align: center;
}

.cta-section h2 { margin-bottom: var(--sp-md); }
.cta-section p { margin: 0 auto var(--sp-xl); }

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  padding: var(--sp-2xl) 0 var(--sp-xl);
}

.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--sp-2xl);
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: var(--sp-md);
}

.footer__brand-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.footer__desc {
  font-size: 0.875rem;
  line-height: 1.7;
  max-width: 36ch;
  color: rgba(255,255,255,0.5);
}

.footer h4 {
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-md);
}

.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.footer__links a {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.6);
  transition: color 0.2s;
}

.footer__links a:hover { color: #fff; }

.footer__bottom {
  margin-top: var(--sp-2xl);
  padding-top: var(--sp-lg);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
}

@media (max-width: 768px) {
  .footer__inner { grid-template-columns: 1fr; gap: var(--sp-xl); }
  .footer__bottom { flex-direction: column; gap: var(--sp-sm); text-align: center; }
}

/* ── Legal / Content Pages ─────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: var(--sp-2xl) 0 var(--sp-xl);
}

.page-header h1 { margin-bottom: var(--sp-sm); }

.page-header .updated {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.legal-content {
  padding: var(--sp-2xl) 0 var(--sp-3xl);
}

.legal-content h2 {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: var(--sp-xl);
  margin-bottom: var(--sp-md);
  color: var(--text);
}

.legal-content p,
.legal-content li {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-sub);
  margin-bottom: var(--sp-md);
}

.legal-content ul,
.legal-content ol {
  padding-left: var(--sp-lg);
  margin-bottom: var(--sp-md);
}

.legal-content li { margin-bottom: var(--sp-sm); }

.legal-content strong { color: var(--text); }

/* ── Support Page ──────────────────────────────────────────── */
.support-hero {
  background: linear-gradient(135deg, var(--brand) 0%, #0960C0 100%);
  color: #fff;
  text-align: center;
  padding: var(--sp-3xl) 0;
}

.support-hero h1 { color: #fff; margin-bottom: var(--sp-md); }
.support-hero p { color: rgba(255,255,255,0.85); margin: 0 auto; }

.support-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-lg);
}

.support-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--sp-xl);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.support-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.support-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--brand-bg);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto var(--sp-md);
}

.support-card h3 { margin-bottom: var(--sp-sm); }
.support-card p { font-size: 0.9rem; margin: 0 auto; }

@media (max-width: 700px) {
  .support-grid { grid-template-columns: 1fr; }
}

/* FAQ */
.faq-list {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--border-light);
}

.faq-item:first-child { border-top: 1px solid var(--border-light); }

.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: var(--sp-lg) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}

.faq-question ion-icon {
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.3s;
  flex-shrink: 0;
}

.faq-item.is-open .faq-question ion-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.is-open .faq-answer {
  max-height: 400px;
  padding-bottom: var(--sp-lg);
}

.faq-answer p {
  font-size: 0.925rem;
  line-height: 1.7;
}

/* Contact form */
.contact-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.form-group { display: flex; flex-direction: column; gap: var(--sp-xs); }

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-bg);
}

.form-group textarea { min-height: 120px; resize: vertical; }

/* ── Disclaimer Banner ─────────────────────────────────────── */
.disclaimer-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: var(--sp-md) var(--sp-lg);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.disclaimer-banner ion-icon {
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Utility ───────────────────────────────────────────────── */
.text-center { text-align: center; }
.mb-xs  { margin-bottom: var(--sp-xs); }
.mb-sm  { margin-bottom: var(--sp-sm); }
.mb-md  { margin-bottom: var(--sp-md); }
.mb-lg  { margin-bottom: var(--sp-lg); }
.mb-xl  { margin-bottom: var(--sp-xl); }
.mb-2xl { margin-bottom: var(--sp-2xl); }

/* ── Scroll-reveal Animations ──────────────────────────────── */
.scroll-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Override hover transforms to compose with reveal */
.feature-card.scroll-reveal.is-visible:hover { transform: translateY(-4px); }
.category-chip.scroll-reveal.is-visible:hover { transform: translateY(-2px); }
.support-card.scroll-reveal.is-visible:hover { transform: translateY(-4px); }

/* Hero entrance — CSS-only, no observer needed */
.hero__content {
  opacity: 0;
  transform: translateY(30px);
  animation: heroFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

.hero__visual {
  opacity: 0;
  transform: translateY(30px) scale(0.97);
  animation: heroPhoneIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}

@keyframes heroFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heroPhoneIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Phone frame gentle float */
.hero__phone-frame {
  transition: transform 0.3s ease-out;
  animation: phoneFloat 4s ease-in-out infinite 1.5s;
}

@keyframes phoneFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* Disclaimer fade */
.disclaimer-banner {
  opacity: 0;
  animation: heroFadeIn 0.6s ease 0.6s forwards;
}

/* Stats banner number pop */
.stats-banner__item.scroll-reveal.is-visible strong {
  animation: numberPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes numberPop {
  0%   { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* Button press feedback */
.btn:active {
  transform: scale(0.97) !important;
  transition: transform 0.1s;
}

/* Nav link underline hover */
.nav__links a {
  position: relative;
}

.nav__links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--brand);
  border-radius: 1px;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav__links a:hover::after {
  width: 100%;
}

/* Footer link hover slide */
.footer__links a {
  position: relative;
  padding-left: 0;
  transition: color 0.2s, padding-left 0.25s;
}

.footer__links a:hover {
  padding-left: 6px;
}

/* Form focus glow */
.form-group input,
.form-group textarea,
.form-group select {
  transition: border-color 0.2s, box-shadow 0.3s;
}

/* Support hero gradient shimmer */
.support-hero {
  position: relative;
  overflow: hidden;
}

.support-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.08) 0%, transparent 50%);
  animation: shimmerDrift 8s ease-in-out infinite;
}

@keyframes shimmerDrift {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(5%, 3%); }
}

/* Page header fade */
.page-header {
  opacity: 0;
  animation: heroFadeIn 0.5s ease 0.1s forwards;
}

.legal-content {
  opacity: 0;
  animation: heroFadeIn 0.5s ease 0.25s forwards;
}
