/* aveuo waitlist. Brand kit "First light" (aveuo-branding/01-first-light): tokens.json + README "Colour";
   status colours, radii and the control border from the app (crates/ui-kit/src/tokens.rs). Dark first. */

/* Fonts: Latin subsets in woff2 (from Google Fonts, OFL; licences in /fonts), self-hosted so no request
   leaves this site. Inter is variable 400-600. */
@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* Dark (primary). Contrast on canvas / panel: text 16.4 / 15.3, text-2 9.1 / 8.5, muted 7.4 / 6.9,
     accent 9.27 / 8.67, danger 7.3 / 6.9; control border 3.9 / 3.7; button label on accent 9.27. */
  --canvas: #0E0F10;
  --panel: #161718;
  --text: #EDEDEE;
  --text-2: #B1B2B6;
  --muted: #A0A0A5;
  --border: #2A2B2E;
  --border-control: #6F7177;
  --accent: #F2A43A;
  --on-accent: #0E0F10;
  --success: #4CC38A;
  --danger: #F47C7C;

  --font-display: "Bricolage Grotesque", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --gutter: 16px;
  --container: 1200px;
  --band-h: clamp(176px, 30svh, 280px);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    /* Light. Contrast on canvas / panel: text 16.0 / 17.7, text-2 6.6 / 7.3, muted 5.8 / 6.5,
       accent 4.82 / 5.36, danger 5.4 / 6.0; control border 3.1 / 3.4; button label on accent 5.36. */
    --canvas: #F3F3F1;
    --panel: #FFFFFF;
    --text: #18181A;
    --text-2: #55565A;
    --muted: #5E5E62;
    --border: #E6E6E3;
    --border-control: #8A8B90;
    --accent: #A35700;
    --on-accent: #FFFFFF;
    --success: #17784A;
    --danger: #B8322A;
  }
}

@media (min-width: 600px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 40px; } }

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

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

body {
  position: relative;
  margin: 0;
  min-height: 100svh;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }

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

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

/* ---- The Gold dawn field (field.js: drawn once, then a light motion that redraws a few cells). ------------------------------ */

.field {
  --mode: band;
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: var(--band-h);
  pointer-events: none;
  opacity: 0;
}
.field.is-drawn { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .field { transition: opacity 0.6s ease-out; }
}
@media (min-width: 1024px) {
  .field { --mode: wide; position: fixed; inset: 0; height: 100%; }
}

/* ---- Page frame. ---------------------------------------------------------------------------- */

.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-block-start: 20px;
  /* On phones the header is the band the field is drawn in; the copy starts below it. */
  min-height: calc(var(--band-h) - 16px);
}
@media (min-width: 1024px) { .top { min-height: 0; padding-block-start: 32px; } }

.lockup {
  display: inline-flex;
  color: var(--text);
  border-radius: var(--radius-sm);
  /* Clear space: about one x-height of the wordmark on every side (brand README "Rules"). */
  padding: 6px;
  margin: -6px;
}
.lockup svg { display: block; width: 132px; height: auto; fill: currentColor; }

.say { font-size: 0.8125rem; color: var(--muted); padding-block-start: 6px; }

.main {
  display: grid;
  gap: 40px;
  align-content: center;
  padding-block: 8px 48px;
}
@media (min-width: 1024px) {
  .main {
    /* The form column never drops below 368px: 300px for Turnstile plus the panel's padding and border. */
    grid-template-columns: minmax(0, 7fr) minmax(368px, 5fr);
    align-items: center;
    gap: 72px;
    padding-block: 48px;
  }
}

/* ---- Intro. --------------------------------------------------------------------------------- */

.intro { max-width: 600px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--text-2);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

h1 {
  margin-block-start: 16px;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(2.5rem, 1.6rem + 3.8vw, 4.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lead {
  margin-block-start: 20px;
  max-width: 34em;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.5;
  color: var(--text-2);
}

.now {
  display: grid;
  gap: 18px;
  margin-block-start: 36px;
}
.now li { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); align-items: baseline; }
.num { font-size: 0.8125rem; color: var(--accent); }
.now p { color: var(--text-2); }
.now strong { display: block; font-weight: 500; color: var(--text); }

.next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-block-start: 36px;
  padding-block-start: 20px;
  border-block-start: 1px solid var(--border);
}
.label { font-size: 0.8125rem; font-weight: 400; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 4px 10px;
  border: 1px dashed var(--border-control);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-2);
}

