/* Synapse-9. The page is one night: type and colour here, the sky and theme driven from js/stage.js. Mobile first. */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-5.3.0-latin-wdth-wght.woff2") format("woff2");
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
}

/* Tokens */
:root {
  --signal: #00FFFF;
  --bone: #E8EEEE;
  --ash: #93A1A6;
  --ink: #07141C;
  --ink-2: #3F5561;
  --signal-deep: #00636E;

  --m: clamp(20px, 3.5vw, 56px);
  --m-left: max(var(--m), env(safe-area-inset-left));
  --m-right: max(var(--m), env(safe-area-inset-right));
  --gap: clamp(12px, 1.6vw, 24px);
  --section-y: clamp(96px, 14vw, 200px);

  /* The sky is two colours driven by the clock. These are its values at 23:42. */
  --sky-top: #0A1724;
  --sky-bottom: #12283A;
  --sky: #DCE9F0;

  --text: var(--bone);
  --text-2: var(--ash);
  --link: var(--bone);
  --focus: var(--signal);
  --logo-slash: var(--signal);
  --btn-bg: var(--bone);
  --btn-fg: var(--ink);
  --btn-sweep: var(--signal);
  --scheme: dark;
}

/* Morning colours. Without the stage, #apply and the footer are always in the morning, and so is /apply/ without scripts. */
html[data-time="morning"],
html.lit #apply,
html:not(.stage-on) #apply,
html:not(.stage-on) .footer,
html:not(.stage-on):not(.js) .intake-page {
  --text: var(--ink);
  --text-2: var(--ink-2);
  --link: var(--signal-deep);
  --focus: var(--signal-deep);
  --logo-slash: var(--signal-deep);
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  --btn-sweep: var(--signal-deep);
  --scheme: light;
}

/* /apply/ without scripts has a static morning sky: the stage's own gradient, at 06:58. */
html:not(.stage-on):not(.js) .intake-page {
  --sky-top: #DCE9F0;
  --sky-bottom: #F4F3EE;
}

/* Between first light and morning the sky behind #apply is still changing fast: no pale secondary text yet. */
html.lit:not([data-time="morning"]) #apply {
  --text-2: var(--ink);
  --link: var(--ink);
}

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

html {
  background: var(--sky-bottom);
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html[data-time="morning"]:not(.stage-on) { background: var(--sky); }

body {
  margin: 0;
  overflow-x: clip;
  color: var(--text);
  font-family: "Archivo", system-ui, sans-serif;
  font-stretch: 100%;
  font-weight: 400;
  font-size: clamp(1.0625rem, 1.25vw, 1.25rem);
  line-height: 1.55;
  transition: color .4s;
}

h1, h2, h3, p, figure, dl, dd { margin: 0; }

h1 {
  font-stretch: 125%;
  font-weight: 700;
  font-size: clamp(2.75rem, 8vw, 10rem);
  line-height: .94;
  letter-spacing: -.02em;
}

h2 {
  font-stretch: 118%;
  font-weight: 600;
  font-size: clamp(2rem, 4.6vw, 4.75rem);
  line-height: 1;
  letter-spacing: -.015em;
}

h3 {
  font-stretch: 110%;
  font-weight: 600;
  font-size: clamp(1.375rem, 2.2vw, 2rem);
  line-height: 1.1;
}

p, dd { max-width: 62ch; }

img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--link);
  text-underline-offset: .18em;
  transition: color .4s;
}

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

[hidden] { display: none !important; }

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

.sprite { position: absolute; }

.nowrap { white-space: nowrap; }

/* Readout: the condensed cut replaces monospace. */
.readout, .readout__clock, figcaption, dt, .footer__note, .page__meta, .chart__text, .film-cta__time, .sign-date, .legal-version {
  font-stretch: 75%;
  font-weight: 500;
  font-size: .9375rem;
  font-variant-numeric: tabular-nums;
}

.logo { display: block; width: 32px; height: 32px; flex: none; }
.logo__slash { stroke: var(--logo-slash); transition: stroke .4s; }

/* Buttons: a solid rectangle, and on hover a slash at the logo's angle sweeps across. */
.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 32px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-stretch: 110%;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .4s, color .4s;
}

