/* ==========================================================================
   OAK PATH — BRAND SYSTEM
   Accounting & Advisory · Franklin, MI
   Direction: "Editorial Ledger" — paper ground, forest ink, brass accent.
   Everything downstream reads from these tokens. Change them here, once.
   ========================================================================== */

/* ---------- 1. TOKENS ---------------------------------------------------- */
:root {
  /* Core palette. Warm paper + forest ink; brass is the ONLY accent. */
  --paper:        #faf7f0;   /* page ground — warm, never #fff */
  --paper-2:      #f4efe4;   /* recessed panels, alternating bands */
  --paper-3:      #ebe4d5;   /* rules-on-paper, dividers, inactive */
  --ink:          #14342b;   /* forest — primary type & the mark   12.6:1 on paper */
  --ink-2:        #2f5145;   /* secondary type                      8.2:1 on paper */
  --ink-3:        #597269;   /* tertiary / captions / meta          4.9:1 / 4.5:1 sunk */
  --brass:        #8c6624;   /* accent — links, rules, emphasis     4.9:1 / 4.5:1 sunk */
  --brass-2:      #c9a15c;   /* accent ON INK ONLY — brass fails there (2.6:1) 5.6:1 */
  --brass-wash:   #f0e6d0;   /* accent tint fill */
  --flag:         #9a5a2b;   /* the TBC / needs-review marker */

  /* Semantic aliases — components use these, never raw palette values. */
  --bg:           var(--paper);
  --bg-sunk:      var(--paper-2);
  --text:         var(--ink);
  --text-soft:    var(--ink-2);
  --text-meta:    var(--ink-3);
  --accent:       var(--brass);
  --rule:         color-mix(in oklab, var(--ink) 14%, transparent);
  --rule-strong:  color-mix(in oklab, var(--ink) 30%, transparent);
  --rule-brass:   color-mix(in oklab, var(--brass) 55%, transparent);

  /* Type. Source Serif 4 carries the voice; Source Sans 3 carries the load.
     Designed as one superfamily — they share proportions and colour on the page.
     Source Serif 4's opsz axis runs 8–60; 60 is the display end. */
  --font-display: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-body:    "Source Sans 3", ui-sans-serif, "Helvetica Neue", sans-serif;

  /* Fluid modular scale, ~1.25 mobile → ~1.333 desktop. */
  --t-xs:   clamp(0.72rem, 0.70rem + 0.10vw, 0.78rem);
  --t-sm:   clamp(0.83rem, 0.80rem + 0.15vw, 0.92rem);
  --t-base: clamp(1.00rem, 0.96rem + 0.20vw, 1.09rem);
  --t-lg:   clamp(1.16rem, 1.08rem + 0.38vw, 1.38rem);
  --t-xl:   clamp(1.42rem, 1.26rem + 0.76vw, 1.95rem);
  --t-2xl:  clamp(1.85rem, 1.52rem + 1.55vw, 2.90rem);
  --t-3xl:  clamp(2.35rem, 1.72rem + 2.95vw, 4.30rem);
  --t-4xl:  clamp(2.85rem, 1.75rem + 5.10vw, 6.10rem);

  /* Space — deliberately uneven so rhythm reads as composed, not stamped. */
  --s-1:  0.375rem;  --s-2: 0.75rem;   --s-3: 1.125rem;  --s-4: 1.75rem;
  --s-5:  2.5rem;    --s-6: 3.75rem;   --s-7: 5.5rem;    --s-8: 8rem;
  --band: clamp(4rem, 3rem + 6vw, 8.5rem);   /* vertical band padding */

  --measure: 62ch;                            /* prose line length */
  --gutter:  clamp(1.25rem, 0.6rem + 3vw, 3.5rem);
  --maxw:    77rem;
  --maxw-narrow: 52rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);     /* ease-out-quint */
  --dur:  0.62s;

  --radius: 3px;                              /* near-square: paper, not plastic */
  --radius-lg: 6px;
}

/* ---------- 2. RESET ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.62;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Paper grain. Barely there — you feel it before you see it. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: 0.35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
}

img, svg, video { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

::selection { background: var(--brass-wash); color: var(--ink); }

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- 3. TYPOGRAPHY ------------------------------------------------ */
/* The .hN classes must carry the family too, not just the size — they're applied
   to <p> and <div>, which would otherwise inherit the body sans. */
h1, h2, h3, h4, .h1, .h2, .h3, .h4, .display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.014em;
  text-wrap: balance;
  font-variation-settings: "opsz" 60;
}
h1, .h1 { font-size: var(--t-4xl); letter-spacing: -0.022em; }
h2, .h2 { font-size: var(--t-3xl); letter-spacing: -0.018em; }
h3, .h3 { font-size: var(--t-xl); line-height: 1.2; letter-spacing: -0.01em; }
h4, .h4 { font-size: var(--t-lg); line-height: 1.28; letter-spacing: -0.006em; }

/* Drop to a text optical size below ~1.2rem — the display cut gets spindly small. */
.h4, h4 { font-variation-settings: "opsz" 20; }

