/* Layout: sticky top bar; sidebar with quick links + expandable pages (a Menu toggle on phones); each page is a stack of linkable sections */
:root {
  --bg: #141210;
  --surface: #1d1a17;
  --line: #34302b;
  --fg: #eeeae4;
  --muted: #a49d94;
  --accent: #ff7a00;
  --accent-ink: #1a0d02;
  --link: #ffa560;
  --display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --rail: 15rem;
  --bar: 3.5rem;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf7f3; --surface: #f1ebe4; --line: #e0d7cc; --fg: #1c1916; --muted: #6b635a;
    --accent: #e0600a; --accent-ink: #fff; --link: #b54a00; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #faf7f3; --surface: #f1ebe4; --line: #e0d7cc; --fg: #1c1916; --muted: #6b635a;
  --accent: #e0600a; --accent-ink: #fff; --link: #b54a00; color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar) + 1rem + env(safe-area-inset-top, 0px)); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 1rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.wrap {
  max-width: 72rem; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Top bar */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap { display: flex; align-items: center; gap: 1rem; height: var(--bar); }
.brand {
  display: flex; align-items: center; gap: 0.5rem;
  font: 800 1.5rem/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--fg); text-decoration: none;
}
.brand img { display: block; height: 2.6rem; width: auto; }
.bar-links { margin-left: auto; display: flex; gap: 0.25rem; }
.bar-links a {
  font-weight: 600; font-size: 0.9rem; color: var(--fg); text-decoration: none;
  padding: 0.35rem 0.7rem; border-radius: 999px;
}
.bar-links a:hover { background: var(--surface); }
.bar-links a.cta { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 560px) { .bar-links a:not(.cta) { display: none; } }

/* Page grid */
.page { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); gap: 3rem; padding-block: 2rem 5rem; }
@media (max-width: 860px) { .page { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-block: 1rem 4rem; } }

/* Sidebar */
.toc { position: sticky; top: calc(var(--bar) + 1.5rem + env(safe-area-inset-top, 0px)); align-self: start; max-height: calc(100vh - var(--bar) - 3rem); overflow-y: auto; padding-bottom: 1rem; }
.toc h4 {
  margin: 1.5rem 0 0.4rem; font: 600 0.72rem/1 var(--body); letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.toc h4:first-child { margin-top: 0; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 0.3rem 0.6rem; border-radius: 6px;
  color: var(--fg); text-decoration: none; font-size: 0.93rem;
}
.toc a:hover { background: var(--surface); }
.toc a.active { color: var(--accent); background: var(--surface); }
.quick-list a { display: flex; align-items: center; gap: 0.5rem; }
.quick-list a::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--accent); flex: none; }
.grp { border-top: 1px solid var(--line); }
.grp:last-child { border-bottom: 1px solid var(--line); }
.grp-head { display: flex; align-items: center; gap: 0.25rem; padding-block: 0.3rem; }
.grp-head a { flex: 1; font: 600 1.25rem/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; padding: 0.35rem 0.6rem; }
.grp-head a.current { color: var(--accent); }
.grp-toggle {
  flex: none; width: 2rem; height: 2rem; display: grid; place-items: center;
  background: none; border: 0; border-radius: 6px; color: var(--muted); cursor: pointer;
}
.grp-toggle:hover { background: var(--surface); color: var(--fg); }
.grp-toggle svg { width: 0.9rem; height: 0.9rem; transition: transform 0.15s; }
.grp-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.grp ul { padding: 0 0 0.6rem 0.75rem; border-left: 1px solid var(--line); margin-left: 0.6rem; }
.grp ul a { font-size: 0.9rem; }
.grp ul a.page-link { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.grp ul a.page-link::after { content: "→"; color: var(--muted); font-size: 0.85em; }
/* dashed rule between a page's own sections and the separate pages after them */
.grp ul li:not(:has(> a.page-link)) + li:has(> a.page-link) { margin-top: 0.35rem; padding-top: 0.35rem; border-top: 1px dashed var(--line); }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .toc { display: none; position: static; max-height: none; overflow: visible; border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: var(--surface); }
  .toc.open { display: block; }
  .toc a:hover, .toc a.active { background: var(--bg); }
  .menu-btn {
    display: inline-flex; align-items: center; gap: 0.4rem; margin-left: 0.25rem;
    font: 600 0.9rem/1 var(--body); color: var(--fg); background: none;
    border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.8rem; cursor: pointer;
  }
}

.hero-sm h1 { font-size: clamp(2.6rem, 7vw, 4.2rem); }
.hero-sm { padding-bottom: 1.5rem; }

