/* mackenziebowes.com. Near-monochrome zinc, one green for links and progress, tomato for
   figure highlights. The figure runtime draws with --ink, --mute, --line, --card, --code,
   --accent and --done, so those names are a contract with site/figures/. */

/* Self-hosted variable fonts (latin and latin-ext only), so the site contacts no third party.
   Inter, Manrope and Space Grotesk are SIL Open Font License 1.1; see /fonts/README.txt. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/inter-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/inter-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/manrope-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/manrope-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap; src: url(/fonts/space-grotesk-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap; src: url(/fonts/space-grotesk-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  --bg: oklch(0.967 0.001 286.4);       /* zinc-100 */
  --surface: oklch(0.985 0 0);          /* zinc-50 */
  --card: oklch(0.985 0 0);
  --code: oklch(0.92 0.004 286.3);      /* zinc-200 */
  --ink: oklch(0.141 0.005 285.8);      /* zinc-950 */
  --mute: oklch(0.37 0.013 285.8);      /* zinc-700 */
  --line: oklch(0.141 0.005 285.8 / 0.12);
  --link: oklch(0.508 0.118 165.6);     /* emerald-700 */
  --accent: oklch(0.555 0.175 31.9);    /* tomato, darkened to read as text on light */
  --done: oklch(0.596 0.145 163.2);     /* emerald-600 */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: Manrope, ui-sans-serif, system-ui, sans-serif;
  --font-label: Inter, ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Fira Code", ui-monospace, monospace;
  /* two names the converted post figures still use, with the old site's values */
  --accent-b: oklch(0.56 0.14 60);        /* princeton orange, darkened to read on light */
  --font-serif: var(--font-display);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: oklch(0.082 0.005 250);       /* deepspace-bg */
    --surface: oklch(0.116 0.005 250);
    --card: oklch(0.134 0.005 250);
    --code: oklch(0.18 0.005 250);
    --ink: oklch(0.967 0.001 286.4);
    --mute: oklch(0.705 0.015 286.1);   /* zinc-400 */
    --line: oklch(0.967 0.001 286.4 / 0.12);
    --link: oklch(0.765 0.177 163.2);   /* emerald-400 */
    --accent: oklch(0.68 0.17 33);
    --done: oklch(0.765 0.177 163.2);
    --accent-b: oklch(0.705 0.153 60.79);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.082 0.005 250); --surface: oklch(0.116 0.005 250); --card: oklch(0.134 0.005 250);
  --code: oklch(0.18 0.005 250); --ink: oklch(0.967 0.001 286.4); --mute: oklch(0.705 0.015 286.1);
  --line: oklch(0.967 0.001 286.4 / 0.12); --link: oklch(0.765 0.177 163.2);
  --accent: oklch(0.68 0.17 33); --done: oklch(0.765 0.177 163.2); --accent-b: oklch(0.705 0.153 60.79);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--font-body);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
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(--link); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0 0 0.5rem; }
h2 { font-size: 1.6rem; margin: 2.2rem 0 0.8rem; }
h3 { font-size: 1.15rem; margin: 1.8rem 0 0.5rem; }
p, ul, ol, table, pre, blockquote, figure { margin: 0 0 1.1rem; }
ul, ol { padding-left: 1.4rem; }
li + li { margin-top: 0.3rem; }
code { font-family: var(--font-mono); font-size: 0.88em; background: var(--code); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--code); padding: 1rem; border-radius: 6px; overflow-x: auto; }
pre code { background: none; padding: 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font-label); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mute); }
img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.quiet { color: var(--mute); }
.small { font-size: 0.85rem; }

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

/* header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-label);
}
.wordmark { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: 0.01em; }
.mark circle { fill: currentColor; }
.site-header nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.4rem; }
.site-header nav li + li { margin: 0; }
.site-header nav a { color: var(--mute); text-decoration: none; font-size: 0.92rem; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--ink); }
.site-header nav a[aria-current] { text-decoration: underline; text-decoration-color: var(--link); text-underline-offset: 0.4em; }
.menu { display: none; position: relative; }
.menu summary { cursor: pointer; list-style: none; font-size: 0.92rem; padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; }
.menu summary::-webkit-details-marker { display: none; }
.menu nav { position: absolute; right: 0; top: calc(100% + 0.5rem); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.8rem 1rem; z-index: 5; min-width: 12rem; }
.menu nav ul { flex-direction: column; gap: 0.6rem; }
@media (max-width: 640px) {
  .menu { display: block; }
  .menu-wide { display: none; }
}

/* footer */
.site-footer { margin-top: auto; padding: 2rem clamp(1rem, 4vw, 3rem); border-top: 1px solid var(--line); font-size: 0.9rem; }
.site-footer p { margin: 0 0 0.4rem; max-width: 70ch; }

