/* Mycelio theme for arthurgrau. The site and the app demos in /demos/ both load this file.
   Source of truth: design/mycelio-system.md. Sections below follow it:
   1 fonts · 2 tokens · 3 base type · 4 layout · 5 interaction · 6 site parts · 7 entry · 8 cards · 9 Mycelio drawing */

/* ---------- 1. Fonts (self-hosted, Latin subset; §7) ---------- */
@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-roman.woff2') format('woff2');
  font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Piazzolla';
  src: url('/fonts/piazzolla-roman.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Piazzolla';
  src: url('/fonts/piazzolla-italic.woff2') format('woff2');
  font-weight: 100 900; font-style: italic; font-display: swap;
}

/* ---------- 2. Tokens (§8) ---------- */
:root {
  --font-display: 'Archivo', sans-serif;
  --font-body: 'Piazzolla', serif;

  --bg: #f7f8fa; --ink: #14171a; --ink-2: #4a5159; --ink-3: #6a727b;
  --accent: #5a7612; --on-accent: #f7f8fa; --line: rgba(20,23,26,.12);
  --accent-deep: color-mix(in srgb, var(--accent) 72%, var(--ink));
  --tint: color-mix(in srgb, var(--accent) 14%, transparent);
  --band: #eceef1; /* not final: §9 */

  --draw-vermilion: #b8361c; --draw-lichen: #5a7612; --draw-dusty-blue: #3f6680;
  --chart-1: #3a6fb3; --chart-2: #4a8636; --chart-3: #9a4a96;
  --chart-4: #b07a0c; --chart-5: #008f85; --chart-6: #c0393a;

  --s-2: clamp(11.25px, 13.07px - 0.152vw, 12.5px);
  --s-1: 15px;
  --s0:  clamp(18px, 17.09px + 0.242vw, 20px);
  --s1:  clamp(21.6px, 19.27px + 0.620vw, 26.66px);
  --s2:  clamp(25.92px, 21.60px + 1.152vw, 35.55px);
  --s3:  clamp(31.10px, 23.70px + 1.973vw, 47.39px);
  --s4:  clamp(37.32px, 25.53px + 3.144vw, 63.18px);
  --lh-body: 1.5; --lh-head: 1.08; --lh-tight: 1.4;

  --unit: calc(var(--s0) * var(--lh-body));
  --sp-1: calc(var(--unit) * .33); --sp-2: calc(var(--unit) * .66); --sp-3: var(--unit);
  --sp-4: calc(var(--unit) * 1.25); --sp-5: calc(var(--unit) * 2);
  --sp-6: calc(var(--unit) * 2.75); --sp-7: calc(var(--unit) * 4);

  --edge: clamp(16px, 3vw, 48px);
  --gap: var(--sp-5);
  --measure: 65ch;

  --radius: 4px;
  --dur: 150ms; --dur-grow: 220ms;
  --tint-reach: .45em;
  --caret: 7px; --caret-w: 1.5px;
  --grow: 1.02;

  --draw: var(--ink); /* this page's drawing color; set per section/entry */
}
/* Dark: follows the computer's setting, unless the header toggle chose one (html[data-theme]) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d0f11; --ink: #eceef0; --ink-2: #a7afb7; --ink-3: #868e96;
    --accent: #b4cf3a; --on-accent: #0d0f11; --line: rgba(236,238,240,.12);
    --band: #16191c;
    --draw-vermilion: #ff8466; --draw-lichen: #b4cf3a; --draw-dusty-blue: #8fb0c8;
    --chart-1: #5b93db; --chart-2: #5fa047; --chart-3: #b874b4;
    --chart-4: #c08a2a; --chart-5: #1fa89c; --chart-6: #e0605c;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0d0f11; --ink: #eceef0; --ink-2: #a7afb7; --ink-3: #868e96;
  --accent: #b4cf3a; --on-accent: #0d0f11; --line: rgba(236,238,240,.12);
  --band: #16191c;
  --draw-vermilion: #ff8466; --draw-lichen: #b4cf3a; --draw-dusty-blue: #8fb0c8;
  --chart-1: #5b93db; --chart-2: #5fa047; --chart-3: #b874b4;
  --chart-4: #c08a2a; --chart-5: #1fa89c; --chart-6: #e0605c;
  color-scheme: dark;
}
:root[data-theme='light'] { color-scheme: light; }
[data-draw='ink']        { --draw: var(--ink); }
[data-draw='vermilion']  { --draw: var(--draw-vermilion); }
[data-draw='lichen']     { --draw: var(--draw-lichen); }
[data-draw='dusty-blue'] { --draw: var(--draw-dusty-blue); }

/* The divider: a light pencil line (src/lib/pencil-rule.js). Use: background: var(--pencil-rule) top left / 100% 6px no-repeat */
/* PENCIL RULE: generated by src/lib/pencil-rule.js, do not edit by hand */
:root{--pencil-rule:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201200%206%22%20preserveAspectRatio%3D%22none%22%20fill%3D%22none%22%20stroke%3D%22rgba(20%2C23%2C26%2C.30)%22%20stroke-linecap%3D%22butt%22%3E%3Cg%20stroke-width%3D%221%22%3E%3Cpath%20d%3D%22M3.2%202.8L15.2%202.9L27.2%202.9M435.2%203.1L447.2%203L459.2%203.1M555.2%203.3L567.2%203.4L579.2%203.5%22%20stroke-opacity%3D%220.4%22%2F%3E%3Cpath%20d%3D%22M27.2%202.9L39.2%202.8L51.2%202.8M219.2%202.7L231.2%202.8L243.2%203M315.2%203.2L327.2%203.2L339.2%203.2M339.2%203.2L351.2%203.2L363.2%203.2M363.2%203.2L375.2%203.2L387.2%203.1M387.2%203.1L399.2%203.1L411.2%203.1M603.2%203.5L615.2%203.4L627.2%203.4M627.2%203.4L639.2%203.5L651.2%203.5M651.2%203.5L663.2%203.3L675.2%203.3M675.2%203.3L687.2%203.3L699.2%203.3M699.2%203.3L711.2%203.2L723.2%203.1M723.2%203.1L735.2%203L747.2%203.1M747.2%203.1L759.2%203.1L771.2%203.1M771.2%203.1L783.2%203L795.2%203%22%20stroke-opacity%3D%220.6%22%2F%3E%3Cpath%20d%3D%22M51.2%202.8L63.2%202.8L75.2%202.8M171.2%202.6L183.2%202.7L195.2%202.8M819.2%203.1L831.2%203.1L843.2%203.1M963.2%202.9L975.2%202.9L987.2%202.9%22%20stroke-opacity%3D%220.8%22%2F%3E%3Cpath%20d%3D%22M75.2%202.8L87.2%202.8L99.2%202.7M99.2%202.7L111.2%202.6L123.2%202.7M123.2%202.7L135.2%202.7L147.2%202.6M147.2%202.6L159.2%202.6L171.2%202.6M843.2%203.1L855.2%203.1L867.2%203.2M867.2%203.2L879.2%203.2L891.2%203.1M915.2%203.1L927.2%203.2L939.2%203.1M939.2%203.1L951.2%203L963.2%202.9%22%20stroke-opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M195.2%202.8L207.2%202.7L219.2%202.7M795.2%203L807.2%203.1L819.2%203.1M987.2%202.9L999.2%202.8L1011.2%202.7M1011.2%202.7L1023.2%202.7L1035.2%202.7M1035.2%202.7L1047.2%202.7L1059.2%202.6M1059.2%202.6L1071.2%202.5L1083.2%202.6M1083.2%202.6L1095.2%202.7L1107.2%202.7M1107.2%202.7L1119.2%202.6L1131.2%202.7M1131.2%202.7L1143.2%202.8L1155.2%202.8%22%20stroke-opacity%3D%220.7%22%2F%3E%3Cpath%20d%3D%22M243.2%203L255.2%203L267.2%203M267.2%203L279.2%203L291.2%203.1M291.2%203.1L303.2%203.2L315.2%203.2M411.2%203.1L423.2%203.1L435.2%203.1M579.2%203.5L591.2%203.5L603.2%203.5M1155.2%202.8L1167.2%202.8L1179.2%202.8%22%20stroke-opacity%3D%220.5%22%2F%3E%3Cpath%20d%3D%22M459.2%203.1L471.2%203.1L483.2%203.2M483.2%203.2L495.2%203.1L507.2%203.1M507.2%203.1L519.2%203.2L531.2%203.3M531.2%203.3L543.2%203.3L555.2%203.3M1179.2%202.8L1187.6%202.8L1196.1%202.8%22%20stroke-opacity%3D%220.3%22%2F%3E%3Cpath%20d%3D%22M891.2%203.1L903.2%203.1L915.2%203.1%22%20stroke-opacity%3D%221%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M6%202.5L36%202.6L66%202.7L96%202.7L126%202.8L156%202.8L186%202.9L216%202.9L246%203.1L276%203L306%203.1L336%202.9L366%202.9L396%202.7L426%202.7L456%202.7L486%202.9L516%203.1L546%203.4L576%203.6L606%203.7L636%203.7L666%203.5L696%203.3L726%203L756%202.9L786%202.7L816%202.8L846%202.7L876%202.9L906%202.8L936%202.9L966%202.9L996%202.9L1026%202.8L1056%202.8L1086%202.8L1116%202.8L1146%202.8L1176%202.7%22%20stroke-width%3D%22.6%22%20stroke-opacity%3D%22.35%22%2F%3E%3C%2Fsvg%3E")}:root[data-theme='dark']{--pencil-rule:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201200%206%22%20preserveAspectRatio%3D%22none%22%20fill%3D%22none%22%20stroke%3D%22rgba(236%2C238%2C240%2C.22)%22%20stroke-linecap%3D%22butt%22%3E%3Cg%20stroke-width%3D%221%22%3E%3Cpath%20d%3D%22M3.2%202.8L15.2%202.9L27.2%202.9M435.2%203.1L447.2%203L459.2%203.1M555.2%203.3L567.2%203.4L579.2%203.5%22%20stroke-opacity%3D%220.4%22%2F%3E%3Cpath%20d%3D%22M27.2%202.9L39.2%202.8L51.2%202.8M219.2%202.7L231.2%202.8L243.2%203M315.2%203.2L327.2%203.2L339.2%203.2M339.2%203.2L351.2%203.2L363.2%203.2M363.2%203.2L375.2%203.2L387.2%203.1M387.2%203.1L399.2%203.1L411.2%203.1M603.2%203.5L615.2%203.4L627.2%203.4M627.2%203.4L639.2%203.5L651.2%203.5M651.2%203.5L663.2%203.3L675.2%203.3M675.2%203.3L687.2%203.3L699.2%203.3M699.2%203.3L711.2%203.2L723.2%203.1M723.2%203.1L735.2%203L747.2%203.1M747.2%203.1L759.2%203.1L771.2%203.1M771.2%203.1L783.2%203L795.2%203%22%20stroke-opacity%3D%220.6%22%2F%3E%3Cpath%20d%3D%22M51.2%202.8L63.2%202.8L75.2%202.8M171.2%202.6L183.2%202.7L195.2%202.8M819.2%203.1L831.2%203.1L843.2%203.1M963.2%202.9L975.2%202.9L987.2%202.9%22%20stroke-opacity%3D%220.8%22%2F%3E%3Cpath%20d%3D%22M75.2%202.8L87.2%202.8L99.2%202.7M99.2%202.7L111.2%202.6L123.2%202.7M123.2%202.7L135.2%202.7L147.2%202.6M147.2%202.6L159.2%202.6L171.2%202.6M843.2%203.1L855.2%203.1L867.2%203.2M867.2%203.2L879.2%203.2L891.2%203.1M915.2%203.1L927.2%203.2L939.2%203.1M939.2%203.1L951.2%203L963.2%202.9%22%20stroke-opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M195.2%202.8L207.2%202.7L219.2%202.7M795.2%203L807.2%203.1L819.2%203.1M987.2%202.9L999.2%202.8L1011.2%202.7M1011.2%202.7L1023.2%202.7L1035.2%202.7M1035.2%202.7L1047.2%202.7L1059.2%202.6M1059.2%202.6L1071.2%202.5L1083.2%202.6M1083.2%202.6L1095.2%202.7L1107.2%202.7M1107.2%202.7L1119.2%202.6L1131.2%202.7M1131.2%202.7L1143.2%202.8L1155.2%202.8%22%20stroke-opacity%3D%220.7%22%2F%3E%3Cpath%20d%3D%22M243.2%203L255.2%203L267.2%203M267.2%203L279.2%203L291.2%203.1M291.2%203.1L303.2%203.2L315.2%203.2M411.2%203.1L423.2%203.1L435.2%203.1M579.2%203.5L591.2%203.5L603.2%203.5M1155.2%202.8L1167.2%202.8L1179.2%202.8%22%20stroke-opacity%3D%220.5%22%2F%3E%3Cpath%20d%3D%22M459.2%203.1L471.2%203.1L483.2%203.2M483.2%203.2L495.2%203.1L507.2%203.1M507.2%203.1L519.2%203.2L531.2%203.3M531.2%203.3L543.2%203.3L555.2%203.3M1179.2%202.8L1187.6%202.8L1196.1%202.8%22%20stroke-opacity%3D%220.3%22%2F%3E%3Cpath%20d%3D%22M891.2%203.1L903.2%203.1L915.2%203.1%22%20stroke-opacity%3D%221%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M6%202.5L36%202.6L66%202.7L96%202.7L126%202.8L156%202.8L186%202.9L216%202.9L246%203.1L276%203L306%203.1L336%202.9L366%202.9L396%202.7L426%202.7L456%202.7L486%202.9L516%203.1L546%203.4L576%203.6L606%203.7L636%203.7L666%203.5L696%203.3L726%203L756%202.9L786%202.7L816%202.8L846%202.7L876%202.9L906%202.8L936%202.9L966%202.9L996%202.9L1026%202.8L1056%202.8L1086%202.8L1116%202.8L1146%202.8L1176%202.7%22%20stroke-width%3D%22.6%22%20stroke-opacity%3D%22.35%22%2F%3E%3C%2Fsvg%3E")}@media (prefers-color-scheme: dark){:root:not([data-theme='light']){--pencil-rule:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201200%206%22%20preserveAspectRatio%3D%22none%22%20fill%3D%22none%22%20stroke%3D%22rgba(236%2C238%2C240%2C.22)%22%20stroke-linecap%3D%22butt%22%3E%3Cg%20stroke-width%3D%221%22%3E%3Cpath%20d%3D%22M3.2%202.8L15.2%202.9L27.2%202.9M435.2%203.1L447.2%203L459.2%203.1M555.2%203.3L567.2%203.4L579.2%203.5%22%20stroke-opacity%3D%220.4%22%2F%3E%3Cpath%20d%3D%22M27.2%202.9L39.2%202.8L51.2%202.8M219.2%202.7L231.2%202.8L243.2%203M315.2%203.2L327.2%203.2L339.2%203.2M339.2%203.2L351.2%203.2L363.2%203.2M363.2%203.2L375.2%203.2L387.2%203.1M387.2%203.1L399.2%203.1L411.2%203.1M603.2%203.5L615.2%203.4L627.2%203.4M627.2%203.4L639.2%203.5L651.2%203.5M651.2%203.5L663.2%203.3L675.2%203.3M675.2%203.3L687.2%203.3L699.2%203.3M699.2%203.3L711.2%203.2L723.2%203.1M723.2%203.1L735.2%203L747.2%203.1M747.2%203.1L759.2%203.1L771.2%203.1M771.2%203.1L783.2%203L795.2%203%22%20stroke-opacity%3D%220.6%22%2F%3E%3Cpath%20d%3D%22M51.2%202.8L63.2%202.8L75.2%202.8M171.2%202.6L183.2%202.7L195.2%202.8M819.2%203.1L831.2%203.1L843.2%203.1M963.2%202.9L975.2%202.9L987.2%202.9%22%20stroke-opacity%3D%220.8%22%2F%3E%3Cpath%20d%3D%22M75.2%202.8L87.2%202.8L99.2%202.7M99.2%202.7L111.2%202.6L123.2%202.7M123.2%202.7L135.2%202.7L147.2%202.6M147.2%202.6L159.2%202.6L171.2%202.6M843.2%203.1L855.2%203.1L867.2%203.2M867.2%203.2L879.2%203.2L891.2%203.1M915.2%203.1L927.2%203.2L939.2%203.1M939.2%203.1L951.2%203L963.2%202.9%22%20stroke-opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M195.2%202.8L207.2%202.7L219.2%202.7M795.2%203L807.2%203.1L819.2%203.1M987.2%202.9L999.2%202.8L1011.2%202.7M1011.2%202.7L1023.2%202.7L1035.2%202.7M1035.2%202.7L1047.2%202.7L1059.2%202.6M1059.2%202.6L1071.2%202.5L1083.2%202.6M1083.2%202.6L1095.2%202.7L1107.2%202.7M1107.2%202.7L1119.2%202.6L1131.2%202.7M1131.2%202.7L1143.2%202.8L1155.2%202.8%22%20stroke-opacity%3D%220.7%22%2F%3E%3Cpath%20d%3D%22M243.2%203L255.2%203L267.2%203M267.2%203L279.2%203L291.2%203.1M291.2%203.1L303.2%203.2L315.2%203.2M411.2%203.1L423.2%203.1L435.2%203.1M579.2%203.5L591.2%203.5L603.2%203.5M1155.2%202.8L1167.2%202.8L1179.2%202.8%22%20stroke-opacity%3D%220.5%22%2F%3E%3Cpath%20d%3D%22M459.2%203.1L471.2%203.1L483.2%203.2M483.2%203.2L495.2%203.1L507.2%203.1M507.2%203.1L519.2%203.2L531.2%203.3M531.2%203.3L543.2%203.3L555.2%203.3M1179.2%202.8L1187.6%202.8L1196.1%202.8%22%20stroke-opacity%3D%220.3%22%2F%3E%3Cpath%20d%3D%22M891.2%203.1L903.2%203.1L915.2%203.1%22%20stroke-opacity%3D%221%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M6%202.5L36%202.6L66%202.7L96%202.7L126%202.8L156%202.8L186%202.9L216%202.9L246%203.1L276%203L306%203.1L336%202.9L366%202.9L396%202.7L426%202.7L456%202.7L486%202.9L516%203.1L546%203.4L576%203.6L606%203.7L636%203.7L666%203.5L696%203.3L726%203L756%202.9L786%202.7L816%202.8L846%202.7L876%202.9L906%202.8L936%202.9L966%202.9L996%202.9L1026%202.8L1056%202.8L1086%202.8L1116%202.8L1146%202.8L1176%202.7%22%20stroke-width%3D%22.6%22%20stroke-opacity%3D%22.35%22%2F%3E%3C%2Fsvg%3E")}}
/* END PENCIL RULE */

/* ---------- 3. Base type (§2) ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: var(--s0); line-height: var(--lh-body);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-family: var(--font-display); font-stretch: 62%; font-weight: 800; line-height: var(--lh-head); margin: 0; }
h1 { font-size: var(--s4); }
h2 { font-size: var(--s2); }
h3 { font-size: var(--s1); letter-spacing: .015em; }
/* h4: a part inside a h3 section (sample 08): bold, less condensed, body size */
h4 { font-family: var(--font-display); font-weight: 700; font-stretch: 87%; font-size: var(--s0); line-height: var(--lh-head); letter-spacing: .01em; margin: 0; }
/* No Archivo italic is loaded, so italics in headings are a slanted roman that leans into the next word: give it room */
:is(h1, h2, h3) :is(em, i) { padding-right: .14em; }
p, ul, ol, blockquote, figure { margin: 0; }
.dek { font-style: italic; font-weight: 300; font-size: var(--s1); line-height: var(--lh-tight); color: var(--ink-2); }
figcaption { font-style: italic; font-weight: 300; font-size: var(--s-1); line-height: var(--lh-tight); color: var(--ink-2); margin-top: var(--sp-1); }
img, iframe, video { max-width: 100%; display: block; }
img { height: auto; }

/* ---------- 4. Layout: full width, rows of 1–3 columns (§2) ---------- */
.page { padding: var(--sp-5) var(--edge) var(--sp-7); display: grid; gap: var(--gap); }
.row { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 640px)  { .cols-2, .cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cols-3 { grid-template-columns: repeat(3, 1fr); } }
.row > * { min-width: 0; }
.bleed { margin-inline: calc(var(--edge) * -1); }
.band { background: var(--band); margin-inline: calc(var(--edge) * -1); padding: var(--sp-6) var(--edge); }
.module { display: grid; gap: var(--sp-2); align-content: start; }
/* Text never runs wider than the reading width */
:where(.module, .prose, .band) > :where(p, h1, h2, h3, ul, ol, blockquote, .dek, figcaption) { max-width: var(--measure); }

/* ---------- 5. Interaction (§2): no outlines; tint + corner caret for keyboard focus ---------- */
:focus { outline: none; }
a {
  color: var(--accent); text-underline-offset: .2em;
  text-decoration: underline 1px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: text-decoration-color var(--dur), background-color var(--dur), color var(--dur);
}
a:hover { text-decoration-color: var(--accent); }
/* A link that is a heading takes the heading's ink, not the accent: quiet underline, darker on hover */
:is(h1, h2, h3, h4) a { color: inherit; text-decoration-color: var(--line); }
:is(h1, h2, h3, h4) a:hover { text-decoration-color: currentColor; }
a:active { opacity: .7; }

/* Focus: tint reaching past the words, plus the corner caret */
a, button, .card { position: relative; }
a:not(.card):focus-visible {
  background: var(--tint); text-decoration-color: var(--accent); border-radius: var(--radius);
  padding-inline: var(--tint-reach); margin-inline: calc(var(--tint-reach) * -1);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
:where(a, button, .card)::after {
  content: ''; position: absolute; pointer-events: none;
  top: calc(var(--caret-y, 1px) * -1); right: calc(var(--caret-x, 2px) * -1);
  width: var(--caret); height: var(--caret);
  border-top: var(--caret-w) solid var(--accent); border-right: var(--caret-w) solid var(--accent);
  opacity: 0; transform: translate(-2px, 2px); transition: opacity var(--dur), transform var(--dur);
}
:where(a, button, .card):focus-visible::after { opacity: 1; transform: none; }

/* Buttons */
.btn {
  font-family: var(--font-display); font-weight: 400; font-size: var(--s-1);
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.25em;
  border-radius: var(--radius); border: 1.5px solid var(--accent); cursor: pointer; text-decoration: none;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
  --caret-x: 5px; --caret-y: 5px;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover:not(:disabled) { background: var(--tint); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover:not(:disabled) { border-color: var(--ink-2); }
.btn:focus-visible { background: var(--tint); color: var(--accent); border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Form fields */
input, textarea, select {
  font: var(--s0) var(--font-body); color: var(--ink); background: transparent;
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: .5em .7em; min-height: 44px;
  transition: border-color var(--dur), background-color var(--dur);
}
:where(input, textarea, select):hover:not(:disabled) { border-color: var(--ink-3); }
:where(input, textarea, select):focus { border-color: var(--accent); background: var(--tint); }
:where(input, textarea, select):disabled { opacity: .4; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation: none !important; }
}

/* ---------- 6. Site header and footer ---------- */
.site-header {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: baseline; justify-content: space-between;
  padding: var(--sp-3) var(--edge) 0; font-family: var(--font-display); font-size: var(--s-1);
}
.site-header { align-items: center; }
.site-name { color: var(--ink); text-decoration: none; font-weight: 400; font-size: var(--s0); } /* on par with body text */
.site-header a:focus-visible { color: var(--ink); }

/* Light/dark toggle: sun and moon, simple line icons */
.theme-toggle {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -12px -12px -12px 0;
  background: none; border: 0; border-radius: var(--radius); color: var(--ink-2); cursor: pointer;
  transition: color var(--dur), background-color var(--dur);
  --caret-x: 2px; --caret-y: 2px;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle:focus-visible { background: var(--tint); color: var(--ink); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun { display: none; }
:root[data-theme='dark'] .theme-toggle .sun { display: block; }
:root[data-theme='dark'] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .sun { display: block; }
  :root:not([data-theme='light']) .theme-toggle .moon { display: none; }
}

/* Footer: its own ground (--band); section menu on the left, copyright on the right */
.site-footer {
  background: var(--band); padding: var(--sp-5) var(--edge);
  display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); align-items: baseline; justify-content: space-between;
  font-family: var(--font-display); font-size: var(--s-1); color: var(--ink-3);
}
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); }
.site-footer nav a { color: var(--ink-2); text-decoration: none; border-bottom: 1.5px solid transparent; padding-bottom: 2px; transition: color var(--dur), border-color var(--dur), background-color var(--dur); }
.site-footer nav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.site-footer nav a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--accent); }
.site-footer a:focus-visible { color: var(--ink); }
/* The ask, on the right: a link in the footer's ink with a quiet underline, like links in headings */
.site-footer .footer-ask strong { color: var(--draw-vermilion); font-weight: 700; }
.site-footer .footer-ask a { color: var(--ink); text-decoration-color: var(--line); }
.site-footer .footer-ask a:hover { text-decoration-color: currentColor; }
/* Footer always at the bottom, even on short pages */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1 0 auto; width: 100%; align-content: start; }

