/* =========================================================================
   SoundSleep — marketing site
   Brand tokens mirror SoundSleepNative/Sources/Theme + src/theme/index.ts
   ========================================================================= */

:root {
  /* Backgrounds — Midnight Navy palette */
  --bg:          #0D1B2A;
  --bg-card:     #1B2B4B;
  --bg-elevated: #233260;
  --bg-surface:  #162040;

  /* Borders */
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* Accents */
  --primary:    #5C6BC0;  /* Moon Purple  */
  --primary-2:  #7C8AE0;
  --secondary:  #52E5C4;  /* Mint Glow    */
  --amber:      #FFB347;
  --coral:      #FF6B6B;

  /* Text */
  --text:      #F0F4FF;   /* Star White   */
  --text-2:    #9FA8DA;   /* Lavender     */
  --text-3:    #8793b8;   /* Muted        */

  /* Type */
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, "Iowan Old Style",
           Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
           Arial, sans-serif;

  /* Layout */
  --maxw: 1180px;
  --radius: 22px;
  --radius-sm: 14px;

  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  --glow-purple: 0 0 90px -10px rgba(92, 107, 192, 0.55);
  --glow-mint:   0 0 80px -10px rgba(82, 229, 196, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Night-sky backdrop ------------------------------------------------------ */
.sky {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(92, 107, 192, 0.32), transparent 60%),
    radial-gradient(900px 650px at 8% 8%, rgba(82, 229, 196, 0.12), transparent 55%),
    radial-gradient(1200px 900px at 50% 115%, rgba(92, 107, 192, 0.18), transparent 60%),
    linear-gradient(180deg, #0b1726 0%, var(--bg) 35%, #0a1421 100%);
}
.stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1.4px 1.4px at 20% 30%,  rgba(255,255,255,0.9), transparent),
    radial-gradient(1.2px 1.2px at 70% 20%,  rgba(255,255,255,0.7), transparent),
    radial-gradient(1px   1px   at 40% 70%,  rgba(255,255,255,0.6), transparent),
    radial-gradient(1.6px 1.6px at 85% 60%,  rgba(255,255,255,0.8), transparent),
    radial-gradient(1px   1px   at 55% 45%,  rgba(255,255,255,0.5), transparent),
    radial-gradient(1.3px 1.3px at 12% 80%,  rgba(255,255,255,0.7), transparent),
    radial-gradient(1px   1px   at 92% 85%,  rgba(255,255,255,0.5), transparent),
    radial-gradient(1.2px 1.2px at 33% 12%,  rgba(255,255,255,0.6), transparent);
  background-repeat: no-repeat;
  opacity: 0.55;
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.7; } }

/* Layout helpers ---------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
section { position: relative; padding: 96px 0; }
.eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 14px;
}
.section-head { max-width: 720px; margin: 0 auto 56px; text-align: center; }
.section-head .eyebrow { text-align: center; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.08; letter-spacing: -0.5px; }
h2 { font-size: clamp(30px, 4.2vw, 46px); }
h3 { font-size: 21px; letter-spacing: -0.2px; }
p.lead { color: var(--text-2); font-size: 18.5px; }

.grad-text {
  background: linear-gradient(110deg, var(--text) 0%, var(--primary-2) 45%, var(--secondary) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans); font-size: 15.5px; font-weight: 600;
  padding: 14px 26px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; color: var(--text);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6f7fd6 55%, var(--secondary) 165%);
  box-shadow: 0 14px 40px -14px rgba(92, 107, 192, 0.9);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 50px -16px rgba(92, 107, 192, 1); }
.btn-ghost { background: rgba(255,255,255,0.04); border-color: var(--border-strong); }
.btn-ghost:hover { background: rgba(255,255,255,0.09); transform: translateY(-2px); }

/* App Store badge */
.appstore {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 12px 22px; border-radius: 14px; text-decoration: none;
  background: #000; border: 1px solid var(--border-strong); color: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
}
.appstore:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -18px rgba(0,0,0,0.9); }
.appstore svg { width: 26px; height: 26px; flex: none; }
.appstore .as-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.appstore .as-text small { font-size: 10.5px; opacity: 0.8; letter-spacing: 0.4px; }
.appstore .as-text span { font-size: 19px; font-weight: 600; letter-spacing: -0.3px; }

