/* Rede C2 — site styles (all pages).
   Tokens first; every colour used on the site is defined here, for both themes.
   Palette from the earlier site: red, olive, deep green, ochre on cream.
   Theme: the system decides until the visitor picks one (html[data-theme]).
   Sidebar: html[data-rail="collapsed"] narrows the rail and widens the content. */

:root {
  --paper: #f6f1e8;
  --surface: #fffdf7;
  --ink: #1d1b16;
  --ink-2: #4a4339;
  --muted: #675f55;
  --line: #e3dacb;
  --line-strong: #c4b8a3;
  --accent: #a93632;
  --accent-ink: #fffdf7;
  --accent-soft: #f3e3da;
  --olive: #626a38;
  --deep: #2e3b24;
  --deep-ink: #f6f1e8;
  --ochre: #d99a27;
  --rust: #8f3a22;
  --heading: #2e3b24;
  --caatinga: #b4532a;
  --cerrado: #55702f;
  --country-fill: #efe8da;
  --zigzag: rgba(169, 54, 50, 0.16);
  --focus: #1d1b16;
  --focus-halo: #f6f1e8;

  --font-display: "Montserrat", "Inter", system-ui, sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --rail: 15.5rem;
  --rail-collapsed: 4.25rem;
  --gutter: 16px;
  --measure: 38rem;
  --content: 74rem;
  --radius: 4px;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14130f;
    --surface: #1d1b16;
    --ink: #f2ece0;
    --ink-2: #d2cabb;
    --muted: #aaa191;
    --line: #2f2b23;
    --line-strong: #514a3d;
    --accent: #ea8a80;
    --accent-ink: #14130f;
    --accent-soft: #3a2320;
    --olive: #4d5530;
    --deep: #1f2a19;
    --deep-ink: #f2ece0;
    --ochre: #e6ad47;
    --rust: #6e2e1c;
    --heading: #dfe5c4;
    --caatinga: #e48c5d;
    --cerrado: #a6bf6c;
    --country-fill: #221f19;
    --zigzag: rgba(234, 138, 128, 0.14);
    --focus: #f2ece0;
    --focus-halo: #14130f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14130f;
  --surface: #1d1b16;
  --ink: #f2ece0;
  --ink-2: #d2cabb;
  --muted: #aaa191;
  --line: #2f2b23;
  --line-strong: #514a3d;
  --accent: #ea8a80;
  --accent-ink: #14130f;
  --accent-soft: #3a2320;
  --olive: #4d5530;
  --deep: #1f2a19;
  --deep-ink: #f2ece0;
  --ochre: #e6ad47;
  --rust: #6e2e1c;
  --heading: #dfe5c4;
  --caatinga: #e48c5d;
  --cerrado: #a6bf6c;
  --country-fill: #221f19;
  --zigzag: rgba(234, 138, 128, 0.14);
  --focus: #f2ece0;
  --focus-halo: #14130f;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }
p { margin: 0 0 1em; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.12; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
h2 { color: var(--heading); }
em, i, .sci { font-style: italic; }
strong { font-weight: 620; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--focus-halo);
  border-radius: 2px;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 60;
  background: var(--ink); color: var(--paper); padding: 0.5rem 0.9rem;
  font: 500 0.875rem/1 var(--font-sans); text-decoration: none;
}
.skip-link:focus-visible { top: 0.75rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* type roles */
.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.ui, button, input, textarea, select, table, figcaption, .num {
  font-family: var(--font-sans);
}
.num { font-variant-numeric: tabular-nums lining-nums; }
.lead { font-size: clamp(1.15rem, 0.9rem + 0.8vw, 1.4rem); line-height: 1.5; color: var(--ink); }
.muted { color: var(--muted); }

/* striped accent (ochre and ink), from the earlier site */
.stripe {
  display: inline-block; width: 0.42rem; height: 1.15em; vertical-align: -0.2em; margin-right: 0.6rem;
  background: repeating-linear-gradient(-45deg, var(--ochre) 0 3px, var(--ink) 3px 5px);
  border-radius: 1px;
}

/* ------------------------------------------------------------------ shell */
.shell { min-height: 100vh; }
.main { min-width: 0; }

/* Desktop rail (collapsible) */
.rail { display: none; }
@media (min-width: 64em) {
  .shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); transition: grid-template-columns 260ms var(--ease); }
  :root[data-rail="collapsed"] .shell { grid-template-columns: var(--rail-collapsed) minmax(0, 1fr); }
  :root[data-rail="collapsed"] { --content: 88rem; }
  .rail {
    display: flex; flex-direction: column; gap: 1.8rem;
    position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
    padding: 1.5rem 0.9rem 1.4rem 1.4rem;
    border-right: 1px solid var(--line);
    background: var(--paper);
    font-family: var(--font-sans);
    z-index: 30;
  }
  .topbar, .bottombar { display: none !important; }
}
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.rail-toggle {
  flex: none; display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--ink);
  cursor: pointer; transition: border-color 160ms var(--ease), transform 260ms var(--ease);
}
.rail-toggle:hover { border-color: var(--ink); }
.rail-toggle .ico { width: 15px; height: 15px; }
.rail .brand { gap: 0.5rem; }
.rail .brand-name small { letter-spacing: 0.07em; font-size: 0.6rem; }
.rail-toggle[hidden] { display: none; }

