@font-face {
  font-family: "Alegreya";
  src: url("../fonts/alegreya-cyr.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Alegreya";
  src: url("../fonts/alegreya-lat.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+2019, U+2026, U+2192, U+2212;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-cyr.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-lat.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+2019, U+2026, U+2192, U+2212;
}

:root {
  --ink: #141414;
  --ink-soft: #3a3836;
  --grey: #6b665f;
  --paper: #f7f5f0;
  --bone: #e8e2d6;
  --mustard: #d9a21b;
  --brick: #b5432f;
  --brick-dark: #8f3322;
  --serif: "Alegreya", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --frame: 70rem;
  --column: 41rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.06rem/1.72 var(--sans);
  counter-reset: chapter;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--brick-dark); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--ink); text-decoration-color: var(--mustard); text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }

.jump {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 60;
  padding: .5rem .9rem;
  background: var(--mustard);
  color: var(--ink);
  font-weight: 600;
}
.jump:focus { top: .6rem; }

/* notice strip */
.notice {
  background: var(--ink);
  color: var(--bone);
  font-size: .8rem;
  letter-spacing: .02em;
}
.notice p {
  max-width: var(--frame);
  margin: 0 auto;
  padding: .35rem 1.25rem;
}
.notice b { color: var(--mustard); }

/* masthead */
.mast {
  max-width: var(--frame);
  margin: 0 auto;
  padding: 1.1rem 1.25rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .8rem 2rem;
  border-bottom: 2px solid var(--ink);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  padding-bottom: .9rem;
  color: var(--ink);
  text-decoration: none;
}
.wordmark img { width: 44px; height: 44px; flex-shrink: 0; }
.wordmark strong {
  display: block;
  font: 800 1.7rem/1 var(--serif);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.wordmark small {
  display: block;
  margin-top: .25rem;
  font-size: .78rem;
  color: var(--grey);
  white-space: nowrap;
}
.wordmark:hover { color: var(--ink); }

.nav-open { display: none; }
.sections[hidden] { display: none; }

.sections {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}
.sections a {
  display: block;
  padding: .7rem .9rem .8rem;
  color: var(--ink);
  font-weight: 500;
  font-size: .95rem;
  text-decoration: none;
  border-top: 4px solid transparent;
}
.sections a:hover { background: var(--bone); }
.sections a[aria-current="page"] { border-top-color: var(--mustard); background: var(--bone); }

@media (max-width: 880px) {
  .mast { align-items: center; padding-bottom: .9rem; }
  .wordmark { padding-bottom: 0; }
  .nav-open {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .9rem;
    font: 600 .95rem var(--sans);
    color: var(--paper);
    background: var(--ink);
    border: 0;
    cursor: pointer;
  }
  .nav-open svg { width: 18px; height: 18px; }
  .nav-open[aria-expanded="true"] .bar-mid { opacity: 0; }
  .mast nav { flex-basis: 100%; }
  .sections { flex-direction: column; border-top: 1px solid var(--bone); }
  .sections a { border-top: 0; border-left: 4px solid transparent; padding: .75rem .6rem; }
  .sections a[aria-current="page"] { border-left-color: var(--mustard); }
}

/* story head: title and lede side by side */
.story-head {
  max-width: var(--frame);
  margin: 0 auto;
  padding: 2.4rem 1.25rem 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.5rem 3rem;
  align-items: end;
  border-bottom: 1px solid var(--bone);
}
.trail { font-size: .88rem; color: var(--grey); margin-bottom: .9rem; }
.trail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.trail li + li::before { content: "→"; margin: 0 .5rem; color: var(--mustard); }
.story-head h1 {
  margin: 0;
  font: 800 clamp(2rem, 1.3rem + 3vw, 3.4rem)/1.05 var(--serif);
  letter-spacing: -.015em;
  overflow-wrap: break-word;
}
.stamp { margin: 1rem 0 0; font-size: .85rem; color: var(--grey); }
.lede {
  margin: 0;
  font: 400 1.22rem/1.6 var(--serif);
  color: var(--ink-soft);
}
.lede::first-letter {
  float: left;
  margin: .08em .12em 0 0;
  font: 800 3.6em/.8 var(--serif);
  color: var(--brick);
}

/* story body: left-aligned reading column */
.story-body {
  max-width: var(--frame);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}
.story-body > * { max-width: var(--column); }
.story-body > figure,
.story-body > .table-wrap { max-width: 52rem; }
.story-body p { margin: 0 0 1.1rem; }
.story-body h2 {
  counter-increment: chapter;
  margin: 3rem 0 1rem;
  font: 800 clamp(1.5rem, 1.2rem + 1.1vw, 2.05rem)/1.15 var(--serif);
}
.story-body h2::before {
  content: counter(chapter, decimal-leading-zero);
  display: block;
  margin-bottom: .35rem;
  font: 600 .85rem/1 var(--sans);
  letter-spacing: .12em;
  color: var(--brick);
}
.story-body h3 {
  margin: 1.9rem 0 .45rem;
  font: 700 1.25rem/1.3 var(--serif);
}
.story-body ul,
.story-body ol { margin: 0 0 1.3rem; padding-left: 1.35rem; }
.story-body li { margin-bottom: .45rem; }
.story-body li::marker { color: var(--brick); font-weight: 700; }

figure { margin: 2.2rem 0; }
figure img { width: 100%; background: var(--bone); }

/* tables */
.table-wrap { margin: 1.8rem 0; overflow-x: auto; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: .94rem; line-height: 1.5; }
caption { text-align: left; padding: .8rem 0 .5rem; font: 700 1.1rem var(--serif); }
thead th {
  text-align: left;
  padding: .55rem .9rem .55rem 0;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--grey);
  border-bottom: 1px solid var(--ink);
}
tbody th,
tbody td { padding: .7rem .9rem .7rem 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--bone); }
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; }

/* colophon */
.colophon { background: var(--ink); color: var(--bone); font-size: .92rem; }
.colophon-in {
  max-width: var(--frame);
  margin: 0 auto;
  padding: 2.4rem 1.25rem 1.6rem;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1.4rem 3rem;
}
.colophon-title { margin: 0 0 .5rem; font: 800 1.45rem var(--serif); color: #fff; }
.colophon p { margin: 0 0 .65rem; max-width: 36rem; }
.colophon ul { list-style: none; margin: 0; padding: 0; }
.colophon li { margin-bottom: .35rem; }
.colophon a { color: #fff; }
.colophon a:hover { color: var(--mustard); }
.colophon-end {
  grid-column: 1 / -1;
  padding-top: 1rem;
  border-top: 1px solid #34322f;
  font-size: .84rem;
  color: #9b958b;
}

@media (max-width: 820px) {
  .story-head { grid-template-columns: 1fr; padding-top: 1.8rem; }
  .lede { font-size: 1.1rem; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .colophon-in { grid-template-columns: 1fr; }
  .wordmark small { display: none; }
  table { font-size: .9rem; }
}
