/* AUREUM waitlist — layout and components.
 *
 * Colours come exclusively from the tokens in themes.css; nothing here hard
 * codes a brand colour, so every theme restyles the whole page. Sections
 * appear in page order: theme toggle, hero stage, logo banner, intro copy,
 * signup form + CTA. Motion respects prefers-reduced-motion throughout.
 */

:root {
  --font: ui-sans-serif, "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --radius: 14px;
  --radius-sm: 10px;
  --measure: 640px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
  background-image:
    radial-gradient(900px 480px at 50% -10%, rgba(var(--accent-rgb), 0.10), transparent 65%),
    radial-gradient(1000px 600px at 100% 30%, rgba(var(--secondary-rgb), 0.18), transparent 60%);
  background-attachment: fixed;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(var(--accent-rgb), 0.4); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.page { display: flex; flex-direction: column; align-items: center; padding: 0 0 96px; }

/* ---------- Theme toggle (top corner) ---------- */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 30;
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: 999px;
  background: rgba(var(--secondary-rgb), 0.14);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.theme-opt {
  padding: 6px 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.theme-toggle[hidden] { display: none; }
/* Live site (theme locked, no switch): the lockup needs no clearance for it. */
:root[data-theme-lock] .logos { margin-top: 28px; }
.theme-opt:hover { color: var(--text); }
.theme-opt[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.theme-opt:focus-visible { outline-offset: 1px; }

/* ---------- 1. Hero stage ---------- */
.hero-stage {
  position: relative; width: 100%;
  height: clamp(380px, 68svh, 680px);
  overflow: hidden;
  touch-action: pan-y;        /* horizontal drags rotate the object, vertical swipes still scroll */
  cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.hero-stage.is-dragging { cursor: grabbing; }
.hero-stage::before {        /* soft halo behind the object, same hue as the theme accent */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(42% 46% at 50% 48%, rgba(var(--glow-rgb), 0.22), transparent 70%),
    radial-gradient(70% 60% at 50% 60%, rgba(var(--secondary-rgb), 0.16), transparent 75%);
  transition: opacity 0.35s var(--ease);
}
.hero-stage::after {         /* fade the stage into the page so the grid never ends on a hard line */
  content: ""; position: absolute; inset: auto 0 0 0; height: 36%; pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--bg));
}
.hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  opacity: 0; transition: opacity 0.8s var(--ease);
}
.hero-canvas.ready { opacity: 1; }
.hero-stage.no-webgl::before { opacity: 0.6; }

/* ---------- 2. Logo comparison banner ---------- */
.logos {
  display: flex; align-items: center; justify-content: center; gap: clamp(20px, 5vw, 56px);
  width: min(100% - 40px, 880px);
  margin: 28px auto 0;
  padding: 0;
}
.logo { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo figcaption { font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
@font-face { font-family: "Manrope"; src: url("/fonts/manrope-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Michroma"; src: url("/fonts/michroma-latin.woff2") format("woff2"); font-display: swap; }
/* "by" between the marks: wide geometric face echoing the AUREUM wordmark, tinted from the old divider colour. */
.logo-by {
  display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px;
  font-family: "Michroma", var(--font); font-size: clamp(12px, 1.3vw, 15px); letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--muted);                                             /* fallback where color-mix() is unsupported */
  color: color-mix(in srgb, var(--border-strong), var(--text) 35%);
}
.logo-by > span { padding-left: 0.32em; }   /* balance the trailing letter-spacing so the word sits centred on the line */
.logo-by::before, .logo-by::after { content: ""; width: 1px; height: 40px; }
.logo-by::before { background: linear-gradient(180deg, transparent, var(--border-strong)); }
.logo-by::after  { background: linear-gradient(180deg, var(--border-strong), transparent); }

/* Both marks sit in identical square boxes so the captions line up; --mask-size
 * compensates for the artwork's own padding (the AUREUM PNG is ~55% dead black
 * around the art, the Goober disc fills its PNG). The box clips, so the
 * oversized AUREUM art is cropped to its drawing. */
.logo-art { position: relative; width: clamp(150px, 22vw, 220px); aspect-ratio: 1; overflow: hidden; }
/* Pre-tinted PNGs (web/assets/*-logo-<set>.png, baked from the originals with the
 * theme's --logo-a/--logo-b). Plain images: no masks or canvas readback, so they
 * render the same in every browser, including Brave and Safari. A new theme
 * points at an existing set here, or gets its own baked pair. */
.logo-art-aureum { --mask-size: 100%; }   /* baked PNG is already cropped square around the art */
.logo-art-goober { --mask-size: 64%; }
.logo-img {
  display: none; position: absolute; left: 50%; top: 50%;
  width: var(--mask-size); height: var(--mask-size); max-width: none;
  transform: translate(-50%, -50%);
}
:root:not([data-theme]) .logo-img[data-set="aureum"],
:root[data-theme="aureum"] .logo-img[data-set="aureum"],
:root[data-theme="labs"] .logo-img[data-set="labs"],
:root[data-theme="studio"] .logo-img[data-set="labs"] { display: block; }

/* ---------- 3. Intro ---------- */
/* The intro is wider than the copy measure so the headline can sit on two
 * balanced lines; the lede keeps its own 58ch cap below. */
.intro { position: relative; z-index: 1; width: min(100% - 40px, 1100px); margin: -40px auto 0; text-align: center; }
/* Centred and balanced at every width: the measure caps the line length, the
 * font scale keeps the headline to three lines, text-wrap: balance evens them
 * out where supported. Gradient text uses -webkit-text-fill-color (Safari's
 * reliable route) with color: transparent as the fallback, and a little
 * bottom padding so descenders are not clipped by the background box. */
.title {
  margin: 0 auto; max-width: 30ch; padding-bottom: 0.1em;
  font-size: clamp(29px, 4.6vw, 54px); font-weight: 700; line-height: 1.04; letter-spacing: -0.03em;
  text-align: center; text-wrap: balance;
  background: linear-gradient(180deg, var(--text) 55%, var(--text-dim));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.lede { margin: 32px auto 0; color: var(--text); font-family: "Manrope", var(--font); font-size: clamp(18px, 1.35vw, 21px); font-weight: 500; line-height: 1.65; letter-spacing: -0.005em; max-width: 1000px; }
.lede p { margin: 0; text-wrap: pretty; }
.lede p + p { margin-top: 0.9em; }
.title em { font-style: italic; padding-right: 0.06em; }   /* the full stop sits inside the em, so this only gives the slant room */

/* ---------- 4. Form ---------- */
.signup-heading {
  width: min(100% - 40px, 1000px); margin: 64px auto 0; text-align: center; text-wrap: balance;
  font-family: "Manrope", var(--font); font-size: clamp(21px, 1.8vw, 27px); font-weight: 700; line-height: 1.4; letter-spacing: -0.01em; color: var(--text);
}
.signup { width: min(100% - 40px, 520px); margin: 32px auto 0; }
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.01em; }
.hint { margin: 0; font-size: 12.5px; color: var(--faint); }

.input, .select {
  width: 100%; padding: 14px 16px;
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); outline: none; font-size: 16px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.35s var(--ease);
}
.input::placeholder { color: var(--faint); }
.input:hover, .select:hover { border-color: var(--accent-text); }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18); }
.input:focus-visible, .select:focus-visible { outline: none; }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 4px var(--err-soft); }
.select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5l3.5 3.5 3.5-3.5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.select:invalid { color: var(--faint); }
.select option { color: var(--text); background: var(--bg-elev); }

