/* ─────────────────────────────────────────────────────────────────────────
   NOVA SAKI — launch countdown
   Design tokens and layout follow design_handoff_countdown_landing/README.md.
   The planet anchor percentages are measured against the background art;
   if the art is ever re-exported with a different crop, they must be
   re-measured or the clock circles drift off the painted planets.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --bg:            #070B22;
  --text:          #FFFFFF;
  --text-dim:      #D4DAEE;
  --text-panel:    #DDE2F4;
  --accent:        #A9C4FF;
  --cta-from:      #FFBE8C;
  --cta-to:        #F6A2CB;
  --cta-ink:       #1A1330;

  --font-display: Marcellus, Georgia, serif;
  --font-ui:      'Instrument Sans', system-ui, -apple-system, sans-serif;

  --glass-bg:
    radial-gradient(60% 48% at 100% 100%, rgba(248,190,215,.36), transparent 70%),
    radial-gradient(51% 42% at 0% 0%,     rgba(140,170,255,.324), transparent 70%),
    linear-gradient(150deg, rgba(28,40,100,.60), rgba(26,30,78,.42));
  --glass-border: rgba(180,200,255,.55) rgba(255,205,215,.44) rgba(255,205,190,.55) rgba(180,200,255,.44);
  --glass-blur:   blur(10px) saturate(1.2);
  --glass-shadow: 0 30px 80px rgba(0,0,10,.15), inset 0 1px 0 rgba(255,255,255,.1);

  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ── Scene ──────────────────────────────────────────────────────────────── */

.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  container-type: size;
}

/* ── Painted stage ──────────────────────────────────────────────────────── */
/* One element holds the art and every clock, so the circles stay welded to
   the painted planets at any viewport. W never exceeds 166cqw, which keeps
   the planet row (31%→87% of the art) on screen on tall displays. */

.stage {
  --W: min(max(100cqw, 177.73cqh), 166cqw);
  --H: calc(var(--W) * 0.56264);
  position: absolute;
  width: var(--W);
  height: var(--H);
  left: clamp(calc(100cqw - var(--W)), calc(50cqw - var(--W) * 0.59), 0px);
  top:  clamp(calc(100cqh - var(--H)), calc(50cqh - var(--H) * 0.62), 0px);
}

.stage-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  animation: fade 1.6s both;
}

/* Blends the top of the art into the page background. */
.stage-fade {
  position: absolute;
  left: 0; right: 0; top: -2px;
  height: 18%;
  background: linear-gradient(180deg, var(--bg), rgba(7,11,34,0));
  pointer-events: none;
}

/* ── Clock circles ──────────────────────────────────────────────────────── */

.clock {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--d);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3%;
  /* Readability scrim -- the painted planet still shows through. */
  background: radial-gradient(circle, rgba(4,6,20,.5) 0%, rgba(4,6,20,.25) 45%, rgba(4,6,20,0) 70%);
  animation: fade 1.2s var(--in) both;
}

.clock-ring {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  border: 1px solid var(--ring);
  animation: breathe 4s ease-in-out infinite;
}

.clock-digit {
  font-size: calc(var(--W) * 0.034);
  line-height: 1;
  color: var(--text);
  text-shadow: 0 2px 16px rgba(0,0,0,.85), 0 0 4px rgba(0,0,0,.6);
  font-variant-numeric: tabular-nums;
  display: flex;
}

.clock-unit {
  font-size: max(9px, calc(var(--W) * 0.0068));
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 1px 8px rgba(0,0,0,.9);
}

.phase {
  position: absolute;
  left: var(--x);
  top: 84.2%;
  transform: translateX(-50%);
  font-size: max(10px, calc(var(--W) * 0.0078));
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 1px 10px rgba(0,0,0,.9);
  white-space: nowrap;
  animation: fade 1s var(--in) both;
}

/* A digit re-mounts on change; JS re-triggers this by toggling the class. */
.is-ticking { animation: tick .55s var(--ease); }

/* ── Header ─────────────────────────────────────────────────────────────── */

.header {
  position: absolute;
  z-index: 4;
  left: 0; right: 0; top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(14px, 3cqh, 28px) 5cqw;
  padding-top: max(clamp(14px, 3cqh, 28px), env(safe-area-inset-top));
  animation: fade 1s .1s both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
}
.brand span {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.7cqw, 22px);
  letter-spacing: .3em;
}
.brand img { display: block; }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2cqw, 26px);
}