/* ---------- 7. Entry pages ---------- */
.entry-head { align-items: center; }
@media (min-width: 1024px) { .entry-head { grid-template-columns: 1fr 1fr; } }
.prose { display: grid; gap: 0; }
.prose > * + * { margin-top: var(--sp-3); }
/* Headings: more room above than below, so each one sits with the text it introduces */
.prose > h2 { margin-top: var(--sp-6); }
.prose > h3 { margin-top: var(--sp-5); }
.prose > h4 { margin-top: var(--sp-4); }
.prose > h3 + h4 { margin-top: var(--sp-2); }
.prose > h2 + *, .prose > h3 + *, .prose > h4 + * { margin-top: var(--sp-1); }
.prose > :where(.row, .band, .figure-full, .embed) { margin-block: var(--sp-5); }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose blockquote { border-left: 1.5px solid var(--line); padding-left: var(--sp-3); color: var(--ink-2); }

/* A case's parts: <Phase name="Observe"> (sample 08). The word is the theory framing the case, set in a
   subtle half tone in a margin column that stays in view; above its part on tablets and phones. */
.phase { --phase-ink: color-mix(in srgb, var(--ink) 24%, var(--bg)); display: grid; gap: var(--sp-2); background: var(--pencil-rule) top left / 100% 6px no-repeat; padding-top: var(--sp-4); }
:root[data-theme='dark'] .phase { --phase-ink: color-mix(in srgb, var(--ink) 38%, var(--bg)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .phase { --phase-ink: color-mix(in srgb, var(--ink) 38%, var(--bg)); } }
.prose > .phase { margin-top: var(--sp-6); }
.prose > .outcomes + .phase { margin-top: 0; background: none; } /* the Outcomes line already divides */
.phase-head { display: grid; justify-items: start; gap: var(--sp-1); }
.phase-head h2 { color: var(--phase-ink); }

/* The marks (src/lib/phase-marks.js): drawn in slowly when they come into view (src/scripts/phase-marks.ts),
   in the page's drawing color; the slow waver is SVG <animate> inside each mark (src/lib/phase-marks.js). */
.phase-mark { width: 48px; height: 48px; flex: none; color: var(--draw); overflow: visible; }
.phase-mark path { vector-effect: non-scaling-stroke; }
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .phase-mark path { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .phase-mark.is-drawn path { animation: pm-draw var(--du) cubic-bezier(.45, .05, .35, 1) var(--dl) forwards; }
}
@keyframes pm-draw { to { stroke-dashoffset: 0; } }

.phase-body > :first-child { margin-top: 0; }
@media (min-width: 1024px) {
  .phase { grid-template-columns: minmax(9rem, 1fr) 4fr; gap: var(--gap); }
  .phase-head { position: sticky; top: var(--sp-4); align-self: start; }
  .phase-mark { width: 64px; height: 64px; }
}

/* Facts: <Facts><Fact label="Role">…</Fact></Facts>, short details as rows under a thin rule */
.facts { display: grid; grid-template-columns: max-content 1fr; align-items: baseline; gap: var(--sp-1) var(--sp-3); background: var(--pencil-rule) top left / 100% 6px no-repeat; padding-top: var(--sp-3); margin: 0; max-width: var(--measure); }
.prose > .facts { margin-top: var(--sp-4); }
.facts dt { font-family: var(--font-display); font-weight: 700; font-stretch: 87%; letter-spacing: .01em; }
.facts dd { margin: 0; }

/* Outcomes: one band between two thin rules; a number beside its label, or a plain statement */
.outcomes { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); background: var(--pencil-rule) top left / 100% 6px no-repeat, var(--pencil-rule) bottom right / 100% 6px no-repeat; padding-block: var(--sp-3); }
.prose > .outcomes { margin-block: var(--sp-3) var(--sp-5); }
.outcomes .stat { display: flex; gap: .4em; align-items: center; max-width: 24ch; margin: 0; }
.outcomes .stat-text { max-width: var(--measure); }
.outcomes .stat-n { font-family: var(--font-display); font-weight: 800; font-stretch: 62%; font-size: var(--s2); line-height: 1; }
.outcomes .stat-l { font-size: var(--s-1); line-height: var(--lh-tight); color: var(--ink-2); }
.outcomes .stat-text .stat-l { font-size: var(--s0); line-height: var(--lh-body); color: var(--ink); }

