/* Talaria beta signup — monochrome editorial product stage. Tokens documented in DESIGN.md. */

@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin-400-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000000;
  --surface: #0c0c0c;
  --surface-raised: #151515;
  --ink: #f2f2ef;          /* 18.9:1 on --bg */
  --ink-soft: #d6d6d1;     /* 14.6:1 */
  --ink-muted: #a8a8a3;    /*  8.9:1 */
  --ink-faint: #8c8c87;    /*  6.2:1 — smallest text allowed */
  --ink-on-light: #5c5c57; /*  6.1:1 on --ink — secondary text inside white pills */
  --line: #262626;
  --line-strong: #6e6e6a;  /* 3.9:1 — form control borders */
  --focus: #ffffff;
  --glow: rgba(255, 255, 255, 0.075); /* the soft light the phone and film cast on black */

  --serif: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --step--2: 0.75rem;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
  --step-3: clamp(1.75rem, 1.2rem + 2.6vw, 2.75rem);
  --step-tagline: clamp(1.625rem, 1.05rem + 2.3vw, 2.625rem);
  --step-wordmark: clamp(3.5rem, 1.6rem + 7.2vw, 7.5rem);

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: clamp(4.5rem, 2rem + 8vw, 9.5rem);

  --radius-pill: 999px;
  --radius-field: 14px;
  --radius-media: clamp(14px, 0.5rem + 1vw, 24px);
  --measure: 33rem;
  --page-max: 80rem;
  --gutter: clamp(1.25rem, 0.5rem + 4vw, 4.5rem);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* exponential ease-out */
  --press: 120ms;
}

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

html {
  color-scheme: dark;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-4);
  scrollbar-color: #3a3a37 var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--ink); color: var(--bg); }

/* Decorative light (glows) may extend past the viewport; clip it without
   creating a scroll container. */
main { overflow-x: clip; }

img, video { display: block; max-width: 100%; height: auto; }
input, button { caret-color: var(--ink); }

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

a { color: var(--ink); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -4rem;
  z-index: 10;
  padding: var(--space-2) var(--space-3);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  border-radius: var(--radius-pill);
  text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

/* ---------- Pills (shared by submit, closing link) ---------- */

.signup__submit,
.closing__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  flex: none;
  min-height: 48px;
  padding: 0 1.35rem 0 1.5rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 650;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, scale var(--press) ease;
}
/* The cover's arrow, drawn as a CSS mask so the JS can still own the button text. */
.signup__submit::after,
.closing__link::after {
  content: '';
  width: 1em;
  height: 1em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 10h11m-4.5-4.5L15 10l-4.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 10h11m-4.5-4.5L15 10l-4.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: translate 220ms var(--ease-out);
}
.signup__submit:hover:not(:disabled),
.closing__link:hover { background: #ffffff; }
.signup__submit:hover:not(:disabled)::after,
.closing__link:hover::after { translate: 3px 0; }
.signup__submit:active:not(:disabled),
.closing__link:active { scale: 0.97; }
.signup__submit:disabled { cursor: default; background: var(--ink-muted); }
.signup__submit:disabled::after { display: none; }

/* ---------- Stage (first viewport) ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: var(--space-5);
  max-width: var(--page-max);
  min-height: min(100svh, 60rem);
  margin: 0 auto;
  padding: var(--space-5) var(--gutter);
}

.stage__copy { max-width: var(--measure); }

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.17em;
  margin: 0 0 0 -0.02em; /* optical: the icon's rounded corner reads inset */
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--step-wordmark);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.wordmark__icon {
  width: 0.84em;
  height: 0.84em;
  border-radius: 22.5%;
  flex: none;
  translate: 0 0.02em; /* sit on the cap-height, not the em box */
}

.tagline {
  margin: 0.4em 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-tagline);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}

.subline {
  margin: var(--space-4) 0 0;
  max-width: 30rem;
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-muted);
}

/* ---------- Signup form ---------- */

.signup {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* never grow to the input's intrinsic width */
  gap: var(--space-2);
  max-width: 30rem;
  margin-top: var(--space-5);
}
.signup > h2 { scroll-margin-top: var(--space-5); }

