/* gakhov.com design system — shared by gakhov.com, pdsa.gakhov.com and clocks.gakhov.com.
   Descends from math.gakhov.com: warm paper, near-black ink, hairline rules, one accent colour per site.
   Headings in Source Serif 4 Display, text in Golos Text; both self-hosted (no third-party requests).
   The canonical copy lives in the www.gakhov.com repo (assets/css/gakhov.css); the book sites carry
   an identical copy and set only --accent (and --accent-ink) in a <style> block or their own file. */

@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url("../fonts/GolosText-Regular.ttf") format("truetype"); }
@font-face { font-family: "Golos Text"; font-weight: 700; font-display: swap; src: url("../fonts/GolosText-Bold.ttf") format("truetype"); }
@font-face { font-family: "Source Serif"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/SourceSerif4Display-Semibold.woff2") format("woff2"); }
@font-face { font-family: "Source Serif"; font-weight: 600; font-style: italic; font-display: swap; src: url("../fonts/SourceSerif4Display-SemiboldIt.woff2") format("woff2"); }

:root {
  --paper: #fcfbf9; --paper-2: #f4f1ea; --ink: #1b1b1b; --muted: #5d5d5d; --rule: #e4e1da;
  --accent: #9b2c2c;      /* links, buttons, small marks — overridden per site */
  --accent-ink: #fff;     /* text on an accent background */
  --serif: "Source Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 42rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #161513; --paper-2: #1f1d1a; --ink: #ebe7df; --muted: #a39e94; --rule: #34312c; }
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { margin: 0 auto; max-width: 64rem; padding: 0 1.25rem; font: 400 1.0625rem/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; }
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.6rem; margin: 0 0 1.1rem; }
h3 { font-size: 1.2rem; margin: 1.5rem 0 0.4rem; }
h1 em, h2 em { font-style: italic; }
.subtitle { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.3rem; line-height: 1.3; color: var(--muted); margin: -0.25rem 0 1rem; }
.kicker { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* ---------- header and navigation ---------- */
.site-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem;
               padding: 1.5rem 0 1.1rem; border-bottom: 1px solid var(--rule); }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.brand small { font-family: var(--sans); font-weight: 400; font-size: 0.85rem; color: var(--muted); margin-left: 0.5rem; }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: 0.95rem; }
