/* D.R. Thorn — The Accession Ledger. A calm town archive on pale paper; the horror is in the catalog notes. */
@font-face { font-family: 'Libre Caslon Display'; src: url('fonts/caslondisplay.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Libre Caslon Text'; src: url('fonts/caslontext.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Libre Caslon Text'; src: url('fonts/caslontext-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url('fonts/courierprime.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url('fonts/courierprime-bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --paper: #ecebe4;     /* background */
  --paper-2: #e3e1d8;   /* alternate bands */
  --card: #f7f6f1;      /* catalog cards */
  --rule: #c9c5b8;
  --dash: #b9b4a6;
  --ink: #15140f;       /* 15.4:1 on paper */
  --body: #34322b;      /* 10.7:1 on paper, 9.8:1 on paper-2 */
  --muted: #5f5b50;     /* 5.7:1 on paper, 5.2:1 on paper-2, 6.3:1 on card */
  --red: #9b1c1c;       /* stamp red: 6.8:1 on paper, 7.5:1 on card; white on it 7.9:1 */
  --red-deep: #6e1313;
  --teal: #2c5a63;      /* archive teal: 6.4:1 on paper */
  --night-text: #d6d3c8;/* on ink: 12.7:1 */
  --display: 'Libre Caslon Display', 'Big Caslon', Georgia, serif;
  --text: 'Libre Caslon Text', Georgia, 'Times New Roman', serif;
  --type: 'Courier Prime', 'Courier New', monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--text); font-size: 19px; line-height: 1.65; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-underline-offset: 3px; }
a:hover { color: var(--red-deep); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 30; background: var(--ink); color: var(--paper); padding: 10px 16px; font-family: var(--type); }
.skip:focus { left: max(16px, env(safe-area-inset-left, 0px)); }

/* Header */
.site-header { border-bottom: 1px solid var(--ink); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; padding-block: 16px; }
.wordmark { font-family: var(--display); font-size: 32px; line-height: 1.1; color: var(--ink); text-decoration: none; }
.wordmark:hover { color: var(--ink); }
.nav { display: flex; flex-wrap: wrap; gap: 0 26px; font-family: var(--type); font-size: 16px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); }
.nav a:hover { color: var(--red); }
.nav a[aria-current="page"] { color: var(--red); text-decoration-thickness: 2px; }
.nav a.nav-cta { color: var(--red); }

/* Type */
.label { margin: 0; font-family: var(--type); font-size: 16px; color: var(--muted); }
.label.red { color: var(--red); }
.label.teal { color: var(--teal); }
.display { margin: 0; font-family: var(--display); font-weight: 400; line-height: 1.04; text-wrap: balance; overflow-wrap: break-word; }
.d1 { font-size: clamp(42px, 6.2vw, 84px); }
.d2 { font-size: clamp(38px, 5vw, 64px); }
.d3 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; }
.d4 { font-size: 27px; line-height: 1.1; }
.answer { margin: 0; font-family: var(--display); font-size: clamp(26px, 3vw, 36px); line-height: 1.2; color: var(--red); }
.lede { margin: 0; max-width: 32em; font-size: clamp(20px, 2.2vw, 22px); color: var(--body); }
.prose { margin: 0; max-width: 36em; color: var(--body); }
.big { margin: 0; max-width: 32em; font-size: clamp(21px, 2.3vw, 23px); line-height: 1.5; }
.redact { background: var(--ink); color: var(--ink); padding: 0 .15em; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: color 1.2s ease; }
.redact:hover { color: var(--paper); }
.on-ink .redact { background: var(--paper); color: var(--paper); }
.on-ink .redact:hover { color: var(--ink); }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 28px; font-family: var(--type); font-weight: 700; font-size: 17px; text-decoration: none; text-align: center; border: 1px solid transparent; cursor: pointer; transition: background-color .15s, color .15s; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: #33312a; color: var(--paper); }
.btn-red { background: var(--red); color: #ffffff; }
.btn-red:hover { background: var(--red-deep); color: #ffffff; }
.btn-line { border-color: var(--ink); color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); }

/* Hero */
.hero .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 56px; align-items: center; padding-block: clamp(48px, 7vw, 80px) clamp(64px, 9vw, 96px); }
.hero-copy { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.mount { margin: 0; justify-self: center; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 14px; background: var(--card); box-shadow: 0 1px 0 #d6d3c8, 0 24px 60px rgba(21, 20, 15, 0.18); transform: rotate(1.5deg); }
.mount figcaption { font-family: var(--type); font-size: 15px; line-height: 1.45; color: var(--muted); }
.cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }

/* Sections */
.band { border-top: 1px solid var(--ink); }
.band.alt { background: var(--paper-2); }
.band.ink { background: var(--ink); color: var(--paper); }
.band > .wrap { padding-block: clamp(64px, 9vw, 88px); }
.stack { display: flex; flex-direction: column; gap: 40px; }
.row-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }
.centered { max-width: 900px; display: flex; flex-direction: column; gap: 20px; align-items: center; text-align: center; }
.on-ink .prose { color: var(--night-text); }
.on-ink .label { color: var(--night-text); }
.split { display: flex; flex-wrap: wrap; gap: 48px; }
.split > :first-child { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.split > :last-child { flex: 2 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* Ledger cards */
.ledger { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.entry { position: relative; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; padding: 20px; background: var(--card); border: 1px solid var(--rule); box-shadow: 0 1px 0 #d6d3c8; transition: box-shadow .2s ease, transform .2s ease; }
.entry:hover { box-shadow: 0 1px 0 #d6d3c8, 0 14px 30px rgba(21, 20, 15, 0.12); transform: translateY(-2px); }
.entry img { width: 112px; aspect-ratio: 2 / 3; object-fit: cover; }
.entry .rec { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-family: var(--type); font-size: 15px; line-height: 1.45; }
.entry .rec p { margin: 0; }
.entry .no { color: var(--muted); }
.entry .kind { color: var(--teal); }
.entry h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 27px; line-height: 1.1; }
.entry h3 a { color: var(--ink); text-decoration: none; }
.entry h3 a::after { content: ""; position: absolute; inset: 0; }
.entry .cond { margin-top: 6px !important; padding-top: 8px; border-top: 1px dashed var(--dash); color: var(--body); }
.entry .cond b, .record .cond b { color: var(--red); }
.entry .go { margin-top: auto !important; padding-top: 6px; color: var(--red); font-weight: 700; }

/* Book page */
.book .wrap { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; padding-block: clamp(40px, 6vw, 64px) clamp(64px, 9vw, 88px); }
.book .mount { flex: 0 1 380px; transform: rotate(-1deg); }
.book-copy { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.subtitle { margin: -6px 0 0; font-style: italic; font-size: 21px; color: var(--muted); }
.hook { margin: 0; font-size: clamp(21px, 2.3vw, 23px); line-height: 1.5; color: var(--ink); }
.stamp { align-self: flex-start; margin: 4px 0; padding: 6px 14px; border: 2px solid var(--red); color: var(--red); font-family: var(--type); font-weight: 700; font-size: 17px; transform: rotate(-1.5deg); }
.record { margin: 6px 0 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 22px; padding: 20px; background: var(--card); border: 1px solid var(--rule); font-family: var(--type); font-size: 16px; line-height: 1.45; max-width: 36em; }
.record dt { color: var(--muted); }
.record dd { margin: 0; color: var(--ink); }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.band > .wrap.pager { padding-block: 28px; }
.pager a { display: inline-flex; flex-direction: column; min-height: 44px; text-decoration: none; color: var(--ink); }
.pager a span { font-family: var(--type); font-size: 15px; color: var(--muted); }
.pager a strong { font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1.2; }
.pager a:hover strong { color: var(--red); }
.pager .next { margin-left: auto; text-align: right; align-items: flex-end; }

.cta .wrap { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-end; justify-content: space-between; }
.cta .cta-copy { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.portrait { margin: 0; width: 100%; max-width: 280px; padding: 14px 14px 10px; background: var(--card); box-shadow: 0 1px 0 #d6d3c8, 0 18px 40px rgba(21, 20, 15, 0.15); transform: rotate(-1.5deg); }
.portrait img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.portrait figcaption { padding-top: 8px; font-family: var(--type); font-size: 14px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; padding-block: 0 clamp(56px, 8vw, 88px); }
.card { padding: 28px; background: var(--card); border: 1px solid var(--rule); display: flex; flex-direction: column; gap: 14px; }
.facts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.facts li { padding-left: 24px; position: relative; color: var(--body); }
.facts li::before { content: "—"; position: absolute; left: 0; color: var(--red); font-family: var(--type); }

/* Footer */
.site-footer { border-top: 1px solid var(--ink); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-block: 24px; font-family: var(--type); font-size: 15px; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--red); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }

.lost { min-height: 45vh; display: flex; flex-direction: column; justify-content: center; gap: 22px; }

@media (max-width: 600px) {
  body { font-size: 18px; }
  .wordmark { font-size: 27px; }
  .nav { gap: 0 18px; font-size: 15px; }
  .mount { max-width: 270px; }
  .book .mount { flex-basis: 270px; margin: 0 auto; }
  .ledger { grid-template-columns: minmax(0, 1fr); }
  .entry { grid-template-columns: 92px minmax(0, 1fr); gap: 16px; padding: 16px; }
  .entry img { width: 92px; }
  .entry h3 { font-size: 24px; }
  .record { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .record dd { margin-bottom: 8px; }
  .actions .btn { flex: 1 1 100%; }
  .pager .next { margin-left: 0; text-align: left; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