.nav-link {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 6px 0;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.nav-link:hover { color: var(--text); }
.nav-link[aria-expanded="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,.3);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  transition: box-shadow .3s, transform .3s, background .3s;
}

.btn--primary {
  color: var(--cta-ink);
  background: linear-gradient(90deg, var(--cta-from), var(--cta-to));
  box-shadow: 0 0 28px rgba(255,200,190,.35);
}
.btn--primary:hover {
  box-shadow: 0 0 40px rgba(255,200,190,.6);
  transform: translateY(-1px);
}

.btn--ghost {
  align-self: flex-start;
  margin-top: 6px;
  color: var(--text);
  border: 1px solid rgba(190,205,255,.55);
  background: rgba(120,150,255,.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: rise 1s .8s var(--ease) both;
}
.btn--ghost:hover {
  background: rgba(160,185,255,.3);
  box-shadow: 0 0 30px rgba(150,180,255,.4);
}

.btn--block { width: 100%; height: 48px; padding: 0; }

.btn:focus-visible,
.nav-link:focus-visible,
.brand:focus-visible,
.panel-close:focus-visible,
.field:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.field:focus-within { outline-offset: 1px; }

/* Submit button loading state */
.btn-spinner { display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(26,19,48,.3); border-top-color: var(--cta-ink);
  animation: spin .7s linear infinite; }
.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading .btn-label { display: none; }
.btn.is-loading .btn-spinner { display: block; }

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  position: absolute;
  z-index: 1;
  left: 8cqw;
  top: clamp(84px, 14cqh, 140px);
  max-width: min(480px, 86cqw);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.4cqh, 22px);
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, min(4.2cqw, 7cqh), 72px);
  line-height: 1.04;
  letter-spacing: -.01em;
  text-wrap: balance;
  animation: rise 1s .3s var(--ease) both;
}

.hero-lede {
  margin: 0;
  font-size: clamp(15px, 2.2cqh, 18px);
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 34ch;
  text-wrap: pretty;
  animation: rise 1s .5s var(--ease) both;
}

.hero-kicker {
  margin: 0;
  font-size: clamp(17px, 2.5cqh, 21px);
  color: var(--accent);
  animation: rise 1s .65s var(--ease) both;
}

/* ── Portrait stacked countdown (hidden on landscape) ───────────────────── */

.stack-clock { display: none; }

/* ── Glass panels ───────────────────────────────────────────────────────── */

.panel {
  position: absolute;
  z-index: 5;
  right: 5cqw;
  overflow: auto;
  border-radius: 22px;
  border: 1px solid;
  border-color: var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.2cqh, 20px);
  animation: rise .6s var(--ease) both;
}
.panel[hidden] { display: none; }

.panel--signal {
  top: clamp(76px, 13cqh, 110px);
  width: min(430px, 90cqw);
  max-height: calc(100cqh - clamp(90px, 15cqh, 130px));
  padding: clamp(20px, 4cqh, 36px) clamp(22px, 3.4cqw, 40px) clamp(18px, 3cqh, 28px);
}

.panel--why {
  top: clamp(76px, 11cqh, 100px);
  width: min(600px, 90cqw);
  max-height: calc(100cqh - clamp(90px, 13cqh, 120px));
  padding: clamp(20px, 4cqh, 36px) clamp(22px, 3.2cqw, 44px) clamp(18px, 3cqh, 28px);
}

.panel-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.panel-close:hover { background: rgba(255,255,255,.12); }

.eyebrow {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
}
.eyebrow img { display: block; }

.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, min(2.8cqw, 5cqh), 40px);
  line-height: 1.08;
  text-wrap: balance;
}
.panel-title--wide {
  padding-right: 28px;
  font-size: clamp(24px, min(2.5cqw, 4.6cqh), 36px);
  line-height: 1.14;
  text-wrap: pretty;
}

.panel-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-panel);
  text-wrap: pretty;
}

/* ── Signup form ────────────────────────────────────────────────────────── */

.signup {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 4px 0 0;
}
.signup[hidden] { display: none; }

.field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(200,210,255,.45);
  background: rgba(10,14,40,.45);
  transition: border-color .2s;
}
.field svg { flex: none; }
.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px; /* 16px stops iOS Safari zooming the viewport on focus */
}
.field input::placeholder { color: rgba(221,226,244,.65); }
.field.is-invalid { border-color: rgba(255,170,170,.85); }

/* Honeypot -- off-screen rather than display:none, which some bots skip. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.field-error {
  margin: 0;
  font-size: 13px;
  color: #FFC2C2;
}
.field-error[hidden] { display: none; }

.success {
  margin: 4px 0 0;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255,217,184,.5);
  background: rgba(255,217,184,.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: rise .5s var(--ease) both;
}
.success[hidden] { display: none; }
.success-title { font-size: 15px; font-weight: 600; }
.success-body  { font-size: 14px; color: var(--text-panel); }
.success-body b { font-weight: 500; word-break: break-all; }

.promises {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.promises li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 0 8px;
  font-size: 12.5px;
  line-height: 1.35;
}
.promises li:nth-child(2) {
  border-left: 1px solid rgba(255,255,255,.18);
  border-right: 1px solid rgba(255,255,255,.18);
}

/* ── Why panel ──────────────────────────────────────────────────────────── */

.why-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-panel);
}

