/* ==========================================================================
   TOPOS ASTRO MATCH — site design system
   Mirrors apps/mobile/theme/tokens.ts (§3.2 of the build brief).
   Two surfaces: the app is a dark instrument, the dossier is a printed plate.
   ========================================================================== */

:root {
  /* Instrument (dark) */
  --ground: #0E1626;
  --raised: #182640;
  --rule: #2A3A57;
  --chalk: #E8E4D9;
  --chalk-dim: #9AA6B8;
  --brass: #C9A227;
  --verdigris: #4E8C7F;
  --oxide: #B4432E;

  /* Plate (light) */
  --paper: #F2EDE1;
  --paper-raised: #EAE3D2;
  --plate-rule: #C4BCA8;
  --plate-ink: #16160F;
  --plate-dim: #5C5847;
  --plate-brass: #8A6D1F;
  --plate-verdigris: #3F6E62;
  --plate-oxide: #93341F;

  /* Type scale (§3.2): 34 / 24 / 18 / 15 / 13 / 11, body 15/1.6 */
  --s-display: 34px;
  --s-title: 24px;
  --s-section: 18px;
  --s-body: 15px;
  --s-small: 13px;
  --s-micro: 11px;

  --f-display: "Bodoni Moda", "Didot", serif;
  --f-ui: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --f-mono: "IBM Plex Mono", "SF Mono", monospace;

  /* Motion (§3.2): 200ms state, 400ms surface */
  --m-state: 200ms;
  --m-surface: 400ms;

  --maxw: 1080px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--ground);
  color: var(--chalk);
  font-family: var(--f-ui);
  font-size: var(--s-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(201, 162, 39, 0.28); }

a { color: inherit; text-decoration: none; }

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

/* --------------------------------------------------------------------------
   Shared type
   -------------------------------------------------------------------------- */

.display {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--s-display);
  line-height: 1.22;
  letter-spacing: 0.005em;
}

.title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--s-title);
  line-height: 1.3;
}

.section-label {
  font-family: var(--f-mono);
  font-size: var(--s-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}

.body { font-size: var(--s-body); max-width: 58ch; }

.dim { color: var(--chalk-dim); }

.mono {
  font-family: var(--f-mono);
  font-size: var(--s-small);
  font-variant-numeric: tabular-nums;
}

.mono-micro {
  font-family: var(--f-mono);
  font-size: var(--s-micro);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* --------------------------------------------------------------------------
   Chrome — header
   -------------------------------------------------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14, 22, 38, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  gap: 24px;
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: var(--s-small);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wordmark .astro { color: var(--brass); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: var(--s-small);
  color: var(--chalk-dim);
}

.site-nav a {
  transition: color var(--m-state) ease-out;
}

.site-nav a:hover { color: var(--chalk); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--f-ui);
  font-weight: 500;
  font-size: var(--s-small);
  letter-spacing: 0.04em;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: background var(--m-state) ease-out, color var(--m-state) ease-out,
    border-color var(--m-state) ease-out;
}

.btn-brass { background: var(--brass); color: #14100a; }
.btn-brass:hover { background: #dcb53a; }

.btn-ghost {
  border-color: var(--rule);
  color: var(--chalk);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--brass); color: var(--brass); }

.head-cta { padding: 8px 16px; }

/* --------------------------------------------------------------------------
   Hero — the cold open (§4.1) with the orbital system.
   Full viewport, near-black space; the canvas sits behind the content and
   the scrim guarantees text contrast no matter where a trail wanders.
   -------------------------------------------------------------------------- */

.hero-orbit {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  background: #03040A;
  overflow: hidden;
  padding: 120px 0 110px;
}

#orbit-canvas {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none; /* the text and CTAs stay fully interactive */
}

/* Left-side scrim: trails may pass behind the copy, never through it. */
.hero-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(3, 4, 10, 0.78) 0%,
    rgba(3, 4, 10, 0.42) 34%,
    rgba(3, 4, 10, 0) 62%
  );
}

/* Seamless handoff from near-black space to the instrument ground. */
.hero-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 170px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(14, 22, 38, 0), var(--ground));
}

.hero-wrap { position: relative; z-index: 2; width: 100%; }

.hero-content { max-width: 560px; }

.hero .display { margin: 28px 0 20px; }

.hero-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.hero-secondary {
  font-size: var(--s-small);
  color: var(--chalk-dim);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: color var(--m-state) ease-out, border-color var(--m-state) ease-out;
}
.hero-secondary:hover { color: var(--chalk); border-color: var(--brass); }