.signup__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem var(--space-3);
  padding-inline: 0.25rem;
}
.signup__label { font-weight: 600; font-size: var(--step--1); color: var(--ink-soft); }
.signup__soon {
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.signup__row {
  display: flex;
  gap: 0.375rem;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.signup__row:hover { border-color: #8a8a85; }
.signup__row:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

.signup__input {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
}
.signup__input::placeholder { color: var(--ink-faint); opacity: 1; }
.signup__input:focus-visible { outline: none; } /* the row draws the ring */
.signup__input[aria-invalid='true'] { box-shadow: inset 0 -1px 0 var(--ink); }
.signup__input[readonly] { color: var(--ink-muted); }

.signup__again {
  justify-self: start;
  min-height: 44px;
  padding: 0 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, scale var(--press) ease;
}
.signup__again:hover { border-color: var(--ink); }
.signup__again:active { scale: 0.97; }

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

.signup__captcha {
  --altcha-color-base: var(--surface);
  --altcha-color-base-content: var(--ink);
  --altcha-color-neutral: var(--surface-raised);
  --altcha-color-neutral-content: var(--ink-soft);
  --altcha-color-primary: var(--ink);
  --altcha-color-primary-content: var(--bg);
  --altcha-color-success: var(--ink);
  --altcha-color-success-content: var(--bg);
  --altcha-color-error: #ffffff;
  --altcha-color-error-content: #000000;
  --altcha-border-color: var(--line-strong);
  --altcha-checkbox-border-color: var(--line-strong);
  --altcha-input-background-color: var(--surface);
  --altcha-spinner-color: var(--ink);
  --altcha-border-radius: var(--radius-field);
  --altcha-max-width: 100%;
  display: block;
  max-width: 22rem;
}

.signup__status {
  min-height: 1.55em;
  margin: 0;
  font-size: var(--step-0);
  color: var(--ink-soft);
}
.signup__status:empty { min-height: 0; }
.signup__status:focus { outline: none; }
.signup__status[data-state='error'] {
  padding-left: var(--space-2);
  border-left: 1px solid var(--ink);
  color: var(--ink);
}
.signup__status[data-state='error']::before { content: 'Not sent — '; font-weight: 600; }
.signup__status[data-state='success'] {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-1);
}

.signup__note {
  margin: 0;
  padding-inline: 0.25rem;
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--ink-faint);
}
.signup__note a { color: var(--ink-soft); }

.signup__noscript {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  color: var(--ink-soft);
}

.is-complete .signup__captcha { display: none; }

/* Without scripting the form can't run its proof-of-work, so don't offer a dead field. */
@media (scripting: none) {
  .signup__head,
  .signup__row,
  .signup__captcha { display: none; }
}

/* ---------- Phone (the one authored motion moment) ---------- */

.stage__phone {
  position: relative;
  isolation: isolate;
  margin: 0;
  justify-self: center;
  width: min(100%, 27rem);
}
/* Light the phone casts on black, plus a faint floor beneath it. */
.stage__phone::before,
.stage__phone::after {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
}
.stage__phone::before {
  inset: -12% -38%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  animation: glow-bloom 2200ms var(--ease-out) both;
}
.stage__phone::after {
  left: 14%;
  right: 14%;
  bottom: -2.5%;
  height: 5%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.12), transparent);
}
/* Never taller than the viewport (minus stage padding), so the phone cannot
   push the stage taller than the first screen and drop the form below the fold. */
.stage__phone img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100svh - 2 * var(--space-5));
  margin-inline: auto;
  object-fit: contain;
  animation: phone-arrive 1500ms var(--ease-out) both;
}

/* Starts already visible (dimmed, slightly low and soft) and settles into focus. */
@keyframes phone-arrive {
  from {
    opacity: 0.35;
    transform: translate3d(0, 3.5%, 0) scale(0.965);
    filter: blur(10px) brightness(0.7);
  }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes glow-bloom {
  from { opacity: 0; transform: scale(0.7); }
}

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

.section-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--step-2);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.section-lede { margin: var(--space-2) 0 0; color: var(--ink-muted); max-width: var(--measure); }

.film,
.story,
.closing {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-7) var(--gutter) 0;
}

/* ---------- Film ---------- */

.film__frame {
  position: relative;
  isolation: isolate;
  margin-top: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-media);
  background: #000;
  aspect-ratio: 16 / 9;
}
.film__frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: calc(var(--radius-media) - 1px);
  background: #000;
}
.film__frame video:focus-visible { outline-offset: 4px; }
/* Screen light spilling onto the room; it brightens while the film plays. */
.film__frame::before {
  content: '';
  position: absolute;
  inset: 10% -6% -16%;
  z-index: -1;
  background: radial-gradient(closest-side, var(--glow), transparent);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 900ms var(--ease-out);
}
.film__frame[data-film='playing']::before { opacity: 1; }

/* JS-enhanced only: our play button replaces the platform's centre overlay. */
.film__frame[data-film] video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
.film__frame[data-film] video::-webkit-media-controls-overlay-play-button { display: none; }

.film__play {
  position: absolute;
  left: 50%;
  top: 69%;
  translate: -50% -50%;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 48px;
  padding: 5px 1.2rem 5px 5px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.9);
  transition: background-color 160ms ease, scale var(--press) ease;
}
.film__play[hidden] { display: none; }
.film__play:hover { background: #ffffff; }
.film__play:active { scale: 0.97; }
.film__play:focus-visible { outline-offset: 4px; border-radius: var(--radius-pill); }
.film__play-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  transition: scale 220ms var(--ease-out);
}
.film__play-icon svg { translate: 1px 0; } /* optical centre of a triangle */
.film__play:hover .film__play-icon { scale: 1.06; }
.film__play-time {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-on-light);
}

/* ---------- Story (From the app) ---------- */