.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: auto; height: 40px; flex: none; }
.brand-name { font: 700 1rem/1.1 var(--font-display); letter-spacing: 0.01em; white-space: nowrap; }
.brand-name small { display: block; font: 400 0.64rem/1.3 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 0.15rem; }

.ico { width: 18px; height: 18px; flex: none; }
.rail-nav ul, .toc ul, .bottombar ul { list-style: none; margin: 0; padding: 0; }
.rail-nav a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.45rem 0.6rem; margin-left: -0.6rem; border-radius: 6px;
  text-decoration: none; color: var(--ink-2); white-space: nowrap;
  font-size: 0.92rem; transition: color 160ms var(--ease), background 160ms var(--ease);
}
.rail-nav a:hover { color: var(--ink); background: var(--accent-soft); }
.rail-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.rail-nav a[aria-current="page"] .ico { stroke-width: 1.9; }

.toc { border-top: 1px solid var(--line); padding-top: 1.1rem; }
.toc .label { margin: 0 0 0.6rem; white-space: nowrap; }
.toc a {
  display: grid; grid-template-columns: 18px 1fr; gap: 0.55rem; align-items: center;
  padding: 0.28rem 0; text-decoration: none; color: var(--muted); font-size: 0.86rem; line-height: 1.3;
}
.toc a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc a:hover, .toc a.is-active { color: var(--ink); }
.toc svg { width: 18px; height: 18px; transform: rotate(-90deg); }
.toc .arc-bg { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.toc .arc { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 44; stroke-dashoffset: calc(44 * (1 - var(--p, 0))); }
.toc a.is-done .arc { stroke-dashoffset: 0; }

.rail-foot { margin-top: auto; display: grid; gap: 0.75rem; font-size: 0.82rem; }
.controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.ctl {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.25rem;
  padding: 0.35rem 0.7rem; border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--ink); font: 500 0.8rem/1 var(--font-sans);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}
.ctl:hover { border-color: var(--ink); }
.ctl .ico { width: 15px; height: 15px; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
}
.kbd-hint { color: var(--muted); font-size: 0.75rem; line-height: 1.5; }
kbd { font: 400 0.72rem/1 var(--font-mono); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0.1rem 0.3rem; }
.theme-toggle[hidden] { display: none; }

/* collapsed rail: icons only */
@media (min-width: 64em) {
  :root[data-rail="collapsed"] .rail { padding: 1.5rem 0.75rem 1.4rem; align-items: center; }
  :root[data-rail="collapsed"] .rail-head { flex-direction: column; gap: 0.9rem; }
  :root[data-rail="collapsed"] .rail-toggle { transform: rotate(180deg); }
  :root[data-rail="collapsed"] .brand-name,
  :root[data-rail="collapsed"] .rail-nav a span,
  :root[data-rail="collapsed"] .toc a span,
  :root[data-rail="collapsed"] .toc .label,
  :root[data-rail="collapsed"] .ctl span,
  :root[data-rail="collapsed"] .kbd-hint { display: none; }
  :root[data-rail="collapsed"] .brand img { height: 34px; }
  :root[data-rail="collapsed"] .rail-nav a { margin-left: 0; padding: 0.6rem; justify-content: center; }
  :root[data-rail="collapsed"] .toc { padding-top: 1rem; }
  :root[data-rail="collapsed"] .toc a { grid-template-columns: 18px; justify-content: center; padding: 0.35rem 0; }
  :root[data-rail="collapsed"] .controls { flex-direction: column; }
  :root[data-rail="collapsed"] .ctl { padding: 0; width: 2.25rem; justify-content: center; }
}