/* ---- The form panel. ------------------------------------------------------------------------ */

.join {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
}
/* Turnstile needs 300px of width. Below 400px the panel runs edge to edge so the widget fits down to a
   320px screen, and its content keeps the page's 16px edge where there is room. */
@media (max-width: 399.98px) {
  .join {
    margin-inline: calc(-1 * var(--gutter));
    border-inline-width: 0;
    border-radius: 0;
    padding-inline: clamp(10px, calc((100vw - 300px) / 2), 16px);
  }
}
@media (min-width: 600px) { .join { padding: 32px; } }

.join h2 {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.join-lead { margin-block-start: 8px; color: var(--text-2); }

.form { display: grid; gap: 16px; margin-block-start: 24px; }
.form[hidden] { display: none; }

.field-row { display: grid; gap: 8px; }
label { font-size: 0.9375rem; font-weight: 500; }

input[type="email"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  background: var(--canvas);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px: no zoom on focus in iOS Safari */
}
input[type="email"]::placeholder { color: var(--muted); opacity: 1; }
input[type="email"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type="email"][aria-invalid="true"] { border-color: var(--danger); }

.field-error { font-size: 0.9375rem; color: var(--danger); }
.field-error[hidden] { display: none; }

.hp {
  position: absolute;
  inset-inline-start: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.cf-turnstile { min-height: 65px; }

/* The gilded button: the app's textured gold primary button (ui-kit GildedButton) in CSS. A gold gradient
   from the brand ramp, a fine static texture of tiny cream glyphs (grain.svg) brightest at the top, a cream
   sheen, a 1px inner highlight and shade, and a warm shadow. The label stays #0E0F10 in both themes
   (lowest contrast 4.66:1, measured for the app button). Nothing animates except hover and press. */
.button {
  --g-top: #FFC56B;
  --g-mid: #E39A36;
  --g-bot: #B8792A;
  --g-rim: rgba(94, 59, 16, 0.85);
  --g-glow: rgba(242, 164, 58, 0.38);
  --g-grain: 0.24;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 50px;
  padding: 12px 20px;
  border: 1px solid var(--g-rim);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--g-top) 0%, var(--g-mid) 52%, var(--g-bot) 100%);
  color: #0E0F10;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 228, 0.6),
    inset 0 -1px 0 rgba(94, 59, 16, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 10px 24px -10px var(--g-glow);
  transition: box-shadow 0.2s ease, filter 0.2s ease, transform 0.12s ease;
}
.button::before,
.button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.button::before {
  background: url("/grain.svg") repeat;
  background-size: 120px 56px;
  opacity: var(--g-grain);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.55) 60%, rgba(0, 0, 0, 0.15) 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.55) 60%, rgba(0, 0, 0, 0.15) 100%);
}
.button::after { background: linear-gradient(180deg, rgba(255, 246, 228, 0.16) 0%, rgba(255, 246, 228, 0) 55%); }
@media (prefers-color-scheme: light) {
  .button {
    --g-top: #F6BC62;
    --g-mid: #DB9333;
    --g-bot: #B07226;
    --g-rim: rgba(165, 107, 34, 0.9);
    --g-glow: rgba(176, 114, 38, 0.32);
    --g-grain: 0.2;
  }
}
@media (hover: hover) {
  .button:hover {
    filter: brightness(1.06) saturate(1.04);
    box-shadow:
      inset 0 1px 0 rgba(255, 246, 228, 0.7),
      inset 0 -1px 0 rgba(94, 59, 16, 0.35),
      0 1px 2px rgba(0, 0, 0, 0.35),
      0 12px 32px -8px var(--g-glow),
      0 0 0 4px rgba(242, 164, 58, 0.08);
  }
}
.button:active {
  transform: translateY(1px);
  filter: brightness(0.95);
  box-shadow:
    inset 0 2px 4px rgba(94, 59, 16, 0.35),
    inset 0 -1px 0 rgba(94, 59, 16, 0.2),
    0 1px 1px rgba(0, 0, 0, 0.3);
}
.button:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.button:disabled { cursor: progress; opacity: 0.75; transform: none; filter: none; }

