/* Arrival Experience — spec 006 v2.0.
   A premium, calm arrival: black void, a constructing logo, a living warm-gold
   knowledge graph, one question. References: Apple, Arc, Linear, Figma, Stripe.
   Palette is the scoped Arrival palette (docs/004) — it never touches product. */

/* Two palettes, one arrival. LIGHT is the system default (docs/004 §1); the
   original void + gold lives under [data-theme="dark"]. theme.js resolves the
   OS setting to an explicit data-theme in <head>, so there is no flash, and a
   toggle can override. The graph's own colours are mirrored in arrival.js. */
/* All arrival vars are scoped to #arrival-intro so they never pollute the
   landing page's palette. The intro is always the black-gold void, whatever
   the page theme. (Forked from arrival.css for the combined homepage.) */
#arrival-intro {
  /* Light "paper void" by default; the dark override below applies when the
     page theme is dark. Both scoped to #arrival-intro so the landing palette
     is never touched. The intro now follows the visitor's theme. */
  --bg: #f7f9fd;
  --panel: #ffffff;
  --gold: #b7791f;
  --glow: #d99a2b;
  --text: #101828;
  --muted: #5d6b84;
  --edge: rgba(16, 24, 40, 0.12);
  --hair: rgba(16, 24, 40, 0.12);
  --field: rgba(16, 24, 40, 0.03);
  --scrim: rgba(247, 249, 253, 0.72);
  --sheet: #ffffff;
  --sel: rgba(183, 121, 31, 0.20);
  --hi: #101828;
  --hglow: transparent;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --void: var(--bg);
}
:root[data-theme="dark"] #arrival-intro {
  --bg: #040404;           /* the void */
  --panel: #101013;
  --gold: #ffd34d;
  --glow: #ffc107;
  --text: #f7f7f7;
  --muted: #9e9e9e;
  --edge: rgba(255, 201, 120, 0.11);
  --hair: rgba(247, 247, 247, 0.10);
  --field: rgba(255, 255, 255, 0.03);
  --scrim: rgba(4, 4, 4, 0.66);
  --sheet: #0a0a0a;
  --sel: rgba(255, 211, 77, 0.26);
  --hi: #ffffff;
  --hglow: rgba(255, 193, 7, 0.35);
}

#arrival-intro {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#arrival-intro *, #arrival-intro *::before, #arrival-intro *::after { box-sizing: border-box; }
#arrival-intro ::selection { background: var(--sel); }
::selection { background: var(--sel); }
:focus-visible {
  outline: 1.5px solid var(--gold);
  outline-offset: 4px;
  border-radius: 3px;
}

/* ---------- the living graph ---------- */
#graph-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 2s var(--ease);
}
#graph-canvas.on { opacity: 1; }

/* ---------- header ---------- */
/* The header box spans the whole top strip; make it click-through so it never
   traps controls beneath it (e.g. the standalone back button). Only the logo
   and sign-in themselves stay interactive. */
.arrival-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 30px 34px;
  pointer-events: none;
}
.arrival-head .logo-home,
.arrival-head .head-right { pointer-events: auto; }
.head-right { display: flex; align-items: center; gap: 18px; }

/* theme toggle (from theme.js — .theme-btn). Scoped to #arrival-intro so it
   never overrides the landing page's own toggle styling (theme.css). */
#arrival-intro .theme-btn {
  background: none; border: none; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 4px;
  opacity: 0; transition: opacity 1s var(--ease), transform 0.46s var(--ease);
}
#arrival-intro .theme-btn.show { opacity: 1; }
#arrival-intro .head-right .theme-btn { opacity: 1; }
#arrival-intro .theme-btn.spin { transform: rotate(180deg); }

