/* ============================================================
   The waiting-list site's only stylesheet.

   WHY THE COLOURS ARE HEX LITERALS HERE AND NOWHERE ELSE
   CLAUDE.md's rule — "no hex literals in a screen" — is about
   client/src, where theme.ts exists and can be imported. This site
   is deliberately outside that build: no Metro, no bundler, no
   TypeScript, so there is nothing to import from. It is the same
   compromise client/public/index.html already makes and documents,
   and the same obligation comes with it:

     EVERY VALUE BELOW IS A COPY OF A TOKEN IN client/src/theme.ts.
     If the palette moves there, it has to be moved here by hand, or
     the waiting list and the product stop being the same brand.

   The mapping, so a future edit does not have to guess:

     #0b0b0f  color.bg            (room.base)
     #12141c  color.bgSubtle      (room.sunken)
     #16181f  color.surface       (room.surface)
     #2a2e3d  color.border        (room.border)
     #3a3f52  color.borderStrong  (room.borderStrong)
     #e5e7eb  color.text          (neutral[200], via room.ink)
     #9ca3af  color.textMuted     (neutral[400], via room.inkMuted)
     #7d8593  color.textSubtle
     #6b7280  color.textFaint     (neutral[500])
     #e11d48  color.primary       (rose[500])
     #fb7185  color.primaryInk    (rose[400])
     #c81e4a  rose[600]           — the pressed fill
     #ffffff  color.onPrimary     (neutral[0])
     #34d399  color.success
     #fda4af  rose[300]           — error ink on the dark ground

   Georgia is font.serif and the system stack is font.sans, both
   verbatim from theme.ts.
   ============================================================ */

:root {
  color-scheme: dark;

  --bg: #0b0b0f;
  --bg-subtle: #12141c;
  --surface: #16181f;
  /* Neutral grey, no blue in it, by request: the fill of the name and
     phone fields and of the progress bar's track. --bg-subtle is the
     navy it replaced there. */
  --fill-grey: #1c1c1e;
  --border: #2a2e3d;
  --border-strong: #3a3f52;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-subtle: #7d8593;
  --text-faint: #6b7280;
  --primary: #e11d48;
  --primary-ink: #fb7185;
  --primary-pressed: #c81e4a;
  --on-primary: #ffffff;
  --success: #34d399;
  --danger-ink: #fda4af;

  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* space.md / lg / xl / 2xl / 3xl off theme.ts's 4-8 rhythm. */
  --s-sm: 8px;
  --s-md: 12px;
  --s-lg: 16px;
  --s-xl: 24px;
  --s-2xl: 32px;
  --s-3xl: 48px;

  --radius: 14px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* privacy.html and terms.html scroll — they're ordinary long-form
   documents and must not inherit any assumption otherwise. index.html
   (the join form) is short enough to never need to, and a `.no-scroll`
   class on ITS <body> only (not the legal pages', which share this
   stylesheet) disables it there — see the block below, and
   landing/landing.css's identical fix for the 100dvh/overflow reasoning. */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.no-scroll {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

html:has(body.no-scroll) {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

a {
  color: var(--primary-ink);
  text-decoration-color: rgba(251, 113, 133, 0.4);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

/* Visible focus on every interactive thing. The app gets this from
   the a11y helpers in ui/a11y.ts; a plain document gets it here, and
   removing it would be the single most common accessibility
   regression on a form. */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary-ink);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  /* Narrower than it was (680). With the card's chrome gone there is
     no box holding the form together, so the COLUMN has to do it —
     a lone input stretched to 680px stops reading as a form. `.doc`
     overrides this back up for the legal pages, which are prose and
     want the wider measure. */
  max-width: 560px;
  margin: 0 auto;
  padding: var(--s-3xl) var(--s-xl);
  flex: 1 0 auto;
}

/* ---------- the wordmark ---------- */

/* An <img>, sized by WIDTH with height:auto, so whatever aspect ratio
   the PNG turns out to have is preserved rather than squashed. The
   cap is deliberately modest — a plain page's logo should not be the
   loudest thing on it.

   If the file is absent the browser renders the alt text ("Spark")
   in the flow instead, which is why this block sets no fixed height:
   a height here would leave a tall empty box around a short line of
   fallback text. */
/* 12px to the tagline, half the 24px it had, by request: the tagline
   reads as a caption of the wordmark rather than a separate line. */
.wordmark {
  display: block;
  margin: 0 auto var(--s-md);
  width: auto;
  height: auto;
  max-width: 180px;
  /* Retina: a 180px slot wants ~360-540px of pixels. See README. */
}

@media (min-width: 720px) {
  .wordmark {
    max-width: 220px;
  }
}

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

/* Plain by request: the sans stack rather than Georgia, normal-ish
   weight, no letter-spacing trick, no brand colour on a single word.
   The serif headline is still the app's voice — this page just isn't
   using it.

   Still bounded on both axes. Sizing off width alone is what lets a
   headline overrun a short window. */
h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(24px, 4.5vw, 30px);
  line-height: 1.25;
  margin: 0 0 var(--s-md);
  text-align: center;
  color: var(--text);
}

