:root {
  color-scheme: light;
  --paper: #faf8f2;
  --ink: #252b2a;
  --muted: #58625f;
  --accent: #185b54;
  --line: #d8ded7;
  --panel: #eef2eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.13rem/1.65 Georgia, "Times New Roman", serif;
}

main { max-width: 49rem; margin: 0 auto; padding: 3.5rem 2rem 5rem; }

h1, h2, h3, nav, .eyebrow, summary, th, .label {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.12; letter-spacing: -.035em; margin: .6rem 0 1rem; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2.5rem 0 .7rem; }
h3 { font-size: 1rem; }
p { margin: .75rem 0 1rem; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: .14em; }
a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

nav { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; font-size: .85rem; margin-bottom: 2.5rem; }
.eyebrow { color: var(--accent); font-size: .78rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.lede { font-size: 1.26rem; max-width: 38rem; }
.note { color: var(--muted); font-size: .98rem; }
.label { font-size: .75rem; color: var(--muted); margin: 1.3rem 0 .25rem; }

code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .88em; }
pre { background: var(--panel); border-left: 3px solid var(--accent); padding: 1.15rem 1.3rem; overflow-x: auto; line-height: 1.55; }
pre code { font-size: .88rem; }
p code, td code, dd code, li code { overflow-wrap: anywhere; }

.exercise { border: 1px solid var(--line); border-radius: .4rem; padding: .4rem 1.25rem 1rem; margin: 1.5rem 0; }
.exercise h2 { margin-top: 1rem; }
details { margin: 1.2rem 0 0; border-top: 1px solid var(--line); padding-top: .8rem; }
summary { cursor: pointer; color: var(--accent); font-size: .95rem; font-weight: 600; }
details[open] summary { margin-bottom: .8rem; }
details p:last-child { margin-bottom: 0; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 1rem; }
th, td { border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; padding: .65rem .6rem; }
th { font-size: .85rem; }
td:first-child { width: 30%; }
dt { font-weight: 700; margin-top: .9rem; }
dd { margin: .15rem 0 0; }
footer { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

@media (max-width: 600px) {
  main { padding: 2rem 1.2rem 3rem; }
  body { font-size: 1.05rem; }
  pre { padding: 1rem; }
  .exercise { padding-inline: .85rem; }
}

@media print {
  :root { --paper: #fff; --ink: #000; --muted: #333; --accent: #174c45; --line: #aaa; --panel: #f4f4f4; }
  @page { margin: 17mm; }
  body { font-size: 10.5pt; line-height: 1.4; }
  main { max-width: none; padding: 0; }
  nav { display: none; }
  h1 { font-size: 24pt; }
  h2 { font-size: 13pt; margin-top: 1.4rem; break-after: avoid; }
  .lede { font-size: 12pt; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; break-inside: avoid; }
  pre code { font-size: 9pt; }
  .exercise { break-inside: avoid; }
  details > * { display: block !important; }
  details::details-content { display: block; content-visibility: visible; }
  summary { font-size: 10pt; }
  a { color: inherit; }
}
