/* Cerberry · "Slate (light)". Base: tokens, type, top bar, buttons,
   forms, footer. Section layouts live in sections.css. */

:root {
  /* Palette (OKLCH, hex for reference) */
  --bone: oklch(95.9% 0.010 87.5);      /* #F4F1EA paper */
  --bone-hi: oklch(98.2% 0.007 88.6);   /* #FBF9F4 card stock */
  --bone-lo: oklch(92.3% 0.016 86.4);   /* #EAE5DA well */
  --ink: oklch(17.7% 0.011 260.6);      /* #0E1116 */
  --ink-soft: oklch(46% 0.010 264.5);   /* #55585E secondary text, 6.3:1 on bone */
  --rec: oklch(58.5% 0.193 23.9);       /* #D63A3F REC red: dots, large type, rules */
  --rec-ink: oklch(52.2% 0.172 23.3);   /* #B83036 red for small text, 5.3:1 */
  --amber: oklch(65.3% 0.142 68.9);     /* #C77D00 Dead Air accent: rules, fills */
  --amber-ink: oklch(50.2% 0.108 70.5); /* #8A5700 amber for small text, 5.4:1 */
  --rule: oklch(17.7% 0.011 260.6 / 0.12);
  --rule-strong: oklch(17.7% 0.011 260.6 / 0.55);

  /* Type */
  --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Archivo", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --t-hero: clamp(3rem, 13.4vw, 12.75rem);
  --t-h2: clamp(2.25rem, 5.4vw, 4.75rem);
  --t-h3: clamp(1.75rem, 2.6vw, 2.5rem);
  --t-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --t-mono: 0.75rem;

  /* Space */
  --gutter: clamp(20px, 4vw, 56px);
  --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: clamp(72px, 10vw, 144px);
  --max: 1360px;

  /* Depth: layered soft shadows, never one hard drop */
  --lift-1: 0 1px 0 oklch(17.7% 0.011 260.6 / 0.05), 0 2px 6px -2px oklch(17.7% 0.011 260.6 / 0.08);
  --lift-2: 0 1px 0 oklch(17.7% 0.011 260.6 / 0.04), 0 3px 6px -2px oklch(17.7% 0.011 260.6 / 0.06),
            0 12px 24px -8px oklch(17.7% 0.011 260.6 / 0.10), 0 32px 64px -24px oklch(17.7% 0.011 260.6 / 0.16);

  /* Motion */
  --ease-cut: cubic-bezier(0.7, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --d-fast: 160ms; --d-mid: 320ms;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0; background: var(--bone); color: var(--ink);
  font: 400 var(--t-body)/1.55 var(--f-body);
  font-optical-sizing: auto; text-rendering: optimizeLegibility;
}
/* Paper grain: static SVG noise over everything, never intercepts input */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .05 0 0 0 0 .06 0 0 0 0 .08 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 1em; max-width: 62ch; }
h1, h2, h3 { margin: 0; font-family: var(--f-display); font-weight: 800; font-stretch: 112%; line-height: 0.92; letter-spacing: -0.02em; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.mono { font: 500 var(--t-mono)/1.4 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-4); top: -60px; z-index: 200; background: var(--ink); color: var(--bone); padding: var(--s-3) var(--s-4); }
.skip:focus { top: var(--s-3); }

/* Top bar: wordmark, REC timecode, nav */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: oklch(95.9% 0.010 87.5 / 0.9); backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--rule);
}
.topbar__in { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s-5); min-height: 64px; }
.wordmark { font: 800 1.125rem/1 var(--f-display); font-stretch: 125%; letter-spacing: 0.04em; text-decoration: none; }
.rec { margin: 0; display: inline-flex; align-items: center; gap: 10px; justify-self: center; color: var(--ink); white-space: nowrap; }
.rec__label { color: var(--rec-ink); }
.rec__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 3px oklch(58.5% 0.193 23.9 / 0.18); animation: pulse 1.2s ease-in-out infinite; }
.rec__tc { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; min-width: 11ch; }
@keyframes pulse { 50% { opacity: 0.25; } }
.nav { display: flex; align-items: center; gap: var(--s-2); }
.nav a { text-decoration: none; padding: 12px 12px; }
.nav a:not(.btn):hover, .nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.nav .btn { margin-left: var(--s-2); }

/* Buttons: square-cornered like slate stock */
.btn {
  display: inline-flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 22px;
  font: 700 1rem/1 var(--f-display); font-stretch: 112%; text-decoration: none; border-radius: 2px; border: 0; cursor: pointer;
  transition: transform var(--d-fast) var(--ease-out), box-shadow var(--d-mid) var(--ease-out);
}
.btn--ink { background: var(--ink); color: var(--bone); box-shadow: var(--lift-1); }
.btn--ink::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rec); }
.btn--ink:hover { transform: translateY(-2px); box-shadow: var(--lift-2); }
.btn--ink:active { transform: translateY(0); }
.btn.mono { font: 500 var(--t-mono)/1 var(--f-mono); min-height: 44px; padding: 0 16px; }
.link-cut { display: inline-flex; align-items: center; min-height: 52px; font: 700 1rem/1 var(--f-display); font-stretch: 112%; text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 3px; text-underline-offset: 7px; }
.link-cut:hover { text-decoration-color: var(--ink); }

