/* StarryTime — website stylesheet.
   Tokens mirror lib/core/theme/app_tokens.dart via DESIGN.md §7 (doc-sync rule:
   regenerate the :root block whenever app tokens change). No third-party
   requests: fonts are self-hosted WOFF2 instances of the app's bundled TTFs. */

:root {
  --night-deepest: #060B14; --night: #0A111E;
  --surface: #101A2C; --surface-high: #16233A; --surface-highest: #1D2C47;
  --hairline: #26344E;
  --gold: #F2C14E; --gold-deep: #D99A2B; --gold-glow: #FFE29A; --on-gold: #2B1F0A;
  --text-primary: #F5EBD8; --text-secondary: #A8B3C7;
  --text-label: #C9A15E; --text-disabled: #5D6A82;
  --status-success: #7FD8A4; --status-warning: #F0B95F;
  --status-error: #F08C7D; --status-info: #8FB8F2;
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-12: 48px;
  --font-display: "Lora", Georgia, serif;
  --font-body: "Nunito", system-ui, sans-serif;
  /* web-only derived values */
  --glow-soft: 0 2px 16px rgba(255, 226, 154, 0.20);
  --glow-strong: 0 3px 24px rgba(255, 226, 154, 0.32);
  --measure: 68ch;
}

/* ---------- fonts (same static instances the app bundles; SIL OFL) ------- */
@font-face {
  font-family: "Lora"; font-weight: 700; font-style: normal;
  font-display: swap;
  src: url("../fonts/Lora-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "Lora"; font-weight: 600; font-style: normal;
  font-display: swap;
  src: url("../fonts/Lora-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito"; font-weight: 400; font-style: normal;
  font-display: swap;
  src: url("../fonts/Nunito-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito"; font-weight: 600; font-style: normal;
  font-display: swap;
  src: url("../fonts/Nunito-SemiBold.woff2") format("woff2");
}

/* ---------- reset-ish ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  overflow-x: clip;
  background: var(--night);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-size-adjust: from-font;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; height: auto; display: block; }

/* ---------- night sky ------------------------------------------------------
   Procedural starfield, matching the app's painted starfield: tiny gold-glow
   speckles over a vertical night gradient. Pure CSS, no raster assets. */
.sky {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, var(--night) 0%, var(--night-deepest) 100%);
  overflow: hidden;
}
.sky::before, .sky::after {
  content: ""; position: absolute; inset: -10%;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255,226,154,.55), transparent 60%),
    radial-gradient(1px 1px at 28% 64%, rgba(255,226,154,.35), transparent 60%),
    radial-gradient(2px 2px at 41% 12%, rgba(245,235,216,.40), transparent 60%),
    radial-gradient(1px 1px at 57% 47%, rgba(255,226,154,.45), transparent 60%),
    radial-gradient(1.5px 1.5px at 66% 79%, rgba(245,235,216,.30), transparent 60%),
    radial-gradient(1px 1px at 74% 28%, rgba(255,226,154,.50), transparent 60%),
    radial-gradient(2px 2px at 86% 58%, rgba(255,226,154,.35), transparent 60%),
    radial-gradient(1px 1px at 93% 15%, rgba(245,235,216,.45), transparent 60%),
    radial-gradient(1px 1px at 8% 86%, rgba(255,226,154,.40), transparent 60%),
    radial-gradient(1.5px 1.5px at 49% 92%, rgba(255,226,154,.30), transparent 60%);
  background-size: 640px 640px;
}
.sky::after {
  background-size: 920px 920px;
  opacity: .6;
  animation: twinkle 9s ease-in-out infinite alternate;
}
@keyframes twinkle {
  from { opacity: .25; }
  to   { opacity: .65; }
}
@media (prefers-reduced-motion: reduce) {
  .sky::after { animation: none; }
}

/* ---------- type scale (DESIGN.md §3) ------------------------------------- */
h1, h2, h3 { font-family: var(--font-display); color: var(--text-primary); }
h1 { font-weight: 700; font-size: clamp(2.1rem, 5.5vw, 3.4rem); line-height: 1.15; margin: 0 0 var(--space-5); }
h2 { font-weight: 700; font-size: clamp(1.6rem, 3.5vw, 2.2rem); line-height: 1.2; margin: 0 0 var(--space-4); }
h3 { font-weight: 600; font-size: 1.25rem; line-height: 1.3; margin: 0 0 var(--space-2); }
p  { margin: 0 0 var(--space-4); }
.lede { color: var(--text-secondary); font-size: 1.15rem; max-width: var(--measure); }
.label {
  font-family: var(--font-body); font-weight: 600; font-size: .8rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-label);
  margin: 0 0 var(--space-3);
}
a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold-glow); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