/* Mobile top bar + bottom bar (pure HTML, works without JavaScript) */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.65rem var(--gutter);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  position: sticky; top: 0; z-index: 40;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.topbar .brand img { height: 32px; }
.bottombar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottombar ul { display: grid; grid-template-columns: repeat(5, 1fr); }
.bottombar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
  min-height: 3.4rem; padding: 0.35rem 0.1rem; text-decoration: none;
  font: 500 0.68rem/1.1 var(--font-sans); color: var(--muted); text-align: center;
}
.bottombar .ico { width: 20px; height: 20px; }
.bottombar a[aria-current="page"] { color: var(--accent); }
@media (max-width: 63.99em) { body { padding-bottom: calc(3.5rem + env(safe-area-inset-bottom)); } }

/* ------------------------------------------------------------------ page blocks */
.wrap { width: 100%; max-width: var(--content); margin: 0 auto; padding: 0 var(--gutter); transition: max-width 260ms var(--ease); }
@media (min-width: 40em) { :root { --gutter: 28px; } }
@media (min-width: 80em) { :root { --gutter: 48px; } }

.section { padding: clamp(3rem, 7vw, 6rem) 0; position: relative; }
.section + .section { border-top: 1px solid var(--line); }
.section.band, .section.deep, .section.band + .section, .section.deep + .section { border-top: 0; }
.band { background: var(--surface); }
.section-head { display: grid; gap: 0.8rem; margin-bottom: clamp(1.5rem, 3vw, 2.5rem); max-width: 46rem; }
.section-head .label { display: flex; align-items: center; }
.section-head h2 { font-size: clamp(1.75rem, 1.15rem + 2.1vw, 2.85rem); }
.prose { max-width: var(--measure); }
.prose p { color: var(--ink-2); }

.grid-2 { display: grid; gap: clamp(1.5rem, 4vw, 4rem); }
@media (min-width: 56em) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; } }