/* References: Markdown footnotes, shown as numbered references (§2) */
.prose [data-footnote-ref] { font-family: var(--font-display); font-weight: 500; color: var(--ink-3); text-decoration: none; padding-inline: .1em; }
.prose sup:has([data-footnote-ref]) { font-size: .62em; line-height: 0; }
.prose [data-footnote-ref]::before { content: '['; }
.prose [data-footnote-ref]::after { content: ']'; position: static; width: auto; height: auto; border: 0; opacity: 1; transform: none; }
.prose .footnotes { margin-top: var(--sp-6); background: var(--pencil-rule) top left / 100% 6px no-repeat; padding-top: var(--sp-3); }
/* The Markdown engine labels the list "Footnotes" and hides it; show it as "References" */
.prose .footnotes > h2 { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; font-size: 0; margin-bottom: var(--sp-2); }
.prose .footnotes > h2::before { content: 'References'; font-size: var(--s1); }
.prose .footnotes ol { list-style: none; padding: 0; counter-reset: ref; display: grid; gap: var(--sp-2); font-size: var(--s-1); line-height: var(--lh-tight); color: var(--ink-2); max-width: var(--measure); }
.prose .footnotes li { counter-increment: ref; padding-left: 2.2em; position: relative; }
.prose .footnotes li::before { content: '[' counter(ref) ']'; position: absolute; left: 0; font-family: var(--font-display); color: var(--ink-3); }
.prose .footnotes li p { margin: 0; }
.prose [data-footnote-backref] { text-decoration: none; margin-left: .3em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Blocks used inside entries (src/components) */
.prose > .slides { margin-block: var(--sp-5); }
/* Decks: two-thirds of the page width on desktop; full width on tablets and phones */
@media (min-width: 1024px) { .slides { width: calc(200% / 3); } }

/* Sideways rows: slideshows and Related (src/scripts/carousel.ts adds the arrows) */
.slides { display: grid; gap: var(--sp-2); }
.slides-track {
  /* As tall as the tallest image (at most 80% of the window). No background: images of one size fill it;
     smaller or narrower ones sit on the page itself, never on a grey band. */
  display: flex; align-items: center; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  border-radius: var(--radius); scrollbar-width: none;
}
.slides-track::-webkit-scrollbar, .related-track::-webkit-scrollbar { display: none; }
.slides-track:focus-visible { background: var(--tint); }
.slides-track > * { flex: 0 0 100%; margin: 0 !important; max-width: none !important; scroll-snap-align: center; display: flex; justify-content: center; }
.slides-track img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
.carousel-bar { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font-display); font-size: var(--s-1); color: var(--ink-2); }
.carousel-bar[hidden] { display: none; }