/* ---------- the rotating tagline ---------- */

/* Forced onto ONE line, by request — it was wrapping the longest
   tagline ("You'll know in the first ten seconds.", 37 characters) on
   narrow screens, and a wrap here is worse than most: the line jumps
   from one row to two mid-animation, which is what actually read as
   "not centered" the first time this was reported, rather than any
   real alignment bug — a second line breaks the symmetry every other
   line on the page has.

   Two things make "never wraps" true rather than merely intended:

     1. white-space: pre, not pre-wrap. pre-wrap was chosen so a run
        of spaces mid-erase would not collapse and make the text
        shiver — pre keeps that property (it doesn't collapse
        whitespace either) but additionally never wraps a line, no
        matter how long the string or how narrow the screen. The
        trade against pre-wrap is that overflow, if it ever happened,
        would spill past the box rather than wrap — which is exactly
        why the font-size below is sized to make sure it never does.

     2. THE FONT-SIZE IS MEASURED, NOT GUESSED. ch units make a box
        font-relative-proportional — a 42ch box always holds 42
        characters of ITS OWN font, whatever that font resolves to —
        so widening the box doesn't buy real safety, only a smaller
        font-size does, because that is the only thing that changes
        how many pixels the narrowest real viewport has to offer per
        character. Measured with canvas measureText, the same
        technique client/app/index.tsx uses for its own headline, at
        this font stack: ~0.55em per character. On the narrowest
        phone this site supports (320px, minus the wrap's 48px of
        padding — 272px available), the 37-character string plus the
        trailing caret needs about 262px at 12px — an 11px margin held
        deliberately, not a coincidence of some particular font.

   min-height only needs to reserve ONE line now — pre made a second
   line structurally impossible, so the old 2-line floor (3em) was
   guarding against a wrap that can no longer happen and was reserving
   dead space under every short tagline for no reason.

   Monospace stays for the same reason as before: the effect being
   imitated is a terminal, and a proportional font gives it away — in
   a proportional face the caret visibly jitters left and right as it
   passes over narrow and wide letters. */
.tagline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--primary-ink);
  text-align: center;
  margin: 0 auto var(--s-xl);
  min-height: 1.6em;
  max-width: 42ch;
  white-space: pre;
}

/* An old-school block caret rather than a thin bar — it is the DOS
   cursor, which is the look being asked for. */
.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 1px;
  /* Takes up no room in the line, by request, so the centring is
     done on the words alone and they sit exactly under the wordmark's
     centre at every length. Without this the caret (1px + 0.6em)
     counted as part of the line and pushed the text ~4px left. The
     negative margin cancels its advance; it still draws just after
     the last letter. */
  margin-right: calc(-0.6em - 1px);
  vertical-align: text-bottom;
  background: var(--primary-ink);
  animation: caret-blink 1.06s steps(1, end) infinite;
}

@keyframes caret-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* ---------- the progress bar ---------- */

/* The top of the form block, by request: a wide gap above separates
   it from the wordmark and tagline, and the gap below is the same as
   the one between the two fields, so the bar, the fields, the
   checkbox and the button read as one group. */