.chapter {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: var(--space-5) var(--space-6);
  margin: 0;
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--line);
}
.chapter:first-of-type { margin-top: var(--space-4); border-top: 1px solid var(--line); }
.chapter:last-of-type { border-bottom: 0; padding-bottom: 0; }
.chapter--flip { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.chapter--flip .chapter__text { order: -1; justify-self: end; }

.chapter__media {
  position: relative;
  isolation: isolate;
  justify-self: center;
}
.chapter__media::before {
  content: '';
  position: absolute;
  inset: -8% -30%;
  z-index: -1;
  background: radial-gradient(closest-side, var(--glow), transparent);
  pointer-events: none;
}
.chapter__media img { width: clamp(13rem, 9rem + 10vw, 19.5rem); }

.chapter__text { max-width: 27rem; }
.chapter__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.chapter__text p {
  margin: var(--space-3) 0 0;
  font-size: var(--step-1);
  color: var(--ink-muted);
}

/* ---------- Closing ---------- */

.closing { text-align: center; padding-bottom: var(--space-7); }
.closing__title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2rem, 1.3rem + 3vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.closing .section-lede { margin-inline: auto; }
.closing__link { margin-top: var(--space-4); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-5) var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: var(--step--1);
}
.footer p { margin: 0; }
.footer a { color: var(--ink-soft); }

/* ---------- Privacy / plain pages ---------- */

.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: var(--space-6) var(--gutter);
}
.page__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
}
.page__brand img { width: 2rem; height: 2rem; border-radius: 22%; }
.page h1 { font-family: var(--serif); font-weight: 400; font-size: var(--step-3); line-height: 1.15; margin: var(--space-5) 0 var(--space-3); }
.page h2 { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; margin: var(--space-5) 0 var(--space-2); }
.page p, .page li { color: var(--ink-soft); }
.page .meta { color: var(--ink-faint); font-size: var(--step--1); }

/* ---------- Responsive ----------
   Width breakpoints are in em so browser text zoom (e.g. 200%) reflows the
   layout instead of squeezing larger text into the desktop grid. */

/* Wide desktops (1440×900+): give the stage more presence. */
@media (min-width: 80em) {
  .stage { gap: var(--space-6); }
  .stage__phone { width: min(100%, 28.5rem); }
}

/* Tablets (768/820): keep the two-column stage with a smaller phone. */
@media (min-width: 43.75em) and (max-width: 60em) {
  .stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.64fr);
    gap: var(--space-4);
    min-height: auto;
    padding-block: var(--space-6);
  }
  .subline { font-size: var(--step-0); }
  .chapter { gap: var(--space-4); }
}

/* Short desktop/laptop windows (e.g. 1280×577): tighten the stage so the
   wordmark, form row and CAPTCHA all fit in the first viewport. */
@media (min-width: 43.75em) and (max-height: 47.5em) {
  .stage {
    min-height: 100svh;
    padding-block: var(--space-4);
    gap: var(--space-4);
  }
  .stage__phone img { max-height: calc(100svh - 2 * var(--space-4)); }
  .wordmark { font-size: min(var(--step-wordmark), 13svh); }
  .tagline { font-size: min(var(--step-tagline), 5.5svh); }
  .subline { margin-top: var(--space-2); font-size: var(--step-0); }
  .signup { gap: var(--space-1); margin-top: var(--space-4); }
  .signup__input,
  .signup__submit { min-height: 44px; }
}

/* Phones and large text zoom: single column, copy and form first. */
@media (max-width: 43.74em) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
    gap: var(--space-6);
    padding-top: var(--space-5);
  }
  .stage__phone { width: min(74%, 20rem); }
  .stage__phone img { max-height: none; }
  .signup { margin-top: var(--space-4); }

  /* Small frames: sit above the poster title, clear of the native control bar. */
  .film__play { top: 27%; min-height: 44px; padding: 4px 1rem 4px 4px; gap: 0.55rem; font-size: var(--step--1); }
  .film__play-icon { width: 36px; height: 36px; }

  .chapter,
  .chapter--flip {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
    padding-block: var(--space-5);
  }
  .chapter__text,
  .chapter--flip .chapter__text { order: -1; justify-self: start; }
  .chapter__media img { width: min(64vw, 16rem); }
}

@media (max-width: 32.5em) {
  .footer { flex-direction: column; }
}

/* Phones (≤416px): the pill row stacks so the field is wide enough to read a real address. */
@media (max-width: 26em) {
  .signup__row {
    flex-direction: column;
    border-radius: 22px;
  }
  .signup__submit { width: 100%; }
}
@media (max-width: 22.5em) {
  .film__play-time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage__phone img,
  .stage__phone::before { animation: none; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .signup__submit:active, .closing__link:active, .film__play:active, .signup__again:active { scale: none; }
}

@media (forced-colors: active) {
  .signup__row, .signup__submit, .closing__link, .film__play, .signup__again { border: 1px solid CanvasText; }
  .signup__input:focus-visible { outline: 2px solid CanvasText; }
  .signup__submit::after, .closing__link::after { background: CanvasText; }
}