/* Hero */
.hero { padding-block: 0.5rem 2.5rem; border-bottom: 1px solid var(--line); }
.hero .kicker { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0; }
.hero h1 {
  font: 800 clamp(3rem, 9vw, 5.6rem)/0.9 var(--display); text-transform: uppercase;
  letter-spacing: 0.01em; margin: 0.4rem 0 1rem; text-wrap: balance;
}
.hero p.lede { font-size: 1.15rem; max-width: 40rem; margin: 0 0 1.5rem; color: var(--fg); }
.quick { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.quick a {
  font-weight: 600; text-decoration: none; color: var(--fg);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.45rem 1rem;
}
.quick a:hover { border-color: var(--accent); }
.quick a.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Sections */
section { padding-top: 2.25rem; max-width: 46rem; }
h2 {
  font: 800 2.3rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.01em;
  margin: 0 0 1rem; text-wrap: balance; display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
}
h3 { font: 600 1.45rem/1.15 var(--display); text-transform: uppercase; letter-spacing: 0.02em; margin: 1.75rem 0 0.5rem; display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
h4.sub { font: 700 1rem/1.3 var(--body); margin: 1.25rem 0 0.25rem; }
p { margin: 0 0 0.85rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }
li::marker { color: var(--accent); }
.muted { color: var(--muted); }
.note { font-size: 0.92rem; color: var(--muted); }

.anchor {
  font: 600 0.75rem/1 var(--body); letter-spacing: 0.04em; text-transform: none;
  color: var(--muted); background: none; border: 1px solid transparent; border-radius: 999px;
  padding: 0.3rem 0.55rem; cursor: pointer; opacity: 0.55; transition: opacity 0.15s, border-color 0.15s;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; border-color: var(--line); }
.anchor.copied { opacity: 1; color: var(--accent); border-color: var(--accent); }
@media (hover: none) { .anchor { opacity: 0.8; } }

/* Definition-style rows */
.rows { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: 0.6rem 1.25rem; margin: 0 0 1rem; }
.rows dt { font-weight: 700; }
.rows dd { margin: 0; min-width: 0; }
@media (max-width: 520px) { .rows { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; } .rows dd { margin-bottom: 0.6rem; } }

/* Fee list */
.fees { border-top: 1px solid var(--line); margin: 0 0 1rem; }
.fee { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.fee .name { font-weight: 700; }
.fee .price { font: 800 1.5rem/1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; text-align: right; }
.fee .desc { grid-column: 1 / -1; color: var(--muted); font-size: 0.95rem; }

/* Bank box */
.bank { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; margin: 0 0 1.25rem; }
.bank .rows { margin: 0; align-items: center; }
.bank dd { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.copy {
  font: 600 0.78rem/1 var(--body); color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.35rem 0.6rem; cursor: pointer;
}
.copy:hover { border-color: var(--accent); }
.copy.copied { color: var(--accent); border-color: var(--accent); }

.paylinks { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.5rem; margin: 0 0 1rem; }
.paylinks a {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: 8px;
  text-decoration: none; color: var(--fg); font-weight: 600;
}
.paylinks a span { color: var(--accent); font-variant-numeric: tabular-nums; }
.paylinks a:hover { border-color: var(--accent); }

/* Resource list */
.res { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.res li { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: 0.25rem 1rem; padding: 0.7rem 0; margin: 0; border-bottom: 1px solid var(--line); }
.res li > span:first-child { font-weight: 700; }
@media (max-width: 520px) { .res li { grid-template-columns: minmax(0, 1fr); } }

/* Roster */
.table-scroll { overflow-x: auto; margin: 0 0 1rem; }
table { border-collapse: collapse; width: 100%; min-width: 20rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem 0.55rem 0; border-bottom: 1px solid var(--line); }
th { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
td.num { font: 800 1.5rem/1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; width: 4rem; }
.tracker { min-width: 34rem; }
.tracker th:not(:first-child), .tracker td:not(:first-child) { text-align: center; }
.tracker td.num { font-size: 1.15rem; width: auto; }
.tracker td.tally { font-weight: 700; font-variant-numeric: tabular-nums; }
.tracker tr.split td { padding: 0; border-bottom: 2px solid var(--line); }
td.num.empty { color: var(--muted); font-weight: 600; }
.tag { font-size: 0.8rem; color: var(--muted); }

/* Governing documents */
.doc { max-width: 46rem; padding-top: 1.5rem; }
.doc h2 { font-size: 1.9rem; margin-top: 2.25rem; }
.doc h3 { font-size: 1.25rem; margin-top: 1.25rem; }
.doc ol.alpha { list-style-type: lower-alpha; }
.doc ol.alpha li::marker { font-weight: 600; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* Callouts */
.callout { border-left: 3px solid var(--accent); padding: 0.25rem 0 0.25rem 1rem; margin: 0 0 1.25rem; }

/* Figures */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.75rem; margin: 0.5rem 0 1.25rem; }
.gallery.wide { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
figure { margin: 0; }
figure a { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
figure img { display: block; width: 100%; }
figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.35rem; }
.img-fallback { display: block; padding: 1.5rem 1rem; font-size: 0.9rem; text-align: center; }

.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding-left: 2.4rem; margin-bottom: 1.1rem; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: -0.1rem;
  font: 800 1.35rem/1 var(--display); color: var(--accent); width: 1.8rem; text-align: right;
}
.steps .gallery { margin-top: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(9rem, 12rem)); }

.cal-frame { width: 100%; aspect-ratio: 4 / 3; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin: 0.5rem 0 1rem; }
@media (max-width: 520px) { .cal-frame { aspect-ratio: 3 / 4; } }

.role { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.role:first-of-type { border-top: 1px solid var(--line); }
.role h4 { margin: 0 0 0.2rem; font: 600 1.3rem/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }

footer { border-top: 1px solid var(--line); padding-block: 2rem; color: var(--muted); font-size: 0.9rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 1rem);
  background: var(--fg); color: var(--bg); font-weight: 600; font-size: 0.9rem;
  padding: 0.6rem 1rem; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