.progress {
  /* + md: gives back the 12px the tagline moved up by, so the form
     block stays exactly where it was. */
  margin: calc(var(--s-3xl) * 2 + var(--s-md)) auto var(--s-lg);
  max-width: 420px;

  /* ---------- THE ONE PLACE THE NUMBER LIVES ----------
     Unitless, so it can be used three different ways below: as a
     width (× 100%), as the end of the fill animation, and as the
     offset of the leading-edge glow. It was three hardcoded `75%`
     values before the bar was animated, and the animation would have
     made it four — at which point a change to the progress means
     finding all four or the glow detaches from the fill.

     The HTML still carries "77%" twice, in the visible label and the
     aria-label, because CSS cannot write text content. If this moves,
     those two move with it. */
  --p: 0.77;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  margin-bottom: 6px;
}

.progress-pct {
  color: var(--primary-ink);
  font-weight: 700;
}

/* Square corners, visible border, inset padding: the bar is drawn as
   a container with a fill inside it rather than as a rounded modern
   meter. */
.progress-track {
  height: 16px;
  background: var(--fill-grey);
  border: 1px solid var(--border-strong);
  padding: 2px;
  /* Anchors the leading-edge glow below. */
  position: relative;
}

/* The bright edge at the head of the fill, breathing.

   Positioned rather than parented to .progress-fill on purpose: the
   fill is masked into discrete blocks, and a mask clips everything
   the element paints — including a glow or a box-shadow. Anything
   meant to bleed past the blocks has to live outside the masked
   element.

   The offset re-derives the fill's right edge: 2px of track padding,
   plus the fraction of the remaining content width. */
.progress-track::after {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: calc(2px + (100% - 4px) * var(--p));
  width: 2px;
  margin-left: -2px;
  background: var(--primary-ink);
  box-shadow: 0 0 7px 1px var(--primary);
  animation: edge-breathe 1.9s ease-in-out infinite;
}

@keyframes edge-breathe {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

/* The segments are a repeating gradient rather than 20 elements.
   Same blocky result, one node instead of twenty, and the count
   reflows by itself at any width — hand-placed cells would have to be
   re-counted every time the bar's max-width changed.

   The gaps are transparent so the track shows through them, which is
   what makes it read as discrete blocks rather than a striped bar. */
/* The blocks are now a MASK rather than the background.

   Inverting it is what lets the bar shimmer. As a background the
   blocks were opaque paint, and anything drawn over them would also
   cover the transparent gaps — a highlight sweeping the full width
   rather than lighting each block in turn. As a mask, the blocks
   define where the element is visible at all, so the shimmer
   underneath them is revealed block by block and the gaps stay empty.

   -webkit- prefix included: Safari has only shipped masks prefixed,
   and without it the whole bar renders as one solid rectangle rather
   than failing visibly. That is the dangerous kind of breakage —
   still looks like a progress bar, just the wrong one. */
.progress-fill {
  height: 100%;
  width: calc(var(--p) * 100%);

  background-color: var(--primary);
  /* The travelling highlight. no-repeat + a fixed size means one band
     crossing, not a striped pattern. */
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 100%
  );
  background-size: 64px 100%;
  background-repeat: no-repeat;

  -webkit-mask-image: repeating-linear-gradient(
    90deg,
    #000 0 9px,
    transparent 9px 12px
  );
  mask-image: repeating-linear-gradient(90deg, #000 0 9px, transparent 9px 12px);

  /* Fills on load, then shimmers forever — the shimmer waits for the
     fill to finish so the highlight is not chasing a moving edge.
     The blanket prefers-reduced-motion rule at the foot of this file
     switches both off, and because the declared width is already the
     final value the bar simply appears filled and still. */
  animation:
    progress-fill-in 900ms ease-out 1,
    progress-shimmer 2.6s linear 900ms infinite;
}

@keyframes progress-fill-in {
  from {
    width: 0;
  }
  to {
    width: calc(var(--p) * 100%);
  }
}

@keyframes progress-shimmer {
  from {
    background-position-x: -64px;
  }
  to {
    background-position-x: calc(100% + 64px);
  }
}

/* ---------- the status LED ---------- */

.progress-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  /* Red, by request — the brand's accent, matching the 77% and "Beta"
     beside it, rather than a status-light green. */
  background: var(--primary-ink);
  box-shadow: 0 0 6px var(--primary-ink);
  animation: live-dot-pulse 2.1s ease-in-out infinite;
}

@keyframes live-dot-pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- accessibility helper ---------- */