/* Nav --------------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: rgba(10, 20, 33, 0.6);
  border-bottom: 1px solid transparent;
  transition: background .25s ease, border-color .25s ease;
}
.nav.scrolled { background: rgba(10, 20, 33, 0.86); border-bottom-color: var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 6px 18px -6px rgba(92,107,192,0.8); }
.brand b { font-family: var(--serif); font-size: 21px; letter-spacing: -0.3px; }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a { color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 500; transition: color .15s ease; }
.nav-links a:hover { color: var(--text); }
.nav-cta { display: flex; align-items: center; gap: 14px; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); cursor: pointer; }

/* Hero -------------------------------------------------------------------- */
.hero { padding: 70px 0 60px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 40px; align-items: center; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px; border-radius: 999px; margin-bottom: 26px;
  background: rgba(82, 229, 196, 0.1); border: 1px solid rgba(82, 229, 196, 0.28);
  font-size: 13px; color: var(--secondary); font-weight: 600;
}
.hero-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--secondary); box-shadow: 0 0 10px var(--secondary); }
.hero h1 { font-size: clamp(42px, 6.4vw, 74px); }
.hero h1 .grad-text { display: inline; }
.hero p.lead { margin: 26px 0 34px; max-width: 540px; }
.hero-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-meta { margin-top: 30px; display: flex; gap: 28px; flex-wrap: wrap; color: var(--text-2); font-size: 14px; }
.hero-meta b { color: var(--text); font-family: var(--serif); font-size: 22px; display: block; letter-spacing: -0.3px; }

.hero-art { position: relative; display: flex; justify-content: center; }
.hero-art .glow {
  position: absolute; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(92,107,192,0.5), transparent 65%);
  filter: blur(20px); top: 8%; z-index: 0;
}
.hero-art .phone-stack { position: relative; z-index: 1; }
.hero-art .phone-stack .phone.back {
  position: absolute; top: 46px; left: -118px; transform: rotate(-8deg) scale(0.86);
  opacity: 0.92; filter: brightness(0.9);
}
.hero-art .phone-stack .phone.front { animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* Device frame ------------------------------------------------------------ */
.phone {
  width: 270px; border-radius: 42px; padding: 9px;
  background: linear-gradient(160deg, #2a3550, #121d33);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), var(--glow-purple);
}
.phone .screen { position: relative; border-radius: 34px; overflow: hidden; background: #0a1421; display: block; }
.phone .screen img { width: 100%; display: block; }
.phone.sm { width: 232px; border-radius: 38px; }
.phone.sm .screen { border-radius: 30px; }

/* Trust strip ------------------------------------------------------------- */
.trust { padding: 30px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.trust-row { display: flex; align-items: center; justify-content: center; gap: 14px 44px; flex-wrap: wrap; }
.trust-item { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14.5px; font-weight: 500; }
.trust-item svg { width: 19px; height: 19px; color: var(--secondary); flex: none; }

/* Feature rows ------------------------------------------------------------ */
.feature-row { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.feature-row + .feature-row { margin-top: 120px; }
.feature-row.reverse .f-copy { order: 2; }
.feature-row.reverse .f-art  { order: 1; }
.f-art { display: flex; justify-content: center; position: relative; }
.f-art::before {
  content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(92,107,192,0.28), transparent 68%); filter: blur(10px); z-index: 0;
}
.f-art .phone { position: relative; z-index: 1; }
.f-tag {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase; color: var(--secondary); margin-bottom: 16px;
}
.f-tag .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(82,229,196,0.12); border: 1px solid rgba(82,229,196,0.25); }
.f-tag .ic svg { width: 16px; height: 16px; }
.feature-row h2 { margin-bottom: 16px; }
.feature-row p { color: var(--text-2); font-size: 17.5px; }
.f-list { list-style: none; margin-top: 24px; display: grid; gap: 13px; }
.f-list li { display: flex; gap: 12px; align-items: flex-start; color: var(--text); font-size: 15.5px; }
.f-list li svg { width: 20px; height: 20px; color: var(--secondary); flex: none; margin-top: 2px; }
.f-list li b { font-weight: 600; }

/* Feature grid ------------------------------------------------------------ */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  background: linear-gradient(180deg, rgba(27,43,75,0.7), rgba(22,32,64,0.5));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 26px;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card .ic {
  width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 18px;
  background: linear-gradient(140deg, rgba(92,107,192,0.25), rgba(82,229,196,0.14));
  border: 1px solid var(--border-strong);
}
.card .ic svg { width: 24px; height: 24px; color: var(--secondary); }
.card h3 { margin-bottom: 9px; }
.card p { color: var(--text-2); font-size: 15px; }

/* How it works ------------------------------------------------------------ */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; counter-reset: step; }
.step { position: relative; padding: 34px 28px; border-radius: var(--radius);
  background: rgba(22,32,64,0.45); border: 1px solid var(--border); }
.step .num {
  font-family: var(--serif); font-size: 46px; line-height: 1; counter-increment: step;
  background: linear-gradient(135deg, var(--primary-2), var(--secondary));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 16px; display: block;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--text-2); font-size: 15px; }
.step-line { position: absolute; top: 56px; right: -13px; color: var(--primary); opacity: 0.4; }

/* Pricing ----------------------------------------------------------------- */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; max-width: 1000px; margin: 0 auto; }
.price {
  position: relative; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(27,43,75,0.7), rgba(22,32,64,0.5));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 28px;
}
.price.feat {
  border-color: rgba(92,107,192,0.6);
  box-shadow: var(--glow-purple);
  background: linear-gradient(180deg, rgba(35,50,96,0.85), rgba(22,32,64,0.7));
}
.price .ribbon {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #08111d; font-size: 11.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  padding: 6px 16px; border-radius: 999px; white-space: nowrap;
}
.price .plan { font-family: var(--serif); font-size: 20px; margin-bottom: 4px; }
.price .sub { color: var(--text-3); font-size: 13.5px; margin-bottom: 20px; }
.price .amount { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.price .amount .big { font-family: var(--serif); font-size: 46px; line-height: 1; letter-spacing: -1px; }
.price .amount .per { color: var(--text-2); font-size: 15px; }
.price .save { color: var(--secondary); font-size: 13.5px; font-weight: 600; margin-bottom: 22px; min-height: 20px; }
.price ul { list-style: none; display: grid; gap: 12px; margin-bottom: 26px; }
.price ul li { display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; color: var(--text); }
.price ul li svg { width: 18px; height: 18px; color: var(--secondary); flex: none; margin-top: 2px; }
.price ul li.muted { color: var(--text-3); }
.price ul li.muted svg { color: var(--text-3); }
.price .btn { width: 100%; justify-content: center; margin-top: auto; }
.price-note { text-align: center; color: var(--text-3); font-size: 13.5px; margin-top: 26px; }

/* FAQ --------------------------------------------------------------------- */
.faq { max-width: 800px; margin: 0 auto; display: grid; gap: 14px; }
.faq details {
  background: rgba(22,32,64,0.45); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 24px; transition: border-color .2s ease;
}
.faq details[open] { border-color: var(--border-strong); }
.faq summary {
  cursor: pointer; list-style: none; padding: 18px 0; font-weight: 600; font-size: 16.5px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .chev { transition: transform .25s ease; color: var(--text-2); flex: none; }
.faq details[open] summary .chev { transform: rotate(180deg); }
.faq details p { color: var(--text-2); font-size: 15.5px; padding: 0 0 20px; }

/* Final CTA --------------------------------------------------------------- */
.cta-wrap {
  position: relative; text-align: center; overflow: hidden;
  border-radius: 32px; padding: 72px 32px;
  background: linear-gradient(150deg, rgba(35,50,96,0.9), rgba(27,43,75,0.6));
  border: 1px solid var(--border-strong); box-shadow: var(--glow-purple);
}
.cta-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(600px 300px at 50% -20%, rgba(82,229,196,0.18), transparent 70%);
}
.cta-wrap > * { position: relative; z-index: 1; }
.cta-wrap h2 { font-size: clamp(30px, 4.4vw, 50px); margin-bottom: 18px; }
.cta-wrap p { color: var(--text-2); font-size: 18px; max-width: 520px; margin: 0 auto 32px; }
.cta-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Footer ------------------------------------------------------------------ */
footer { border-top: 1px solid var(--border); padding: 56px 0 40px; }
.foot-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.foot-brand { max-width: 320px; }
.foot-brand .brand { margin-bottom: 14px; }
.foot-brand p { color: var(--text-3); font-size: 14px; }
.foot-cols { display: flex; gap: 64px; flex-wrap: wrap; }
.foot-col h4 { font-family: var(--sans); font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-3); margin-bottom: 16px; }
.foot-col a { display: block; color: var(--text-2); text-decoration: none; font-size: 14.5px; margin-bottom: 11px; transition: color .15s ease; }
.foot-col a:hover { color: var(--text); }
.foot-bottom { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-3); font-size: 13.5px; }