/* the persistent corner logo (Component: Logo — home state) */
.logo-home {
  display: inline-block;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.logo-home.show { opacity: 1; transform: none; }
.logo-home .tml-logo { width: 132px; height: auto; display: block; }
.logo-home .lg-horizon { display: none; } /* cleaner in the small corner mark */

/* sign in — very small, very elegant (Component: SignIn) */
.signin-link {
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0.1px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  position: relative;
  opacity: 0;
  transition: color 0.35s var(--ease), opacity 1s var(--ease);
}
.signin-link.show { opacity: 1; }
.signin-link::after {
  content: "";
  position: absolute;
  left: 2px; right: 2px; bottom: 0;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.4s var(--ease);
}
.signin-link:hover { color: var(--text); }
.signin-link:hover::after { transform: scaleX(1); transform-origin: left center; }

/* ---------- intro logo stage (Component: Logo — construct state) ---------- */
.logo-stage {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.logo-stage.settle {
  opacity: 0;
  transform: translate(-6px, -12px) scale(0.86);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
}
.logo-stage.hidden { display: none; }
.intro-logo { width: min(560px, 84vw); }
.tml-logo { width: 100%; height: auto; display: block; overflow: visible; }

/* the logo constructs: horizon draws → child rises reaching → star ignites →
   the wordmark wipes in. Initial/hidden states are scoped to the intro
   instance so the static corner mark always shows complete. */
#intro-logo .lg-horizon { stroke-dasharray: 640; stroke-dashoffset: 640; }
#intro-logo .lg-child {
  opacity: 0; transform: translateY(18px);
  transform-box: fill-box; transform-origin: center bottom;
}
#intro-logo .lg-star {
  opacity: 0; transform: scale(0.2) rotate(-24deg);
  transform-box: fill-box; transform-origin: center;
}
#intro-logo .lg-sparks { opacity: 0; }
#intro-logo .lg-word { clip-path: inset(0 100% 0 0); }

#intro-logo.build .lg-horizon { animation: lg-draw 1.05s var(--ease) 0.3s forwards; }
#intro-logo.build .lg-child   { animation: lg-rise 0.85s var(--ease) 1s forwards; }
#intro-logo.build .lg-star    { animation: lg-pop 0.7s var(--ease) 1.7s forwards; }
#intro-logo.build .lg-sparks  { animation: lg-spark 0.6s var(--ease) 1.95s forwards; }
#intro-logo.build .lg-word    { animation: lg-wipe 0.95s var(--ease) 2.1s forwards; }

@keyframes lg-draw  { to { stroke-dashoffset: 0; } }
@keyframes lg-rise  { to { opacity: 1; transform: none; } }
@keyframes lg-pop   { to { opacity: 1; transform: none; } }
@keyframes lg-spark { to { opacity: 1; } }
@keyframes lg-wipe  { to { clip-path: inset(0 -2% 0 0); } }

/* ---------- center stage ---------- */
.stage {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 28px;
}
.scene { width: min(760px, 92vw); text-align: center; }

/* scene transitions — dissolve, never snap */
.scene-block {
  opacity: 0;
  transform: scale(0.985);
  filter: blur(7px);
  transition: opacity 0.95s var(--ease), transform 0.95s var(--ease), filter 0.95s var(--ease);
  pointer-events: none;
}
.scene-block.show { opacity: 1; transform: none; filter: none; pointer-events: auto; }
.scene-block.gone {
  opacity: 0;
  transform: scale(1.015);
  filter: blur(7px);
  pointer-events: none;
  position: absolute;
  inset: 0;
}

/* ---------- cinematic hook (Component: HookCinematic) ----------
   Line 1 types word-by-word in gold, then shrinks + turns white; Line 2 types
   word-by-word in gold below it; hold; then the scene dissolves to the
   homepage where the hook lives combined with the question. */