.status { margin-block-start: 16px; font-size: 0.9375rem; color: var(--text-2); }
.status:empty { display: none; }
.status:focus { outline: none; }
.status[data-kind="error"] { color: var(--danger); }
.status[data-kind="success"] {
  margin-block-start: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--success);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 1rem;
}

.note { font-size: 0.9375rem; color: var(--text-2); }

.privacy { margin-block-start: 20px; font-size: 0.875rem; line-height: 1.5; color: var(--muted); }
.privacy a, .foot a, .doc a { color: var(--accent); text-underline-offset: 3px; }

/* ---- Footer. -------------------------------------------------------------------------------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 24px 32px;
  border-block-start: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}
.foot a { padding-block: 12px; margin-block: -12px; }

/* ---- Privacy page. -------------------------------------------------------------------------- */

/* Spacing on an 8px scale: 32/48 above the title, 40 below the head, 48 between sections, 16 inside. */
.doc { max-width: 720px; padding-block: 32px 96px; }
@media (min-width: 1024px) { .doc { padding-block-start: 72px; } }
.doc-head { padding-block-end: 32px; margin-block-end: 32px; border-block-end: 1px solid var(--border); }
.doc h1 {
  margin: 0;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.doc .updated { margin-block-start: 16px; font-size: 0.875rem; color: var(--muted); }
.doc h2 {
  margin-block-start: 48px;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.doc-head + p { margin-block-start: 0; }
.doc p, .doc ul { margin-block-start: 16px; color: var(--text-2); line-height: 1.65; }
.doc ul { padding-inline-start: 1.25rem; list-style: disc; }
.doc li + li { margin-block-start: 6px; }
.doc strong { color: var(--text); font-weight: 500; }

/* ---- One screen on laptops and desktops: the home page fits the window, no scrolling. Spacing and the
   headline scale with the window height (vh), so it holds from ~640px tall up. Phones scroll (they must). */

@media (min-width: 1024px) and (min-height: 600px) {
  .page.home { height: 100svh; min-height: 0; overflow: hidden; }
  .home .top { padding-block-start: clamp(16px, 3.2vh, 32px); }
  .home .main { padding-block: clamp(8px, 2.4vh, 32px); gap: 64px; }
  .home .intro { max-width: 640px; }
  .home h1 { margin-block-start: clamp(8px, 1.6vh, 16px); font-size: clamp(2.5rem, 8.2vh, 4.5rem); }
  .home .lead { margin-block-start: clamp(10px, 2vh, 20px); font-size: clamp(1rem, 2.1vh, 1.25rem); }
  .home .now { margin-block-start: clamp(14px, 3.2vh, 36px); gap: clamp(6px, 1.5vh, 18px); }
  .home .now p { font-size: clamp(0.9375rem, 1.85vh, 1rem); line-height: 1.45; }
  .home .next { margin-block-start: clamp(14px, 3.2vh, 36px); padding-block-start: clamp(10px, 2vh, 20px); }
  .home .join { padding: clamp(20px, 3.2vh, 32px); }
  .home .form { margin-block-start: clamp(14px, 2.4vh, 24px); gap: clamp(10px, 1.6vh, 16px); }
  .home .privacy { margin-block-start: clamp(12px, 2vh, 20px); }
  .home .foot { padding-block: clamp(12px, 2.2vh, 24px) clamp(14px, 2.8vh, 32px); }
}

/* ---- Entrance motion (motion.js). Without JS, or with reduced motion, everything is simply there. ---- */

.has-motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  filter: blur(6px);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform, filter;
}
.has-motion [data-reveal="panel"] { transform: translate3d(0, 24px, 0) scale(0.97); }
.has-motion [data-reveal].is-in { opacity: 1; transform: none; filter: none; }
.has-motion [data-reveal].is-done { will-change: auto; }

/* The success message replaces the form with a soft rise. */
.status[data-kind="success"] { animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .has-motion [data-reveal] { transform: none; filter: none; transition: opacity 0.3s linear; }
  .has-motion [data-reveal="panel"] { transform: none; }
  .status[data-kind="success"] { animation: none; }
}

/* Forced colours (Windows high contrast): keep borders and the button visible. */
@media (forced-colors: active) {
  .field { display: none; }
  .button { border: 1px solid ButtonText; }
  .dot { background: CanvasText; }
}
