/* carlos · sandlot sketchbook theme
   Single source of truth across docs/. Mirrors the tokens documented at
   /Volumes/nas/vault/personal/projects/carlos/branding/theme.md.

   ─ tokens          (:root + dark mode)
   ─ base + paper    (body, grain, doodles)
   ─ chrome          (header / footer / brand mark / docs nav)
   ─ hero + headings (Caveat display + Inter body)
   ─ prose           (p, lists, code spans, inline kbd)
   ─ cards           (sketch SVG border via mask-composite)
   ─ code blocks     (deep cap-navy ground, warm cream type, syntax tokens)
   ─ tables          (sticky thead, row hover)
   ─ patterns        (callouts, paths list, pills, kbd, hand-drawn rules)
   ─ phase nodes     (flow diagrams + corner-tag pattern; replaces left-stripe)
   ─ docs surface    (breadcrumbs, group grid, sidebar, prev/next)
   ─ accessibility   (focus rings, skip link, reduced motion)
*/

/* ───────────────────────── tokens ───────────────────────── */
:root {
  --paper:    #f4ecd8;
  --paper-hi: #fdf7e6;
  --paper-lo: #ece4d2;
  --card:     #fdf7e6;

  --sky:      #d8e2ee;
  --sky-soft: rgba(216, 226, 238, 0.65);

  --navy:      #2c4a78;
  --navy-soft: rgba(44, 74, 120, 0.14);
  --navy-deep: #1f3658;
  --clay:      #c64a2c;
  --clay-soft: rgba(198, 74, 44, 0.14);
  --sage:      #7a9676;
  --sage-soft: rgba(122, 150, 118, 0.20);
  --sun:       #e8a635;
  --sun-soft:  rgba(232, 166, 53, 0.18);

  --ink:      #1b1812;
  --ink-soft: #3a342a;
  --muted:    #6b6357;
  --subtle:   #8a8170;
  --rule:     rgba(27, 24, 18, 0.18);
  --rule-soft:rgba(27, 24, 18, 0.10);
  --shadow:   rgba(20, 22, 30, 0.10);
  --shadow-soft: rgba(20, 22, 30, 0.06);

  /* column identities (agent-loop comparison) */
  --claude: #b56a16;
  --carlos: #2c4a78;
  --codex:  #3b6f3a;

  /* per-section accent helpers (concepts/reference/guides) */
  --bucket-getting: var(--clay);
  --bucket-concepts: var(--navy);
  --bucket-reference: var(--sage);
  --bucket-guides: var(--sun);

  --focus: var(--navy);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #15171c;
    --paper-hi: #1c1f27;
    --paper-lo: #0b0d12;
    --card:     #1a1d27;
    --sky:      #1f2a3c;
    --sky-soft: rgba(31, 42, 60, 0.5);
    --navy:      #7aa0d4;
    --navy-soft: rgba(122, 160, 212, 0.18);
    --navy-deep: #a8c3e8;
    --clay:      #e87a55;
    --clay-soft: rgba(232, 122, 85, 0.18);
    --sage:      #a3c0a0;
    --sage-soft: rgba(163, 192, 160, 0.18);
    --sun:       #f3c886;
    --sun-soft:  rgba(243, 200, 134, 0.18);
    --ink:      #ece4d2;
    --ink-soft: #c9c1ad;
    --muted:    #8a8170;
    --subtle:   #6b6357;
    --rule:     rgba(236, 228, 210, 0.18);
    --rule-soft:rgba(236, 228, 210, 0.08);
    --shadow:   rgba(0, 0, 0, 0.5);
    --shadow-soft: rgba(0, 0, 0, 0.28);
    --claude: #f0b067;
    --carlos: #7aa0d4;
    --codex:  #a3c0a0;
  }
}