/* plain pages */
.page { width: 100%; max-width: 46rem; margin: 0 auto; padding: 3rem 1rem 4rem; }
.lede { font-size: 1.15rem; color: var(--mute); max-width: 60ch; }
.doc-list { list-style: none; padding: 0; }
.doc-list li { padding: 1rem 0; border-bottom: 1px solid var(--line); margin: 0; }
.doc-list a { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.doc-list time { font-family: var(--font-label); font-size: 0.8rem; color: var(--mute); margin-left: 0.5rem; }
.doc-list p { margin: 0.3rem 0 0; color: var(--mute); }

/* articles: research, stories, posts. The contents list sits beside the text on wide
   screens; every other child of the article is in the text column. */
.article { width: 100%; max-width: 76rem; margin: 0 auto; padding: 3rem clamp(1rem, 4vw, 3rem) 4rem; display: grid; grid-template-columns: minmax(0, 46rem); justify-content: center; }
.article > * { grid-column: 1; min-width: 0; }
.toc { font-family: var(--font-label); font-size: 0.88rem; margin: 0 0 2rem; padding: 0.8rem 1.2rem; border: 1px solid var(--line); border-radius: 10px; }
.toc > summary { cursor: pointer; color: var(--mute); }
.toc[open] > summary { margin-bottom: 0.6rem; }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc li + li { margin-top: 0.25rem; }
.toc a { color: var(--mute); text-decoration: none; }
.toc a:hover { color: var(--ink); text-decoration: underline; }
@media (min-width: 1100px) {
  .article { grid-template-columns: 15rem minmax(0, 46rem); column-gap: 3.5rem; }
  .article > * { grid-column: 2; }
  .article > .toc { grid-column: 1; grid-row: 1 / span 400; align-self: start; position: sticky; top: 1.5rem; border: 0; padding: 0; max-height: calc(100dvh - 3rem); overflow-y: auto; }
  .article > .toc > summary { display: none; }
}
.article h2 { scroll-margin-top: 1.5rem; }
.article-foot { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--mute); font-size: 0.9rem; }
.article-foot p { margin: 0 0 0.4rem; }
.embed { margin: 1.6rem 0; overflow-x: auto; }

/* shared blocks */
.fig { margin: 1.6rem 0; padding: 0.8rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.fig [data-figure] { cursor: pointer; border-radius: 6px; }
@media (min-width: 768px) { .fig { padding: 1.25rem; } } /* the room the post figures were drawn for */
.fig-fallback { margin: 0; padding: 1rem; color: var(--mute); font-size: 0.92rem; }
.fig figcaption { font-size: 0.85rem; color: var(--mute); margin-top: 0.5rem; }
.note { border-left: 3px solid var(--line); padding: 0.2rem 0 0.2rem 1rem; margin: 1.4rem 0; color: var(--mute); }
.note-inference { border-color: var(--accent); }
.note-gap { border-color: var(--mute); border-left-style: dashed; }
.note-tone { color: var(--ink); }
.said { margin: 1.4rem 0; padding-left: 1rem; border-left: 3px solid var(--link); }
.said footer { font-size: 0.85rem; color: var(--mute); }
.cite { font-family: var(--font-label); font-size: 0.75em; vertical-align: super; line-height: 0; text-decoration: none; margin-left: 0.1em; }
.sources ol { font-size: 0.88rem; color: var(--mute); }
.sources a { word-break: break-all; }

/* lessons */
.lesson {
  display: grid; grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem);
  width: 100%; max-width: 76rem; margin: 0 auto; padding: 2.5rem clamp(1rem, 4vw, 3rem) 4rem;
}
.lesson-side h1 { font-size: 1.5rem; margin-bottom: 1.2rem; }
.steps-list > summary { list-style: none; cursor: pointer; font-family: var(--font-label); font-size: 0.9rem; color: var(--mute); margin-bottom: 0.6rem; display: none; }
@media (max-width: 860px) { .steps-list > summary { display: block; } }
.steps-list > summary::-webkit-details-marker { display: none; }
.steps-list > summary::after { content: " +"; }
.steps-list[open] > summary::after { content: " -"; }
.lesson.paged .lesson-side { position: sticky; top: 1.5rem; align-self: start; max-height: calc(100dvh - 3rem); overflow-y: auto; }
.panes { list-style: none; padding: 0; margin: 0 0 1rem; font-family: var(--font-label); font-size: 0.9rem; }
.panes li + li { margin-top: 0.1rem; }
.panes a { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.4rem 0.6rem; border-radius: 6px; color: var(--mute); text-decoration: none; line-height: 1.35; }
.panes a:hover { background: var(--code); color: var(--ink); }
.panes a[aria-current] { background: var(--code); color: var(--ink); font-weight: 600; }
.pane-num { flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1.5px solid currentColor; display: inline-grid; place-items: center; font-size: 0.72rem; transform: translateY(0.2rem); }
.panes a:not(:has(.pane-num))::before { content: ""; flex: none; width: 1.4rem; }
.panes a.done .pane-num { background: var(--done); border-color: var(--done); color: var(--bg); }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 0.8rem; }
.progress i { display: block; height: 100%; width: 0; background: var(--done); transition: width 0.3s; }
.lesson:not(.paged) .progress { display: none; }
.lesson-main { min-width: 0; max-width: 46rem; }
.pane { scroll-margin-top: 1.5rem; }
.lesson:not(.paged) .pane + .pane { border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1rem; }
.pane > h2:first-child { margin-top: 0; }
.goal { font-size: 1.1rem; }
.done { margin-top: 2rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.done h3 { margin-top: 0; }
.done ul { list-style: none; padding: 0; margin: 0; }
.done label { display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer; }
.done input { flex: none; width: 1.15rem; height: 1.15rem; margin-top: 0.3rem; accent-color: var(--done); }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.pager button {
  font: 500 0.95rem var(--font-label); padding: 0.6rem 1.3rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.pager button.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pager button:disabled { opacity: 0.35; cursor: default; }
@media (max-width: 860px) {
  .lesson { grid-template-columns: minmax(0, 1fr); padding-top: 1.5rem; }
  .lesson.paged .lesson-side { position: static; max-height: none; }
  .panes { columns: 2; column-gap: 1rem; }
  .panes li { break-inside: avoid; }
}
@media (max-width: 480px) { .panes { columns: 1; } }
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } }
