/* The interim landing page. Its colours are the site's own tokens, copied from web/styles.css
   so both themes read as the full site does: graphite and chalk grounds, the lime accent, the
   kit's glow green for links. Nothing here loads a file from anywhere. */

:root {
  color-scheme: dark;
  --paper: #121413;
  --sheet: #1A1D1B;
  --raised: #212522;
  --well: #0C0E0D;
  --ink: #F4F4F2;
  --ink-2: #B4BAB4;
  --ink-3: #8D948E;
  --rule-strong: #8D948E;
  --accent: #9BF25A;
  --flow: #7EF050;
  --ok: #7EF050;
  --warn: #F5B74A;
  --bad: #FF7C6C;
  --shade: #000000;
  --ticket: #9BF25A;
  --on-ticket: #121413;
  --neon: #7EF050;
  --glow: 8%;
  --dots: 7%;
  --shine: 25%;
  --shine-wide: 12%;
  --edge: 7%;
  --depth: 90%;
  --text-weight: 300;
  --font-display: "Geologica", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body: "Geologica", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-hex: "Atkinson Hyperlegible Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 72px;
  --r-pill: 10px;
  --r-card: 14px;
  --r-control: 8px;
  /* 16px, or as much as a phone's notch or rounded corner takes when it is held sideways */
  --gutter: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --line: color-mix(in srgb, var(--ink) 9%, transparent);
  --line-2: color-mix(in srgb, var(--ink) 18%, transparent);
  --halo: color-mix(in srgb, var(--accent) var(--glow), transparent);
  --shadow-lit: inset 0 1px 0 0 color-mix(in srgb, var(--ink) var(--edge), transparent), 0 36px 70px -46px color-mix(in srgb, var(--shade) var(--depth), transparent), 0 0 120px -50px color-mix(in srgb, var(--accent) 55%, transparent);

  /* The teaser's own measures. The film is a 480px square; its last frame holds the wordmark
     and the line under it, and the page's wordmark is laid over that frame's as the film ends.
     --teaser-size is the most the film is shown at. Raise it if a larger master replaces it. */
  --teaser-size: 720px;
  --teaser-ground: #000000;
}

:root[data-theme="light"] {
  color-scheme: light;
  --paper: #F4F4F2;
  --sheet: #FFFFFF;
  --raised: #F9F9F7;
  --well: #ECECE9;
  --ink: #121413;
  --ink-2: #4A504B;
  --ink-3: #5E655F;
  --rule-strong: #5E655F;
  --accent: #2C600A;
  --flow: #1D6430;
  --ok: #1A5E2E;
  --warn: #683E00;
  --bad: #771B11;
  --shade: #121413;
  --glow: 10%;
  --dots: 8%;
  --shine: 45%;
  --shine-wide: 30%;
  --edge: 0%;
  --depth: 26%;
  --text-weight: 400;
}

/* ---- base ---- */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* the brand kit's dots: one of r 1.2 on a grid of 28 */
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) var(--dots), transparent) 1.2px, transparent 1.6px) -14px -14px / 28px 28px, var(--paper);
  color: var(--ink);
  font: var(--text-weight) 1rem/1.6 var(--font-body);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* The one light on the desk: a wide, faint wash of the accent behind the top of the page. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: min(900px, 100%);
  background: radial-gradient(62% 58% at 50% 0%, var(--halo), transparent 72%);
  pointer-events: none;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: var(--flow);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

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

button,
input {
  font: inherit;
  color: inherit;
}

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

.skip {
  position: absolute;
  left: var(--s4);
  top: -80px;
  z-index: 10;
  padding: var(--s2) var(--s4);
  background: var(--sheet);
  color: var(--ink);
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
}

.skip:focus {
  top: var(--s2);
}

/* ---- controls (the site's own) ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  color: var(--ink);
  font: 500 0.9375rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}

/* Hover looks are for a pointer that can hover. On a touch screen they would stick to the
   last button tapped. */
@media (hover: hover) {
  .btn:hover {
    background: color-mix(in srgb, var(--ink) 10%, transparent);
    border-color: color-mix(in srgb, var(--ink) 30%, transparent);
  }
}

.btn:disabled {
  background: transparent;
  border-style: dashed;
  color: var(--ink-3);
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ticket);
  border-color: var(--accent);
  color: var(--on-ticket);
  font-weight: 600;
  box-shadow: 0 12px 36px -12px color-mix(in srgb, var(--accent) 75%, transparent);
}

@media (hover: hover) {
  .btn-primary:hover {
    background: color-mix(in srgb, var(--ticket) 86%, var(--ink));
    border-color: var(--accent);
  }
}

.btn-primary:disabled {
  background: var(--raised);
  border: 1px dashed var(--line-2);
  color: var(--ink-3);
  box-shadow: none;
}