.hero-dataline {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--chalk-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.hero-dataline span { white-space: nowrap; }
.hero-dataline b { color: var(--brass); font-weight: 400; }

/* The narrative hook: the animation is a sky fixed at one birth moment. */
.hero-caption {
  position: absolute;
  right: 28px;
  bottom: 22px;
  z-index: 2;
  color: var(--chalk-dim);
  opacity: 0.75;
  letter-spacing: 0.12em;
  text-align: right;
}

/* The graduated hairline with a travelling brass index mark.
   Aspect ratio drives the height so the viewBox never letterboxes. */
.hairline { width: 100%; max-width: 560px; height: auto; aspect-ratio: 720 / 54; display: block; }
.hairline .index-mark { animation: sweep 7s ease-in-out infinite alternate; }

@keyframes sweep {
  from { transform: translateX(0); }
  to { transform: translateX(calc(100% - 2px)); }
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

section { padding: 96px 0; }

section + section { border-top: 1px solid var(--rule); }

.section-head { margin-bottom: 56px; max-width: 640px; }
.section-head .section-label { display: block; margin-bottom: 14px; }
.section-head .title { margin-bottom: 16px; }

/* --------------------------------------------------------------------------
   The determinism strip — three rules
   -------------------------------------------------------------------------- */

.rules-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.rule-cell {
  background: var(--ground);
  padding: 28px 26px 30px;
}

.rule-cell .mono-micro { color: var(--brass); display: block; margin-bottom: 12px; }
.rule-cell p { font-size: var(--s-small); color: var(--chalk-dim); }
.rule-cell p strong { color: var(--chalk); font-weight: 500; }

/* --------------------------------------------------------------------------
   The five surfaces (§3.3)
   -------------------------------------------------------------------------- */

.figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.figure {
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 26px 26px 22px;
  display: flex;
  flex-direction: column;
}

.figure.wide { grid-column: 1 / -1; }

.figure .fig-tag {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: var(--chalk-dim);
  margin-bottom: 20px;
}

.figure .fig-tag .no { color: var(--brass); }

.figure .fig-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.figure svg { max-width: 100%; height: auto; display: block; }

.figure .fig-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: var(--s-small);
  color: var(--chalk-dim);
}

/* --------------------------------------------------------------------------
   The dossier — the plate (light) surface. §4.9's mode switch.
   -------------------------------------------------------------------------- */

.plate-section {
  background: var(--paper);
  color: var(--plate-ink);
}

.plate-section .section-label { color: var(--plate-brass); }
.plate-section .dim { color: var(--plate-dim); }

.dossier-sheet {
  border: 1px solid var(--plate-rule);
  background: var(--paper);
  padding: 56px 56px 48px;
  position: relative;
}

.dossier-sheet::before,
.dossier-sheet::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

/* Engraved double frame. */
.dossier-sheet::before { inset: 10px; border: 1px solid var(--plate-rule); }
.dossier-sheet::after { inset: 14px; border: 1px solid var(--plate-rule); opacity: 0.5; }

.dossier-masthead {
  text-align: center;
  padding-bottom: 34px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--plate-rule);
  position: relative;
  z-index: 1;
}

.dossier-masthead .mono-micro { color: var(--plate-brass); letter-spacing: 0.3em; }

.dossier-masthead .title {
  font-size: 30px;
  margin: 16px 0 10px;
}

.dossier-verdict {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.verdict-line {
  font-family: var(--f-display);
  font-size: var(--s-title);
  line-height: 1.35;
}

.verdict-line em { font-style: italic; }

.verdict-meta { margin-top: 18px; color: var(--plate-dim); }
.verdict-meta b { color: var(--plate-ink); font-weight: 400; }

.dossier-figure { text-align: center; }

.mechanic-card {
  margin-top: 44px;
  border-top: 1px solid var(--plate-rule);
  padding-top: 30px;
  position: relative;
  z-index: 1;
}

.mechanic-card .mono-micro { color: var(--plate-oxide); letter-spacing: 0.2em; }

.mechanic-card h3 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--s-title);
  margin: 10px 0 12px;
}

.mechanic-card p { color: var(--plate-dim); max-width: 62ch; }
.mechanic-card p strong { color: var(--plate-ink); font-weight: 500; }

.traced {
  margin-top: 14px;
  font-family: var(--f-mono);
  font-size: var(--s-micro);
  color: var(--plate-dim);
  letter-spacing: 0.02em;
}
.traced b { color: var(--plate-brass); font-weight: 400; }

.dossier-contents {
  margin-top: 44px;
  border-top: 1px solid var(--plate-rule);
  padding-top: 30px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 48px;
  position: relative;
  z-index: 1;
}

.dossier-contents li {
  list-style: none;
  display: flex;
  gap: 16px;
  align-items: baseline;
  font-size: var(--s-small);
  color: var(--plate-dim);
}