.btn::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30%;
  background: var(--btn-sweep);
  transform: translateX(-150%) skewX(-20.56deg);
  transition: transform .55s cubic-bezier(.65, 0, .35, 1);
}

@media (hover: hover) {
  .btn:hover::before { transform: translateX(450%) skewX(-20.56deg); }
}

.btn--small {
  min-height: 44px;
  padding: 6px 18px;
  font-size: 1rem;
}

.btn--submit {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  --btn-sweep: var(--signal-deep);
  width: 100%;
  min-height: 68px;
  font-size: 1.375rem;
}

.btn--large {
  min-height: 68px;
  padding: 10px 40px;
  font-size: 1.375rem;
}

.btn:disabled { cursor: progress; }

.skip {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 10px 16px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  transform: translateY(-200%);
}

.skip:focus { transform: none; }

/* Nav: transparent, no border, no blur. It only stays fixed when the stage can keep its colours right. */
.nav {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px var(--m-right) 10px var(--m-left);
  color: var(--text);
  transition: color .4s, transform .3s;
}

html.stage-on .nav { position: fixed; }

/* Hidden while scrolling down (js/nav.js), but never while anything inside it has focus. */
html.stage-on .nav--hidden:not(:focus-within) { transform: translateY(-100%); }

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: inherit;
  font-stretch: 110%;
  font-weight: 600;
  text-decoration: none;
}

.nav__right { display: flex; align-items: center; gap: clamp(16px, 2.2vw, 36px); }
.nav__link { display: none; color: inherit; text-decoration: none; }
.nav__link:hover { text-decoration: underline; }

/* The sound button. The slash through the wave means off, and goes when it's on. */
.nav__sound { display: inline-flex; align-items: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.nav__sound[hidden] { display: none; }
.nav__sound svg { flex: none; }
.nav__sound-slash { stroke: var(--logo-slash); }
.nav__sound.is-on .nav__sound-slash { display: none; }
.nav__sound.is-on svg path:first-child { stroke: var(--logo-slash); }
.nav__sound-label { display: none; }
@media (min-width: 390px) { .nav__sound-label { display: inline; } }

/* The readout: under the nav on phones, bottom right on wide screens. */
.readout {
  position: fixed;
  z-index: 9;
  top: 64px;
  right: var(--m-right);
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  transition: color .4s;
}

.readout__clock { font-size: 1.125rem; }

html:not(.stage-on) .readout { display: none; }

.readout__chart {
  display: none;
  align-self: center;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.readout__rest { opacity: .25; }

/* Stage */
.stage {
  position: fixed;
  z-index: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  pointer-events: none;
}

.stage__sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--sky-top), var(--sky-bottom));
}

.stage__photo {
  position: absolute;
  inset: 0;
  display: block;
  opacity: .78;
}

.stage__photo img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 62% 40%;
}

.stage__signal {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
}

main, .footer { position: relative; z-index: 1; }

/* Intro. Hidden only until main.js says otherwise, and a failed script can't leave it hidden: the failsafe shows
   everything regardless. intro.js takes over with inline opacity once it adds .intro-ready. */
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.intro-ready) :is(.nav, .readout, .stage__photo, .stage__signal, .hero__title, .hero__pay, .hero__lede, .hero__actions, .intake) {
    visibility: hidden;
    animation: intro-failsafe 1ms linear 3s forwards;
  }
}

@keyframes intro-failsafe {
  to { visibility: visible; }
}

/* Letters of the headline while it wakes. intro.js puts the plain text back afterwards. */
.word { display: inline-block; white-space: nowrap; }
.letter { font-variation-settings: "wdth" var(--wdth, 125), "wght" var(--wght, 700); }

/* Layout */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px) var(--gap);
  padding-left: var(--m-left);
  padding-right: var(--m-right);
}

.grid > * { min-width: 0; }

.section { padding-top: var(--section-y); padding-bottom: var(--section-y); }

/* Hero */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: clamp(20px, 3vh, 36px);
  min-height: 100vh;
  min-height: 100svh;
  padding: 104px var(--m-right) clamp(28px, 5vh, 56px) var(--m-left);
}

.hero::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 80%;
  background: linear-gradient(to bottom, transparent, var(--sky-bottom) 85%);
  pointer-events: none;
}

.hero > * { position: relative; min-width: 0; }

/* Three lines on phones, at a width that fits 350px. */
.hero__title {
  --h1-wdth: 100;
  font-stretch: 100%;
  font-size: 12.5vw;
}

.hero__title br { display: none; }
.hero__word { display: block; white-space: nowrap; }

.hero__foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.hero__foot > * { min-width: 0; }

/* The Sub-heading style. --bone, since the hero is always at night. */
.hero__pay {
  grid-column: 1 / -1;
  color: var(--bone);
  font-stretch: 110%;
  font-weight: 600;
  font-size: clamp(1.375rem, 2.2vw, 2rem);
  line-height: 1.1;
}

.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }

/* With a browser's toolbars showing, the hero runs a little past the first screen, so the headline clears her face. The nav's Apply button stays visible. */
@media (max-width: 759px) and (max-height: 780px) {
  .hero { min-height: 118svh; }
}

/* The film: a plain text button, or a plain link to the file until js/film.js swaps them. */
.film-cta {
  display: inline-flex;
  align-items: baseline;
  gap: .5em;
  padding: .55em 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .18em;
}

.film-cta__time { display: inline-block; }

.film {
  --focus: var(--signal);
  box-sizing: border-box;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100svh;
  max-height: none;
  margin: auto;
  padding: max(env(safe-area-inset-top), 3vh) env(safe-area-inset-right) max(env(safe-area-inset-bottom), 8px) env(safe-area-inset-left);
  overflow: hidden;
  border: 0;
  background: none;
  color: var(--bone);
}

.film[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.film::backdrop { background: rgb(0 0 0 / .92); }

.film video {
  display: block;
  flex: 1 1 0;
  min-height: 0;
  width: auto;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
}

/* Portrait phones: leave room for the status bar, which can sit over the top of the page. */
@media (max-width: 759px) and (orientation: portrait) {
  .film { padding-top: max(env(safe-area-inset-top), 60px); }
}

.film__close {
  min-height: 44px;
  padding: 8px 20px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: .18em;
  cursor: pointer;
}

/* Problem */
.problem__words { display: grid; gap: 1.1em; }

/* The generations of the headline, built by scenes/collapse.js. They keep their length, so nothing reflows. */
.collapse__line {
  margin-top: .5em;
  font-stretch: 110%;
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.1;
  white-space: pre;
}

/* Protocol. The chart and the bit grid exist only when scenes/protocol.js has built them. */
.beats { display: grid; gap: clamp(48px, 7vw, 96px); }
.beat h3 { margin-bottom: .6em; }

.chart {
  position: relative;
  display: flex;
  flex-direction: column;
  height: clamp(260px, 46vh, 460px);
  margin: clamp(32px, 5vw, 64px) 0;
  padding-top: 1.6rem;
  color: var(--text-2);
}

.chart:empty { display: none; }
.chart__plot { position: relative; flex: 1; min-height: 0; }

.chart__copy {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.chart__copy--faint { opacity: .22; }
.chart__copy path { fill: none; vector-effect: non-scaling-stroke; }
.chart__copy .chart__line { stroke: var(--bone); stroke-width: 2px; }
.chart__copy .chart__ticks { stroke: var(--bone); stroke-width: 1px; }
.chart__copy .chart__area { fill: var(--signal); fill-opacity: .22; }
.chart__copy .chart__top { stroke: var(--signal); stroke-width: 1px; }

.chart__text { position: absolute; white-space: nowrap; }
.chart__level { left: var(--m-left); padding-bottom: 2px; transform: translateY(-100%); }
.chart__cycles { top: 0; }
.chart__processing { left: var(--m-left); bottom: 4px; }
.chart__note { right: var(--m-right); bottom: 4px; }
.chart__axis { position: relative; flex: none; height: 1.6rem; }
.chart__tick { top: .2rem; transform: translateX(-50%); }

.bits { margin-top: 20px; }
.bits__grid { display: grid; grid-template-columns: repeat(16, 10px); gap: 2px; }

/* 1 is solid and 0 is an outline, so the value isn't carried by colour alone. */
.bit {
  height: 10px;
  border: 1px solid color-mix(in srgb, var(--bone) 30%, transparent);
  visibility: hidden;
}

.bit--one { border-color: var(--signal); background: var(--signal); }
.bit.is-set { visibility: visible; }
.bits figcaption { margin-top: 10px; color: var(--text-2); }

/* Band */
.band__product figcaption { margin-top: 10px; color: var(--text-2); }
.band__words > h2 { margin-bottom: .55em; }
.band__sensors { width: 100%; margin-top: clamp(28px, 4vw, 48px); }

.specs { margin-top: clamp(28px, 4vw, 48px); }

.specs > div {
  display: grid;
  grid-template-columns: minmax(0, 6.5rem) minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
}

.specs > div + div { border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent); }
.specs dt { color: var(--text-2); }

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--signal);
  vertical-align: .12em;
}

