:root {
  color-scheme: dark;
  --ink: #e8e9ec;
  --muted: #9aa1ab;
  --accent: #3f9c6b;
  --accent-ink: #0d1210;
  --paper: #16181c;
  --card: #1e2126;
  --line: #33373d;
  --panel: #22262b;
  --focus: #77b7ea;
  --serif: "Computer Modern Serif", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@font-face {
  font-family: "Computer Modern Serif";
  src: url("paper/fonts/cmunrm.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Computer Modern Serif";
  src: url("paper/fonts/cmunbx.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  width: min(68rem, 100%);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem) 3rem;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.55;
}

.shell { width: 100%; margin: 0 auto; }
.site-nav { display: none; }

a {
  color: var(--ink);
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

a:hover { text-decoration-color: var(--accent); }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Centered paper header, following the GQ2 project layout. */
.hero {
  max-width: 62rem;
  margin: 0 auto clamp(3rem, 6vw, 4.5rem);
  padding: 0;
  text-align: center;
}

h1 {
  max-width: 34ch;
  margin: 0 auto;
  color: var(--accent);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.sub,
.byline {
  margin: 1.1rem 0 0.9rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.gist {
  max-width: 58ch;
  margin: 0 auto 2rem;
  font-size: 1.02rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font: 700 0.72rem/1.2 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.actions + .actions { margin-top: 0.8rem; }

.actions a,
.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.55rem;
  padding: 0.75rem 1.25rem;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  background: transparent;
  font: 650 0.95rem/1 var(--sans);
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease, filter 150ms ease;
}

.actions .primary,
.button.primary {
  color: var(--accent-ink);
  background: var(--accent);
}

.actions .primary:hover,
.button.primary:hover { filter: brightness(1.12); }

.actions .secondary:hover,
.actions a:not(.primary):hover,
.button:not(.primary):hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* Subpage headers. */
.page-header {
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  padding: 0;
}

.page-header .back {
  color: var(--accent);
  font: 650 0.9rem/1 var(--sans);
  text-decoration: none;
}

.page-header .back:hover { text-decoration: underline; }

.page-header h1 {
  max-width: none;
  margin: 0.9rem 0 0;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  text-align: left;
}

.page-header .lede {
  max-width: 66ch;
  margin: 1rem 0 1.5rem;
  color: var(--muted);
  font-size: 1.04rem;
}

.page-header .actions { justify-content: flex-start; }

/* Scholarly prose hierarchy. */
main > section,
main > .two-col {
  margin-top: 3.2rem;
}

main > .two-col:first-child { margin-top: 0; }

.two-col,
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem;
  align-items: start;
}

.prose { max-width: 66ch; }
.prose p { margin: 0 0 1rem; }

h2 {
  margin: 0 0 1rem;
  color: var(--muted);
  font: 700 0.78rem/1.2 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.prose h2,
.section h2 { margin-top: 2.6rem; }

.section:first-of-type h2 { margin-top: 0; }

h3 {
  margin: 1.4rem 0 0.55rem;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.3;
}

.lead-equation {
  margin: 1.1rem 0;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  border-left: 4px solid var(--accent);
  background: var(--panel);
  text-align: center;
}

/* Quiet resource cards, rather than dashboard tiles. */
.resource-grid,
.card-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.resource-card,
.card,
.metric {
  padding: 1.3rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--card);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.resource-card h3,
.card h3,
.metric h3 { margin-top: 0; }

.resource-card p,
.card p,
.metric span {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.resource-card .res-title {
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 700;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.metric strong {
  display: block;
  color: var(--accent);
  font-size: 1.8rem;
  line-height: 1;
}

.tag {
  display: inline-block;
  margin-bottom: 0.65rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font: 700 0.66rem/1.4 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.theorem {
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0.45rem;
  color: var(--ink);
  background: var(--panel);
  box-shadow: none;
}

.theorem .label {
  color: var(--accent);
  font: 700 0.72rem/1.2 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theorem h3 { margin: 0.45rem 0; }
.theorem p { margin: 0; color: var(--muted); }

.theorem .display,
.formula {
  margin-top: 0.8rem;
  padding: 0.6rem;
  overflow-x: auto;
  border-radius: 0.3rem;
  background: var(--card);
  text-align: center;
}

.flow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.flow-step {
  padding: 1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel);
}

.flow-step b { display: block; }
.flow-step span { display: block; margin-top: 0.35rem; color: var(--muted); }

.checklist {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
}

.checklist li { margin: 0.35rem 0; }
.checklist li::marker { color: var(--accent); }

.mono,
code,
.command {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mono { font-size: 0.88em; overflow-wrap: anywhere; }

.command {
  display: block;
  margin: 0.8rem 0 1.1rem;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  color: var(--ink);
  background: #111318;
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre;
}

footer,
.footer {
  margin-top: 3.2rem;
  padding: 1.1rem 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

footer a { color: var(--ink); }

@media (max-width: 46rem) {
  body {
    padding: 2.25rem 1.15rem 2rem;
  }

  .two-col,
  .split,
  .flow {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.4rem;
  }

  .resource-grid,
  .card-grid,
  .metric-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .actions a,
  .button {
    width: 100%;
    justify-content: center;
  }

  .page-header .actions { justify-content: stretch; }
  .footer-grid { display: block; }
  .footer-grid > * + * { margin-top: 0.5rem; }
}

@media print {
  :root {
    color-scheme: light;
    --ink: #111;
    --muted: #444;
    --accent: #1e5c3a;
    --paper: #fff;
    --card: #fff;
    --line: #bbb;
    --panel: #f4f4f1;
  }

  body { width: 100%; padding: 0; }
  .actions { display: none; }
  .resource-card, .card, .metric { box-shadow: none; }
}
