/* Vellum base: tokens, type, layout, shared components. Page-specific styles live in landing.css and app.css.
   Direction: a premium ledger room. Deep ink-navy ground, aged-paper cream text and sheets, one bold copper accent
   (with a brass highlight) used for "this row / this action". --gold* token names are kept; they hold copper now. */
@font-face { font-family: "Fraunces"; src: url(/fonts/fraunces.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(/fonts/instrument.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(/fonts/plex-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(/fonts/plex-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: dark;
  /* ground */
  --bg: #0e1830;
  --bg-2: #132039;
  --surface: #16233d;
  --surface-2: #1b2a47;
  --raise: #213252;
  --line: rgba(226, 216, 196, .09);
  --line-2: rgba(226, 216, 196, .16);
  /* text: parchment */
  --ink: #f2e8d2;
  --ink-2: #bdb5a4;
  --ink-3: #958e82;
  /* accents */
  --gold: #c8703e;
  --gold-2: #e09461;
  --gold-ink: #1e0d03;
  --gold-soft: rgba(200, 112, 62, .12);
  --brass: #c9a45c;
  --cream: #efe4cc;
  --slate: #8fb0c4;
  --slate-soft: rgba(143, 176, 196, .12);
  --vellum: #e9dfc8; /* the sheet itself */
  --ok: #8fc39a;
  --ok-soft: rgba(143, 195, 154, .1);
  --warn: #e7b25c;
  --warn-soft: rgba(231, 178, 92, .1);
  --bad: #ee8f84;
  --bad-soft: rgba(238, 143, 132, .1);

  /* legacy names kept so page scripts that set classes keep working */
  --paper: var(--bg); --paper-2: var(--surface-2); --card: var(--surface); --brick: var(--gold); --lamp: var(--gold);

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r: 10px;
  --r-lg: 18px;
  --wrap: 1120px;
  --pad: clamp(16px, 4.5vw, 32px);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 48px -24px rgba(0, 0, 0, .7);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden; position: relative; min-height: 100vh;
}
/* ambient ground: a slow drifting lamp glow behind everything, plus fine grain. Transform/opacity only. */
body::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -2; pointer-events: none;
  background:
    radial-gradient(40vmax 30vmax at 70% 12%, rgba(200, 112, 62, .075), transparent 70%),
    radial-gradient(45vmax 35vmax at 15% 40%, rgba(84, 128, 156, .11), transparent 70%),
    radial-gradient(50vmax 40vmax at 60% 95%, rgba(30, 48, 92, .22), transparent 70%);
  animation: drift 38s ease-in-out infinite alternate;
  will-change: transform;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(3%, 2%, 0) scale(1.06); } }

img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--slate); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .15s; }
a:hover { color: var(--gold-2); }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.06; letter-spacing: -0.02em; margin: 0 0 .5em; font-variation-settings: "SOFT" 30, "opsz" 96; text-wrap: balance; color: var(--ink); }
h1 { font-size: clamp(2.3rem, 7.4vw, 4.4rem); }
h2 { font-size: clamp(1.7rem, 4.6vw, 2.6rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.005em; font-weight: 550; font-variation-settings: "SOFT" 30, "opsz" 24; }
p { margin: 0 0 1em; text-wrap: pretty; }
b, strong { font-weight: 600; color: var(--ink); }
code, pre, .mono { font-family: var(--mono); font-size: .9em; }
pre { background: #070d18; color: #d9d3c4; border: 1px solid var(--line); padding: 16px; border-radius: var(--r); overflow-x: auto; line-height: 1.55; font-size: 13px; margin: 0 0 1em; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .85em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(200, 112, 62, .3); color: #fff; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.eyebrow { font: 500 .72rem/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--brass); margin: 0 0 14px; display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* header: a quiet floating bar */
.top { position: sticky; top: 0; z-index: 20; background: transparent; transition: background .25s, border-color .25s; border-bottom: 1px solid transparent; }
.top.scrolled { background: rgba(14, 24, 48, .9); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border-bottom-color: var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 550 1.2rem/1 var(--display); letter-spacing: -0.01em; min-height: 44px; }
.brand:hover { color: var(--ink); }
.brand img { width: 28px; height: 28px; border-radius: 7px; box-shadow: 0 0 0 1px var(--line-2), 0 6px 16px -6px rgba(0, 0, 0, .8); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .92rem; padding: 8px 12px; border-radius: 999px; transition: color .15s, background .15s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: rgba(255, 255, 255, .05); }
.nav a.opt[aria-current="page"] { box-shadow: inset 0 0 0 1px var(--line-2); }
.nav .btn { margin-left: 8px; min-height: 40px; }
@media (max-width: 560px) { .nav a.opt { display: none; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--ink); color: #0e1830;
  font: 600 .93rem/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .18s var(--ease-out), background .18s, color .18s, border-color .18s, box-shadow .18s;
}
.btn:hover { background: #fff; color: #0e1830; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.ghost { background: rgba(255, 255, 255, .03); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .07); border-color: rgba(226, 216, 196, .28); color: var(--ink); }
/* primary action: gold, lit from above */
.btn.brick, .btn.gold {
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: rgba(255, 196, 150, .5); color: var(--gold-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 10px 28px -10px rgba(200, 112, 62, .55);
}
.btn.brick:hover, .btn.gold:hover { background: linear-gradient(180deg, #f4b98d, var(--gold-2)); color: var(--gold-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .4) inset, 0 14px 34px -10px rgba(200, 112, 62, .7); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: .86rem; }
.btn.wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; box-shadow: none; }
.linkish { background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--slate); font: 500 .9rem var(--sans); cursor: pointer; }
.linkish:hover { color: var(--gold-2); }

/* forms */
label { display: block; font-weight: 600; font-size: .88rem; margin: 0 0 6px; color: var(--ink); }
.hint { font-size: .82rem; color: var(--ink-3); margin: 6px 0 0; font-weight: 400; }
input[type="text"], input[type="email"], input[type="number"], input[type="search"], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: rgba(6, 11, 22, .6); color: var(--ink); font: 400 1rem/1.4 var(--sans); transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #6c7378; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23b4b2aa' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select option { background: var(--surface); color: var(--ink); }
input[type="file"] { color: var(--ink-2); font: 400 .9rem var(--sans); max-width: 100%; }
input[type="file"]::file-selector-button { margin-right: 12px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); font: 600 .86rem var(--sans); cursor: pointer; }
textarea { min-height: 96px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: rgba(226, 216, 196, .26); }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(200, 112, 62, .6); box-shadow: 0 0 0 3px var(--gold-soft); background: rgba(6, 11, 22, .85); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .92rem; cursor: pointer; color: var(--ink-2); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--gold); }
.field { margin: 0 0 18px; }

/* range: a thin rule with a gold bead */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold) var(--fill, 50%), rgba(226, 216, 196, .14) var(--fill, 50%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(226, 216, 196, .14); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--gold); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff0e2, var(--gold) 55%, #a55a2c); border: 0; box-shadow: 0 0 0 4px rgba(200, 112, 62, .16), 0 4px 10px rgba(0, 0, 0, .6); transition: box-shadow .15s, transform .15s; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff0e2, var(--gold) 55%, #a55a2c); border: 0; box-shadow: 0 0 0 4px rgba(200, 112, 62, .16), 0 4px 10px rgba(0, 0, 0, .6); }
input[type="range"]:active::-webkit-slider-thumb, input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 8px rgba(200, 112, 62, .2), 0 4px 10px rgba(0, 0, 0, .6); transform: scale(1.08); }
input[type="range"]:focus { box-shadow: none; }