/* On wide screens this stays out of the fixed readout's way at the bottom right: see the breakpoints below. */
.band__worn { width: 60%; margin-left: auto; }

.band__words h3 { margin-top: clamp(40px, 6vw, 72px); margin-bottom: .5em; }
.band__words h3 ~ p + p { margin-top: .6em; }

/* Society. The figure stays hidden until scenes/society.js shows it. */
.society__words p { margin-top: 1em; }
.society__plate { position: relative; container-type: inline-size; width: min(72vh, 100%); width: min(72svh, 100%); }

/* The background is the world's dark ground, for the moment before the canvas has been filled. */
.society__plate canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: rgb(5 7 15);
}

/* Hard pixels only at full size or above. Scaled down they alias, so there the browser smooths them. */
@container (min-width: 1000px) {
  .society__plate canvas { image-rendering: pixelated; }
}

/* Centred on its pixel, which scenes/society.js picks. The ring is what finds it at a glance. */
.society__you {
  position: absolute;
  top: 40%;
  left: 64%;
  width: 7px;
  height: 7px;
  background: var(--signal);
  outline: 1px solid var(--signal);
  outline-offset: 3px;
  transform: translate(-50%, -50%);
}

.society__field figcaption { margin-top: 10px; color: var(--text-2); }

/* Questions: native rows, with hairlines between them. */
.questions__list details + details { border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent); }

.questions__list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 0;
  font-stretch: 110%;
  font-weight: 600;
  font-size: clamp(1.125rem, 1.6vw, 1.5rem);
  line-height: 1.2;
  cursor: pointer;
  list-style: none;
}

.questions__list summary::-webkit-details-marker { display: none; }

/* Plus and minus, drawn so they aren't read out. */
.questions__list summary::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
}

.questions__list details[open] summary::after {
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}

.questions__list details p { padding-bottom: 20px; }

/* Dawn: the sky does the work. The line sits in the upper half, where it is still dark. */
.dawn {
  min-height: 130vh;
  padding: clamp(96px, 18vh, 200px) var(--m-right) 0 var(--m-left);
}

.dawn__line {
  color: var(--bone);
  font-stretch: 125%;
  font-weight: 700;
  font-size: clamp(2.75rem, 11vw, 14rem);
  line-height: .94;
  letter-spacing: -.02em;
}

/* Apply. The form is on its own page now: here are the words, the way in, what happens next and the morning. */
.apply {
  min-height: 100vh;
  min-height: 100svh;
  color: var(--text);
  transition: color .4s;
}

.apply__grid { row-gap: clamp(32px, 5vw, 56px); }
.apply__intro > p { margin-top: 1em; }
.apply__intro .btn { margin-top: clamp(24px, 3vw, 40px); }

.apply__next h3 { margin-bottom: .6em; }
.apply__next ol { margin: 0; padding: 0 0 0 1.6em; }
.apply__next li { padding: 14px 0 14px .25em; }
.apply__next li + li { border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent); }
.apply__next li::marker { font-stretch: 75%; font-weight: 500; font-variant-numeric: tabular-nums; }
.apply__next strong { font-weight: 600; }

.apply__photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

/* The application, /apply/: one question per screen with scripts, one long form without. */
html.stage-on .intake-page .nav { position: absolute; }

.intake-page .readout {
  position: absolute;
  top: 18px;
  bottom: auto;
}

.intake {
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(96px, 16vh, 160px) var(--m-right) 22vh var(--m-left);
}