/* Cookie notice (Base.astro): a small box, bottom right, until a choice is made. */
.consent {
  position: fixed; z-index: 50; right: var(--edge); bottom: var(--sp-3); max-width: calc(100% - 2 * var(--edge));
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3); background: var(--band); border-radius: var(--radius);
  font-size: var(--s-1); color: var(--ink-2);
}
.consent[hidden] { display: none; }
.consent p { margin: 0; }
.consent-actions { display: flex; gap: var(--sp-1); }
@media (max-width: 480px) { .consent { padding-left: var(--sp-2); gap: var(--sp-1); } }
.consent button {
  font: inherit; color: var(--ink); background: none; border: 1px solid var(--line); border-radius: var(--radius);
  padding: .3em .7em; cursor: pointer; transition: border-color var(--dur), background-color var(--dur);
}
.consent button:hover { border-color: var(--ink-3); }
.consent button:focus-visible { background: var(--tint); }
.carousel-bar button {
  width: 44px; height: 44px; display: inline-grid; place-items: center; font: inherit; font-size: var(--s0);
  color: var(--ink-2); background: none; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
  transition: color var(--dur), border-color var(--dur), background-color var(--dur), opacity var(--dur);
}
.carousel-bar button:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-3); }
.carousel-bar button:focus-visible { background: var(--tint); color: var(--ink); }
.carousel-bar button:disabled { opacity: .35; cursor: default; }
.carousel-count { min-width: 4.5em; text-align: center; font-variant-numeric: tabular-nums; }
.figure-full { margin-inline: 0; }
.embed iframe { width: 100%; border: 0; border-radius: var(--radius); background: var(--band); }
@media (min-width: 1280px) { .embed.two-thirds { max-width: calc(100% * 2 / 3); } }

