/* GrowthPedia — one stylesheet, no framework, no web fonts, no third-party requests.
   Warm paper rather than clinical white: this should read like a printed reference, not a SaaS
   dashboard. Moss green carries links and markers; nothing else competes with the text. */

:root {
  --paper: #fcfbf8;
  --card: #fff;
  --ink: #1b1d20;
  --muted: #5b6167;
  --accent: #2f6f4e;
  --accent-dark: #245c3f;
  --tint: #eef3ef;
  --line: #e3e0d8;
  --line-soft: #efece4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1180px;
  --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14161a;
    --card: #1a1d22;
    --ink: #e8e6e1;
    --muted: #a3a9b1;
    --accent: #6cc294;
    --accent-dark: #8fd6ae;
    --tint: #1d2a24;
    --line: #2b3038;
    --line-soft: #232830;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 20; }
.skip:focus { left: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------------------------------------------------------------- header */
header.site { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 10; }
header.site .wrap { display: flex; align-items: center; gap: 1.25rem; padding: .65rem 0; flex-wrap: wrap; }
.mark { font: 600 1.35rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.mark-g { color: var(--accent); }
header nav { flex: 1 1 auto; min-width: 0; }
header nav ul { display: flex; gap: .1rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
header nav a {
  display: block; padding: .35rem .55rem; font-size: .875rem; color: var(--muted);
  text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap;
}
header nav a:hover { color: var(--ink); border-bottom-color: var(--line); }
header nav a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.find { display: flex; position: relative; }
.find input {
  font: inherit; font-size: .875rem; padding: .4rem .6rem; width: 12.5rem; max-width: 40vw;
  border: 1px solid var(--line); border-right: 0; border-radius: 4px 0 0 4px;
  background: var(--card); color: var(--ink);
}
.find button {
  font: inherit; font-size: .8rem; padding: .4rem .7rem; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 0 4px 4px 0;
}
.find button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.ac {
  position: absolute; top: calc(100% + 4px); right: 0; width: min(26rem, 82vw); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.09); overflow: hidden; z-index: 30;
}
.ac a { display: block; padding: .5rem .7rem; text-decoration: none; color: var(--ink); font-size: .9rem; border-bottom: 1px solid var(--line-soft); }
.ac a:last-child { border-bottom: 0; }
.ac a:hover, .ac a.sel { background: var(--tint); }
.ac a em { display: block; font-style: normal; color: var(--muted); font-size: .8rem; margin-top: .1rem; }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 3rem; align-items: start; }
main { min-width: 0; padding: 1.6rem 0 3.5rem; }
main.entry, main.page { max-width: var(--measure); }
.rail { position: sticky; top: 4.2rem; padding: 1.8rem 0 3rem; font-size: .9rem; }

.crumb ol { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0 0 1rem; padding: 0; font-size: .8rem; color: var(--muted); }
.crumb li + li::before { content: "›"; margin-right: .35rem; color: var(--line); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); text-decoration: underline; }
.crumb span { color: var(--ink); }

h1 { font: 600 clamp(1.85rem, 1.3rem + 1.9vw, 2.4rem)/1.2 var(--serif); margin: 0 0 .75rem; letter-spacing: -.015em; }
h2 { font: 600 1.4rem/1.3 var(--serif); margin: 2.1rem 0 .7rem; letter-spacing: -.01em; }
.body h2, .cluster h2 { display: flex; align-items: center; gap: .55rem; }
.body h2::before, .cluster h2::before { content: ""; width: .55rem; height: .55rem; background: var(--accent); flex: none; }
h3 { font: 600 .78rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .3rem; }
p { margin: 0 0 1rem; }

.def { font-size: 1.2rem; line-height: 1.55; color: var(--ink); margin-bottom: 1rem; }
.lede { color: var(--muted); }
.meta {
  display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .82rem; color: var(--muted);
  padding-bottom: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem;
}
.meta .by a { color: var(--muted); }

/* key facts — the reader who reads only this box has the topic */
.facts { background: var(--tint); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; padding: 1.1rem 1.3rem .9rem; margin: 0 0 1.4rem; }
.facts h2 { font: 600 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--accent-dark); margin: 0 0 .6rem; }
.facts h2::before { display: none; }
.facts ul { margin: 0; padding-left: 1.1rem; }
.facts li { margin-bottom: .45rem; }
@media (prefers-color-scheme: dark) { .facts h2 { color: var(--accent); } }

.boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; margin: 0 0 1.6rem; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .75rem .85rem; }
.box p { margin: 0; font-size: .92rem; }

.toc { border: 1px solid var(--line); border-radius: 6px; padding: .9rem 1.1rem; margin: 0 0 1.8rem; background: var(--card); }
.toc h2 { font: 600 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .5rem; }
.toc h2::before { display: none; }
.toc ol { margin: 0; padding-left: 1.2rem; font-size: .92rem; }
.toc li { margin-bottom: .25rem; }

.pts { padding-left: 1.15rem; margin: 0 0 1.1rem; }
.pts li { margin-bottom: .45rem; }
.pts li::marker { color: var(--accent); }
.mistakes ul { padding-left: 1.15rem; }
.mistakes li { margin-bottom: .55rem; }
.mistakes li::marker { color: #b4472e; }

.tw { overflow-x: auto; margin: 0 0 1.6rem; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; background: var(--card); }
caption { text-align: left; font-size: .82rem; color: var(--muted); padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
thead th { background: var(--tint); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; }

details { border: 1px solid var(--line); border-radius: 6px; margin-bottom: .55rem; background: var(--card); }
summary { cursor: pointer; padding: .7rem .9rem; font-weight: 600; font-size: .97rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--accent); font-weight: 400; font-size: 1.2rem; line-height: 1; }
details[open] summary::after { content: "−"; }
details p { padding: 0 .9rem .8rem; margin: 0; color: var(--ink); }

.cards { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.cards.wide { grid-template-columns: 1fr; }
.cards a {
  display: block; height: 100%; padding: .7rem .85rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; text-decoration: none; color: var(--ink);
}
.cards a:hover { border-color: var(--accent); }
.cards span { display: block; font-weight: 600; font-size: .95rem; color: var(--accent); }
.cards em {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-style: normal; font-size: .84rem; color: var(--muted); margin-top: .15rem;
}

.src ol { padding-left: 1.2rem; font-size: .93rem; }
.src li { margin-bottom: .4rem; }
.src .pub { color: var(--muted); font-size: .82rem; }
.srcnote { font-size: .82rem; color: var(--muted); }
code { font: .88em var(--mono); background: var(--tint); padding: .1em .35em; border-radius: 3px; }

.byline { display: flex; gap: .9rem; align-items: flex-start; margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.avatar {
  flex: none; width: 2.7rem; height: 2.7rem; border-radius: 50%; background: var(--tint); color: var(--accent-dark);
  display: grid; place-items: center; font: 600 .82rem var(--sans); letter-spacing: .04em; border: 1px solid var(--line);
}
.byline .who { font-weight: 600; margin: 0 0 .2rem; }
.byline .bio { font-size: .88rem; color: var(--muted); margin: 0 0 .3rem; }
.byline .note { font-size: .82rem; color: var(--muted); margin: 0; }

.note { background: var(--tint); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; padding: .9rem 1.1rem; margin: 0 0 1.3rem; }
.note p:last-child { margin-bottom: 0; }
.deflist { margin: 0 0 1.4rem; }
.deflist dt { font-weight: 600; margin-top: .8rem; }
.deflist dd { margin: .15rem 0 0; color: var(--muted); }

.rail h2 { font: 600 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.rail ul { list-style: none; margin: 0 0 .8rem; padding: 0; }
.rail li { margin-bottom: .35rem; }
.rail a { color: var(--ink); text-decoration: none; font-size: .88rem; }
.rail a:hover { color: var(--accent); text-decoration: underline; }
.more { font-size: .85rem; font-weight: 600; }

/* ---------------------------------------------------------------- home + hubs */
.home h1 { font-size: clamp(2.1rem, 1.4rem + 2.4vw, 2.9rem); }
.home .def, .home .lede { max-width: var(--measure); }
/* Prose is capped at a reading measure; a card grid is not prose, and capping it left the
   home page alternating between a full-width band of section cards and a half-width band of
   entry cards, with a column of empty page beside it. */
.home .body > :not(.cards) { max-width: var(--measure); }
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .8rem; margin: 2rem 0; }
.hcard { display: block; padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); }
.hcard:hover { border-color: var(--accent); }
.hcard h2 { font-size: 1.1rem; margin: 0 0 .3rem; }
.hcard h2::before { display: none; }
.hcard p { font-size: .88rem; color: var(--muted); margin: 0 0 .5rem; }
.hcard span { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; }

.hub .def { max-width: var(--measure); }
.cluster { margin-bottom: 2rem; }
.others ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.others li { border: 1px solid var(--line); border-radius: 20px; padding: .25rem .8rem; font-size: .85rem; background: var(--card); }
.others li a { text-decoration: none; }
.others li span { color: var(--muted); font-size: .78rem; }

.alpha ul { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0 0 1.6rem; }
.alpha a { display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; font-weight: 600; font-size: .85rem; background: var(--card); }
.alpha a:hover { border-color: var(--accent); }
.gl dl { margin: 0 0 1.5rem; }
.gl dt { font-weight: 600; margin-top: .7rem; }
.gl dd { margin: .1rem 0 0; color: var(--muted); font-size: .92rem; max-width: var(--measure); }
.recent { padding-left: 1.4rem; }
.recent li { margin-bottom: .3rem; }
.recent span { color: var(--muted); font-size: .82rem; }

.bigfind { display: flex; margin: 0 0 1.6rem; max-width: 34rem; }
.bigfind input { flex: 1 1 auto; font: inherit; padding: .6rem .8rem; border: 1px solid var(--line); border-right: 0; border-radius: 5px 0 0 5px; background: var(--card); color: var(--ink); }
.bigfind button { font: inherit; padding: .6rem 1.1rem; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 0 5px 5px 0; }

/* ---------------------------------------------------------------- footer */
footer.site { border-top: 1px solid var(--line); margin-top: 2rem; padding: 2.2rem 0 2.5rem; background: var(--card); }
.fcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.5rem; margin-bottom: 1.6rem; }
.fcols h2 { font: 600 .76rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .6rem; }
.fcols h2::before { display: none; }
.fcols ul { list-style: none; margin: 0; padding: 0; }
.fcols li { margin-bottom: .3rem; font-size: .9rem; }
.fcols a { color: var(--ink); text-decoration: none; }
.fcols a:hover { color: var(--accent); text-decoration: underline; }
.fnote { font-size: .86rem; color: var(--muted); max-width: 48rem; }
.fmeta { font-size: .8rem; color: var(--muted); margin: 0; }

.totop {
  position: fixed; right: 1rem; bottom: 1rem; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-size: 1rem;
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 62rem) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .rail { position: static; border-top: 1px solid var(--line); padding-top: 1.4rem; }
  .rail ul { columns: 2; column-gap: 1.5rem; }
}
@media (max-width: 44rem) {
  body { font-size: 16.5px; }
  .wrap { width: min(100% - 1.6rem, var(--wrap)); }
  header.site { position: static; }
  header.site .wrap { gap: .6rem; padding: .55rem 0; }
  header nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  header nav ul { flex-wrap: nowrap; }
  .find { flex: 1 1 auto; }
  .find input { width: 100%; max-width: none; }
  .def { font-size: 1.1rem; }
  .cards { grid-template-columns: 1fr; }
  .rail ul { columns: 1; }
}
@media print {
  header.site, footer.site, .rail, .find, .totop, .toc { display: none; }
  body { font-size: 11pt; }
  a::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
  details { break-inside: avoid; }
}