.intake [tabindex="-1"]:focus { outline: none; }

.intake form, .intake__stop, .intake__success { max-width: 100%; }

.step {
  min-width: 0;
  margin: 0 0 clamp(64px, 10vh, 112px);
  padding: 0;
  border: 0;
}

.step legend { display: block; width: 100%; margin-bottom: clamp(24px, 4vh, 40px); padding: 0; }
.step__text { margin-bottom: 24px; }
.step__advice { margin-top: 20px; font-weight: 600; }

/* With scripts one step shows at a time, and the shared buttons sit right under it. */
.stage-on .step { margin-bottom: 0; }

.intake__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  margin-top: clamp(24px, 4vh, 40px);
}

.intake__actions:not(:has(> :not([hidden]))) { display: none; }

.intake__back {
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: .18em;
  cursor: pointer;
}

.intake__back:disabled { cursor: progress; }

/* Large rows, like the ad. The native control stays on top, invisible, so focus and keyboard behaviour stay native. */
.choices { display: grid; }
.choice { position: relative; }
.choice + .choice { margin-top: -1px; }

.choice input {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 12px 20px;
  border: 1px solid currentColor;
  font-size: 1.1875rem;
  line-height: 1.25;
  transition: background-color .15s, color .15s;
}

@media (hover: hover) {
  .choice input:hover:not(:checked) + label { background: color-mix(in srgb, currentColor 12%, transparent); }
}

.choice input:checked + label {
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
}

/* The check mark: an answer isn't carried by colour alone. */
.choice input:checked + label::after {
  content: "";
  flex: none;
  width: 9px;
  height: 18px;
  margin-right: 4px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-2px, -2px);
}

.choice input:focus-visible + label {
  position: relative;
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* The agreement. */
.agreement-panel {
  height: 22rem;
  padding: 20px 24px;
  overflow-y: auto;
  border: 1px solid currentColor;
  background: #fff;
  color: var(--ink);
  overscroll-behavior: contain;
}

.agreement-link { margin: 14px 0 clamp(28px, 4vh, 44px); }

.consent { margin-bottom: 14px; }
.consent .check { align-items: flex-start; }
.consent .check label { padding: 0; }
.consent__heading { margin: clamp(28px, 4vh, 44px) 0 16px; }
.consent + .field:not(.consent) { margin-top: clamp(28px, 4vh, 44px); }
.sign-date { margin-top: 10px; color: var(--text-2); }
.sign-date:empty { display: none; }

/* Fields */
.field {
  min-width: 0;
  margin: 0 0 clamp(24px, 3.4vh, 36px);
  padding: 0;
  border: 0;
}

.field > label {
  display: block;
  margin-bottom: 2px;
  padding: 0;
}

.field input[type="text"], .field input[type="email"], .field input[type="date"] {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  outline: 2px solid transparent;
  background: linear-gradient(var(--focus), var(--focus)) left bottom / 0 3px no-repeat;
  color: inherit;
  color-scheme: var(--scheme);
  font: inherit;
  font-size: 1.375rem;
  scroll-margin-top: 110px;
  scroll-margin-bottom: 40vh;
  appearance: none;
  transition: background-size .35s cubic-bezier(.65, 0, .35, 1);
}

.field input[type="text"]:focus, .field input[type="email"]:focus, .field input[type="date"]:focus { background-size: 100% 3px; }

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s;
}

.field input[aria-invalid="true"] { border-bottom-width: 2px; }

.field__error, .form__failure {
  margin-top: 8px;
  font-weight: 600;
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.check input {
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0;
  border: 2px solid currentColor;
  border-radius: 0;
  background: transparent center / 72% no-repeat;
  cursor: pointer;
  scroll-margin-bottom: 40vh;
  appearance: none;
}

.check input:checked {
  border-color: var(--ink);
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 13l5 5L20 6' fill='none' stroke='%23fff' stroke-width='3'/%3E%3C/svg%3E");
}

.check label { padding: 8px 0; cursor: pointer; }

.form__note {
  margin-top: 16px;
  color: var(--text-2);
  font-size: .9375rem;
  transition: color .4s;
}

/* The success notification, shaped like a phone notification. */
.notice {
  --link: #fff;
  --focus: var(--signal);
  display: grid;
  gap: 8px;
  padding: 24px 28px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  overflow-wrap: anywhere;
  animation: notice-rise .7s cubic-bezier(.2, .8, .2, 1) both;
}

.notice h2 { font-size: clamp(1.75rem, 3vw, 3rem); }
.notice h2:focus { outline: none; }

.notice__links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  margin-top: 8px;
}

