:root {
  --desk: #c9bba4;
  --paper: #f6f1e6;
  --paper-deep: #efe6d4;
  --ink: #1c1712;
  --muted: #5c5348;
  --rule: #d2c6b2;
  --stamp: #7e2c30;
  --spine: #1d3b33;
  --spine-soft: #2f5a4e;
  --gold: #8d6b32;
  --up: #1d3b33;
  --down: #7e2c30;
  --shadow: rgba(48, 32, 16, 0.18);
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
  background-color: var(--desk);
  background-image:
    repeating-linear-gradient(90deg, rgba(80, 52, 24, 0.035) 0 1px, transparent 1px 8px),
    radial-gradient(ellipse at 50% -10%, rgba(255, 250, 240, 0.45), transparent 55%);
}

a { color: var(--spine); text-underline-offset: 0.14em; }

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

:focus-visible {
  outline: 2px solid var(--spine);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 0.6rem;
  top: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: var(--paper);
  transform: translateY(-150%);
  z-index: 5;
}

.skip:focus { transform: none; }

.desk { padding: 0.8rem 0.55rem 2rem; }

.sheet {
  max-width: 1120px;
  margin: 0 auto;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #e3d8c4;
  border-top: 11px solid var(--spine);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    7px 8px 0 rgba(70, 48, 24, 0.05),
    0 16px 36px var(--shadow);
  position: relative;
}

.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2.55rem;
  border-left: 1px solid rgba(126, 44, 48, 0.45);
  pointer-events: none;
}