/* ---------- layout --------------------------------------------------------- */
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: var(--space-5); }
section { padding-block: clamp(56px, 9vw, 108px); }

/* ---------- header ---------------------------------------------------------- */
.site-head {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--night) 88%, transparent);
  backdrop-filter: none; /* lean-effects rule: no blur surfaces */
  border-bottom: 1px solid var(--hairline);
}
.site-head .wrap {
  display: flex; align-items: center; gap: var(--space-5);
  min-height: 64px; flex-wrap: wrap; padding-block: var(--space-2);
}
.brand {
  display: flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-display); font-weight: 700; font-size: 1.3rem;
  color: var(--text-primary); text-decoration: none;
}
.brand img { width: 34px; height: 34px; }
.site-nav { margin-left: auto; display: flex; gap: var(--space-5); flex-wrap: wrap; }
.site-nav a {
  color: var(--text-secondary); text-decoration: none; font-weight: 600;
  font-size: .95rem; padding: var(--space-2) 0;
}
.site-nav a:hover { color: var(--gold); }

/* ---------- buttons & pills ------------------------------------------------ */
.btn {
  display: inline-block; text-align: center;
  padding: 16px 30px; border-radius: var(--r-md);
  font-family: var(--font-body); font-weight: 600; font-size: 1.05rem;
  text-decoration: none; border: 0; cursor: pointer;
}
.btn-gold {
  background: linear-gradient(180deg, #F5C86A, #E8A84C);
  color: var(--on-gold); box-shadow: var(--glow-strong);
}
.btn-gold:hover { filter: brightness(1.06); color: var(--on-gold); }
.btn-ghost {
  border: 1px solid var(--hairline); color: var(--text-primary);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  border-radius: 999px; padding: 6px 14px;
  font-weight: 600; font-size: .9rem;
  background: var(--surface-high); border: 1px solid var(--hairline);
  color: var(--text-secondary);
}
.pill-gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.pill-success { color: var(--status-success); }

/* ---------- hero ------------------------------------------------------------ */
.hero { padding-block: clamp(48px, 8vw, 96px) clamp(40px, 6vw, 72px); }
.hero .wrap {
  display: grid; gap: clamp(32px, 6vw, 72px);
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
}
.hero-cta { display: flex; gap: var(--space-4); flex-wrap: wrap; align-items: center; margin-top: var(--space-6); }
.hero-note { color: var(--text-disabled); font-size: .9rem; margin-top: var(--space-3); }
.hero h1 em { font-style: normal; color: var(--gold); }
@media (max-width: 820px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-phone { order: -1; max-width: 300px; margin-inline: auto; }
}

/* ---------- phone frames ---------------------------------------------------- */
.phone {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 34px; padding: 10px;
  box-shadow: var(--glow-soft);
}
.phone img { border-radius: 26px; }
.phone-halo { position: relative; }
.phone-halo::before {
  content: ""; position: absolute; inset: -12%;
  background: radial-gradient(closest-side, rgba(255,226,154,.14), transparent 70%);
  z-index: -1;
}

/* ---------- trust strip ------------------------------------------------------ */
.trust {
  border-block: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  padding-block: var(--space-5);
}
.trust ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-8);
  justify-content: center;
  color: var(--text-secondary); font-weight: 600; font-size: .98rem;
}
.trust li { display: flex; align-items: center; gap: var(--space-2); }
.trust svg { color: var(--gold); flex: none; }

/* ---------- cards grid -------------------------------------------------------- */
.grid {
  display: grid; gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: var(--space-6);
}
.card .icon {
  width: 46px; height: 46px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--surface-high); color: var(--gold);
  margin-bottom: var(--space-4);
}
.card p { color: var(--text-secondary); margin: 0; }