.dossier-contents li b {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: var(--s-micro);
  color: var(--plate-brass);
  min-width: 22px;
}

.dossier-contents li span { color: var(--plate-ink); }

/* Star atlas gallery — engraved plates on paper. */
.atlas {
  margin-top: 80px;
}

.atlas-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 22px;
  margin-top: 40px;
}

.atlas-cell { text-align: center; }

.atlas-cell img {
  border-radius: 50%;
  border: 1px solid var(--plate-rule);
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform var(--m-state) ease-out, box-shadow var(--m-state) ease-out;
}

.atlas-cell:hover img {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(22, 22, 15, 0.14);
}

.atlas-cell .mono-micro {
  display: block;
  margin-top: 12px;
  color: var(--plate-dim);
}

.atlas-cell .mono-micro b { color: var(--plate-brass); font-weight: 400; }

/* --------------------------------------------------------------------------
   Steps
   -------------------------------------------------------------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
  counter-reset: step;
}

.step { position: relative; padding-top: 26px; border-top: 1px solid var(--rule); }

.step .mono-micro { color: var(--brass); display: block; margin-bottom: 14px; }
.step h3 { font-size: var(--s-section); font-weight: 500; margin-bottom: 10px; }
.step p { font-size: var(--s-small); color: var(--chalk-dim); }

/* --------------------------------------------------------------------------
   Pricing (§4.8)
   -------------------------------------------------------------------------- */

.pricing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  align-items: stretch;
}

.price-card {
  border: 1px solid var(--rule);
  background: var(--raised);
  border-radius: 3px;
  padding: 36px 34px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.price-card.primary { border-color: rgba(201, 162, 39, 0.5); }

.price-card .mono-micro { color: var(--brass); letter-spacing: 0.2em; }

.price-figure {
  font-family: var(--f-mono);
  font-size: 44px;
  font-variant-numeric: tabular-nums;
  margin: 18px 0 4px;
}

.price-figure sup { font-size: 20px; vertical-align: super; }

.price-per { color: var(--chalk-dim); font-size: var(--s-small); margin-bottom: 22px; }

.price-card ul { list-style: none; margin: 0 0 26px; }
.price-card li {
  font-size: var(--s-small);
  color: var(--chalk-dim);
  padding: 9px 0 9px 22px;
  border-top: 1px solid var(--rule);
  position: relative;
}
.price-card li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 16px;
  width: 8px;
  height: 1px;
  background: var(--brass);
}
.price-card li strong { color: var(--chalk); font-weight: 500; }

.price-card .btn { margin-top: auto; }

.pricing-note {
  margin-top: 28px;
  color: var(--chalk-dim);
  font-size: var(--s-small);
}
.pricing-note em { color: var(--chalk); font-style: normal; }

/* --------------------------------------------------------------------------
   Limits / guardrails
   -------------------------------------------------------------------------- */

.limits {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.limit-cell { background: var(--ground); padding: 30px 28px; }
.limit-cell .mono-micro { color: var(--verdigris); display: block; margin-bottom: 12px; }
.limit-cell p { font-size: var(--s-small); color: var(--chalk-dim); }
.limit-cell p strong { color: var(--chalk); font-weight: 500; }

/* --------------------------------------------------------------------------
   FAQ
   -------------------------------------------------------------------------- */

.faq { max-width: 760px; }

.faq details {
  border-top: 1px solid var(--rule);
  padding: 22px 0;
}

.faq details:last-child { border-bottom: 1px solid var(--rule); }

.faq summary {
  cursor: pointer;
  font-size: var(--s-section);
  font-weight: 500;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  transition: color var(--m-state) ease-out;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  font-family: var(--f-mono);
  font-size: var(--s-body);
  color: var(--brass);
  flex-shrink: 0;
}

.faq details[open] summary::after { content: "–"; }
.faq summary:hover { color: var(--brass); }

.faq .answer { padding-top: 14px; color: var(--chalk-dim); font-size: var(--s-body); max-width: 62ch; }
.faq .answer strong { color: var(--chalk); font-weight: 500; }

/* --------------------------------------------------------------------------
   CTA band
   -------------------------------------------------------------------------- */

.cta-band { text-align: center; padding: 110px 0; }

.cta-band .display { margin: 22px 0 30px; }

.cta-band .hero-actions { justify-content: center; }

.cta-band .mono-micro { color: var(--chalk-dim); display: block; margin-top: 26px; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-foot {
  border-top: 1px solid var(--rule);
  padding: 64px 0 40px;
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 0.8fr);
  gap: 40px;
  margin-bottom: 48px;
}

.foot-col h4 {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: var(--s-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--chalk-dim);
  margin-bottom: 16px;
}

.foot-col ul { list-style: none; }
.foot-col li { margin-bottom: 10px; font-size: var(--s-small); }
.foot-col a { color: var(--chalk-dim); transition: color var(--m-state) ease-out; }
.foot-col a:hover { color: var(--chalk); }

.foot-brand p { font-size: var(--s-small); color: var(--chalk-dim); margin-top: 14px; max-width: 34ch; }

.foot-legal {
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  color: var(--chalk-dim);
}

.foot-legal .mono-micro { max-width: 70ch; line-height: 1.7; }

/* --------------------------------------------------------------------------
   Document pages (privacy / terms / support) — printed plates
   -------------------------------------------------------------------------- */

.doc-page { background: var(--paper); color: var(--plate-ink); min-height: 100vh; }
.doc-page .site-head { background: rgba(242, 237, 225, 0.9); border-bottom-color: var(--plate-rule); }
.doc-page .wordmark, .doc-page .site-nav { color: var(--plate-ink); }
.doc-page .site-nav a { color: var(--plate-dim); }
.doc-page .site-nav a:hover { color: var(--plate-ink); }
.doc-page .wordmark .astro { color: var(--plate-brass); }
.doc-page .btn-ghost { border-color: var(--plate-rule); color: var(--plate-ink); }
.doc-page .btn-ghost:hover { border-color: var(--plate-brass); color: var(--plate-brass); }

.doc-body { max-width: 760px; margin: 0 auto; padding: 80px 24px 110px; }

.doc-body .doc-kicker {
  font-family: var(--f-mono);
  font-size: var(--s-micro);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--plate-brass);
  margin-bottom: 18px;
}