.nav a { color: var(--muted); text-decoration: none; padding: 0.15rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- page structure ---------- */
main section { padding: 2.25rem 0; border-top: 1px solid var(--rule); }
main > section:first-child, main > .intro + section { border-top: 0; }
.intro { padding: 3rem 0 2rem; }
.intro p.lede { font-size: 1.2rem; max-width: var(--measure); margin: 0; }
.intro .kicker { margin-bottom: 0.4rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.section-head a { font-size: 0.95rem; white-space: nowrap; }
.prose-width, .about { max-width: var(--measure); }

/* Portrait + text, used on the home page and for author blurbs. */
.person { display: grid; grid-template-columns: 9rem 1fr; gap: 1.75rem; align-items: start; }
.person img { width: 9rem; height: 9rem; border-radius: 50%; object-fit: cover; filter: grayscale(15%); }
.person.small { grid-template-columns: 5rem 1fr; gap: 1.25rem; }
.person.small img { width: 5rem; height: 5rem; }

/* Three pillars on the home page: a rule in the accent colour, a serif heading, a line, a link. */
.pillars { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.pillars li { border-top: 3px solid var(--accent); padding-top: 1rem; }
.pillars h2 { font-size: 1.45rem; margin-bottom: 0.5rem; }
.pillars h2 a { color: var(--ink); text-decoration: none; }
.pillars h2 a:hover { color: var(--accent); }
.pillars p { margin: 0 0 0.6rem; }

/* ---------- books ---------- */
.covers { list-style: none; padding: 0; margin: 0; display: grid; gap: 2rem 1.75rem; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.covers img, .cover { width: 100%; aspect-ratio: 0.703; object-fit: cover; display: block; border-radius: 3px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16); }
.covers h3 { font-size: 1.1rem; margin: 0.85rem 0 0.2rem; }
.covers h3 a { color: var(--ink); text-decoration: none; }
.covers h3 a:hover { color: var(--accent); }
.covers p { margin: 0.15rem 0; font-size: 0.92rem; }

.book { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: 2.5rem; align-items: start; }
.book + .book { margin-top: 2.75rem; }
.book h2, .book h3 { margin-top: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; margin: 1rem 0; font-size: 0.95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.button { display: inline-block; padding: 0.55rem 1.1rem; border-radius: 6px; background: var(--accent); color: var(--accent-ink);
          text-decoration: none; font-weight: 700; border: 1px solid var(--accent); }
.button:hover { filter: brightness(1.08); }
.button.ghost { background: transparent; color: var(--accent); }
.button.small { padding: 0.3rem 0.8rem; font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0 0; }

/* Store links: a compact list of countries, not a table of buttons. */
.stores { display: grid; gap: 1.5rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.stores h3 { margin-top: 0; }
.stores ul { list-style: none; padding: 0; margin: 0.25rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; }

/* ---------- entries: CV-style rows (year | content) ---------- */
.entries { list-style: none; margin: 0; padding: 0; }
.entries > li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.25rem 1.25rem; padding: 0.85rem 0; border-top: 1px solid var(--rule); }
.entries > li:first-child { border-top: 0; padding-top: 0.25rem; }
.entries .when { color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; padding-top: 0.1rem; }
.entries .what { min-width: 0; }
.entries .title { font-weight: 700; margin: 0; }
.entries .title a { color: var(--ink); text-decoration-color: var(--rule); }
.entries .title a:hover { color: var(--accent); text-decoration-color: currentColor; }
.entries p { margin: 0.2rem 0 0; }
.entries .meta { color: var(--muted); font-size: 0.92rem; }
.entries ul.courses { margin: 0.3rem 0 0; padding-left: 1.1rem; font-size: 0.95rem; }
.tag { display: inline-block; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
       border: 1px solid var(--rule); border-radius: 3px; padding: 0 0.35rem; margin-left: 0.35rem; vertical-align: 0.1em; }
.links { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; margin-top: 0.25rem; font-size: 0.92rem; }

.toc { columns: 2 18rem; column-gap: 2.5rem; padding: 0; margin: 0; list-style: none; counter-reset: ch; }
.toc > li { break-inside: avoid; margin: 0 0 1.4rem; counter-increment: ch; }
.toc h3 { margin: 0 0 0.25rem; }
.toc h3::before { content: counter(ch) "  "; color: var(--accent); }
.toc p { margin: 0 0 0.35rem; }
.toc ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.95rem; }

details { border-top: 1px solid var(--rule); padding: 0.75rem 0; }
details > summary { cursor: pointer; font-weight: 700; }
details[open] > summary { margin-bottom: 0.75rem; }

/* ---------- tables (errata) ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.75rem 0.55rem 0; border-top: 1px solid var(--rule); }
th { font-weight: 700; color: var(--muted); font-size: 0.85rem; letter-spacing: 0.04em; border-top: 0; }
td.was { color: var(--muted); }
.errata td:first-child { white-space: nowrap; }
.errata td:nth-child(2) { min-width: 7rem; }

/* ---------- long-form text (archived articles) ---------- */
.prose { max-width: var(--measure); }
.prose h2 { font-size: 1.45rem; margin: 2.25rem 0 0.75rem; }
.prose h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose li + li { margin-top: 0.3rem; }
.prose blockquote { margin: 1.25rem 0; padding: 0.1rem 0 0.1rem 1.1rem; border-left: 3px solid var(--accent); color: var(--muted); }
.prose figure { margin: 1.75rem 0; }
.prose figure img { display: block; margin: 0 auto; border-radius: 3px; }
.prose figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.5rem; text-align: center; }
.prose table { margin: 1.25rem 0; }
.prose math[display="block"] { margin: 1rem 0; overflow-x: auto; }
.prose .embed-link { font-size: 0.95rem; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--paper-2); padding: 0.08em 0.3em; border-radius: 3px; }
pre { font-family: var(--mono); font-size: 0.85rem; line-height: 1.5; background: var(--paper-2); border: 1px solid var(--rule);
      border-radius: 6px; padding: 0.9rem 1rem; overflow-x: auto; margin: 1.25rem 0; }
pre code { background: none; padding: 0; font-size: inherit; }
.archived { font-size: 0.9rem; color: var(--muted); border: 1px dashed var(--rule); border-radius: 6px; padding: 0.6rem 0.9rem; margin: 0 0 2rem; max-width: var(--measure); }
.article-head { padding: 2.75rem 0 1rem; max-width: var(--measure); }
.article-head .summary { font-size: 1.15rem; color: var(--muted); margin: 0.5rem 0 0; }
.wide { max-width: none; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 1.5rem; padding: 1.5rem 0 2.5rem; font-size: 0.85rem; color: var(--muted);
               display: grid; gap: 0.75rem 2rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.site-footer p { margin: 0.2rem 0; }
.site-footer a { color: var(--muted); }
.social { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }

@media (max-width: 40rem) {
  .person { grid-template-columns: 1fr; gap: 1rem; }
  .person img { width: 7rem; height: 7rem; }
  .person.small { grid-template-columns: 4rem 1fr; }
  .person.small img { width: 4rem; height: 4rem; }
  .book { grid-template-columns: 1fr; gap: 1.5rem; }
  .book > img, .book > a > img { max-width: 14rem; }
  .entries > li { grid-template-columns: 1fr; }
  .covers { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 1rem; }
  .section-head { flex-direction: column; gap: 0; }
}
@media print { .nav, .site-footer .social { display: none; } body { max-width: none; } a { color: inherit; } }

/* D3 charts in the archived Strata article: their labels reach past the drawing area. */
.prose svg { overflow: visible; max-width: 100%; }
