/* =========================================================
   Legacy Ledger — base.css
   Design tokens, reset, typography, layout primitives.
   ========================================================= */

/* ---------- Fonts (self-hosted, latin subset, variable) ---------- */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/fraunces-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url("../assets/fonts/fraunces-italic-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/inter-latin.woff2") format("woff2");
}
/* Metric-matched fallback keeps text from jumping while Inter loads */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  size-adjust: 107.06%;
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
}

:root {
  /* Brand palette */
  --green-950: #081C15;
  --green-900: #0B241C;
  --green: #0F2E24;            /* deep forest green */
  --green-700: #163F31;
  --green-600: #1F5242;
  --green-100: #E4ECE6;
  --cream: #FAF6EE;            /* warm cream */
  --cream-200: #F4EDDF;
  --cream-300: #EADFC9;
  --paper: #FFFDF8;
  --gold: #C9A24B;             /* rich gold accent */
  --gold-300: #E2C88A;
  --gold-100: #F4EAD2;
  --gold-ink: #7A5B14;         /* gold dark enough for text on cream (AA) */
  --charcoal: #1C1C1C;         /* body text */
  --ink-2: #4D4A43;            /* muted text on cream (AA) */
  --ink-3: #6A665D;
  --line: rgba(15, 46, 36, 0.12);
  --line-gold: rgba(201, 162, 75, 0.55);
  --error: #A3261B;
  --success: #1F6B4A;

  /* Type */
  --font-serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1.0625rem;
  --fs-lg: 1.1875rem;
  --fs-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-h3: clamp(1.25rem, 1.15rem + 0.4vw, 1.4375rem);
  --fs-h2: clamp(2.125rem, 1.6rem + 2.4vw, 3.5rem);
  --fs-h1: clamp(3rem, 1.9rem + 5.4vw, 6.25rem);

  /* Shape & depth */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 46, 36, 0.05), 0 4px 12px -4px rgba(15, 46, 36, 0.08);
  --shadow: 0 2px 4px rgba(15, 46, 36, 0.04), 0 16px 36px -12px rgba(15, 46, 36, 0.16);
  --shadow-lg: 0 30px 70px -24px rgba(15, 46, 36, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 0.35s;

  /* Layout */
  --container: 1200px;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --section-y: clamp(4.5rem, 3rem + 6vw, 8.5rem);
  --header-h: 76px;

  /* Focus ring (overridden on dark surfaces) */
  --focus: var(--green);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}
body {
  min-height: 100vh;
  background: var(--cream);
  color: var(--charcoal);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.menu-open { overflow: hidden; }
img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
address { font-style: normal; }
[hidden] { display: none !important; }

/* ---------- Focus ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--green);
  font-variation-settings: "opsz" 96;
  text-wrap: balance;
}
h3 { font-size: var(--fs-h3); line-height: 1.25; font-variation-settings: "opsz" 36; }
p { text-wrap: pretty; }
em { font-style: italic; }
strong { font-weight: 600; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-ink);
  margin-bottom: 1.125rem;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gold);
}
.eyebrow-light { color: var(--gold-300); }

.section-title { font-size: var(--fs-h2); }
.section-lead {
  font-size: var(--fs-lg);
  color: var(--ink-2);
  max-width: 38rem;
  margin-top: 1.25rem;
}
.section-lead a { color: var(--green); font-weight: 600; }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-y); }
.section-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head-split {
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}
.section-head-split > div:first-child { max-width: 40rem; }

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--gold);
  color: var(--charcoal);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ---------- Scroll reveal (only when JS is running) ---------- */
.js .reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