.pillars {
  list-style: none;
  margin: 0;
  padding: clamp(12px, 2.4cqh, 20px) 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid rgba(255,255,255,.18);
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.pillars li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 0 10px;
  color: var(--tint);
}
.pillars li:nth-child(2) {
  border-left: 1px solid rgba(255,255,255,.18);
  border-right: 1px solid rgba(255,255,255,.18);
}
.pillars span {
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.why-footer {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.why-footer-title { font-family: var(--font-display); font-size: 19px; }
.why-footer-body  { font-size: 13px; color: var(--text-panel); }

/* ── Launch state (countdown reached zero) ──────────────────────────────── */

.is-launched .hero-kicker { color: var(--cta-from); }
.is-launched .clock-ring  { animation: breathe 1.6s ease-in-out infinite; }

/* ─────────────────────────────────────────────────────────────────────────
   PORTRAIT / SMALL SCREENS
   The handoff proposed rotating the whole viewport 90°. We build a real
   stacked layout instead: the art can't hold its planet alignment in a tall
   crop, so the clocks leave the painting and become their own grid.
   ───────────────────────────────────────────────────────────────────────── */

@media (orientation: portrait) and (max-width: 900px) {

  .scene { overflow-y: auto; }

  /* Art becomes an atmospheric backdrop, not a positioning surface. */
  .stage {
    --W: 100cqw;
    position: fixed;
    left: 0;
    top: auto;
    bottom: 0;
    width: 100cqw;
    height: 62cqh;
    opacity: .55;
    mask-image: linear-gradient(180deg, transparent, #000 38%, #000);
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 38%, #000);
  }
  .stage-art { object-fit: cover; object-position: 59% 62%; }
  .stage-fade { display: none; }
  /* The painted planets are cropped out of alignment here -- hide the
     circles that were welded to them. */
  .clock, .phase { display: none; }

  .header {
    position: relative;
    padding: max(16px, env(safe-area-inset-top)) 6cqw 0;
    gap: 12px;
  }
  .brand span { font-size: 15px; letter-spacing: .26em; }
  .nav { gap: 14px; }
  .nav-link { font-size: 14px; }
  /* The header CTA would crowd a phone; the hero button carries the action. */
  .nav .btn--primary { display: none; }
  .nav-divider { display: none; }

  .hero {
    position: relative;
    left: auto; top: auto;
    max-width: none;
    padding: clamp(24px, 6cqh, 48px) 6cqw 0;
    gap: 14px;
  }
  .hero-title  { font-size: clamp(30px, 9.5cqw, 46px); }
  .hero-lede   { font-size: 16px; max-width: 32ch; }
  .hero-kicker { font-size: 18px; }
  /* The ghost pill becomes the primary action on a phone, since the header
     CTA is hidden -- full width so it's an easy thumb target. */
  .btn--ghost {
    align-self: stretch;
    justify-content: center;
    margin-top: 10px;
    height: 50px;
    padding: 0;
  }

  .stack-clock {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: clamp(22px, 5cqh, 40px) 6cqw 0;
    position: relative;
    z-index: 1;
  }
  .stack-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 18px 8px 14px;
    border-radius: 18px;
    border: 1px solid rgba(180,200,255,.28);
    background: linear-gradient(160deg, rgba(20,30,78,.55), rgba(12,18,52,.4));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fade 1.2s .6s both;
  }
  .stack-digit {
    font-size: clamp(34px, 11cqw, 52px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 16px rgba(0,0,0,.85);
  }
  .stack-unit {
    font-size: 10px;
    letter-spacing: .2em;
    text-transform: uppercase;
    margin-top: 6px;
  }
  .stack-phase {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
  }

  .stack-clock { padding-bottom: max(24px, env(safe-area-inset-bottom)); }

  .panel {
    position: fixed;
    right: 0; left: 0; bottom: 0;
    top: auto;
    width: auto;
    max-height: 88cqh;
    border-radius: 22px 22px 0 0;
    padding: 28px 6cqw max(24px, env(safe-area-inset-bottom));
  }
  .panel--why { padding-left: 6cqw; padding-right: 6cqw; }
  .panel-title { font-size: 26px; }
  .panel-title--wide { font-size: 23px; padding-right: 24px; }
  .promises li span { font-size: 11.5px; }
  .pillars svg { width: 26px; height: 26px; }
}

/* Short landscape phones: shrink the hero so it can't collide with the art. */
@media (orientation: landscape) and (max-height: 460px) {
  .hero { top: clamp(56px, 12cqh, 90px); }
  .hero-lede { display: none; }
  .btn { padding: 11px 20px; font-size: 14px; }
}

/* ── Motion ─────────────────────────────────────────────────────────────── */

@keyframes rise   { from { opacity: 0; transform: translateY(28px); filter: blur(6px); }
                    to   { opacity: 1; transform: none; filter: blur(0); } }
@keyframes fade   { from { opacity: 0; } to { opacity: 1; } }
@keyframes tick   { from { opacity: 0; transform: translateY(.35em) scale(.96); }
                    to   { opacity: 1; transform: none; } }
@keyframes breathe{ 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes spin   { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .clock-ring { opacity: .8; }
}