.btn-quiet {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--flow);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font: 600 0.6875rem/1.5 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---- the page ---- */

.page {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  width: min(1216px, 100% - 2 * var(--gutter));
  min-height: 72px;
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
}

/* The mark: the brand kit's icon without its square, its slanted bar alone, in the page's
   accent and lit by the kit's glow green. */
.mark {
  flex: none;
  width: auto;
  height: 36px;
  filter: drop-shadow(0 0 1px color-mix(in srgb, var(--neon) var(--shine), transparent)) drop-shadow(0 0 4px color-mix(in srgb, var(--neon) var(--shine-wide), transparent));
}

.mark-bar,
.mark-shape {
  fill: var(--accent);
}

main {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--s6);
  width: min(560px, 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-block: var(--s5) var(--s7);
  text-align: center;
}

main:focus {
  outline: none;
}

/* The lockup: the wordmark with the teaser's line under it, in the measures of the film's last
   frame. There the wordmark is 80.4% of the frame wide and the line's letters sit 18.5% of the
   wordmark's width under its middle; every length below is a share of the wordmark's width
   (cqw), so the two keep that arrangement at any size. */
.lockup {
  container-type: inline-size;
  width: 100%;
  transform-origin: 50% 0;
  transform: translate(var(--fx, 0px), var(--fy, 0px)) scale(var(--fs, 1));
}

.lockup-mark {
  font-size: 0;
  line-height: 0;
}

.banner {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 2px color-mix(in srgb, var(--neon) var(--shine), transparent)) drop-shadow(0 0 8px color-mix(in srgb, var(--neon) var(--shine-wide), transparent));
}

.tagline {
  color: var(--accent);
  white-space: nowrap;
  /* first, for a browser that has no container units; the next two lines replace these */
  margin-top: 14px;
  font: 400 clamp(0.8rem, 4.2vw, 1.6rem)/1.2 var(--font-hex);
  margin-top: 4.3cqw;
  font: 400 4.75cqw/1.2 var(--font-hex);
}

.tagline-words {
  position: relative;
  display: inline-block;
}

/* The film's cursor. It hangs off the end of the line so the words stay centred, as they are
   in the film. */
.cursor {
  position: absolute;
  left: 100%;
  top: 0.1em;
  width: 0.55em;
  height: 1em;
  margin-left: 0.2em;
  background: var(--accent);
}

.soon {
  display: grid;
  justify-items: center;
  gap: var(--s4);
}

.tag-live {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 5px 14px;
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
  font-size: 0.75rem;
}

.tag-live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.lede {
  max-width: 34ch;
  color: var(--ink-2);
  font-size: 1.125rem;
  line-height: 1.5;
  text-wrap: balance;
}

.panel {
  width: 100%;
  padding: var(--s5);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lit);
  text-align: left;
}

.signup {
  display: grid;
  gap: var(--s2);
}

.signup label {
  color: var(--ink-2);
  font-size: 0.875rem;
}

.signup-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
}

.signup-row input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--well);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-control);
  /* 1rem or more: a smaller field makes a phone zoom the page when it is tapped */
  font-size: 1rem;
}

.signup-row input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.signup-row input[aria-invalid="true"] {
  border-color: var(--bad);
}

.signup-row .btn {
  flex: 0 0 auto;
}

/* The trap is taken off the page altogether, for a person and for a screen reader alike. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.field-problem {
  color: var(--bad);
  font-size: 0.875rem;
}

.note {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.done {
  color: var(--ink);
  font-size: 1rem;
}

.done:focus {
  outline: none;
}

.done::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: var(--s2);
  border-radius: 50%;
  background: var(--ok);
}

.x-glyph {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s5);
  width: min(1216px, 100% - 2 * var(--gutter));
  margin-inline: auto;
  /* the links are a finger tall, so the padding is small; the bottom clears a phone's home bar */
  padding-block: var(--s3) max(var(--s3), env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s5);
}

.foot-links a,
.foot-links .link-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.foot a {
  text-decoration: underline;
}

/* The privacy page's prose. */
.prose {
  display: grid;
  gap: var(--s4);
  width: 100%;
  text-align: left;
}

.prose h1 {
  font: 600 clamp(1.75rem, 5vw, 2.5rem)/1.1 var(--font-display);
  letter-spacing: -0.03em;
}

.prose h2 {
  margin-top: var(--s4);
  font: 600 1.125rem/1.3 var(--font-display);
  letter-spacing: -0.01em;
}

.prose p {
  color: var(--ink-2);
}

.main-prose {
  align-content: start;
  width: min(68ch, 100% - 2 * var(--gutter));
  padding-block: var(--s6) var(--s8);
}

