:root {
  --ink: #1c1c1c;
  --ink-soft: #4a4a4a;
  --paper: #f7f5f1;
  --paper-elevated: #ffffff;
  --accent: #9a4d1c;
  --line: #d8d2c8;
  --measure: 68ch;
  --font-display: "Merriweather Sans", "Helvetica Neue", sans-serif;
  --font-body: "Merriweather", Georgia, serif;
  --header-h: 3.75rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-optical-sizing: auto;
  font-size: 1.05rem;
  line-height: 1.7;
  background: var(--paper);
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper-elevated);
}

.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}

.brand:hover {
  color: var(--accent);
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
}

.header-nav a {
  text-decoration: none;
  color: var(--ink-soft);
}

.header-nav a:hover {
  color: var(--accent);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

.hub,
.series {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.hub-hero,
.series-hero {
  margin-bottom: 2.5rem;
}

.hub-brand,
.series-hero h1,
.article__title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.9rem;
  color: var(--ink);
}

.hub-brand {
  font-size: clamp(2.4rem, 7vw, 3.6rem);
}

.series-hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
}

.hub-lead,
.series-lead {
  font-size: 1.1rem;
  max-width: 38rem;
  color: var(--ink-soft);
  margin: 0;
}

.series-note {
  margin: 1.1rem 0 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: 40rem;
}

.hub-series h2,
.chapter-index h2 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
}

.series-list,
.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.series-list li,
.chapter-list li {
  border-bottom: 1px solid var(--line);
}

.series-list a,
.chapter-list a {
  display: grid;
  gap: 0.15rem 1rem;
  padding: 0.95rem 0.1rem;
  text-decoration: none;
  color: inherit;
}

.series-list a {
  grid-template-columns: 7.5rem 1fr;
  grid-template-rows: auto auto;
}

.series-list a:hover .series-title,
.chapter-list a:hover .ch-title {
  color: var(--accent);
}

.series-num,
.ch-num,
.toc-num {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.series-list .series-num {
  grid-row: 1 / span 2;
  align-self: center;
}

.series-title,
.ch-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.series-desc,
.ch-author {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.chapter-list a {
  grid-template-columns: 3rem 1fr;
  align-items: baseline;
}

.chapter-list--community a {
  grid-template-columns: 1fr;
}

.chapter-layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem;
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
  gap: 2.25rem;
  align-items: start;
}

.chapter-layout--simple {
  grid-template-columns: 12rem minmax(0, 1fr);
}

.toc {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding-right: 0.35rem;
}

.toc__label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

.toc__back {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

.toc__back a {
  text-decoration: none;
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc__list a {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.3rem;
  padding: 0.32rem 0;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.35;
}

.toc__list a:hover,
.toc__list a[aria-current="page"] {
  color: var(--ink);
}

.toc__list a[aria-current="page"] {
  font-weight: 700;
}

.article {
  min-width: 0;
}

.article__header {
  margin-bottom: 1.35rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.article__title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 0.5rem;
}

.article__meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.article__body {
  max-width: var(--measure);
}

.article__body h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 1.15rem;
}

.article__body p {
  margin: 0 0 1.05rem;
}

.article__body .size {
  font-family: var(--font-display);
  font-weight: 700;
}

.article__body .color {
  font-weight: 700;
}

.article__body .u {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.article__body a.download {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95em;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
}

.article__body a.download:hover {
  border-bottom-color: var(--accent);
}

.shot {
  margin: 1.25rem 0 1.45rem;
  padding: 0;
}

.shot img {
  width: 100%;
  border: 1px solid var(--line);
  background: #111;
  opacity: 0;
  animation: fade-in 420ms ease forwards;
}

.quote {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--paper-elevated);
  color: var(--ink-soft);
}

.quote-cite {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 0.45rem;
  color: var(--ink-soft);
}

.code {
  margin: 1.1rem 0;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  background: #1c1c1c;
  color: #f3efe8;
  font-size: 0.9rem;
  line-height: 1.5;
}

.code code {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
}

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
  max-width: var(--measure);
}

.pager a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--font-display);
  color: var(--ink-soft);
}

.pager a span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.pager a strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.pager__next {
  text-align: right;
  justify-self: end;
}

.pager__index {
  align-self: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-elevated);
}

.site-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0 0 0.55rem;
  max-width: 52rem;
}

.site-footer__copy {
  font-size: 0.82rem;
}

.site-footer__legal {
  margin-top: 0.85rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
}

.site-footer__legal a {
  text-decoration: none;
}

.site-footer__legal a:hover {
  text-decoration: underline;
}

.spoiler {
  margin: 1.25rem 0;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper-elevated);
}

.spoiler > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
  color: var(--ink);
  user-select: none;
}

.spoiler > summary::-webkit-details-marker {
  display: none;
}

.spoiler > summary::before {
  content: "▸ ";
  color: var(--accent);
}

.spoiler[open] > summary::before {
  content: "▾ ";
}

.spoiler__body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.spoiler__body > :first-child {
  margin-top: 0.85rem;
}

.bb-list {
  margin: 0.85rem 0 1.1rem;
  padding-left: 1.35rem;
}

.bb-list li {
  margin: 0.25rem 0;
}

.center {
  text-align: center;
  margin: 1rem 0;
}

mark {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: inherit;
  padding: 0 0.15em;
}

.video {
  margin: 1rem 0;
  font-family: var(--font-display);
  font-weight: 700;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .chapter-layout,
  .chapter-layout--simple {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .toc {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.85rem;
  }

  .toc__list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.1rem 0.75rem;
  }
}

@media (max-width: 640px) {
  .series-list a {
    grid-template-columns: 1fr;
  }

  .toc__list {
    grid-template-columns: 1fr;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager__next {
    text-align: left;
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .shot img {
    animation: none !important;
    opacity: 1 !important;
  }
}