.hook-stage {
  position: relative;
  height: 2.6em;
  width: 100%;
}
.hook-l1, .hook-l2 {
  position: absolute;
  left: 50%; top: 50%;
  margin: 0;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  font-size: clamp(30px, 4.8vw, 50px);
}
.hook-l1 {
  color: var(--gold);
  transform: translate(-50%, -50%);
  transition: transform 0.9s var(--ease), color 0.9s var(--ease);
}
.hook-l1.settled { color: var(--text); transform: translate(-50%, calc(-50% - 46px)) scale(0.58); }
.hook-l2 {
  color: var(--gold);
  transform: translate(-50%, calc(-50% + 24px));
  text-shadow: 0 0 26px var(--hglow);
}
.hook-word { opacity: 0; transition: opacity 0.35s var(--ease); }
.hook-word.in { opacity: 1; }
.hook-caret {
  display: inline-block;
  width: 3px; height: 0.9em;
  background: currentColor;
  vertical-align: -0.1em;
  margin-left: 5px;
  animation: caret-blink 1.05s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

/* ---------- the chooser (Component: Chooser) ---------- */
/* the persistent brand hook, standing over the graph on the homepage */
.hook-line {
  font-weight: 600;
  font-size: clamp(20px, 2.6vw, 30px);
  letter-spacing: -0.6px;
  line-height: 1.35;
  color: var(--text);
  margin: 0 0 26px;
}
.hook-line .typed-b { color: var(--gold); }
.begin-q {
  font-weight: 700;
  font-size: clamp(25px, 3.4vw, 36px);
  letter-spacing: -0.7px;
  color: var(--text);
  margin: 0 0 52px;
}
.nav-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}
/* elegant text navigation with an animated underline (no boxes anywhere) */
.nav-link {
  font-weight: 500;
  font-size: clamp(18px, 2vw, 21px);
  letter-spacing: -0.2px;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 4px 10px;
  position: relative;
  transition: color 0.4s var(--ease), text-shadow 0.5s var(--ease);
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 4px; right: 4px; bottom: 2px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--gold), var(--glow));
  transform: scaleX(0.001);
  transform-origin: center;
  transition: transform 0.45s var(--ease), opacity 0.45s var(--ease);
  opacity: 0.5;
}
.nav-link:hover {
  color: var(--hi);
  text-shadow: 0 0 22px var(--hglow);
}
.nav-link:hover::after { transform: scaleX(1); opacity: 1; }
.opt-note {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2.4px;
  color: var(--muted);
  margin-top: 44px;
}

/* ---------- validation: one honest question, then the payoff ---------- */
.ask-eyebrow, .ans-eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 2.6px; text-transform: uppercase; color: var(--muted); margin: 0 0 20px;
}
.ask-q, .ans-line {
  font-weight: 700; font-size: clamp(27px, 4.4vw, 46px); letter-spacing: -1px;
  line-height: 1.13; color: var(--text); margin: 0 0 18px;
}
.ans-line b { color: var(--gold); font-weight: 700; }
.ask-sub, .ans-sub {
  font-size: clamp(15px, 2vw, 18px); line-height: 1.55; color: var(--muted);
  margin: 0 auto 40px; max-width: 48ch;
}
.ask-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.ask-btn {
  font-family: var(--font); font-size: 15.5px; font-weight: 600; cursor: pointer;
  border-radius: 999px; padding: 13px 32px; border: 1px solid var(--text);
  background: var(--text); color: var(--bg);
  transition: transform 0.16s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.ask-btn.ghost { background: transparent; color: var(--text); }
.ask-btn:hover { transform: translateY(-2px); }
.ask-btn.ghost:hover { border-color: var(--gold); color: var(--gold); }
.ask-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.home-note { font-size: 14px; line-height: 1.55; color: var(--muted); margin: -14px auto 30px; max-width: 46ch; }
.home-note b { color: var(--text); font-weight: 600; }

/* balanced headline wrapping (progressive) */
.ask-q, .ans-line, .begin-q, .panel-title, .hook-l1, .hook-l2 { text-wrap: balance; }
.ask-sub, .ans-sub, .hook-line, .panel-sub { text-wrap: pretty; }

/* ---------- destination picker (Component: DestinationPicker) ---------- */
.panel-title {
  font-weight: 700;
  font-size: clamp(23px, 3vw, 32px);
  letter-spacing: -0.6px;
  margin: 0 0 8px;
}
.panel-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 40px;
}
/* standalone button, clear of the header, sitting 10px below the logo */
.back-link {
  position: fixed;
  z-index: 22;
  top: 88px; left: 34px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 2.6px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 2px;
  pointer-events: auto;
  transition: color 0.35s var(--ease);
}
.back-link:hover { color: var(--gold); }