/* ---- the teaser and the hand-off ----

   The stage is written on the root element by boot.js before the first paint:
     intro    the film plays over the page, which is held out of sight
     handoff  the film has ended; the page's wordmark lies exactly over the film's, and the
              film dissolves away over it
     settle   the wordmark glides to its place and the rest of the page comes up around it
     page     the page alone
   Without JavaScript no stage is written, and the page alone is what shows. */

.intro {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  place-items: center;
  background: var(--teaser-ground);
  color-scheme: dark;
  opacity: 1;
}

:root[data-stage="intro"] .intro,
:root[data-stage="handoff"] .intro,
:root[data-stage="settle"] .intro {
  display: grid;
}

:root[data-stage="handoff"] .intro,
:root[data-stage="settle"] .intro,
.intro.is-entering {
  opacity: 0;
}

:root[data-stage="handoff"] .intro,
:root[data-stage="settle"] .intro {
  pointer-events: none;
}

/* The film: a square in the middle, never larger than the screen's short side. Its edges are
   feathered into the ground so no square shows. It is clear until it is playing. */
.teaser {
  display: block;
  width: min(100vmin, var(--teaser-size));
  height: min(100vmin, var(--teaser-size));
  /* The same, measured against the screen as it is now: a phone held sideways with its bars
     showing has less height than vmin says. */
  width: min(100vw, 100dvh, var(--teaser-size));
  height: min(100vw, 100dvh, var(--teaser-size));
  object-fit: contain;
  opacity: 0;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
}

.teaser.is-playing {
  opacity: 1;
}

.intro-controls {
  position: absolute;
  /* 16px in from the corners, or clear of a phone's notch and home bar where it has them */
  inset: auto max(var(--s4), env(safe-area-inset-right, 0px)) max(var(--s4), env(safe-area-inset-bottom, 0px)) max(var(--s4), env(safe-area-inset-left, 0px));
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  opacity: 0;
}

.intro-controls.is-shown {
  opacity: 1;
}

/* The film is dark in both themes, so its two buttons keep the dark theme's colours. */
.intro-btn {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid rgb(244 244 242 / 22%);
  border-radius: var(--r-pill);
  background: rgb(244 244 242 / 6%);
  color: #F4F4F2;
  font: 500 0.875rem/1.2 var(--font-body);
  cursor: pointer;
}

@media (hover: hover) {
  .intro-btn:hover {
    background: rgb(244 244 242 / 14%);
    border-color: rgb(244 244 242 / 36%);
  }
}

.intro-btn:focus-visible {
  outline-color: #9BF25A;
}

/* While the film plays, the page under it is out of sight and out of reach, and cannot be
   scrolled: a swipe on the film would otherwise move the page nobody can see, and a short
   window would show a scrollbar beside the film. */
:root[data-stage="intro"] .page,
:root[data-stage="intro"] .skip {
  visibility: hidden;
}

:root[data-stage="intro"],
:root[data-stage="handoff"] {
  overflow: hidden;
}

/* During the hand-off only the lockup shows; everything marked .reveal waits for the settle. */
:root[data-stage="handoff"] .reveal {
  opacity: 0;
}

:root[data-stage="handoff"] .page {
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .btn,
  .intro-btn {
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
  }

  .intro {
    transition: opacity 1100ms ease;
  }

  .intro.is-quick {
    transition-duration: 500ms;
  }

  .teaser {
    transition: opacity 900ms ease;
  }

  .intro-controls {
    transition: opacity 600ms ease 1200ms;
  }

  :root[data-stage="handoff"] .reveal {
    transform: translateY(14px);
  }

  /* The footer only fades. Moved down, it would reach past the end of the page and make the
     page 14px longer for a moment. */
  :root[data-stage="handoff"] .foot {
    transform: none;
  }

  :root[data-stage="settle"] .lockup {
    transition: transform 1100ms cubic-bezier(0.22, 0.7, 0.18, 1);
  }

  :root[data-stage="settle"] .reveal {
    transition: opacity 800ms ease, transform 900ms cubic-bezier(0.22, 0.7, 0.18, 1);
  }

  :root[data-stage="settle"] .soon {
    transition-delay: 250ms;
  }

  :root[data-stage="settle"] .panel {
    transition-delay: 400ms;
  }

  :root[data-stage="settle"] .follow {
    transition-delay: 550ms;
  }

  :root[data-stage="settle"] .top,
  :root[data-stage="settle"] .foot {
    transition-delay: 700ms;
  }

  .cursor {
    animation: cursor-blink 1.1s steps(1, end) infinite;
  }
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 420px) {
  .signup-row .btn {
    flex: 1 1 100%;
  }

  .panel {
    padding: var(--s4);
  }
}