/* ---------- how-it-works ------------------------------------------------------- */
.steps { counter-reset: step; display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.step {
  position: relative; padding: var(--space-6);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg);
}
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  background: linear-gradient(180deg, #F5C86A, #E8A84C); color: var(--on-gold);
  margin-bottom: var(--space-4);
}
.step p { color: var(--text-secondary); margin: 0; }

/* ---------- narration sample ----------------------------------------------------- */
.script {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: var(--space-6);
  max-width: 620px;
}
.script p { margin: 0 0 var(--space-4); font-size: 1.08rem; }
.script .direction {
  display: block; color: var(--text-label); font-size: .85rem;
  font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 2px;
}
.script p:last-child { margin-bottom: 0; }

/* ---------- gallery ---------------------------------------------------------------- */
.gallery {
  display: grid; gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: start;
}
.gallery figure { margin: 0; }
.gallery figcaption {
  text-align: center; color: var(--text-secondary);
  font-size: .92rem; margin-top: var(--space-3);
}

/* ---------- pricing ------------------------------------------------------------------ */
.plans { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 860px; margin-inline: auto; }
.plan {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: var(--space-8);
  display: flex; flex-direction: column;
}
.plan.featured { border: 1.5px solid var(--gold); box-shadow: var(--glow-soft); }
.plan .price { font-family: var(--font-display); font-weight: 700; font-size: 2.3rem; margin: var(--space-2) 0; }
.plan .price small { font-family: var(--font-body); font-weight: 400; font-size: 1rem; color: var(--text-secondary); }
.plan ul { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-3); color: var(--text-secondary); }
.plan li { display: flex; gap: var(--space-3); align-items: baseline; }
.plan li::before { content: "✦"; color: var(--gold); flex: none; }
.fineprint { color: var(--text-disabled); font-size: .9rem; max-width: 720px; margin: var(--space-6) auto 0; text-align: center; }

/* ---------- FAQ ------------------------------------------------------------------------ */
.faq { max-width: 780px; margin-inline: auto; }
.faq details {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
}
.faq summary {
  cursor: pointer; font-weight: 600; font-size: 1.05rem;
  color: var(--text-primary); list-style: none;
  display: flex; justify-content: space-between; gap: var(--space-4); align-items: center;
  min-height: 32px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--gold); font-size: 1.4rem; flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--text-secondary); margin: var(--space-3) 0 0; }

/* ---------- footer ------------------------------------------------------------------------ */
.site-foot {
  border-top: 1px solid var(--hairline);
  padding-block: var(--space-8) var(--space-12);
  color: var(--text-secondary); font-size: .95rem;
}
.site-foot .cols {
  display: grid; gap: var(--space-8);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: var(--space-8);
}
.site-foot h3 { font-size: 1rem; font-family: var(--font-body); color: var(--text-primary); }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.site-foot a { color: var(--text-secondary); text-decoration: none; }
.site-foot a:hover { color: var(--gold); }
.site-foot .legal { color: var(--text-disabled); font-size: .85rem; }

/* ---------- article pages (privacy, terms, …) ------------------------------------------------ */
.article { max-width: 780px; margin-inline: auto; padding-block: clamp(40px, 6vw, 72px); }
.article h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.article h2 { font-size: 1.45rem; margin-top: var(--space-8); }
.article h3 { margin-top: var(--space-6); }
.article p, .article li { color: var(--text-secondary); }
.article strong { color: var(--text-primary); }
.article .updated { color: var(--text-disabled); font-size: .9rem; margin-bottom: var(--space-8); }
.article table { border-collapse: collapse; width: 100%; margin: var(--space-4) 0; }
.article th, .article td {
  text-align: left; padding: var(--space-3);
  border: 1px solid var(--hairline); color: var(--text-secondary);
  vertical-align: top;
}
.article th { color: var(--text-primary); background: var(--surface); }
.article .callout {
  background: var(--surface); border: 1px solid var(--hairline);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm); padding: var(--space-4) var(--space-5);
  margin: var(--space-5) 0;
}
.table-scroll { overflow-x: auto; }

/* ---------- scroll reveals (progressive enhancement, CSS-only) ------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: rise-in both;
      animation-timeline: view();
      animation-range: entry 0% entry 45%;
    }
    @keyframes rise-in {
      from { opacity: 0; transform: translateY(22px); }
      to   { opacity: 1; transform: none; }
    }
  }
}
