/* Hand-maintained. The build script never overwrites this file.
   Mobile first: the phone layout is the base, the sidebar appears at 52rem. */

:root {
  --ink: #23201b;
  --ink-soft: #5f584c;
  --parchment: #f7f3e9;
  --panel: #ece4d3;
  --rule: #d3c8b0;
  --accent: #7a2e1d;
  --accent-soft: #a8563f;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 18px;
  line-height: 1.65;
}

/* ---------- Masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border-bottom: 2px solid var(--rule);
}

.brand {
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Layout ---------- */

.layout {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1rem 1rem;
}

main { min-width: 0; }

/* The full tree is desktop-only. On a phone you navigate by hub pages and
   the pager at the foot of each page, so it never buries the content. */
.sidebar { display: none; }

/* ---------- Breadcrumb ---------- */

.crumbs {
  margin: 0.9rem 0 1.4rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-style: italic;
}

.crumbs a { color: var(--accent-soft); }

.crumbs span[aria-current] { color: var(--ink-soft); }

/* ---------- Cover banner ---------- */

.cover-banner {
  display: block;
  width: 100%;
  height: auto;
  /* Line art on a white ground: multiply drops the white to the parchment
     tone, leaving only the ink. */
  mix-blend-mode: multiply;
}

main > p:has(> .cover-banner) {
  margin: 0 0 1.4rem;
}

/* ---------- Prose ---------- */

h1, h2, h3, h4 {
  font-family: "Iowan Old Style", Georgia, serif;
  line-height: 1.25;
  color: var(--accent);
  text-wrap: balance;
}

h1 {
  margin: 0 0 1rem;
  font-size: 1.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--rule);
}

h2 {
  margin-top: 2.2rem;
  font-size: 1.25rem;
}

h3 {
  margin-top: 1.6rem;
  font-size: 1.05rem;
  color: var(--ink);
}

main a { color: var(--accent); }

main p, main li { overflow-wrap: break-word; }

ul, ol { padding-left: 1.3rem; }

li { margin: 0.3rem 0; }

/* Hub pages: turn a bare list of links into tap targets. */
main > ul > li.link-item > a {
  display: block;
  padding: 0.15rem 0;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--panel);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
}

pre code { background: none; padding: 0; }

/* ---------- Tables ---------- */

.table-scroll {
  overflow-x: auto;
  margin: 1rem 0;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}

th, td {
  border: 1px solid var(--rule);
  padding: 0.4rem 0.6rem;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--panel);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:nth-child(even) { background: rgba(211, 200, 176, 0.25); }

/* ---------- Pager ---------- */

.pager {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}

.pager a {
  display: block;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.4rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--accent);
  text-decoration: none;
}

.pager a:hover { border-color: var(--accent-soft); }

.pager .label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-style: normal;
}

/* ---------- Colophon ---------- */

.colophon {
  max-width: 76rem;
  margin: 0 auto;
  padding: 1.2rem 1rem 2rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-style: italic;
}

/* ---------- Wide screens ---------- */

@media (min-width: 52rem) {
  .masthead { padding: 0.8rem 1.5rem; }
  .brand { font-size: 1.1rem; }

  .layout {
    display: flex;
    align-items: flex-start;
    gap: 3rem;
    padding: 0 1.5rem 2rem;
  }

  main {
    flex: 1 1 auto;
    max-width: 44rem;
    padding-top: 0.5rem;
  }

  .sidebar {
    display: block;
    flex: 0 0 15rem;
    position: sticky;
    top: 4rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding-top: 1.4rem;
    font-size: 0.88rem;
    line-height: 1.45;
  }

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

  .sidebar > ul > li { margin-bottom: 0.9rem; }

  .sidebar > ul > li > a {
    font-variant: small-caps;
    letter-spacing: 0.04em;
    font-size: 0.95rem;
  }

  .sidebar ul ul {
    margin: 0.2rem 0 0 0.2rem;
    padding-left: 0.7rem;
    border-left: 1px solid var(--rule);
  }

  .sidebar li { margin: 0.1rem 0; }

  .sidebar .nav-group {
    margin: 0.6rem 0 0.15rem;
    font-variant: small-caps;
    letter-spacing: 0.04em;
    font-size: 0.8rem;
    color: var(--ink-soft);
  }

  .sidebar .nav-group:first-child { margin-top: 0.1rem; }

  .sidebar a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
  }

  .sidebar a:hover { border-bottom-color: var(--accent-soft); }

  .sidebar a.current { color: var(--accent); font-weight: bold; }

  .pager { display: flex; gap: 0.6rem; }
  .pager a { flex: 1; margin-bottom: 0; }

  h1 { font-size: 2rem; }
}