/* surfaces */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(16px, 4vw, 26px); box-shadow: var(--shadow);
}
.note { border-radius: var(--r); padding: 12px 14px; font-size: .92rem; background: var(--slate-soft); color: #c6d8e3; border: 1px solid rgba(143, 176, 196, .18); }
.note b { color: inherit; }
.note.warn { background: var(--warn-soft); color: #f1bd94; border-color: rgba(231, 178, 92, .22); }
.note.bad { background: var(--bad-soft); color: #f6b7af; border-color: rgba(238, 143, 132, .24); }
.note.ok { background: var(--ok-soft); color: #b9dcc0; border-color: rgba(143, 195, 154, .22); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line-2); font: 500 .78rem/1.5 var(--mono); color: var(--ink); white-space: nowrap; }
.chip .t { color: var(--ink-3); font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font: 500 .72rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); background: rgba(255, 255, 255, .02); }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; padding: 40px 18px; color: var(--ink-2); border: 1px dashed var(--line-2); border-radius: var(--r-lg); background: rgba(255, 255, 255, .015); }
.empty svg { margin: 0 auto 14px; }

/* footer */
.foot { margin-top: 120px; border-top: 1px solid var(--line); padding: 36px 0 44px; font-size: .9rem; color: var(--ink-2); background: linear-gradient(180deg, rgba(0, 0, 0, .2), transparent); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }
.foot nav { display: flex; flex-wrap: wrap; gap: 0 20px; }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--ink); }
.foot .brand { font-size: 1.05rem; color: var(--ink); }
.foot nav a { display: inline-flex; align-items: center; min-height: 44px; }
.foot .fine { flex-basis: 100%; font-size: .82rem; color: var(--ink-3); margin: 0; max-width: 70ch; }

/* scroll reveal (only when JS marks the page ready and motion is allowed) */
.js .reveal { opacity: 0; transform: translate3d(0, 18px, 0); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