/* ───────────────────────── base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

html { scroll-padding-top: 96px; }

body {
  background:
    radial-gradient(ellipse 60% 40% at 20% 0%, var(--sky-soft), transparent 65%),
    radial-gradient(ellipse 70% 50% at 85% 30%, var(--sky-soft), transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 100%, var(--paper-lo), transparent 70%),
    var(--paper);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  line-height: 1.55;
}

/* paper grain — fractal-noise SVG overlay at low opacity */
body::before {
  content: ''; position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: 0.5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
@media (prefers-color-scheme: dark) {
  body::before { mix-blend-mode: screen; opacity: 0.3; }
}

/* ────────────────────── ambient doodles ──────────────────── */
.doodle { position: fixed; pointer-events: none; z-index: 1; opacity: 0.55; }
.doodle path { fill: none; stroke: var(--navy); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.doodle.ink path { stroke: var(--ink); }
.doodle.sage path { stroke: var(--sage); }
.doodle.clay path { stroke: var(--clay); }
.doodle-cloud-1 { top: 90px;   right: 4%;   width: 220px; }
.doodle-cloud-2 { top: 380px;  left: -20px; width: 170px; opacity: 0.42; }
.doodle-cloud-3 { top: 920px;  right: -40px; width: 240px; opacity: 0.42; }
.doodle-cloud-4 { top: 1500px; left: 2%;    width: 150px; opacity: 0.40; transform: rotate(4deg); }
.doodle-star    { top: 520px;  right: 8%;   width: 32px;  opacity: 0.6; }
.doodle-loop    { top: 1080px; left: 4%;    width: 70px;  opacity: 0.50; }
@media (max-width: 800px) {
  .doodle-cloud-1, .doodle-cloud-3 { display: none; }
}

/* ───────────────────────── chrome ───────────────────────── */
header.site, footer.site {
  position: relative; z-index: 3;
  padding: 22px 36px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px;
  font-size: 11px; letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted); font-weight: 500;
  flex-wrap: wrap;
}
header.site nav {
  display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
}
header.site .mark {
  color: var(--ink); letter-spacing: 0.18em; font-weight: 600;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px;
  transition: color 0.15s;
  border: 0; padding-bottom: 0;
  font-size: 12px;
}
header.site .mark::before {
  content: '🧢';
  font-size: 18px;
  line-height: 1;
  letter-spacing: normal;
  transform: translateY(-1px);
}
header.site .mark:hover, header.site .mark:focus-visible { color: var(--navy); border: 0; }
header.site nav a {
  color: var(--muted); text-decoration: none;
  letter-spacing: 0.22em;
  padding-bottom: 2px;
  border-bottom: 1px dotted transparent;
  transition: color 0.15s, border-color 0.15s;
}
header.site nav a:hover,
header.site nav a:focus-visible {
  color: var(--ink); border-bottom-color: var(--navy);
}
header.site nav a[aria-current="page"] {
  color: var(--navy-deep);
  border-bottom-color: var(--navy);
}

footer.site {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px dashed var(--rule);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}
footer.site a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: color 0.15s, border-color 0.15s;
}
footer.site a:hover, footer.site a:focus-visible {
  color: var(--ink); border-bottom-color: var(--navy);
}

main {
  position: relative; z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 36px 80px;
}
main.wide { max-width: 1240px; }
main.narrow { max-width: 820px; }

/* ───────────────────────── hero ─────────────────────────── */
.hero { margin-bottom: 42px; }
.hero .eyebrow {
  font-family: 'Caveat', cursive; font-weight: 500;
  font-size: 22px; color: var(--clay);
  transform: rotate(-1deg); display: inline-block;
  margin-bottom: 4px;
}

h1 {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: clamp(44px, 6.4vw, 82px);
  line-height: 0.98;
  letter-spacing: 0;
  color: var(--ink);
  margin: 0 0 18px;
}
h1 .accent { color: var(--navy); position: relative; display: inline-block; }
h1 .accent::after {
  content: '';
  position: absolute; left: -1%; right: -1%; bottom: -10px;
  height: 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'><path d='M2 7 Q 28 2, 60 6 T 120 6 T 178 5 T 198 7' fill='none' stroke='%232c4a78' stroke-width='2.4' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-size: 100% 100%;
}
h1 .accent.clay { color: var(--clay); }
h1 .accent.clay::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'><path d='M2 7 Q 28 2, 60 6 T 120 6 T 178 5 T 198 7' fill='none' stroke='%23c64a2c' stroke-width='2.4' stroke-linecap='round'/></svg>");
}

