:root {
  --paper: #eef1f3;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #56626e;
  --rule: #cfd6dc;
  --yellow: #f2b705;
  --yellow-ink: #6b4f00;
  --good: #1e7a55;
  --bad: #b3372f;
  --code-bg: #17202a;
  --code-ink: #e8edf1;
  --measure: 70ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12181e;
    --panel: #1a222a;
    --ink: #e6ebef;
    --muted: #9aa6b1;
    --rule: #2c3741;
    --yellow-ink: #f2c53d;
    --good: #4cc08c;
    --bad: #ef7a70;
    --code-bg: #0c1115;
  }
}
:root[data-theme="dark"] {
  --paper: #12181e;
  --panel: #1a222a;
  --ink: #e6ebef;
  --muted: #9aa6b1;
  --rule: #2c3741;
  --yellow-ink: #f2c53d;
  --good: #4cc08c;
  --bad: #ef7a70;
  --code-bg: #0c1115;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 "IBM Plex Sans", system-ui, sans-serif;
}
a { color: inherit; text-decoration-color: var(--yellow); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { background: color-mix(in srgb, var(--yellow) 30%, transparent); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

h1, h2, h3 {
  font-family: "Archivo", sans-serif;
  font-stretch: 112%;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); font-weight: 800; margin: 0 0 .4em; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 750; margin: 2.2em 0 .5em; }
h3 { font-size: 1.2rem; font-weight: 700; margin: 1.6em 0 .3em; }
p, li { max-width: var(--measure); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* top bar: a yellow-and-ink hazard stripe, the one loud thing on every page */
.site-head { border-bottom: 1px solid var(--rule); background: var(--panel); }
.site-head::before {
  content: ""; display: block; height: 8px;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 14px, #17202a 14px 28px);
}
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-family: "Archivo", sans-serif; font-weight: 800; font-stretch: 115%; text-decoration: none; font-size: 1.1rem; }
.site-head nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .95rem; }
.site-head nav a { text-decoration: none; color: var(--muted); padding: 2px 0; }
.site-head nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--yellow); }
.theme-btn { margin-left: auto; background: none; border: 1px solid var(--rule); color: var(--ink); border-radius: 6px; padding: 4px 10px; font: inherit; font-size: .85rem; cursor: pointer; }

main { padding: 48px 16px 80px; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }

/* hero chart */
.hero { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: end; }
@media (min-width: 900px) { .hero { grid-template-columns: 5fr 6fr; } }
.chart-box { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 16px; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-box figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .85rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend .l-good::before { background: var(--good); }
.legend .l-bad::before { background: var(--bad); }
.legend .l-cut::before { background: var(--yellow); border-radius: 0; height: 3px; vertical-align: 3px; }

/* page index on the home page */
.pages { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--ink); }
.pages li { max-width: none; border-bottom: 1px solid var(--rule); }
.pages a { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 16px 4px; text-decoration: none; }
@media (min-width: 700px) { .pages a { grid-template-columns: 16rem 1fr; gap: 24px; } }
.pages strong { font-family: "Archivo", sans-serif; font-stretch: 110%; font-size: 1.15rem; }
.pages span { color: var(--muted); }

/* lessons: numbered because they are ranked by how much they cost me */
.lessons { counter-reset: l; padding: 0; list-style: none; }
.lessons li { counter-increment: l; position: relative; padding: 0 0 0 3rem; margin: 0 0 1.2em; }
.lessons li::before {
  content: counter(l); position: absolute; left: 0; top: 0;
  font-family: "Archivo", sans-serif; font-weight: 800; font-size: 1.6rem; line-height: 1;
  color: var(--yellow-ink);
}

/* timeline for the version journey */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 1.4em 1.4rem; max-width: none; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: .45em; width: 15px; height: 15px; border-radius: 50%; background: var(--good); border: 3px solid var(--paper); }
.timeline li.bad::before { background: var(--bad); }
.timeline .ver { font-family: "Archivo", sans-serif; font-weight: 750; }
.timeline .score { font-variant-numeric: tabular-nums; font-weight: 600; }
.timeline li.bad .score { color: var(--bad); }
.timeline li:not(.bad) .score { color: var(--good); }
.timeline p { margin: .2em 0 0; }

.callout { border-left: 6px solid var(--yellow); background: var(--panel); padding: 12px 18px; margin: 1.5em 0; max-width: var(--measure); border-radius: 0 8px 8px 0; }
.callout p { margin: .3em 0; }

table { border-collapse: collapse; width: 100%; max-width: 640px; font-variant-numeric: tabular-nums; margin: 1em 0; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
th { font-family: "Archivo", sans-serif; font-weight: 700; border-bottom: 2px solid var(--ink); }
.table-scroll { overflow-x: auto; }

details { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; margin: 0 0 10px; max-width: 820px; }
summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
details[open] summary { border-bottom: 1px solid var(--rule); }
details > div { padding: 4px 16px 12px; }

pre { background: var(--code-bg); color: var(--code-ink); padding: 14px 16px; border-radius: 8px; overflow-x: auto; font: 14px/1.5 "JetBrains Mono", ui-monospace, monospace; max-width: 820px; }
code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .9em; }
p code, li code { background: color-mix(in srgb, var(--yellow) 22%, transparent); padding: 1px 4px; border-radius: 4px; }
.copy-btn { float: right; margin: -4px -6px 0 8px; background: #2c3741; color: #e8edf1; border: 0; border-radius: 4px; font: 12px "IBM Plex Sans", sans-serif; padding: 3px 8px; cursor: pointer; }

.two-col { display: grid; grid-template-columns: 1fr; gap: 0 40px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }
.worked h3 { color: var(--good); }
.failed h3 { color: var(--bad); }

.site-foot { border-top: 1px solid var(--rule); padding: 24px 0 40px; color: var(--muted); font-size: .9rem; }

@media (prefers-reduced-motion: no-preference) {
  .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.6s ease-out .2s forwards; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}

.hero > *, .two-col > * { min-width: 0; }
h1, h2, h3, p, li { overflow-wrap: break-word; }

/* simple directory: one block per subject, one row per note or file */
.subject { margin: 0 0 40px; }
.subject h2 { margin: 0 0 4px; }
.subject > p { margin: 0 0 12px; color: var(--muted); }
.items { list-style: none; padding: 0; margin: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
.items li { max-width: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.items li:last-child { border-bottom: 0; }
.items .what { flex: 1 1 22rem; }
.items .what strong { display: block; }
.items .what span { color: var(--muted); font-size: .95rem; }
.kind { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--yellow) 28%, transparent); color: var(--ink); }
.kind.file { background: color-mix(in srgb, var(--good) 22%, transparent); }
.btns { display: flex; gap: 8px; }
.btn { display: inline-block; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn:hover { background: var(--yellow); color: #17202a; border-color: var(--yellow); }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 36px; }