/* ---------- 8. Cards (§2 Cards) ---------- */
.card {
  isolation: isolate; display: grid; gap: var(--sp-1); align-content: start;
  text-decoration: none; color: var(--ink);
  transition: transform var(--dur-grow) ease-out;
  --caret-x: var(--sp-2); --caret-y: var(--sp-2);
}
.card::before {
  content: ''; position: absolute; inset: calc(var(--sp-2) * -1); z-index: -1;
  /* Hover tint follows the card's drawing color (red on Portfolio, etc.) */
  background: color-mix(in srgb, var(--draw) 14%, transparent); border-radius: var(--radius); opacity: 0; transition: opacity var(--dur-grow);
}
.card:hover, .card:focus-visible { transform: scale(var(--grow)); }
.card:hover::before, .card:focus-visible::before { opacity: 1; }
.card .thumb {
  /* The drawing file is a shape; the page colors it, so it follows the theme toggle and the drawing color */
  display: block; aspect-ratio: 4 / 3; width: 100%; background: var(--draw); will-change: transform;
  -webkit-mask: var(--src) center / contain no-repeat; mask: var(--src) center / contain no-repeat;
}
/* Title: as long as it needs to be on the entry page; trimmed to two lines on the card */
.card .card-title {
  font-size: var(--s1); transition: color var(--dur); min-height: calc(2em * var(--lh-head));
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.card:hover .card-title, .card:focus-visible .card-title { color: var(--draw); }
.card .dek {
  font-size: var(--s-1); min-height: calc(3em * var(--lh-tight));
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
@media (prefers-reduced-motion: reduce) { .card:hover, .card:focus-visible { transform: none; } }

/* "Related": the section's other entries. One row of six (3 on tablets, 2 on phones), left-aligned;
   when there are more, the row scrolls sideways and arrows appear. Set apart from the entry above. */
.related {
  margin: var(--sp-7) calc(var(--edge) * -1) calc(var(--sp-7) * -1); padding: var(--sp-6) var(--edge) var(--sp-7);
  background: var(--pencil-rule) top left / 100% 6px no-repeat; display: grid; gap: var(--sp-4);
}
.related-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.related-head h2 { font-size: var(--s2); }
.related-track {
  --n: 2; --related-gap: var(--sp-4);
  display: flex; gap: var(--related-gap); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  /* room inside the scroller so the hover tint and grow aren't clipped */
  padding: var(--sp-2); margin: calc(var(--sp-2) * -1); scroll-padding-inline: var(--sp-2);
}
@media (min-width: 720px)  { .related-track { --n: 3; } }
@media (min-width: 1200px) { .related-track { --n: 6; } }
.related-track > .card { flex: 0 0 calc((100% - (var(--n) - 1) * var(--related-gap)) / var(--n)); scroll-snap-align: start; }
.related .card-title { font-size: var(--s0); min-height: calc(2em * var(--lh-head)); }

/* ---------- 9. Mycelio drawing (§5) ---------- */
.mycelio { color: var(--draw); aspect-ratio: 4 / 3; }
.mycelio svg { display: block; width: 100%; height: 100%; }
.mycelio path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.mycelio .g { stroke-dasharray: 1; stroke-dashoffset: 1; animation: grow var(--d) linear var(--dl) forwards; }
@keyframes grow { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .mycelio .g { animation: none !important; stroke-dashoffset: 0; } }
