/* Colors are the app's theme tokens (meaning-native crates/ui/src/tokens/theme.rs).
   main.js reads --paper, --paper-shadow, --ink and --accent for the shader. */

/* PP Museum (Pangram Pangram), the pack's web files, unmodified. */
@font-face {
  font-family: "PP Museum";
  src: url("/fonts/PPMuseum-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "PP Museum";
  src: url("/fonts/PPMuseum-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: rgb(249 247 246);         /* surface_main */
  --paper-shadow: rgb(178 171 164 / 0.88);  /* the paper's creases and grain */
  --ink: rgb(9 8 7);                 /* foreground */
  --muted: rgb(61 59 56);            /* muted */
  /* Text beside the logo: softer than --ink, since the paper softens the logo. */
  --text: color-mix(in srgb, var(--ink) 74%, var(--paper));
  --text-blend: multiply;
  --accent: #4c6d5e;                 /* primary_fill_accent */
  --accent-hover: #597a6b;
  --accent-active: #436455;
  --on-accent: rgb(255 255 255);
  --field: rgb(255 255 255 / 0.4);  /* surface_raised, over the paper */
  --field-border: rgb(168 166 163);  /* border_medium */
  --focus: #4c6d5e;
  --error: #a2392b;

  --font: "PP Museum", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --logo-width: 31rem;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: rgb(33 31 28);          /* surface_base */
    --paper-shadow: rgb(10 8 8 / 0.92);  /* darker than the paper: creases, not highlights */
    --ink: rgb(237 235 232);
    --muted: rgb(156 153 150);
    --text: color-mix(in srgb, var(--ink) 70%, var(--paper));
    --text-blend: screen;
    --on-accent: #f3f6f5;
    --field: rgb(61 59 56 / 0.2);    /* surface_raised */
    --field-border: rgb(95 92 89);
    --focus: #8fb3a2;
    --error: #f0a093;
  }
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  font: 300 1.0625rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

#paper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.no-paper #paper { display: none; }

main {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(3rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(3rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  text-align: center;
}

/* One column, the logo's width. Type and spacing inside are in container
   units (cqi, 1% of the column's width), so they scale with the logo and
   the lines break in the same places at every size. */
.column {
  width: min(100%, var(--logo-width));
  container-type: inline-size;
  display: grid;
  justify-items: center;
}

/* The mark and the logotype. The SVGs set the size and place of each; when
   the paper runs, it draws them (animated) and these stay invisible.
   It's as wide as the column. The aspect ratio is the mark's + the gap + the logotype's,
   the gap being 0.12 of the height. */
.lockup {
  display: flex;
  align-items: center;
  gap: 2.9%;
  width: 100%;
  aspect-ratio: 4.139;
  margin: 0;
}
.lockup svg { display: block; height: 100%; width: auto; overflow: visible; }
.lockup .mark { aspect-ratio: 510 / 1030; fill: var(--accent); }
.lockup .type { aspect-ratio: 2731 / 775; fill: var(--ink); }
.js .lockup svg { visibility: hidden; }
.js.no-paper .lockup svg { visibility: visible; }

.lede, .ask, .status { mix-blend-mode: var(--text-blend); }  /* lets the paper's grain into the text a little */

/* The text comes in as the logo starts drawing (main.js adds .intro then):
   the line first, then the question and the form. */
.js .lede, .js .waitlist {
  opacity: 0;
  translate: 0 0.5rem;
  transition: opacity 900ms var(--ease-out), translate 900ms var(--ease-out);
}
.js.intro .lede, .js.intro .waitlist { opacity: 1; translate: none; }
.js.intro .lede { transition-delay: 1.75s; }
.js.intro .waitlist { transition-delay: 2.5s; }
.js.no-paper .lede, .js.no-paper .waitlist, .js.late .lede, .js.late .waitlist { transition-delay: 0ms; }
@media (prefers-reduced-motion: reduce) {
  .js .lede, .js .waitlist { translate: none; transition: opacity 400ms ease; }
}

.lede {
  margin: 7cqi 0 0;
  color: var(--text);
  font-size: 6cqi;
  line-height: 1.3;
  text-wrap: balance;
}

/* The question sits with the form, set off from the line above. */
.waitlist { width: 100%; margin-top: 11cqi; }
.ask {
  margin: 0 0 0.625rem;
  color: var(--text);
  font-size: max(0.9375rem, 3.5cqi);  /* not below 15px on a phone */
  line-height: 1.3;
}

/* Corners: round, or where the browser can (Chromium), the app's
   superellipse(1.5): between round and a squircle, with radii scaled by √2
   to look the same size (meaning-native crates/ui/src/smooth_corners.rs). */
.waitlist {
  --field-radius: 999px;
  --corner-scale: 1;
}
@supports (corner-shape: superellipse(1.5)) {
  .waitlist { --corner-scale: 1.4142; }
  .field, .field button { corner-shape: superellipse(1.5); }
}

.field {
  position: relative;
  display: flex;
  gap: 0.375rem;
  padding: 0.375rem;
  border: 1px solid var(--field-border);
  border-radius: calc(var(--field-radius) * var(--corner-scale));
  background-color: var(--field);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  box-shadow: 0 0 0 0 transparent;
  transition:
    border-color 250ms var(--ease-out), box-shadow 250ms var(--ease-out),
    background-color 600ms var(--ease-out), translate 800ms var(--ease-out);
}
.field:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }

.field input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.875rem;
  border: 0;
  background: transparent;
  color: var(--text);  /* what you type: the line's color, in Regular */
  font: inherit;
  font-weight: 400;
  outline: none;
  transition: opacity 250ms var(--ease-out), filter 250ms var(--ease-out);
}
/* the placeholder: softer and Light. It's the only visible label, so it stays at 4.5:1. */
.field input::placeholder { color: color-mix(in srgb, var(--ink) 58%, var(--paper)); font-weight: 300; opacity: 1; }

.field button {
  flex: none;
  padding: 0.5rem 1.125rem;
  border: 0;
  /* concentric with the field */
  border-radius: calc((var(--field-radius) - 0.375rem) * var(--corner-scale));
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 400;
  cursor: pointer;
  /* A spring on the scale; the color eases over the spring's rise, so it
     lands as the button reaches its peak. */
  transition:
    transform var(--spring-duration) var(--spring),
    background-color 200ms var(--ease-out),
    opacity 300ms var(--ease-out), filter 300ms var(--ease-out);
  --spring-duration: 450ms;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);  /* where linear() isn't supported */
}
@supports (transition-timing-function: linear(0, 1)) {
  .field button, .done svg {
    /* a damped spring (stiffness 500, damping 22, mass 1): ~17% overshoot, settled in 550ms */
    --spring-duration: 550ms;
    --spring: linear(0, 0.065, 0.222, 0.425, 0.634, 0.821, 0.971, 1.078, 1.141, 1.167, 1.165, 1.143, 1.111,
      1.076, 1.042, 1.014, 0.993, 0.979, 0.973, 0.971, 0.974, 0.979, 0.985, 0.991, 0.996, 1, 1.003, 1.004,
      1.005, 1.005, 1.004, 1.003, 1);
  }
}
/* hover only where there's a pointer that hovers, so a tap doesn't leave it grown */
@media (hover: hover) {
  .field button:hover:not(:disabled) { transform: scale(1.02); background-color: var(--accent-hover); }
}
.field button:active:not(:disabled) { transform: scale(0.96); background-color: var(--accent-active); }
.field button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.field button:disabled { cursor: default; opacity: 0.6; }

.status { min-height: 1.5em; margin: 0.75rem 0 0; color: var(--muted); font-size: 0.9375rem; }
.status[data-state="error"] { color: var(--error); }

/* Joined. The field becomes the confirmation, in one movement:
     0ms    the question lifts away; what was typed and the button fade, blurring
     100ms  the field rises into the question's place (main.js sets --lift)
            and takes on the accent's tint
     350ms  the check springs in and draws itself
     420ms  "We'll write to …" comes up into focus */
.done {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem 1.25rem;
  color: var(--text);
  text-wrap: balance;
  outline: none;
  pointer-events: none;
}
.done > span {
  opacity: 0;
  translate: 0 0.25rem;
  filter: blur(3px);
  transition: opacity 500ms var(--ease-out), translate 600ms var(--ease-out), filter 500ms var(--ease-out);
}
.done svg {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  scale: 0.5;
  transition: opacity 200ms var(--ease-out), scale var(--spring-duration, 450ms) var(--spring, ease-out);
}
.done svg path { stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset 450ms var(--ease-out); }
.done-email { font-weight: 400; overflow-wrap: anywhere; }

.ask { transition: opacity 300ms var(--ease-out), translate 400ms var(--ease-out), filter 300ms var(--ease-out); }

.waitlist[data-state="done"] .ask { opacity: 0; translate: 0 -0.375rem; filter: blur(2px); }
.waitlist[data-state="done"] .field {
  translate: 0 calc(-1 * var(--lift, 0px));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background-color: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: 0 0 0 0 transparent;
  transition-delay: 100ms, 0ms, 100ms, 100ms;
}
.waitlist[data-state="done"] .field input,
.waitlist[data-state="done"] .field button { opacity: 0; filter: blur(4px); pointer-events: none; }
.waitlist[data-state="done"] .field button { transform: scale(0.94); }
.waitlist[data-state="done"] .done svg { opacity: 1; scale: 1; transition-delay: 350ms; }
.waitlist[data-state="done"] .done svg path { stroke-dashoffset: 0; transition-delay: 400ms; }
.waitlist[data-state="done"] .done > span { opacity: 1; translate: none; filter: none; transition-delay: 420ms; }
@media (prefers-color-scheme: dark) {
  .done svg { stroke: var(--focus); }
}

@media (max-width: 30rem) {
  .waitlist { --field-radius: 1.25rem; }
  .field { flex-direction: column; }
  .field input { padding: 0.625rem 0.875rem; text-align: center; }
  .field button { padding: 0.75rem 1rem; }
  .done { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .field button { transition: background-color 150ms ease, opacity 300ms ease; }
  .field button:hover, .field button:active { transform: none; }
  .ask, .field, .done > span, .done svg { translate: none !important; scale: 1 !important; filter: none !important; }
}

/* the bot trap (index.html): off screen, out of the tab order, hidden from assistive tech */
.trap { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

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