/* deep green band (method, workflow) */
.deep { background: var(--deep); color: var(--deep-ink); --line: rgba(246, 241, 232, 0.18); --line-strong: rgba(246, 241, 232, 0.4); --ink: #f6f1e8; --ink-2: rgba(246, 241, 232, 0.86); --muted: rgba(246, 241, 232, 0.72); --heading: #f6f1e8; --focus: #f6f1e8; --focus-halo: var(--deep); }
.deep .stripe { background: repeating-linear-gradient(-45deg, var(--ochre) 0 3px, #f6f1e8 3px 5px); }

/* zigzag border, from the earlier site */
.zigzag {
  height: 14px;
  background:
    linear-gradient(135deg, var(--zigzag) 25%, transparent 25%) -7px 0 / 14px 14px,
    linear-gradient(225deg, var(--zigzag) 25%, transparent 25%) -7px 0 / 14px 14px;
}

/* figures */
.figure { margin: 0; }
.figure-frame {
  position: relative; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  aspect-ratio: var(--ar, 4 / 3); overflow: hidden;
}
.figure-frame > svg, .figure-frame > canvas, .figure-frame > img, .figure-frame > picture { width: 100%; height: 100%; }
.figure-frame > canvas { position: absolute; inset: 0; opacity: 0; transition: opacity 700ms var(--ease); }
.figure-frame.is-3d > canvas { opacity: 1; }
.figure-frame.is-3d > svg { opacity: 0; transition: opacity 500ms var(--ease); }
.figure figcaption {
  display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; justify-content: space-between;
  margin-top: 0.65rem; font-size: 0.8rem; line-height: 1.45; color: var(--muted);
}
.figure figcaption .src { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; list-style: none; padding: 0; margin: 0.6rem 0 0; font: 0.78rem/1.3 var(--font-sans); color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.swatch { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; flex: none; }
.swatch.caa { background: var(--caatinga); }
.swatch.cer { background: var(--cerrado); }

/* SVG marks (generated by scripts/build_assets.R; colours from the tokens) */
.rc2-svg { width: 100%; height: 100%; }
.rc2-svg text { font-family: var(--font-sans); }
.rc2-svg .g-country { fill: var(--country-fill); stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rc2-svg .g-caatinga { fill: color-mix(in srgb, var(--caatinga) 14%, transparent); stroke: var(--caatinga); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rc2-svg .g-cerrado { fill: color-mix(in srgb, var(--cerrado) 12%, transparent); stroke: var(--cerrado); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rc2-svg .g-stem { stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.rc2-svg .g-stem.g-caa { stroke: var(--caatinga); }
.rc2-svg .g-stem.g-cer { stroke: var(--cerrado); }
.rc2-svg .g-dot.g-caa, .rc2-svg .g-bar.g-caa { fill: var(--caatinga); }
.rc2-svg .g-dot.g-cer, .rc2-svg .g-bar.g-cer { fill: var(--cerrado); }
.rc2-svg--map .g-dot { stroke: var(--surface); stroke-width: 1.2; }
.rc2-svg .g-scale line { stroke: var(--ink-2); stroke-width: 1; }
.rc2-svg .g-scale text { font: 11px var(--font-mono); fill: var(--muted); }
.rc2-svg .g-plotline { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.rc2-svg .g-grid { stroke: var(--line-strong); stroke-width: 0.75; }
.rc2-svg .g-dim { stroke: var(--muted); stroke-width: 1; }
.rc2-svg .g-dimtext { font: 17px var(--font-mono); fill: var(--muted); }
/* timeline */
.rc2-svg .g-col { stroke: var(--line); stroke-width: 1; }
.rc2-svg .g-year { font-size: 13px; font-weight: 600; fill: var(--ink-2); }
.rc2-svg .g-count { font-size: 12px; fill: var(--muted); }
.rc2-svg .g-track { stroke: var(--line); stroke-width: 1; }
.rc2-svg .g-span { stroke-width: 2.4; stroke-linecap: round; }
.rc2-svg .g-span.g-caa { stroke: var(--caatinga); }
.rc2-svg .g-span.g-cer { stroke: var(--cerrado); }
.rc2-svg .g-id { font: 9.5px var(--font-mono); fill: var(--muted); }
.rc2-svg .g-group { font: 700 12px var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; }
.rc2-svg .g-group.g-caa { fill: var(--caatinga); }
.rc2-svg .g-group.g-cer { fill: var(--cerrado); }
.rc2-svg .g-row:hover .g-track { stroke: var(--line-strong); }
.rc2-svg .g-row:hover .g-id { fill: var(--ink); }
/* network links */
.rc2-svg .g-head { font: 700 13px var(--font-display); fill: var(--heading); letter-spacing: 0.02em; }
.rc2-svg .g-link { fill: none; stroke-width: 1.3; opacity: 0.75; transition: opacity 200ms var(--ease), stroke-width 200ms var(--ease); }
.rc2-svg .g-link.g-aff { stroke: var(--line-strong); }
.rc2-svg .g-link.g-caa { stroke: var(--caatinga); opacity: 0.55; }
.rc2-svg .g-link.g-cer { stroke: var(--cerrado); opacity: 0.6; }
.rc2-svg .g-node { cursor: default; transition: opacity 200ms var(--ease); }
.rc2-svg .g-node text { font-size: 11px; fill: var(--ink); }
.rc2-svg .g-n-inst rect { fill: var(--deep); }
.rc2-svg .g-n-inst text { fill: #f6f1e8; font-weight: 600; font-size: 10.5px; letter-spacing: 0.02em; }
.rc2-svg .g-n-person rect { fill: var(--surface); stroke: var(--line-strong); }
.rc2-svg .g-n-plot text { font: 9.5px var(--font-mono); fill: var(--muted); }
.rc2-svg--links.is-focus .g-link, .rc2-svg--links.is-focus .g-node { opacity: 0.12; }
.rc2-svg--links.is-focus .g-link.is-on { opacity: 1; stroke-width: 2.2; }
.rc2-svg--links.is-focus .g-node.is-on { opacity: 1; }
.rc2-svg--links .g-n-person.is-on rect { stroke: var(--accent); stroke-width: 1.5; }

/* buttons and links */
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem; min-height: 2.75rem;
  padding: 0.65rem 1.2rem; border: 1px solid var(--accent); border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: 600 0.92rem/1 var(--font-sans);
  text-decoration: none; cursor: pointer;
  transition: background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.btn:hover { background: var(--deep); border-color: var(--deep); color: #f6f1e8; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.arrow-link {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem;
  font: 600 0.92rem/1.3 var(--font-sans); text-decoration: none; color: var(--accent);
  border-bottom: 1px solid currentColor; padding-bottom: 0.15rem;
}
.deep .arrow-link { color: var(--ochre); }
.arrow-link::after { content: "→"; transition: transform 180ms var(--ease); }
.arrow-link:hover::after { transform: translateX(3px); }

/* numbered list (workflow, steps) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line); counter-reset: step; }
.steps > li { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); gap: 1rem; padding: 1.15rem 0; border-bottom: 1px solid var(--line); counter-increment: step; }
.steps > li::before { content: counter(step, decimal-leading-zero); font: 700 1.3rem/1.2 var(--font-display); color: var(--ochre); }
.steps h3 { font-size: 1.12rem; margin-bottom: 0.3rem; }
.steps h3 a { text-decoration: none; }
.steps h3 a:hover { text-decoration: underline; }
.steps p { margin: 0; color: var(--ink-2); font-size: 0.98rem; }
@media (min-width: 56em) { .steps.cols-2 { grid-template-columns: 1fr 1fr; column-gap: 3rem; } }

.terms { margin: 0; display: grid; gap: 1.1rem; }
.terms div { border-left: 3px solid var(--ochre); padding-left: 1rem; }
.terms dt { font: 700 0.98rem/1.3 var(--font-display); margin-bottom: 0.2rem; color: var(--heading); }
.terms dd { margin: 0; color: var(--ink-2); }

.refs { display: grid; gap: 1rem; }
@media (min-width: 48em) { .refs { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 72em) { .refs { grid-template-columns: repeat(3, 1fr); } }
.ref { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--olive); border-radius: var(--radius); padding: 1.4rem 1.3rem 1.3rem; display: flex; flex-direction: column; gap: 0.6rem; }
.ref:nth-child(3n+2) { border-top-color: var(--accent); }
.ref:nth-child(3n) { border-top-color: var(--ochre); }
.ref h3 { font-size: 1.1rem; }
.ref p { margin: 0; font-size: 0.95rem; color: var(--ink-2); }
.pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; padding-top: 0.4rem; }
.pills a {
  font: 500 0.78rem/1 var(--font-sans); text-decoration: none; padding: 0.45rem 0.7rem;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink);
}
.pills a:hover { border-color: var(--accent); color: var(--accent); }

/* photos */
.photo { margin: 0; }
.photo picture, .photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame { display: block; overflow: hidden; background: var(--line); aspect-ratio: var(--ar, 3 / 2); border-radius: var(--radius); }
.photo-frame img { transition: transform 900ms var(--ease); }
.photo-frame:hover img { transform: scale(1.04); }
.photo figcaption { margin-top: 0.5rem; font: 0.8rem/1.4 var(--font-sans); color: var(--muted); display: flex; gap: 0.5rem; align-items: center; }

/* ------------------------------------------------------------------ footer */
.site-footer { background: var(--deep); color: rgba(246, 241, 232, 0.86); padding: 0 0 2.25rem; font-family: var(--font-sans); font-size: 0.86rem; --zigzag: rgba(217, 154, 39, 0.5); }
.site-footer .zigzag { background-color: var(--paper); margin-bottom: 2.75rem; }
.footer-grid { display: grid; gap: 1.75rem; }
@media (min-width: 48em) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.3fr; } }
.site-footer h2 { font: 400 0.7rem/1.4 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ochre); margin-bottom: 0.6rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.site-footer a { text-decoration: none; color: #f6f1e8; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 0 0 0.5rem; }
.site-footer .brand { color: #f6f1e8; }
.site-footer .brand-name small { color: rgba(246, 241, 232, 0.7); }
.footer-brand p { max-width: 26rem; margin-top: 0.9rem; color: rgba(246, 241, 232, 0.75); }
.footer-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; margin-top: 2rem; padding-top: 1.1rem; border-top: 1px solid rgba(246, 241, 232, 0.18); color: rgba(246, 241, 232, 0.7); font-size: 0.8rem; }
.site-footer :focus-visible { outline-color: #f6f1e8; box-shadow: 0 0 0 6px var(--deep); }

/* ------------------------------------------------------------------ 404 */
.notfound { min-height: 70vh; display: grid; align-content: center; gap: 1rem; padding: 4rem 0; }
.notfound .code { font: 800 clamp(4rem, 14vw, 9rem)/1 var(--font-display); color: var(--line-strong); letter-spacing: -0.04em; margin: 0; }
.notfound h1 { font-size: clamp(2rem, 1.4rem + 2vw, 3rem); }

/* ------------------------------------------------------------------ lightbox */
.lightbox { border: 0; padding: 0; margin: auto; max-width: min(96vw, 1600px); max-height: 94vh; background: transparent; color: #f6f1e8; overflow: visible; }
.lightbox::backdrop { background: rgba(12, 12, 9, 0.9); }
.lightbox figure { margin: 0; display: grid; gap: 0.6rem; justify-items: center; }
.lightbox img { max-width: min(96vw, 1600px); max-height: 84vh; width: auto; height: auto; object-fit: contain; border-radius: 3px; }
.lightbox figcaption { font: 0.9rem/1.4 var(--font-sans); display: flex; gap: 0.5rem; align-items: center; }
.lb-btn {
  position: fixed; display: grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: 50%;
  border: 1px solid rgba(246, 241, 232, 0.4); background: rgba(20, 19, 15, 0.6); color: #f6f1e8; cursor: pointer;
  font: 400 1.4rem/1 var(--font-sans);
}
.lb-btn:hover { border-color: #f6f1e8; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox :focus-visible { outline-color: #f6f1e8; box-shadow: none; }

/* ------------------------------------------------------------------ motion */
.reveal { opacity: 1; transform: none; }
.rv .reveal { opacity: 0; transform: translateY(18px); transition: opacity 800ms var(--ease), transform 800ms var(--ease); }
.rv .reveal.is-in { opacity: 1; transform: none; }
.rv .figure--timeline .g-row { opacity: 0; transition: opacity 500ms var(--ease); transition-delay: calc(var(--i) * 18ms); }
.rv .figure--timeline.is-in .g-row { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .rv .reveal, .rv .figure--timeline .g-row { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ print */
@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #000; --ink-2: #222; --muted: #444; --line: #ccc; --line-strong: #999; --heading: #000; color-scheme: light; }
  body { background: #fff; font-size: 11pt; padding: 0 !important; }
  .rail, .topbar, .bottombar, .skip-link, .controls, .contact-form, .contact-toggle, .map-open, .team-search, canvas, .mosaic, .wave, .zigzag, .banner-media, .scroll-cue, .contact-photo, .lightbox { display: none !important; }
  .shell { display: block; }
  .banner { min-height: 0 !important; color: #000 !important; background: none !important; padding: 1rem 0 !important; }
  .banner .facts dt, .banner .facts dd, .banner .lead, .banner h1, .banner-kicker { color: #000 !important; text-shadow: none !important; }
  .deep, .site-footer { background: #fff !important; color: #000 !important; }
  .deep *, .site-footer * { color: #000 !important; }
  .figure-frame > svg { opacity: 1 !important; }
  .section { padding: 1.5rem 0; break-inside: avoid-page; }
  .rv .reveal, .rv .g-row { opacity: 1 !important; transform: none !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #444; word-break: break-all; }
}