/* Padding, not flex, makes the 44px target: flex would split "Back to" from its nowrap span and lose the space. */
.notice__links a { padding: 9px 0; }

@keyframes notice-rise {
  from {
    transform: translateY(32px);
    clip-path: polygon(-40% 0, -40% 0, -80% 100%, -80% 100%);
  }
  to {
    transform: none;
    clip-path: polygon(-40% 0, 140% 0, 100% 100%, -80% 100%);
  }
}

/* Footer */
.footer {
  padding: 32px var(--m-right) 40px var(--m-left);
  color: var(--text);
  transition: color .4s;
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

.footer__row a { display: inline-flex; align-items: center; min-height: 44px; }
.footer__note { margin-top: 12px; color: var(--text-2); transition: color .4s; }

/* Small static pages: privacy, thanks, 404. */
.plain { min-height: 100vh; min-height: 100svh; background: var(--sky); }

/* A film's own page, the link people share. Always in the night colours. */
.film-page { background: var(--sky-top); }
html body.film-page .footer { --text: var(--bone); --text-2: var(--ash); --link: var(--bone); background: none; }
.film-page__main { display: grid; gap: 32px; justify-items: center; padding: 88px var(--m-right) 48px var(--m-left); }
.film-page__video { display: block; width: min(100%, calc(78svh * 9 / 16)); height: auto; aspect-ratio: 9 / 16; background: #000; }
.film-page__words { display: grid; gap: 1.1em; justify-items: start; width: 100%; max-width: 40ch; }
.film-page__words h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); }
@media (min-width: 760px) {
  .film-page__main { grid-template-columns: auto minmax(0, 40ch); justify-content: center; align-items: center; gap: clamp(40px, 6vw, 96px); min-height: calc(100svh - 120px); }
}

/* Info */
.info__lede { max-width: 60ch; font-size: clamp(1.125rem, 1.6vw, 1.375rem); line-height: 1.4; }
.info__toc { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: 20px; }
.info__toc a { display: inline-flex; align-items: center; min-height: 44px; }
.info__section { margin-top: clamp(64px, 9vw, 120px); scroll-margin-top: 24px; }
.info__section h2 { font-size: clamp(1.875rem, 4vw, 3.25rem); }
.info__section > p, .info__section > ul { max-width: 62ch; margin-top: 16px; }
.info__section ul { padding-left: 1.1em; }
.info__section li + li { margin-top: .5em; }
.info__section .btn { margin-top: 8px; }
.info__phones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.4vw, 24px); margin-top: 32px; }
.info figure img { display: block; width: 100%; height: auto; }
.info__phones figcaption { margin-top: 4px; padding: 0 clamp(4px, 1vw, 16px); }
.info figcaption strong { display: block; font-weight: 700; }
.info__wide { margin-top: 32px; }
.info__wide img { border-radius: 6px; box-shadow: 0 0 0 1px rgb(7 20 28 / .14); }
.info__wide figcaption { max-width: 72ch; margin-top: 10px; }
@media (max-width: 1023px) { .info__phones { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 559px) { .info__phones { grid-template-columns: minmax(0, 340px); justify-content: center; } }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; }
.share a, .share button, .footer__analytics, .analytics-ask__no {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-decoration: underline; text-underline-offset: .18em; cursor: pointer;
}
.film__bar { display: flex; flex: none; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 18px; padding: 4px 12px; }
.film__bar .film__close { padding: 8px 0; }

.analytics-ask {
  position: fixed; z-index: 20; left: var(--m-left); bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  max-width: min(560px, calc(100vw - var(--m-left) - var(--m-right))); padding: 12px 16px; border-radius: 6px;
  background: var(--sky-top); color: var(--bone); --link: var(--bone); --focus: var(--signal);
}
.analytics-ask p { flex-basis: 100%; }