.dest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px 40px;
  text-align: left;
  margin-top: 44px;
}
.dest {
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.2px;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 2px 10px;
  position: relative;
  text-align: left;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  width: fit-content;
  transition: color 0.4s var(--ease), text-shadow 0.5s var(--ease);
}
.dest::after {
  content: "";
  position: absolute;
  left: 2px; bottom: 2px;
  width: calc(100% - 4px);
  height: 1.5px;
  background: linear-gradient(90deg, var(--gold), var(--glow));
  transform: scaleX(0.001);
  transform-origin: left center;
  transition: transform 0.4s var(--ease);
}
.dest:hover { color: #fff; text-shadow: 0 0 20px rgba(255, 193, 7, 0.3); }
.dest:hover::after { transform: scaleX(1); }
.dest.soon { color: var(--muted); }
.dest.soon:hover { color: var(--text); }
.dest .live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--glow);
  align-self: center;
  flex: none;
}

/* ---------- Spotlight search (Component: Spotlight) ---------- */
.spotlight { position: relative; margin: 0 auto; max-width: 620px; }
.spotlight-input {
  width: 100%;
  font-family: var(--font);
  font-weight: 500;
  font-size: clamp(20px, 2.6vw, 26px);
  letter-spacing: -0.4px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: none;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  padding: 16px 8px 18px;
  text-align: center;
  outline: none;
  transition: border-color 0.4s var(--ease);
  -webkit-appearance: none;
}
.spotlight-input::placeholder { color: var(--muted); font-weight: 400; }
.spotlight-input:focus { border-bottom-color: var(--gold); }
.spotlight-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  text-align: left;
  max-height: 46vh;
  overflow-y: auto;
  background: rgba(6, 6, 6, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 14px;
}
.spotlight-results:empty { display: none; }
.spotlight-results li a, .spotlight-results li button {
  display: flex;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font);
  font-size: 15.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.25s var(--ease);
}
.spotlight-results li a:hover, .spotlight-results li button:hover,
.spotlight-results li .active { background: rgba(255, 211, 77, 0.08); }
.spotlight-results .kind {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 1.8px;
  color: var(--gold);
  flex: none;
  padding-top: 3px;
  min-width: 58px;
}
.spotlight-results .sub { color: var(--muted); font-size: 12.5px; }
.search-empty { color: var(--muted); font-size: 13.5px; margin-top: 22px; }

/* ---------- sign-in modal ---------- */
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: var(--scrim);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}
.modal-wrap.show { opacity: 1; pointer-events: auto; }
.modal {
  width: min(400px, 94vw);
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: 20px;
  padding: 34px 30px;
  text-align: center;
  transform: scale(0.96);
  transition: transform 0.5s var(--ease);
}
.modal-wrap.show .modal { transform: none; }
.modal h2 { font-weight: 700; font-size: 22px; letter-spacing: -0.4px; margin: 0 0 8px; color: var(--text); }
.modal p { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 0 0 22px; }
.modal .note { color: var(--muted); font-size: 12.5px; }

/* ---------- noscript ---------- */
.nojs {
  position: relative;
  z-index: 30;
  max-width: 560px;
  margin: 40vh auto 0;
  text-align: center;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}
.nojs a { color: var(--gold); }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .arrival-head { padding: 20px 20px; }
  .stage { padding: 100px 22px; }
  .back-link { top: 78px; left: 20px; }
  .nav-list { gap: 26px; }
  .dest-grid { grid-template-columns: 1fr 1fr; gap: 20px 24px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #graph-canvas, .logo-home, .signin-link, .scene-block,
  .logo-home .rule, .logo-stage, .nav-link, .nav-link::after,
  .dest, .dest::after, .modal, .hook-l1 { transition: none; }
  #intro-logo .lg-horizon { stroke-dashoffset: 0; }
  #intro-logo .lg-child, #intro-logo .lg-star, #intro-logo .lg-sparks { opacity: 1; transform: none; }
  #intro-logo .lg-word { clip-path: none; }
  #intro-logo [class^="lg-"] { animation: none; }
  .hook-word { opacity: 1; }
  .hook-caret { animation: none; opacity: 0; }
}