.doc-body h1 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--s-display);
  margin-bottom: 12px;
}

.doc-body .doc-date {
  font-family: var(--f-mono);
  font-size: var(--s-micro);
  color: var(--plate-dim);
  padding-bottom: 28px;
  border-bottom: 1px solid var(--plate-rule);
  margin-bottom: 36px;
}

.doc-body h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--s-title);
  margin: 44px 0 14px;
}

.doc-body h2 .no {
  font-family: var(--f-mono);
  font-size: var(--s-micro);
  color: var(--plate-brass);
  display: block;
  margin-bottom: 8px;
  letter-spacing: 0.2em;
}

.doc-body p, .doc-body li { color: var(--plate-dim); font-size: var(--s-body); margin-bottom: 14px; }
.doc-body p strong, .doc-body li strong { color: var(--plate-ink); font-weight: 500; }
.doc-body ul { padding-left: 22px; margin-bottom: 16px; }
.doc-body li { margin-bottom: 8px; }
.doc-body a { color: var(--plate-brass); border-bottom: 1px solid var(--plate-rule); }
.doc-body a:hover { border-bottom-color: var(--plate-brass); }

.doc-body .doc-rule {
  border: none;
  border-top: 1px solid var(--plate-rule);
  margin: 44px 0;
}

/* --------------------------------------------------------------------------
   Reveal-on-scroll
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--m-surface) ease-out, transform var(--m-surface) ease-out;
}

.reveal.in { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 940px) {
  .figures { grid-template-columns: 1fr; }
  .rules-strip, .steps { grid-template-columns: 1fr; }
  .limits { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .atlas-grid { grid-template-columns: repeat(4, 1fr); }
  .dossier-verdict { grid-template-columns: 1fr; gap: 30px; }
  .dossier-contents { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .dossier-sheet { padding: 36px 24px 32px; }
  .site-nav .nav-link { display: none; }
  section { padding: 72px 0; }

  /* Mobile hero: the system moves up and behind the copy, the scrim
     turns vertical, and the caption tucks under the dataline. */
  .hero-orbit {
    min-height: 100svh;
    align-items: flex-end;
    padding: 96px 0 84px;
  }
  .hero-scrim {
    background: linear-gradient(
      to top,
      rgba(3, 4, 10, 0.88) 34%,
      rgba(3, 4, 10, 0.35) 58%,
      rgba(3, 4, 10, 0.05) 80%
    );
  }
  .hero-content { max-width: 100%; }
  .hero-caption {
    position: relative;
    z-index: 2;
    right: auto;
    bottom: auto;
    align-self: flex-start;
    margin: 26px 24px 0;
    text-align: left;
  }
  .hero-orbit { flex-direction: column; justify-content: flex-end; }
}

@media (max-width: 560px) {
  .atlas-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  :root { --s-display: 28px; --s-title: 21px; }
  .dossier-masthead .title { font-size: 24px; }
}

/* --------------------------------------------------------------------------
   Reduced motion (§3.2) — the instrument respects it everywhere.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hairline .index-mark { animation: none; transform: translateX(62%); }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