p { text-wrap: pretty; }
.lede {
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--text-soft);
  max-width: 46ch;
  text-wrap: pretty;
}
.prose { max-width: var(--measure); }
.prose > * + * { margin-block-start: var(--s-3); }
.prose h3 { margin-block-start: var(--s-5); }

/* The ledger label — small caps, wide track. Used for every section marker. */
.label {
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-meta);
  font-feature-settings: "tnum" 1;
}
.label--brass { color: var(--brass); }

/* Figures — accounting site: numerals must line up in a column. */
.tnum, table, .figure { font-variant-numeric: tabular-nums; }
.figure {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 60;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

a { color: inherit; }
.link {
  color: var(--brass);
  text-decoration: none;
  background-image: linear-gradient(var(--rule-brass), var(--rule-brass));
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--dur) var(--ease), color 0.2s;
}
.link:hover { background-size: 100% 2px; color: var(--ink); }

/* ---------- 4. LAYOUT ---------------------------------------------------- */
.wrap  { width: min(100% - var(--gutter) * 2, var(--maxw)); margin-inline: auto; }
.wrap--narrow { width: min(100% - var(--gutter) * 2, var(--maxw-narrow)); margin-inline: auto; }
.band  { padding-block: var(--band); }
.band--sunk { background: var(--bg-sunk); }
.band--ink  { background: var(--ink); color: var(--paper); }
/* --brass is tuned for paper and only reaches 2.6:1 on ink. Anything brass and
   textual must swap to --brass-2 inside an ink band. */
.band--ink .label,
.band--ink .sechead__no,
.band--ink .link { color: var(--brass-2); }
.band--ink .lede  { color: color-mix(in oklab, var(--paper) 78%, var(--ink)); }

.rule { border: 0; border-top: 1px solid var(--rule); }
.rule--strong { border-top-color: var(--rule-strong); }
.rule--brass  { border-top: 2px solid var(--brass); }

/* Section head: ledger number, rule, title. The site's spine. */
.sechead { display: grid; gap: var(--s-3); margin-block-end: var(--s-6); }
.sechead__meta {
  display: flex; align-items: baseline; gap: var(--s-3);
  border-top: 1px solid var(--rule-strong);
  padding-block-start: var(--s-2);
}
.sechead__meta::after { content: ""; flex: 1; }
.sechead__no { font-variant-numeric: tabular-nums; color: var(--brass); }

/* Asymmetric editorial split — text left, weight right. Not 50/50. */
.split {
  display: grid;
  gap: var(--s-5) clamp(2rem, 5vw, 5rem);
  grid-template-columns: 1fr;
}
@media (min-width: 62rem) {
  .split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
  .split--flip > :first-child { order: 2; }
  .split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 5. BUTTONS --------------------------------------------------- */
.btn {
  --btn-bg: var(--ink); --btn-fg: var(--paper); --btn-bd: var(--ink);
  display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.85em 1.6em;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd); border-radius: var(--radius);
  font-size: var(--t-sm); font-weight: 600; letter-spacing: 0.02em;
  text-decoration: none; white-space: nowrap;
  transition: transform 0.25s var(--ease), background-color 0.25s, color 0.25s, border-color 0.25s;
}
.btn:hover { transform: translateY(-2px); --btn-bg: #0d251e; --btn-bd: #0d251e; }
.btn:active { transform: translateY(0); }
.btn__arrow { transition: transform 0.35s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(4px); }

.btn--brass  { --btn-bg: var(--brass); --btn-bd: var(--brass); --btn-fg: #fffdf7; } /* 5.1:1 */
.btn--brass:hover { --btn-bg: #6f5019; --btn-bd: #6f5019; }
.btn--ghost  { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--rule-strong); }
.btn--ghost:hover { --btn-bg: transparent; --btn-fg: var(--brass); --btn-bd: var(--brass); }
.band--ink .btn--ghost { --btn-fg: var(--paper); --btn-bd: color-mix(in oklab, var(--paper) 35%, transparent); }
.band--ink .btn--ghost:hover { --btn-fg: var(--brass-2); --btn-bd: var(--brass-2); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; }

/* ---------- 6. THE TBC MARKER -------------------------------------------- */
/* Placeholder content the client must replace before launch. Loud on purpose.
   Add `data-env="live"` to <html> and every one of these disappears. */
[data-tbc] { position: relative; }
[data-tbc]::after {
  content: "TBC — replace before launch";
  position: absolute; top: 0; right: 0;
  transform: translateY(-50%);
  background: var(--flag); color: #fff;
  font-family: var(--font-body); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.3em 0.7em; border-radius: 2px;
  pointer-events: none; z-index: 5;
}
[data-env="live"] [data-tbc]::after { content: none; }

/* ---------- 7. MOTION ---------------------------------------------------- */
/* One orchestrated entrance per view. Transform + opacity only. */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- 8. UTILITIES ------------------------------------------------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--s-3); top: -4rem; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: 0.7em 1.2em; border-radius: var(--radius); text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip:focus { top: var(--s-3); }
.stack > * + * { margin-block-start: var(--s-3); }