/* Forms: a call sheet. Cells with hairlines, labels in mono. */
.sheet { position: relative; background: var(--bone-hi); border: 1px solid var(--rule); border-radius: 3px; box-shadow: var(--lift-2); }
.sheet__head { display: flex; justify-content: space-between; gap: var(--s-4); padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.sheet__grid { display: grid; grid-template-columns: 1fr 1fr; }
.cell { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 20px 14px; border-bottom: 1px solid var(--rule); }
.cell:nth-child(odd):not(.cell--wide) { border-right: 1px solid var(--rule); }
.cell--wide { grid-column: 1 / -1; }
.cell label { display: flex; justify-content: space-between; color: var(--ink-soft); }
.cell .req { color: var(--rec-ink); }
.cell input, .cell select, .cell textarea {
  width: 100%; font: 400 1.0625rem/1.4 var(--f-body); color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--rule-strong); border-radius: 0; padding: 6px 0 8px; appearance: none;
}
.cell select { background: 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='%230E1116' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 4px center; padding-right: 24px; }
.cell textarea { min-height: 120px; resize: vertical; }
.cell input:focus-visible, .cell select:focus-visible, .cell textarea:focus-visible { outline: none; border-bottom: 2px solid var(--ink); padding-bottom: 7px; }
.cell:focus-within { background: var(--bone); }
.cell:focus-within::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--rec); }
.cell [aria-invalid="true"] { border-bottom-color: var(--rec-ink); }
.cell .err { color: var(--rec-ink); font: 500 0.8125rem/1.3 var(--f-mono); margin: 0; }
.cell .err:empty { display: none; }
.sheet__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); padding: 20px; }
.sheet__foot p { margin: 0; color: var(--ink-soft); font-size: 0.9375rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-alert { margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--rule); color: var(--rec-ink); font: 500 0.875rem/1.4 var(--f-mono); }
.form-alert:empty { display: none; }
.sheet[aria-busy="true"] .btn--ink::before { animation: pulse 0.5s ease-in-out infinite; }
.logged { padding: 40px 24px; }
.logged__stamp { display: inline-flex; align-items: center; gap: 12px; font: 800 clamp(2.5rem, 6vw, 4rem)/1 var(--f-display); font-stretch: 125%; }
.logged__stamp::before { content: ""; width: 0.32em; height: 0.32em; border-radius: 50%; background: var(--rec); }
.logged p { margin-top: var(--s-4); }

/* Footer */
.foot { border-top: 1px solid var(--rule); padding-block: var(--s-6) var(--s-7); }
.foot__in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-4); align-items: baseline; }
.foot nav { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.foot nav a { padding: 12px 8px; }
.foot .end { color: var(--ink-soft); }

/* Plain pages (privacy, thank-you, errors) */
.plain-page { max-width: 760px; margin: 0 auto; padding: var(--s-9) var(--gutter); }
.plain-page h1 { font-size: clamp(2.5rem, 7vw, 4.5rem); margin: var(--s-4) 0 var(--s-6); }
.plain-page h2 { font-size: 1.5rem; margin: var(--s-7) 0 var(--s-3); line-height: 1.1; }
.slate-label { color: var(--rec-ink); }

@media (max-width: 760px) {
  .topbar__in { grid-template-columns: 1fr auto; gap: 0 var(--s-4); min-height: 0; padding-top: 12px; }
  .rec { justify-self: end; }
  .nav { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 0; margin: 12px calc(var(--gutter) * -1) 0; border-top: 1px solid var(--rule); }
  .nav a { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 4px; }
  .nav a + a { border-left: 1px solid var(--rule); }
  .nav .btn { margin: 0; border-radius: 0; min-height: 46px; box-shadow: none; }
  .nav .btn:hover { transform: none; }
  .sheet__grid { grid-template-columns: 1fr; }
  .cell:nth-child(odd):not(.cell--wide) { border-right: 0; }
  .sheet__foot .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Structural <p> rows span their container; the 62ch measure is for prose. */
.sheet__head, .svc__bar, .rec, .form-alert { max-width: none; margin: 0; }
@media (max-width: 760px) {
  .nav { grid-template-columns: 1fr 1fr 1.7fr; }
  .nav .btn { padding: 0 8px; gap: 8px; white-space: nowrap; letter-spacing: 0.05em; }
}
