/* ==========================================================================
   Vellardo - base: tokens, fonts, reset, type, buttons, forms, utilities
   Tokens mirror docs/brand.md and are read by the WebGL scenes (main.js).
   ========================================================================== */

@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans-var.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-var.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  /* colour (hue 119-146 deg for the brand pair; paper is a warm neutral) */
  --ink: #090E0B;
  --graphite: #121A15;
  --slate: #1C2A22;
  --line: #2C3F34;
  --volt: #7CF27A;
  --volt-mid: #3FD060;
  --deep: #14602C;
  --paper: #ECEFE4;
  --paper-2: #DDE3D2;
  --chalk: #F4F7EF;
  --dim: #A7B8AC;
  --muted: #46574B;
  --err: #FF9B8A;
  --err-ink: #B3261E;
  --ok: #7CF27A;

  /* type: golden-ratio scale (x1.618) */
  --f-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --f-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --t-0: 1rem;
  --t-1: 1.618rem;
  --t-2: clamp(2rem, 1.4rem + 1.8vw, 2.618rem);
  --t-3: clamp(2.6rem, 1.5rem + 4vw, 4.236rem);
  --t-4: clamp(3.4rem, 1rem + 11vw, 9.4rem);
  --t-5: clamp(4rem, 1rem + 16vw, 16rem);

  /* geometry: big radii, arches, pills */
  --r-s: 14px;
  --r-m: 24px;
  --r-l: 36px;
  --r-xl: 56px;
  --arch: 999px 999px var(--r-l) var(--r-l);

  /* spacing 4/8 */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px; --s-9: 112px;
  --gut: clamp(16px, 4vw, 56px);
  --max: 1320px;
  --pill-top: 14px;
  --pill-h: 64px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 100px; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--ink); color: var(--chalk);
  font: 400 1rem/1.62 var(--f-sans); font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-wrap: break-word; min-width: 320px;
}
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: .22em; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
address { font-style: normal; }
[hidden] { display: none !important; }
[x-cloak] { display: none !important; }
::selection { background: var(--volt); color: var(--ink); }

:focus-visible { outline: 2px solid var(--volt); outline-offset: 3px; border-radius: 6px; }
.on-paper :focus-visible, .paper :focus-visible { outline-color: var(--deep); }