/* Visible to a screen reader, invisible on screen. NOT `display:none`
   or `visibility:hidden` — both of those remove the element from the
   accessibility tree as well, which would defeat the entire purpose.
   The clip-rect technique is the one that hides it visually while
   leaving it announced. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  margin: var(--s-2xl) 0 var(--s-md);
  color: var(--text);
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin: var(--s-xl) 0 var(--s-sm);
  color: var(--text);
}

p,
li {
  color: var(--text-muted);
}

/* ---------- the form's container ---------- */

/* Flat by request. It was a raised surface — background, border,
   radius, padding — which on a page containing exactly one thing was
   a box drawn around the whole page.

   Removing the chrome has a side effect worth keeping: the consent
   block below is now the ONLY bordered element on the page, so the
   one thing that legally must not be skimmed past is also the one
   thing the eye stops at. That was true before only by contrast
   against a second border.

   Kept as a class rather than deleted so the markup does not have to
   change, and so there is somewhere to put the width cap. */
.card {
  background: none;
  border: none;
  padding: 0;
}

/* ---------- the form ---------- */

/* The same width as the progress bar above (.progress max-width), by
   request, so the bar and the two fields line up as one column. */
.field {
  max-width: 420px;
  margin: 0 auto var(--s-lg);
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 13px var(--s-md);
  font-family: inherit;
  font-size: 16px; /* 16px or iOS Safari zooms the page on focus. */
  color: var(--text);
  background: var(--fill-grey);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input:focus {
  border-color: var(--border-strong);
}

.field input[aria-invalid='true'] {
  border-color: var(--danger-ink);
}

/* Never red while focused — the focus ring alone marks it, rather than
   the ring stacked on a red border. join.js clears the flag when a
   field is entered; this covers the one case that skips that, Enter
   pressed inside an empty field, which flags it without a new focus. */
.field input[aria-invalid='true']:focus {
  border-color: var(--border-strong);
}

/* ---------- consent ----------

   No box any more, by request — the bordered card read as "why is
   there a warning here" rather than as an ordinary part of the form.
   What Law 25 and CASL actually require is a positive act (an
   unchecked, required checkbox) and a sentence that stands on its
   own; neither one depends on a border. See the long comment in
   index.html above this block for what specifically must not change
   regardless of how it is styled. */

.consent {
  margin-bottom: var(--s-lg);
}

/* The checkbox and its text are one <label> now, not an input paired
   with a separate `for`-linked label — the whole row is the click
   target, not just the 18px box. */
/* Centred on the same axis as the button, by request, and sized
   down with it — it is one line under a short button, not a paragraph
   under a full-width one. */
.consent-row {
  display: flex;
  justify-content: center;
  gap: var(--s-sm);
  align-items: center;
  cursor: pointer;
}

.consent input[type='checkbox'] {
  flex: 0 0 auto;
  /* 14px by request. The whole row is the <label>, so the tap target
     is the box plus the sentence, not the box alone — that is what
     keeps a smaller box safe to hit on a phone. */
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

/* Outlined in red when it is one of the things missing, like the
   fields' red border. join.js sets aria-invalid on it. */
.consent input[type='checkbox'][aria-invalid='true'] {
  outline: 2px solid var(--danger-ink);
  outline-offset: 2px;
}

.consent input[type='checkbox'][aria-invalid='true']:focus-visible {
  outline-color: var(--primary-ink);
}

.consent-row span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ---------- the button ---------- */

/* Short, by request — a one-word button, centred, rather than a
   bar across the form. */
button.primary {
  display: block;
  width: 100%;
  max-width: 100px;
  margin: 0 auto;
  padding: 15px var(--s-lg);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--on-primary);
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  /* touch.min in theme.ts — a 44px target is the floor, not a
     suggestion. */
  min-height: 48px;
}

button.primary:hover:not(:disabled) {
  background: var(--primary-pressed);
}

button.primary:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ---------- status ---------- */

/* Lowercase and 12px, by request, to match the consent line above
   it. The messages in join.js are written lowercase already; the
   transform is for the ones join_waitlist() raises in the database,
   which arrive as they were written there. */
.status {
  margin-top: var(--s-lg);
  text-align: center;
  font-size: 12px;
  text-transform: lowercase;
  min-height: 1.5em;
}

.status.error {
  color: var(--danger-ink);
}

.status.ok {
  color: var(--success);
}

/* Replaces the whole form once someone is on the list, rather than
   sitting under a form they might fill in again.

   Selected by ID, not by a `.done` class, and that is deliberate:
   the progress bar's completed stages (since removed) were also
   "done", and an unscoped `.done` rule reached them too — putting 16px of vertical
   padding on every stage label and centring them inside their flex
   cells. Two unrelated things legitimately called "done" is a name
   collision waiting to happen twice; an ID matches exactly one
   element and cannot collide at all. */
#done {
  text-align: center;
  padding: var(--s-lg) 0;
}

