/* ══════════════════════════════════════════════════════════════════════════
   Characterly shelf — worker-rendered pages (/characters, /characters/<id>).
   Same "Familiar" language as styles.css, self-contained: the hashed vite
   bundle isn't reachable from worker HTML, so fonts load from /fonts/.
   ══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Fraunces Variable";
  font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/fonts/fraunces-latin-opsz-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Instrument Sans Variable";
  font-style: normal; font-display: swap; font-weight: 400 700;
  src: url("/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal; font-display: swap; font-weight: 400;
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal; font-display: swap; font-weight: 500;
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  --bg: #0d0a0e; --bg-2: #141015; --bg-3: #1b161c;
  --paper: #efe5d1; --paper-2: #c4b7a0; --paper-3: #93877a;
  --gold: #d4a35b; --gold-hi: #ebc283;
  --rule: rgba(212, 163, 91, 0.15); --rule-2: rgba(212, 163, 91, 0.32);
  --hair: rgba(239, 229, 209, 0.08);
  --serif: "Fraunces Variable", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --wrap: 1180px; --nav-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scrollbar-color: #3a2f2a var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--paper);
  font-family: var(--sans); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: rgba(212, 163, 91, 0.32); }
img { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
h1, h2 {
  margin: 0; font-family: var(--serif); font-weight: 380;
  font-optical-sizing: auto; line-height: 1.04; letter-spacing: -0.018em;
  text-wrap: balance;
}
h1 { font-size: clamp(40px, 6vw, 64px); }
h2 { font-size: clamp(24px, 3vw, 32px); margin: 44px 0 14px; color: var(--paper); }
.dim { color: var(--paper-3); }

/* ── Nav ────────────────────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(13, 10, 14, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--hair); }
.nav-inner { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; height: var(--nav-h); display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 20px; letter-spacing: -0.01em; }
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a { color: var(--paper-2); text-decoration: none; font-size: 14.5px; transition: color 0.2s; }
.nav-links a:hover { color: var(--gold-hi); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 22px; font-size: 15px; font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; border-radius: 3px; cursor: pointer;
  color: #1d140a; background: linear-gradient(180deg, #e6ba74 0%, #cf9b51 100%);
  box-shadow: inset 0 1px 0 rgba(255, 244, 222, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.35), 0 12px 32px -14px rgba(222, 158, 80, 0.7);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.btn:hover { transform: translateY(-1px); background: linear-gradient(180deg, #efc683 0%, #d9a65c 100%); }
.nav .btn { padding: 10px 18px; font-size: 14px; }

/* ── Shelf index ────────────────────────────────────────────────────────── */
main { min-height: 60vh; }
.shelf { max-width: var(--wrap); margin: 0 auto; padding: 72px 28px 96px; }
.label {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
}
.label::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: 0.6; }
.lede { margin-top: 20px; font-size: 18px; color: var(--paper-2); max-width: 62ch; text-wrap: pretty; }
.lede a { color: var(--gold-hi); }

.grid { margin-top: 44px; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.grid-tight { margin-top: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-tight .card { padding: 14px; }
.grid-tight .card-av { width: 48px; height: 48px; font-size: 20px; }
.card {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 20px; background: var(--bg-2); border: 1px solid var(--hair);
  border-radius: 6px; text-decoration: none;
  transition: border-color 0.25s, transform 0.3s var(--ease), background 0.25s;
}
.card:hover { border-color: var(--rule-2); background: var(--bg-3); transform: translateY(-2px); }
.card-av { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; border: 1px solid var(--hair); }
.card-av-ph {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-3); color: var(--gold);
  font-family: var(--serif); font-size: 26px; font-style: italic;
}
.card-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.card-name { font-family: var(--serif); font-size: 21px; letter-spacing: -0.01em; }
.card-tag { font-size: 14.5px; color: var(--paper-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--paper-3); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.tag {
  display: inline-flex; padding: 3px 9px; border: 1px solid var(--rule); border-radius: 999px;
  font-family: var(--mono); font-size: 11px; color: var(--gold); letter-spacing: 0.04em;
}
.tag-dim { color: var(--paper-3); border-color: var(--hair); }

/* ── Listing page ───────────────────────────────────────────────────────── */
.listing { max-width: 860px; margin: 0 auto; padding: 56px 28px 96px; }
.crumbs { font-family: var(--mono); font-size: 12px; color: var(--paper-3); margin-bottom: 36px; }
.crumbs a { color: var(--gold); text-decoration: none; }
.crumbs a:hover { color: var(--gold-hi); }
.listing-head { display: flex; gap: 28px; align-items: flex-start; }
.listing-av { width: 132px; height: 132px; border-radius: 12px; object-fit: cover; flex: none; border: 1px solid var(--hair); }
.listing-av.card-av-ph { font-size: 52px; }
.listing-head h1 { font-size: clamp(34px, 5vw, 52px); }
.listing-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0 24px; font-family: var(--mono); font-size: 12.5px; }
.listing section p, .listing section blockquote { color: var(--paper-2); font-size: 16.5px; }
.greet {
  margin: 0; padding: 20px 24px; border-left: 2px solid var(--gold);
  background: var(--bg-2); border-radius: 0 6px 6px 0; font-style: italic;
}
.facts { margin: 0; display: grid; grid-template-columns: minmax(140px, 200px) 1fr; gap: 12px 20px; }
.facts dt { font-family: var(--mono); font-size: 12.5px; color: var(--gold); letter-spacing: 0.04em; padding-top: 2px; }
.facts dd { margin: 0; color: var(--paper-2); font-size: 15.5px; }
.listing section .dim { margin-top: 18px; font-size: 14.5px; color: var(--paper-3); }

.cta-back { margin-top: 56px; }
.cta-back a { color: var(--gold); text-decoration: none; font-size: 15px; }
.cta-back a:hover { color: var(--gold-hi); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.foot {
  max-width: var(--wrap); margin: 0 auto; padding: 28px;
  border-top: 1px solid var(--hair);
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  color: var(--paper-3); font-size: 13.5px;
}
.foot nav { display: flex; gap: 18px; }
.foot a { color: var(--paper-2); text-decoration: none; }
.foot a:hover { color: var(--gold-hi); }

@media (max-width: 720px) {
  .nav-links { display: none; }
  .listing-head { flex-direction: column; }
  .listing-av { width: 96px; height: 96px; }
  .shelf { padding-top: 48px; }
}
