/* LAUNCH: countdown internals and the waitlist dialog. Page placement of .launch is LAYOUT's. */

/* ---------- Launch section ---------- */
.launch {
  display: grid;
  justify-items: center;
  gap: 36px;
  text-align: center;
}
.launch-head { display: grid; justify-items: center; gap: 12px; }
.launch-head .micro { margin: 0; }
.launch-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 4.4vw, 48px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.01em;
  color: var(--ink);
}
.launch-title [data-launch-days] { font-variant-numeric: tabular-nums; }
.launch-sub { margin: 0; max-width: 46ch; font-size: 15px; line-height: 1.55; color: var(--muted); }
.launch-sub time { color: var(--ink-2); font-weight: 600; white-space: nowrap; }

.countdown {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: center;
  border-block: 1px solid var(--line);
}
.cd-unit {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px clamp(14px, 2.6vw, 34px) 18px;
}
.cd-unit + .cd-unit { border-left: 1px solid var(--line); }
.cd-flap {
  display: flex;
  justify-content: center;
  min-height: 55px;
  align-items: center;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cd-label {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Plain-text fallback when window.SplitFlap is unavailable: same tile footprint. */
.cd-flap--text { gap: 6px; }
.cd-digit {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 55px;
  border-radius: 6px;
  background: var(--tile);
  font-size: 28px;
  line-height: 1;
}

.launch:not([data-launch-state="counting"]) .countdown { display: none; }

@media (max-width: 480px) {
  .launch { gap: 28px; }
  .cd-unit { padding: 16px 8px 14px; gap: 10px; }
  .cd-flap { min-height: 45px; font-size: 24px; }
  .cd-digit { width: 36px; height: 45px; font-size: 22px; }
  .cd-label { font-size: 9.5px; letter-spacing: .12em; }
}
/* Supervisor: four 2-digit units must fit a ~343px phone column. 30 x 38 keeps 4:5 and an
   even split (18 + 2 + 18). */
@media (max-width: 420px) {
  .launch .split-flap--sm { --flap-w: 30px; --flap-h: 38px; --flap-pad: 5px; --flap-gap: 4px; --flap-mid: 2px; }
  .cd-unit { padding-inline: 6px; }
  .cd-flap { min-height: 38px; }
  .cd-digit { width: 30px; height: 38px; font-size: 19px; }
}
@media (max-width: 340px) {
  .cd-unit { padding-inline: 3px; }
}

/* ---------- Waitlist dialog ---------- */
html.wl-locked { overflow: hidden; scrollbar-gutter: stable; }

.waitlist {
  width: min(600px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  box-shadow: 0 32px 72px -32px rgba(25, 25, 25, .38), 0 2px 8px rgba(25, 25, 25, .06);
}
.waitlist::backdrop {
  background: rgba(244, 244, 244, .8);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.waitlist[open] { animation: wl-in .2s var(--ease-out) both; }
.waitlist[open]::backdrop { animation: wl-fade .2s var(--ease-out) both; }
.waitlist.is-closing { animation: wl-out .14s ease-in both; }
.waitlist.is-closing::backdrop { animation: wl-fade .14s ease-in reverse both; }
@keyframes wl-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes wl-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes wl-fade { from { opacity: 0; } }

.waitlist [hidden] { display: none !important; }
.waitlist-panel {
  max-height: calc(100dvh - 34px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 32px 26px;
}

.waitlist-head {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  row-gap: 6px;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.waitlist-head .micro { margin: 0; grid-column: 1; }
.waitlist-head h2 {
  grid-column: 1;
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.waitlist-lede { grid-column: 1 / -1; margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.dialog-close {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.dialog-close:hover { border-color: var(--line-strong); background: var(--paper); }
.dialog-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.waitlist-fields {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.field { display: grid; gap: 7px; align-content: start; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .field-label-row label {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink-2);
}
.field-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.char-count { font-size: 11.5px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.char-count.is-near { color: var(--ink); font-weight: 700; }

.field input,
.field textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: 500 15px/1.4 var(--font-body);
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.field textarea { min-height: 88px; max-height: 220px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.field input:hover, .field textarea:hover { border-color: #a6a6a6; }
.field input:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(25, 25, 25, .12); }
.field.is-invalid input, .field.is-invalid textarea { border-color: var(--ink); border-width: 1.5px; background: var(--paper); }

.field-group-label { margin: 6px 0 -6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-group-label span { font-weight: 500; color: var(--muted); }

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.field-error:empty { display: none; }
.field-error::before {
  content: '!';
  flex: none;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.form-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 28px; text-align: center; }
.button.cta-glass.cta-submit { min-height: 52px; padding: 0 28px; font-size: 15px; }
.cta-submit[aria-disabled="true"] { cursor: progress; transform: none; }
.form-note { max-width: 40ch; margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.form-message { margin: 16px 0 0; text-align: center; font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.form-message:empty { display: none; }
.form-message:focus { outline: none; }
.form-message[data-state="busy"] { font-weight: 500; color: var(--muted); }
.form-message[data-state="error"] { padding: 11px 14px; border: 1px solid var(--ink); border-radius: 8px; background: var(--paper); }

/* Success */
.waitlist.is-success .waitlist-head { margin-bottom: 0; }
.waitlist-success { display: grid; justify-items: center; gap: 10px; padding: 30px 8px 6px; text-align: center; }
.wl-tick { width: 64px; height: 64px; margin-bottom: 6px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wl-tick circle { stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 176; stroke-dashoffset: 0; }
.wl-tick path { stroke: var(--signal); stroke-width: 3; stroke-dasharray: 34; stroke-dashoffset: 0; }
.waitlist.is-success .wl-tick circle { animation: wl-draw-ring .5s var(--ease-out) both; }
.waitlist.is-success .wl-tick path { animation: wl-draw-tick .36s .32s var(--ease-out) both; }
@keyframes wl-draw-ring { from { stroke-dashoffset: 176; } }
@keyframes wl-draw-tick { from { stroke-dashoffset: 34; } }
.wl-success-title { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: -.01em; }
.wl-success-title:focus { outline: none; }
.waitlist-success p { max-width: 38ch; margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.wl-done {
  margin-top: 14px;
  min-height: 44px;
  padding: 0 26px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font: 600 14px/1 var(--font-body);
  cursor: pointer;
}
.wl-done:hover { border-color: var(--ink); }

.waitlist button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

@media (max-width: 600px) {
  .waitlist { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 14px; }
  .waitlist-panel { max-height: calc(100dvh - 26px); padding: 22px 18px 20px; }
  .waitlist-fields { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .waitlist-head h2 { font-size: 24px; }
  .field input, .field textarea { font-size: 16px; } /* no iOS focus zoom */
  .form-actions { flex-direction: column; align-items: stretch; }
  .button.cta-glass.cta-submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .waitlist[open], .waitlist[open]::backdrop, .waitlist.is-closing, .waitlist.is-closing::backdrop,
  .waitlist.is-success .wl-tick circle, .waitlist.is-success .wl-tick path { animation: none; }
}
html[data-motion="paused"] .waitlist[open],
html[data-motion="paused"] .waitlist[open]::backdrop,
html[data-motion="paused"] .waitlist.is-success .wl-tick circle,
html[data-motion="paused"] .waitlist.is-success .wl-tick path { animation: none; }

/* Privacy link in the dialog note (deploy agent). */
.form-note a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.form-note a:hover { text-decoration-color: var(--ink); }

/* The launch column never grows wider than the section, so the CTA can wrap. */
.launch { grid-template-columns: minmax(0, 1fr); }