.running {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.48rem 1.1rem 0.48rem 3.15rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.folio-run {
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.masthead {
  padding: 1rem 1.25rem 0.95rem 3.2rem;
  border-bottom: 3px double var(--ink);
}

.bureau,
.bureau-name {
  margin: 0;
  font-family: var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bureau { font-size: 0.68rem; color: var(--muted); }

.bureau-name {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--spine);
}

.masthead h1,
.edition-mark {
  margin: 0.25rem 0 0;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.masthead h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); }

.edition-mark {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.edition-mark a { text-decoration: none; color: inherit; }

.edition-mark a:hover { color: var(--stamp); }

.tagline,
.dateline,
.dek {
  color: var(--muted);
}

.tagline { margin: 0.45rem 0 0; max-width: 40rem; }

.dateline {
  margin: 0.35rem 0 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.finder { margin-top: 0.85rem; position: relative; max-width: 38rem; }

.finder label {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.finder input[type="search"],
.tape-tools input[type="search"] {
  width: 100%;
  border: 1px solid #c9bba4;
  background: #fffaf2;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0;
}

.finder-results {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  top: calc(100% + 0.2rem);
  background: #fffaf2;
  border: 1px solid #c9bba4;
  box-shadow: 0 10px 24px var(--shadow);
  max-height: 18rem;
  overflow: auto;
  padding: 0.3rem 0;
}

.finder-results a {
  display: block;
  padding: 0.4rem 0.7rem;
  text-decoration: none;
  color: var(--ink);
}

.finder-results a:hover,
.finder-results a:focus { background: var(--paper-deep); }

.finder-results small {
  display: block;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
}

.finder-results p {
  margin: 0.3rem 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.front {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(16rem, 0.8fr);
  gap: 1.2rem;
  padding: 1.1rem 1.2rem 0.4rem 3.15rem;
}

.cover {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  min-height: 17.5rem;
  background: #fbf7ef;
  border: 1px solid #ddd2bf;
  box-shadow: 5px 6px 0 rgba(36, 24, 12, 0.06);
  text-decoration: none;
  color: inherit;
  position: relative;
}

.cover:hover { border-color: var(--spine); }

.cover-spine { background: linear-gradient(90deg, #142823, var(--spine) 55%, var(--spine-soft)); }

.cover-body {
  padding: 1rem 6.6rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cover-kicker,
.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--stamp);
  text-transform: uppercase;
}

.cover-title {
  font-size: clamp(1.45rem, 3vw, 2.05rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.cover-dek { color: var(--muted); margin-top: auto; }

.cover-open {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--spine);
}

.stamp {
  position: absolute;
  right: 0.8rem;
  bottom: 0.7rem;
  width: 5.6rem;
  height: 5.6rem;
  border: 2px solid var(--stamp);
  border-radius: 50%;
  color: var(--stamp);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  transform: rotate(-8deg);
  background: rgba(246, 241, 230, 0.85);
}

.side-sheet {
  background: var(--paper-deep);
  border: 1px solid #ddd2bf;
  padding: 0.85rem 0.9rem 1rem;
  box-shadow: 4px 5px 0 rgba(36, 24, 12, 0.05);
}

.side-sheet h2,
.block h2,
.essay h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.55rem;
  letter-spacing: -0.02em;
}

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

.toc-book li + li { margin-top: 0.38rem; }

.toc-book a {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  color: inherit;
  text-decoration: none;
}

.toc-book a:hover .toc-name { color: var(--stamp); }

.toc-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--stamp);
  min-width: 1.6rem;
}

.toc-name { flex: 0 1 auto; }

.toc-dots {
  flex: 1 1 auto;
  border-bottom: 1px dotted #9c907e;
  transform: translateY(-0.25rem);
  min-width: 1rem;
}

.rule-note {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.95rem;
}

.rule-note p { margin: 0.4rem 0 0; }

.essay {
  margin-top: 1.1rem;
  column-count: 2;
  column-gap: 1.6rem;
}

.essay p { margin: 0 0 0.75rem; }

.essay h2 { column-span: all; }

.block { padding: 0.4rem 1.2rem 1.1rem 3.15rem; }

.sign {
  margin: 0 0 0.8rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--gold);
  background: var(--paper-deep);
  color: var(--ink);
  font-size: 0.95rem;
}

.meters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0 0 0.9rem;
  padding: 0;
}

.meters div {
  margin: 0;
  padding: 0.55rem 0.6rem 0.65rem;
  background: #fffaf2;
  border: 1px solid var(--rule);
}

.meters dt {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.meters dd { margin: 0.2rem 0 0; font-size: 1.02rem; overflow-wrap: anywhere; }

.meters .fine {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.tape-tools { max-width: 24rem; margin: 0.2rem 0 0.6rem; }

.tape-tools label {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.tape-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }

table.tape {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

table.tape caption {
  caption-side: bottom;
  text-align: left;
  padding: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

table.tape th,
table.tape td {
  padding: 0.38rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  white-space: nowrap;
}

table.tape th {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

table.tape td.num,
table.tape th.num { text-align: right; }

table.tape tbody tr:hover { background: rgba(239, 230, 212, 0.7); }

.up { color: var(--up); }

.down { color: var(--down); }

.tape-status {
  min-height: 1.2rem;
  margin: 0.35rem 0 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
}

.route {
  width: 100%;
  border-collapse: collapse;
}

.route th,
.route td {
  text-align: left;
  vertical-align: top;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.route th {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.sheet-body { padding: 1rem 1.25rem 0.5rem 3.2rem; }

.sheet-body h1 {
  margin: 0.2rem 0 0.4rem;
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  font-weight: 550;
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 22ch;
}

.dek { margin: 0 0 0.8rem; max-width: 46rem; font-size: 1.05rem; }

.toc-toggle {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--spine);
  border: 1px solid var(--spine);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

.toc-toggle:hover { background: var(--paper-deep); }

.sheet-toc {
  margin: 0.7rem 0 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  max-width: 40rem;
}

.sheet-toc ol { margin: 0.3rem 0 0; padding-left: 1.2rem; }

.sheet-toc a { text-decoration: none; }

.sheet-toc a:hover { text-decoration: underline; }

.prose { max-width: 68ch; }

.prose h2 {
  margin: 1.35rem 0 0.4rem;
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.prose p { margin: 0 0 0.75rem; }

.prose > p:first-of-type::first-letter {
  float: left;
  font-size: 3rem;
  line-height: 0.8;
  padding: 0.15rem 0.4rem 0 0;
  color: var(--spine);
}

.figure {
  margin: 1rem 0;
  padding: 0.6rem 0.7rem 0.4rem;
  border: 1px solid var(--rule);
  background: #fffaf2;
  max-width: 40rem;
}

.figure svg { width: 100%; height: auto; display: block; }

.figure figcaption {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.further {
  margin-top: 1.2rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--rule);
  max-width: 68ch;
}

.further h2 { font-size: 1.05rem; margin: 0 0 0.4rem; }

.further ul { margin: 0; padding-left: 1.1rem; }

.folio {
  text-align: center;
  letter-spacing: 0.2em;
  margin: 1.2rem 0 0.2rem;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 0.8rem;
}

.filters button {
  font-family: var(--sans);
  font-size: 0.78rem;
  background: transparent;
  border: 1px solid #c9bba4;
  color: var(--ink);
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}

.filters button[aria-pressed="true"] {
  background: var(--spine);
  border-color: var(--spine);
  color: #f6f1e6;
}

.catalog { list-style: none; margin: 0; padding: 0; max-width: 46rem; }

.catalog li {
  border-top: 1px solid var(--rule);
  padding: 0.65rem 0;
}

.catalog li:last-child { border-bottom: 1px solid var(--rule); }

.catalog a {
  text-decoration: none;
  font-size: 1.12rem;
}

.catalog a:hover { text-decoration: underline; }

.catalog p { margin: 0.25rem 0 0; color: var(--muted); }

.shelf-tag {
  display: inline-block;
  margin-right: 0.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--stamp);
  text-transform: uppercase;
}

.colophon {
  padding: 0.4rem 1.2rem 1.2rem 3.15rem;
  border-top: 3px double var(--ink);
  margin-top: 0.6rem;
}

.disclaimer { margin: 0.7rem 0 0.4rem; max-width: 48rem; }

.mail { margin: 0.2rem 0 0.7rem; overflow-wrap: anywhere; }

.network {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  list-style: none;
  margin: 0;
  padding: 0.6rem 0 0;
  border-top: 1px solid var(--rule);
}

.network a {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-decoration: none;
}

.network a:hover { text-decoration: underline; }

.network a[aria-current="page"] { color: var(--stamp); }

.colophon-meta {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.empty-sheet { max-width: 40rem; }

@media (max-width: 860px) {
  .front,
  .meters { grid-template-columns: 1fr 1fr; }
  .essay { column-count: 1; }
  .sheet::before { left: 0.7rem; }
  .running,
  .masthead,
  .front,
  .block,
  .sheet-body,
  .colophon { padding-left: 1.5rem; padding-right: 0.85rem; }
  .stamp { position: static; transform: none; margin-top: 0.3rem; }
  .cover-body { padding-right: 1rem; }
  .cover { min-height: 0; }
}

@media (max-width: 560px) {
  html { font-size: 17px; }
  .desk { padding: 0.4rem 0.3rem 1.4rem; }
  .meters,
  .front { grid-template-columns: 1fr; }
  .prose > p:first-of-type::first-letter { font-size: 2.35rem; }
  .cover-title { padding-right: 0; }
}

@media (min-width: 1200px) {
  .desk { padding-top: 1.4rem; }
  .sheet { margin-top: 0.4rem; }
}