.subhead {
  max-width: 70ch;
  font-size: 17px; line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}
.subhead code,
p code, li code, td code, .footnote code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.87em;
  background: var(--paper-hi);
  padding: 1px 6px; border-radius: 4px;
  color: var(--ink);
  border: 1px solid var(--rule-soft);
}

/* ────────────────────── prose + headings ─────────────────── */
h2 {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 38px;
  line-height: 1.02;
  letter-spacing: 0;
  margin: 56px 0 18px;
  color: var(--ink);
  scroll-margin-top: 96px;
}
h2 .accent { color: var(--navy); }
h2 .num {
  font-family: 'Caveat', cursive; font-size: 22px;
  color: var(--clay); margin-right: 12px;
  vertical-align: 4px;
}
h3 {
  font-family: 'Inter', sans-serif; font-weight: 600;
  font-size: 17px; letter-spacing: 0.01em;
  margin: 30px 0 10px; color: var(--ink);
  scroll-margin-top: 96px;
}
h4 {
  font-family: 'Inter', sans-serif; font-weight: 600;
  font-size: 14px; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 8px;
}

p { font-size: 16px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 14px; max-width: 70ch; }
main p.lede {
  font-size: 18px; line-height: 1.55;
  color: var(--ink);
  max-width: 70ch;
}
strong { color: var(--ink); font-weight: 600; }
em { font-style: italic; }

ul, ol { padding-left: 22px; margin: 0 0 16px; max-width: 70ch; }
ul li, ol li { margin-bottom: 8px; color: var(--ink-soft); }
ul li::marker { color: var(--navy); }
ol li::marker { color: var(--clay); font-weight: 600; }

a {
  color: var(--navy-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--navy-soft);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
a:hover { color: var(--navy); border-bottom-color: var(--navy); }
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

blockquote {
  margin: 18px 0;
  padding: 8px 18px;
  color: var(--ink-soft);
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 19px;
  line-height: 1.5;
  border-left: 0;
  position: relative;
}
blockquote::before {
  content: '“';
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 56px;
  line-height: 1;
  color: var(--navy);
  opacity: 0.4;
  position: absolute;
  left: -6px; top: -4px;
}

hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 40px 0;
}

/* hand-drawn section rule (place inside .rule-sketch wrapper) */
.rule-sketch {
  margin: 56px auto 16px;
  width: 100%; max-width: 480px;
  display: flex; justify-content: center;
}
.rule-sketch svg { width: 100%; height: 14px; }
.rule-sketch svg path {
  fill: none; stroke: var(--navy);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.6;
}

/* ───────────────────────── cards ────────────────────────── */
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 1px 0 var(--rule-soft) inset, 0 14px 28px var(--shadow);
  position: relative;
  margin: 16px 0 24px;
  transform: rotate(-0.2deg);
}
.card.straight { transform: none; }
.card.tilt-l { transform: rotate(-0.6deg); }
.card.tilt-r { transform: rotate(0.5deg); }
.card.tilt-strong { transform: rotate(-1deg); }

/* sketch SVG border via mask-composite */
.card::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 14px; padding: 1.5px;
  background: var(--ink);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.28; pointer-events: none;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-top: 0; }