/* Honeypot: off-canvas, unfocusable, hidden from assistive tech (aria-hidden on the wrapper). */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 5. Call to action ---------- */
/* A full pill, tall and glossy. Three layers of motion, all from accent tokens
 * so every theme gets its own colour: the gradient itself drifts (cta-sheen),
 * the outer glow breathes (cta-glow), and a shimmer stripe sweeps across
 * (cta-shimmer). Hover lifts and speeds the glow up; press sinks. */
.cta {
  --shimmer: rgba(255, 255, 255, 0.34);
  --cta-inset: inset 0 1px 0 rgba(255, 255, 255, 0.38), inset 0 -2px 0 rgba(0, 0, 0, 0.14);
  position: relative; isolation: isolate; overflow: hidden;
  width: 100%; min-height: 80px; margin-top: 10px;
  padding: 24px 40px; border: 0; border-radius: 999px;
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-strong) 30%, var(--accent) 55%, var(--accent-strong) 80%, var(--accent) 100%);
  background-size: 250% 100%;
  color: var(--accent-ink);
  font-size: 21px; font-weight: 800; letter-spacing: 0.02em;
  box-shadow: var(--cta-inset), 0 14px 40px -12px rgba(var(--accent-rgb), 0.7);
  transition: transform 0.22s var(--ease), filter 0.22s var(--ease), background-color 0.35s var(--ease);
  animation: cta-sheen 7s linear infinite, cta-glow 2.8s ease-in-out infinite;
}
.cta::after {                /* travelling shimmer stripe */
  content: ""; position: absolute; inset: -40% auto -40% -60%; width: 34%; z-index: 1;
  background: linear-gradient(100deg, transparent 0%, var(--shimmer) 50%, transparent 100%);
  transform: skewX(-18deg);
  animation: cta-shimmer 3.4s var(--ease) infinite;
  pointer-events: none;
}
.cta-label { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 12px; }
.cta-label::after {          /* arrow nudges on hover, gone once the state changes */
  content: "\2192"; font-weight: 700; transition: transform 0.25s var(--ease);
}
.cta:hover { transform: translateY(-3px) scale(1.015); filter: brightness(1.08) saturate(1.08); animation-duration: 7s, 1.4s; }
.cta:hover .cta-label::after { transform: translateX(5px); }
.cta:active { transform: translateY(1px) scale(0.985); filter: brightness(0.95); transition-duration: 0.08s; }
.cta:focus-visible { outline: 2px solid var(--text); outline-offset: 5px; }
.cta:disabled { cursor: default; transform: none; filter: none; }
.cta[data-state="busy"] { animation: none; opacity: 0.85; }
.cta[data-state="busy"]::after { animation-duration: 1.1s; }
.cta[data-state="busy"] .cta-label::after, .cta[data-state="success"] .cta-label::after { display: none; }
.cta[data-state="success"] {
  animation: none; background: var(--ok); color: var(--accent-ink);
  box-shadow: var(--cta-inset), 0 14px 40px -14px var(--ok);
}
.cta[data-state="success"]::after { display: none; }
.cta[data-state="error"] { animation: cta-shake 0.45s var(--ease) 1, cta-sheen 7s linear infinite, cta-glow 2.8s ease-in-out infinite; }