.skip { position: absolute; left: 12px; top: -80px; z-index: 300; background: var(--volt); color: var(--ink); padding: 12px 18px; border-radius: var(--r-s); font-weight: 600; transition: top .2s; }
.skip:focus { top: 12px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout helpers ---------- */
.wrap { width: min(100% - 2 * var(--gut), var(--max)); margin-inline: auto; }
.wrap--wide { width: min(100% - 2 * var(--gut), 1560px); }
.band { padding-block: clamp(64px, 9vw, 128px); position: relative; }
.paper { background: var(--paper); color: #0C130E; --dim: var(--muted); }
.paper-2 { background: var(--paper-2); color: #0C130E; --dim: var(--muted); }
.slate { background: var(--graphite); }
.stack > * + * { margin-top: var(--stack, 1rem); }

/* ---------- type ---------- */
.serif { font-family: var(--f-serif); font-weight: 400; letter-spacing: -.01em; }
.display { font-family: var(--f-serif); font-weight: 400; line-height: .92; letter-spacing: -.025em; }
.display em, .serif em { font-style: italic; }
.h-xl { font-size: var(--t-4); }
.h-lg { font-size: var(--t-3); line-height: .98; }
.h-md { font-size: var(--t-2); line-height: 1.05; }
h1, h2, h3 { font-family: var(--f-serif); font-weight: 400; letter-spacing: -.02em; line-height: 1; }
h1 { font-size: var(--t-3); }
h2 { font-size: var(--t-2); }
h3 { font-size: 1.618rem; }
.lead { font-size: clamp(1.05rem, .95rem + .5vw, 1.3rem); line-height: 1.55; color: var(--dim); max-width: 56ch; }
.mono, .kicker { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.kicker { display: inline-flex; align-items: center; gap: 10px; color: var(--volt); }
.paper .kicker, .paper-2 .kicker { color: var(--deep); }
.kicker::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.num { font-variant-numeric: tabular-nums; }
.outline { color: transparent; -webkit-text-stroke: 1.5px var(--chalk); }
.paper .outline, .paper-2 .outline { -webkit-text-stroke-color: #0C130E; }
.link { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .35s var(--ease); padding-bottom: 2px; }
.link:hover, .link:focus-visible { background-size: 100% 1px; }
.note { font-size: .875rem; color: var(--dim); }

/* ---------- buttons: pills ---------- */
.btn {
  --bg: var(--volt); --fg: var(--ink);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 26px; border: 0; border-radius: 999px;
  background: var(--bg); color: var(--fg); font-weight: 600; font-size: .95rem; letter-spacing: .005em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s;
}
.btn::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--chalk); transform: translateY(101%); border-radius: inherit; transition: transform .35s var(--ease); }
.btn:hover::after, .btn:focus-visible::after { transform: translateY(0); }
.btn:active { transform: scale(.97); }
.btn .icon { width: 18px; height: 18px; transition: transform .3s var(--ease); }
.btn:hover .icon--go { transform: translateX(4px); }
.btn--ghost { --bg: transparent; --fg: var(--chalk); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--chalk) 55%, transparent); }
.btn--ghost::after { background: var(--chalk); }
.btn--ghost:hover { --fg: var(--ink); }
.btn--ink { --bg: var(--ink); --fg: var(--chalk); }
.btn--ink::after { background: var(--deep); }
.paper .btn--ghost, .paper-2 .btn--ghost { --fg: #0C130E; box-shadow: inset 0 0 0 1.5px #0C130E; }
.paper .btn--ghost::after, .paper-2 .btn--ghost::after { background: #0C130E; }
.paper .btn--ghost:hover, .paper-2 .btn--ghost:hover { --fg: var(--chalk); }
.btn--sm { min-height: 44px; padding: 0 20px; font-size: .875rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: wait; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-grid; place-items: center; background: transparent; color: inherit; transition: background .2s, transform .25s var(--ease); }
.round-btn:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.round-btn:active { transform: scale(.92); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field, .row + .field, .field + .row, .row + .row { margin-top: 16px; }
.field label { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.field label .opt { text-transform: none; letter-spacing: 0; opacity: .8; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--r-s);
  background: color-mix(in srgb, currentColor 6%, transparent); color: inherit;
  border: 1.5px solid color-mix(in srgb, currentColor 22%, transparent);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field textarea { min-height: 110px; resize: vertical; border-radius: var(--r-m); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.field select option { color: #0C130E; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: color-mix(in srgb, currentColor 45%, transparent); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--volt); box-shadow: 0 0 0 4px color-mix(in srgb, var(--volt) 25%, transparent); }
.paper .field input:focus, .paper .field select:focus, .paper .field textarea:focus { border-color: var(--deep); box-shadow: 0 0 0 4px color-mix(in srgb, var(--deep) 22%, transparent); }
.field.has-error input, .field.has-error select, .field.has-error textarea, .field input[aria-invalid="true"] { border-color: var(--err); }
.paper .field.has-error input, .paper .field input[aria-invalid="true"] { border-color: var(--err-ink); }
.field__err { font-size: .85rem; color: var(--err); min-height: 0; }
.paper .field__err, .paper-2 .field__err { color: var(--err-ink); }
.row { display: grid; gap: 16px; }
@media (min-width: 640px) { .row--2 { grid-template-columns: 1fr 1fr; } .row--3 { grid-template-columns: 1.3fr 1.1fr .8fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status { min-height: 1.5em; font-size: .95rem; margin-top: 12px; }
.status.is-ok { color: var(--volt); }
.status.is-bad { color: var(--err); }
.paper .status.is-ok { color: var(--deep); }
.paper .status.is-bad { color: var(--err-ink); }
.alert { padding: 14px 18px; border-radius: var(--r-s); border: 1.5px solid var(--err); color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); margin-bottom: 16px; }
.paper .alert { border-color: var(--err-ink); color: var(--err-ink); }

/* ---------- reveal (JS adds .is-in) ---------- */
.js [data-r] { opacity: 0; transition: opacity .8s var(--ease), transform .9s var(--ease), clip-path 1s var(--ease), filter .8s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.js [data-r="up"] { transform: translateY(36px); }
.js [data-r="wipe"] { clip-path: inset(0 100% 0 0); opacity: 1; }
.js [data-r="mask"] { clip-path: inset(100% 0 0 0); opacity: 1; transform: translateY(24px); }
.js [data-r="rise"] { transform: translateY(60px) scale(.96); }
.js [data-r="blur"] { filter: blur(14px); transform: scale(1.04); }
.js [data-r="left"] { transform: translateX(calc(var(--gut) * -1)); }
.js [data-r="right"] { transform: translateX(var(--gut)); }
.js [data-r].is-in { opacity: 1; transform: none; clip-path: inset(0 0 0 0); filter: none; }
/* split-word headline */
.words .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.words .w > span { display: inline-block; transform: translateY(105%); transition: transform 1s var(--ease); transition-delay: calc(var(--i) * 60ms); }
.words.is-in .w > span { transform: none; }
.no-js .words .w > span, .words.is-static .w > span { transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .js [data-r] { opacity: 1 !important; transform: none !important; clip-path: none !important; filter: none !important; }
  .words .w > span { transform: none !important; }
}