/* ────────────────────── code blocks ─────────────────────── */
/* deep cap-navy ground, warm cream type, syntax tokens picked for contrast */
.code-block {
  position: relative;
  background: #14253f;
  color: #f3ecda;
  border-radius: 10px;
  padding: 18px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0 20px;
  box-shadow: 0 12px 26px var(--shadow);
  border: 1px solid rgba(243, 236, 218, 0.08);
  overflow-x: auto;
}
.code-block .fname {
  display: block;
  color: #b8c8e0;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(243, 236, 218, 0.10);
}
.code-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
.code-block .kw  { color: #dcc5f4; }
.code-block .str { color: #f7d496; }
.code-block .com { color: #a8b6c8; font-style: italic; }
.code-block .key { color: #9ec0ef; font-weight: 500; }
.code-block .val { color: #f3ecda; }
.code-block .h1  { color: #f49274; font-weight: 700; }
.code-block .err { color: #ffadad; }
.code-block .ok  { color: #b6e2b3; }

/* ──────────────────── tables (sticky thead) ─────────────── */
.table-wrap {
  margin: 18px -8px 0;
  padding: 8px 8px 14px;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
table.fixed { table-layout: fixed; }
table.min-880 { min-width: 880px; }
th, td {
  text-align: left;
  padding: 14px 14px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
td { word-wrap: break-word; }
thead { position: sticky; top: 0; z-index: 5; }
th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid var(--rule);
  padding-top: 16px;
  padding-bottom: 12px;
  box-shadow: 0 6px 10px -8px rgba(20, 22, 30, 0.28);
}
td.row-label { font-weight: 600; color: var(--ink); }
tbody tr:hover td { background: var(--sun-soft); }

/* ───────────────────── chips / pills / kbd ──────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 11px; letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--rule);
  background: var(--paper-hi);
  color: var(--ink-soft);
}
.pill.navy { border-color: var(--navy); color: var(--navy-deep); background: var(--navy-soft); }
.pill.clay { border-color: var(--clay); color: var(--clay); background: var(--clay-soft); }
.pill.sage { border-color: var(--sage); color: #4f7a4d; background: var(--sage-soft); }
.pill.sun  { border-color: var(--sun);  color: #8a6310; background: var(--sun-soft); }
.pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--paper-hi);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 0 var(--rule);
  color: var(--ink);
  white-space: nowrap;
}

/* hand-drawn callout / hint card */
.callout {
  position: relative;
  margin: 18px 0 22px;
  padding: 16px 20px 16px 22px;
  background: var(--sky-soft);
  border-radius: 12px;
  color: var(--ink);
  max-width: 70ch;
}
.callout::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 12px; padding: 1.5px;
  background: var(--navy);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.32; pointer-events: none;
}
.callout .label {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 20px;
  color: var(--navy);
  display: block;
  margin-bottom: 4px;
  transform: rotate(-1deg);
  transform-origin: left center;
}
.callout.clay { background: var(--clay-soft); }
.callout.clay::before { background: var(--clay); }
.callout.clay .label { color: var(--clay); }
.callout.sage { background: var(--sage-soft); }
.callout.sage::before { background: var(--sage); }
.callout.sage .label { color: #4f7a4d; }
.callout.sun  { background: var(--sun-soft); }
.callout.sun::before { background: #b07a17; }
.callout.sun .label { color: #8a6310; }

.callout p:last-child { margin-bottom: 0; }
.callout code { background: var(--paper-hi); border-color: var(--rule); }

/* ─────────────── paths list (vault search-path UX) ──────── */
.paths {
  list-style: none; padding: 0; margin: 12px 0 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  max-width: 70ch;
}
.paths li {
  display: flex; gap: 12px; align-items: baseline;
  padding: 10px 14px;
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  background: var(--paper-hi);
  margin-bottom: 6px;
}
.paths li .ord {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  min-width: 20px;
  transform: rotate(-3deg);
  transform-origin: left center;
  display: inline-block;
  color: var(--navy);
}
.paths li .path { color: var(--ink); }
.paths li .note {
  color: var(--muted);
  font-family: 'Caveat', cursive;
  font-size: 17px;
  letter-spacing: 0;
  margin-left: auto;
  transform: rotate(-1deg);
  display: inline-block;
}
.paths li.user .ord, .paths li.user .note  { color: var(--navy); }
.paths li.proj .ord, .paths li.proj .note  { color: #4f7a4d; }
.paths li.carlos .ord, .paths li.carlos .note { color: var(--clay); }

/* ─────────────── phase nodes + corner tag (flow diagrams) ─ */
.flow {
  display: flex; flex-direction: column;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.4;
}
.node {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 7px;
  padding: 9px 11px 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, opacity 0.2s;
  cursor: default;
  position: relative;
  padding-right: 58px;
  --phase-c: var(--muted);
}
.node strong {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--ink);
}
.node .desc {
  font-size: 11px; color: var(--muted);
  margin-top: 3px;
}
.node[data-phase="input"]   { --phase-c: var(--muted); }
.node[data-phase="context"] { --phase-c: #b07a17; }
.node[data-phase="log"]     { --phase-c: var(--ink); }
.node[data-phase="plan"]    { --phase-c: #4f7a4d; }
.node[data-phase="model"]   { --phase-c: var(--clay); }
.node[data-phase="decide"]  { --phase-c: var(--navy); }
.node[data-phase="gate"]    { --phase-c: #b91c1c; }
.node[data-phase="exec"]    { --phase-c: #4f7a4d; }
.node[data-phase="compact"] { --phase-c: var(--clay); }
.node .phase-tag {
  position: absolute;
  top: 6px; right: 11px;
  font-family: 'Caveat', cursive;
  font-weight: 500;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--phase-c);
  opacity: 0.72;
  transform: rotate(-2deg);
  transform-origin: right top;
  pointer-events: none;
}
.diagrams.phase-active .node:not(.phase-active) { opacity: 0.32; }
.node.phase-active {
  background: var(--paper-hi);
  border-color: var(--phase-c);
  box-shadow: 0 4px 12px var(--shadow);
}
.node.phase-active .phase-tag { opacity: 1; transform: rotate(-2deg) scale(1.08); }

.arrow {
  align-self: center;
  width: 14px; height: 14px;
  color: var(--muted);
}
.arrow svg { width: 14px; height: 14px; }
.arrow svg path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.branch {
  display: grid;
  grid-template-columns: 1fr 22px 1fr;
  gap: 6px;
  align-items: stretch;
}
.branch .label {
  align-self: center;
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 16px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: lowercase;
}
.loop-back {
  align-self: center;
  font-family: 'Caveat', cursive;
  color: var(--clay);
  font-size: 17px;
  text-transform: lowercase;
  padding: 6px 0 2px;
  letter-spacing: 0;
}
.loop-back::before { content: '↻ '; }
.ring {
  border: 1.5px dashed var(--rule);
  border-radius: 12px;
  padding: 12px;
  background: var(--paper-hi);
}

/* ──────────────────── docs surface ─────────────────────── */
/* breadcrumbs above hero */
.crumbs {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.crumbs a {
  color: var(--muted);
  border-bottom: 1px dotted transparent;
  padding-bottom: 2px;
}
.crumbs a:hover, .crumbs a:focus-visible { color: var(--ink); border-bottom-color: var(--navy); }
.crumbs .sep {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--rule);
  transform: translateY(-2px);
}
.crumbs .here { color: var(--navy-deep); }

/* docs nav row beneath the brand mark (used on every doc page) */
.docnav {
  position: relative; z-index: 3;
  margin: -6px auto 0;
  max-width: 1080px;
  padding: 0 36px 14px;
  font-size: 12px;
  display: flex; gap: 18px; flex-wrap: wrap;
  border-bottom: 1px dashed var(--rule);
}
.docnav a {
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  padding: 2px 0 6px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.docnav a:hover, .docnav a:focus-visible { color: var(--ink); border-bottom-color: var(--navy); }
.docnav a[aria-current="page"] { color: var(--navy-deep); border-bottom-color: var(--navy); }

/* group grid (docs hub) — sketch cards, grouped by bucket */
.bucket {
  margin: 48px 0 0;
}
.bucket > .bucket-head {
  display: flex; align-items: baseline; gap: 14px;
  margin: 0 0 8px;
}
.bucket > .bucket-head h2 { margin: 0; }
.bucket > .bucket-head .count {
  font-family: 'Caveat', cursive;
  color: var(--muted);
  font-size: 20px;
}
.bucket .blurb { color: var(--muted); max-width: 70ch; margin: 0 0 18px; font-size: 15px; }
.bucket-getting > .bucket-head h2 .accent { color: var(--clay); }
.bucket-concepts > .bucket-head h2 .accent { color: var(--navy); }
.bucket-reference > .bucket-head h2 .accent { color: #4f7a4d; }
.bucket-guides > .bucket-head h2 .accent { color: #8a6310; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 720px) {
  .grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1020px) {
  .grid.three { grid-template-columns: 1fr 1fr 1fr; }
}

.tile {
  position: relative;
  display: block;
  padding: 18px 22px 20px;
  background: var(--card);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  border: 0;
  transform: rotate(-0.25deg);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 1px 0 var(--rule-soft) inset, 0 10px 22px var(--shadow);
}
.tile:nth-child(2n) { transform: rotate(0.35deg); }
.tile:nth-child(3n) { transform: rotate(-0.45deg); }
.tile:hover, .tile:focus-visible {
  transform: rotate(0) translateY(-3px);
  box-shadow: 0 1px 0 var(--rule-soft) inset, 0 18px 36px var(--shadow);
  outline: none;
}
.tile::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 14px; padding: 1.5px;
  background: var(--ink);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.28; pointer-events: none;
}
.tile h3 {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 26px;
  margin: 0 0 4px;
  color: var(--ink);
  letter-spacing: 0;
}
.tile .blurb {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
}
.tile .corner {
  position: absolute;
  top: 8px; right: 14px;
  font-family: 'Caveat', cursive;
  font-size: 14px;
  opacity: 0.72;
  transform: rotate(-2deg);
  transform-origin: right top;
  color: var(--muted);
}
.bucket-getting .tile .corner { color: var(--clay); }
.bucket-concepts .tile .corner { color: var(--navy); }
.bucket-reference .tile .corner { color: #4f7a4d; }
.bucket-guides .tile .corner { color: #8a6310; }

/* prev/next nav at the bottom of each doc page */
.prevnext {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 48px 0 0;
}
@media (max-width: 600px) {
  .prevnext { grid-template-columns: 1fr; }
}
.prevnext a {
  display: block;
  padding: 14px 18px;
  background: var(--card);
  border-radius: 12px;
  border: 0;
  color: var(--ink);
  text-decoration: none;
  position: relative;
  box-shadow: 0 1px 0 var(--rule-soft) inset, 0 6px 14px var(--shadow);
  transition: transform 0.18s ease;
}
.prevnext a::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 12px; padding: 1.5px;
  background: var(--ink);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.24; pointer-events: none;
}
.prevnext a:hover, .prevnext a:focus-visible {
  transform: translateY(-2px);
}
.prevnext a .dir {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  color: var(--muted);
  display: block;
}
.prevnext a .title {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.prevnext a.next { text-align: right; }

/* skip link for keyboard / AT users */
.skip-link {
  position: absolute;
  top: -40px; left: 14px;
  background: var(--navy-deep);
  color: var(--paper-hi);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.12s;
}
.skip-link:focus {
  top: 12px;
  outline: 2px solid var(--sun);
  outline-offset: 2px;
}

/* on-page TOC (sticky) — used inside .with-toc layout */
.with-toc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
}
@media (min-width: 980px) {
  .with-toc { grid-template-columns: minmax(0, 1fr) 220px; }
}
.toc {
  position: sticky;
  top: 32px;
  align-self: start;
  font-size: 13px;
  border-left: 1px dashed var(--rule);
  padding-left: 18px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.toc h4 {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.toc ul { list-style: none; padding: 0; margin: 0; max-width: none; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 4px 0;
  color: var(--ink-soft);
  border-bottom: 0;
  font-size: 13px;
  line-height: 1.35;
}
.toc a:hover { color: var(--navy-deep); }
.toc a.is-current {
  color: var(--navy-deep); font-weight: 600;
}

/* responsive shrinks */
@media (max-width: 700px) {
  h1 { font-size: 44px; }
  h2 { font-size: 30px; }
  header.site, footer.site { padding: 18px 22px; }
  .docnav { padding-left: 22px; padding-right: 22px; }
  main { padding: 16px 22px 60px; }
  .card, .callout { padding-left: 18px; padding-right: 18px; }
}

/* ──────────────────── accessibility ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .tile, .prevnext a, .card { transform: none !important; }
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* selection styling */
::selection { background: var(--sun-soft); color: var(--ink); }