@keyframes cta-shimmer {
  0%   { left: -60%; }
  55%  { left: 130%; }
  100% { left: 130%; }
}
@keyframes cta-sheen {
  from { background-position: 0% 50%; }
  to   { background-position: 250% 50%; }
}
@keyframes cta-glow {
  0%, 100% { box-shadow: var(--cta-inset), 0 12px 34px -12px rgba(var(--accent-rgb), 0.6), 0 0 0 0 rgba(var(--accent-rgb), 0); }
  50%      { box-shadow: var(--cta-inset), 0 20px 58px -12px rgba(var(--accent-rgb), 1), 0 0 0 7px rgba(var(--accent-rgb), 0.14); }
}
@keyframes cta-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.status { margin: 0; min-height: 1.4em; text-align: center; font-size: 14px; color: var(--muted); }
.status[data-kind="success"] { color: var(--ok); }
.status[data-kind="info"] { color: var(--accent-text); }     /* already on the list */
.status[data-kind="error"] { color: var(--err); }

/* ---------- Responsive ---------- */
/* The fixed theme toggle (top-right) would sit over the Goober mark once the
 * lockup's right column reaches the toggle's column; push the lockup down. */
@media (max-width: 1100px) {
  .logos { margin-top: 68px; }
}
@media (max-width: 640px) {
  .page { padding-bottom: 72px; }
  .theme-toggle { top: 12px; right: 12px; }
  .hero-stage { height: clamp(320px, 56svh, 520px); }
  .logos { gap: 20px; }
  .logo-by::before, .logo-by::after { height: 28px; }
  .intro { margin-top: -16px; }
  .lede { font-size: 17px; }
  .signup-heading { margin-top: 44px; }
  .cta { font-size: 19px; min-height: 70px; padding: 20px 28px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .cta, .cta::after, .cta[data-state="error"] { animation: none !important; }
  .hero-canvas { transition: none; }
}