.page {
  padding: clamp(112px, 18vh, 200px) var(--m-right) var(--section-y) var(--m-left);
}

.page h1 {
  margin-bottom: .6em;
  font-size: clamp(2.75rem, 6vw, 6rem);
}

.page p + p { margin-top: 1em; }
.page__meta { color: var(--text-2); }

/* The legal pages: a calm document at 68ch. The same rules set the agreement inside the panel on /apply/. */
.legal-page .legal { padding-top: clamp(96px, 14vh, 144px); }
.legal-page .page h1 { font-size: clamp(2.25rem, 4.6vw, 4rem); }

.legal { max-width: calc(68ch + var(--m-left) + var(--m-right)); }
.agreement-panel .legal { max-width: 68ch; }
.legal p, .legal li { max-width: 68ch; }
.legal strong { font-weight: 600; }
.legal a { overflow-wrap: anywhere; }

.legal h1 { margin-bottom: .4em; }
.agreement-panel .legal h1 { font-size: 1.5rem; line-height: 1.15; letter-spacing: 0; }

.legal h2 {
  margin: 2.2em 0 .6em;
  font-stretch: 110%;
  font-size: clamp(1.1875rem, 1.5vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.legal p + p { margin-top: 1em; }
.legal ol, .legal ul { margin: 1em 0; padding-left: 1.5em; }
.legal li + li { margin-top: .5em; }

.legal-subtitle { margin-bottom: 1em; color: var(--text-2); }
.legal-version { color: var(--text-2); }
.legal-notice { margin-top: 1.6em; padding: 16px 20px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.legal-end { margin-top: 3em; }

/* Without the stage (no JS, or a script failed), each section has its own static sky. */
html:not(.stage-on) #problem { background: #0A1724; }
html:not(.stage-on) #protocol, html:not(.stage-on) #band, html:not(.stage-on) #society, html:not(.stage-on) #questions { background: #000; }
html:not(.stage-on) .dawn { background: linear-gradient(to bottom, #070B1E 0%, #1E2A52 55%, #A8553F 85%, #FFC9A3 100%); }
html:not(.stage-on) #apply { background: linear-gradient(to bottom, #DCE9F0, #F4F3EE); }
html:not(.stage-on) .footer { background: #F4F3EE; }

/* Phones: text scrolls under the fixed readout, so it gets a small backing. */
@media (max-width: 759px) {
  .readout {
    padding: 2px 6px;
    background: rgba(0, 0, 0, .6);
    transition: color .4s, background-color .4s;
  }

  html[data-time="morning"] .readout { background: rgba(255, 255, 255, .7); }
}

/* Wide screens. The readout moves to the bottom of the screen, where first light reaches it along with #apply. */
@media (min-width: 760px) {
  .nav { padding-top: 16px; padding-bottom: 16px; }
  .nav__link { display: inline-flex; align-items: center; min-height: 44px; }

  .logo { width: 36px; height: 36px; }

  /* Lifted so the headline clears her face. At rest the hero's gradient covers the lower edge; the mask keeps that edge
     from showing once the hero, and its gradient, have scrolled up past it. */
  .stage__photo img {
    transform: translateY(-13%);
    -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent);
    mask-image: linear-gradient(to bottom, #000 82%, transparent);
  }

  .readout {
    top: auto;
    bottom: max(var(--m), env(safe-area-inset-bottom));
    gap: 10px;
  }

  .readout__clock { font-size: 1.5rem; }
  .readout__chart { display: block; }

  html.lit .readout { color: var(--ink); }

  .band__worn { width: 44%; margin-left: 0; }

  .bits__grid { grid-template-columns: repeat(16, 12px); gap: 3px; }
  .bit { height: 12px; }

  .hero { padding-bottom: clamp(36px, 7vh, 72px); }

  .hero__title {
    --h1-wdth: 125;
    font-stretch: 125%;
    font-size: clamp(2.75rem, 8vw, 10rem);
  }

  .hero__title br { display: inline; }
  .hero__word { display: inline-block; }

  .hero__foot { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: end; }
  .hero__lede { grid-column: 1 / span 6; }
  .hero__actions { grid-column: 7 / -1; }
}

@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }

  .hero__lede { grid-column: 1 / span 5; }

  .problem__stack { grid-column: 1 / span 7; }
  .problem__words { grid-column: 9 / span 4; }
  .collapse__line { font-size: clamp(1.375rem, 2.2vw, 2rem); }

  .protocol__title { grid-column: 1 / -1; }
  .beats { grid-column: 1 / span 6; }

  .band__product { grid-column: 1 / span 5; grid-row: 1; }
  .band__words { grid-column: 7 / span 6; grid-row: 1 / span 2; }

  /* Under the product image, about 3 columns wide, so the readout never crosses it. */
  .band__worn { grid-column: 1 / span 5; grid-row: 2; width: 58%; margin-left: auto; }

  .society__words { grid-column: 1 / span 5; }
  .society__field { grid-column: 7 / span 6; }

  .questions__title { grid-column: 1 / span 5; }
  .questions__list { grid-column: 7 / span 6; }

  .apply__intro { grid-column: 1 / span 5; grid-row: 1; }
  .apply__photo { grid-column: 1 / span 5; grid-row: 2; }
  .apply__next { grid-column: 7 / span 6; grid-row: 1 / span 2; }

  .intake form, .intake__stop, .intake__success { width: 60%; }
}

/* Laptops: the buttons stay beside the lede, which needs the room the small chart beside the clock would take. The headline is sized to leave her face clear. */
@media (min-width: 1000px) and (max-width: 1399px) {
  .hero__lede { grid-column: 1 / span 6; }
  .hero__actions { grid-column: 7 / -1; }
  .readout__chart { display: none; }
}

/* Too narrow for the buttons beside the lede. */
@media (min-width: 760px) and (max-width: 999px) {
  .hero__actions { grid-column: 1 / -1; }
}

@media (min-width: 760px) and (max-width: 1399px) {
  .hero__title { font-size: min(6.7vw, 11.4vh); }
}

/* Scenes: a tall section with a sticky child, but only once scenes/sticky.js has marked the section as built, so if a
   script fails or never arrives these sections flow as plain text. The same query is in that file. */
@media (prefers-reduced-motion: no-preference) and (min-height: 640px) {
  html.js .is-scene { padding-top: 0; padding-bottom: 0; }
  html.js .problem.is-scene { height: 240vh; }
  html.js .protocol.is-scene { height: 480vh; }

  html.js .is-scene .problem__sticky, html.js .is-scene .protocol__sticky {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100svh;
    padding-top: 96px;
    padding-bottom: 20px;
  }

  html.js .is-scene .problem__sticky { justify-content: center; }
  html.js .is-scene .protocol__sticky { gap: clamp(12px, 2.5vh, 28px); }
  html.js .is-scene .protocol__sticky .grid { flex: none; }
  html.js .is-scene .chart { flex: 0 1 34svh; height: auto; min-height: 120px; margin: 0; }
  html.js .is-scene .protocol__foot { margin-top: auto; }
  html.js .is-scene .beats { gap: 0; }
  html.js .is-scene .beat { grid-area: 1 / 1; }
}

/* The readout is at the bottom of the screen from here up, so the beats and the bit grid stop above it. */
@media (prefers-reduced-motion: no-preference) and (min-height: 640px) and (min-width: 760px) {
  html.js .is-scene .protocol__sticky { padding-bottom: calc(var(--m) + 40px); }
}

@media (prefers-reduced-motion: no-preference) and (min-height: 640px) and (min-width: 900px) {
  html.js .is-scene .chart { flex: 1 1 0; }
  html.js .is-scene .beats { grid-column: 1 / -1; }

  html.js .is-scene .beat {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
  }

  html.js .is-scene .beat > h3, html.js .is-scene .beat > p { grid-column: 1 / span 5; }
  html.js .is-scene .bits { grid-column: 7 / span 5; grid-row: 1 / span 2; align-self: end; margin: 0; }
}

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }

/* Reduced motion: sky, clock and theme still follow scroll, since they aren't movement. */
@media (prefers-reduced-motion: reduce) {
  .nav { transition: color .4s; }
  .btn::before { display: none; }
  .field input[type="text"], .field input[type="email"], .field input[type="date"] { transition: none; }
  .choice label { transition: none; }
  .notice { animation: none; }
}