/* The heading is the whole message now, so it carries no margin of
   its own: the padding above sits evenly on both sides of it. */
#done h2 {
  margin: 0;
  color: var(--text);
}

/* THE HEADING MATCHES THE WORDMARK'S WIDTH, by request. Measured,
   not guessed: the wordmark's ink is 82.3% of the PNG (741 of 900px),
   so 148px in the phone's 180px slot and 181px in desktop's 220px,
   and the heading is 7.79px wide per px of size. So 19px on a phone
   and 23.25px on a desktop. Measured in Segoe UI; SF and Roboto run a
   few per cent different. Change the wordmark's max-width, the
   heading's words or the breakpoint, and re-measure. */
#done h2 {
  font-size: 19px;
}

@media (min-width: 720px) {
  #done h2 {
    font-size: 23.25px;
  }
}

/* Once someone has joined, the heading sits halfway down the empty
   space between the progress bar and the footer, by request, instead
   of at the top of it. Scoped with :has() to the moment #done is
   shown, so the form layout, and the legal pages that share .wrap,
   are untouched. .wrap already grows to fill the window (flex 1 in
   the body column); this passes that height down to #done. */
.wrap:has(#done:not([hidden])) {
  display: flex;
  flex-direction: column;
}

/* The star above "You're on the list." The PNG is 1080px square
   with the star in its middle ~65%, so 88px here draws a star about
   57px wide. */
.done-mark {
  display: block;
  width: 88px;
  height: 88px;
}

/* After joining, the tagline and the progress bar go too, by
   request: the page is the wordmark, the star and the heading. */
.wrap:has(#done:not([hidden])) > .tagline,
.wrap:has(#done:not([hidden])) > .progress {
  display: none;
}

.wrap:has(#done:not([hidden])) .card {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

#done:not([hidden]) {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-lg);
  /* Raised a little above true centre, by request. Bottom padding
     shifts the centred pair up by half its value; the eye reads the
     exact middle of a tall empty space as sitting low. */
  padding: 0 0 var(--s-3xl);
}

/* ---------- footer ---------- */

footer {
  flex: 0 0 auto;
  /* No divider line above, by request — the page reads as one
     surface, and the footer is set apart by its size and colour. */
  padding: var(--s-xl);
  text-align: center;
  font-size: 13px;
  color: var(--text-subtle);
}

/* Quiet until pointed at: grey with no underline, then the link red
   and underline on hover. Keyboard focus gets the same, so tabbing
   through shows where you are. The spacing between the links replaces
   the dots that used to separate them. */
footer a {
  margin: 0 var(--s-md);
  white-space: nowrap;
  color: var(--text-subtle);
  text-decoration: none;
}

footer a:hover,
footer a:focus-visible {
  color: var(--primary-ink);
  text-decoration: underline;
  text-decoration-color: currentColor;
}

/* ---------- legal documents ---------- */

.doc {
  max-width: 760px;
}

.doc h1 {
  text-align: left;
  font-size: clamp(28px, 5vw, 38px);
}

.doc .updated {
  color: var(--text-faint);
  font-size: 14px;
  margin: 0 0 var(--s-2xl);
}

.doc ul,
.doc ol {
  padding-left: var(--s-xl);
}

.doc li {
  margin-bottom: 6px;
}

/* `.todo` and `.banner` lived here — the red dashed blanks and the
   "Draft — not yet published" bar on the legal pages. Both are gone
   now that those pages are published, and the rules went with them
   rather than sitting unused: dead CSS is a standing invitation to
   re-add the markup without re-reading why it existed.

   If blanks are ever needed again, the point of them was that an
   unfilled legal document must be impossible to publish BY ACCIDENT
   — loud, ugly, and visible on the page itself rather than a note in
   a file nobody opens. Rebuild that property, not just the styling. */

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