/* Scroll reveal ----------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 56px; text-align: center; }
  .hero p.lead { margin-left: auto; margin-right: auto; }
  .hero-actions, .hero-meta, .hero-pill { justify-content: center; }
  .hero-art .phone-stack .phone.back { left: -90px; }
  .feature-row, .feature-row.reverse .f-copy, .feature-row.reverse .f-art { grid-template-columns: 1fr; }
  .feature-row .f-copy, .feature-row.reverse .f-copy { order: 1; }
  .feature-row .f-art,  .feature-row.reverse .f-art  { order: 2; }
  .feature-row { gap: 40px; text-align: center; }
  .feature-row .f-tag, .feature-row .f-list { justify-content: center; }
  .f-list { display: inline-grid; text-align: left; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .step-line { display: none; }
  .price-grid { grid-template-columns: 1fr; max-width: 440px; }
}
@media (max-width: 640px) {
  section { padding: 70px 0; }
  .nav-links { display: none; }
  .nav-cta .btn-ghost { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .hero-art .phone-stack .phone.back { display: none; }
  .hero-meta { gap: 20px; }
  .foot-cols { gap: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* =========================================================================
   Legal pages (privacy.html, terms.html)
   ========================================================================= */
.legal { padding: 150px 0 90px; }
.legal .container { max-width: 820px; }
.legal-head { margin-bottom: 44px; }
.legal-head h1 {
  font-size: clamp(34px, 5vw, 50px);
  background: linear-gradient(110deg, var(--text) 0%, var(--primary-2) 55%, var(--secondary) 110%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.legal-head .updated {
  margin-top: 14px; color: var(--text-3); font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--bg-surface);
}
.legal-toc {
  margin: 28px 0 8px; padding: 20px 24px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.legal-toc h2 { font-family: var(--sans); font-size: 13px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-2); margin-bottom: 12px; }
.legal-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; }
.legal-toc a { color: var(--text-2); text-decoration: none; font-size: 14.5px; line-height: 2; }
.legal-toc a:hover { color: var(--secondary); }
.legal-body h2 {
  font-size: 23px; margin: 40px 0 12px; scroll-margin-top: 100px;
  padding-top: 18px; border-top: 1px solid var(--border);
}
.legal-body h3 { font-family: var(--sans); font-size: 17px; font-weight: 700; margin: 22px 0 8px; color: var(--text); }
.legal-body p, .legal-body li { color: var(--text-2); font-size: 16.5px; }
.legal-body p { margin: 12px 0; }
.legal-body ul { margin: 12px 0 12px 22px; }
.legal-body li { margin: 7px 0; }
.legal-body a { color: var(--secondary); text-decoration: none; }
.legal-body a:hover { text-decoration: underline; }
.legal-body strong { color: var(--text); }
.legal-note {
  margin: 30px 0; padding: 16px 20px; font-size: 14.5px; color: var(--text-3);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: var(--radius-sm);
}
@media (max-width: 640px) { .legal-toc ol { columns: 1; } }
