/* ============================================================================
   APEC — DOCUMENTS · STYLESHEET
   A private reading room: one carved bookcase (shelf.png), law-calf volumes,
   two parchment scrolls, lamplight and dust. Fraunces / Instrument Sans /
   IBM Plex Mono. All shelves are rendered by js/documents.js from
   data/documents-data.js — this file only knows how things LOOK.
   ========================================================================== */

:root {
  --ink:        #0a0b0d;
  --ink-2:      #101217;
  --ink-3:      #161922;
  --line:       rgba(237, 231, 216, 0.13);
  --line-soft:  rgba(237, 231, 216, 0.07);
  --cream:      #ede7d8;
  --cream-dim:  #b6afa0;
  --muted:      #837e70;
  --gold:       #c9a45c;
  --gold-hi:    #e6c581;
  --gold-dim:   rgba(201, 164, 92, 0.35);

  /* the room */
  --room:       #070604;
  --room-2:     #0e0a06;
  --lamplight:  rgba(255, 196, 110, 0.10);

  /* leather & paper */
  --law-leather: 32;                 /* hue for the tan law volumes        */
  --paper:      #efe6d2;
  --paper-2:    #e6d9bd;
  --parch:      #e9dcbc;
  --parch-2:    #d9c69a;
  --parch-ink:  #38291a;
  --wax:        #7e2320;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-text:    "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", Consolas, "Courier New", monospace;

  --pad: clamp(1.25rem, 4vw, 4rem);
  --head-h: 4.25rem;
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-fly:  cubic-bezier(0.3, 0.9, 0.22, 1);
  --ease-page: cubic-bezier(0.55, 0.06, 0.28, 0.99);
}

/* ---- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 125%; /* +25%: 16→20px base type scale, for PC legibility */ scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background:
    radial-gradient(120% 90% at 50% 0%, #14100a 0%, var(--room) 55%, #030302 100%)
    var(--room);
  color: var(--cream);
  font-family: var(--font-text);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  overflow-x: clip;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--gold); color: var(--ink); }
a { color: var(--gold-hi); text-decoration-color: var(--gold-dim); text-underline-offset: 3px; }
a:hover { color: var(--cream); }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; border-radius: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: fixed; top: -4rem; left: 1rem; z-index: 300;
  background: var(--gold); color: var(--ink);
  padding: 0.6rem 1rem; font-family: var(--font-mono); font-size: 0.8rem;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* Film grain */
.grain {
  position: fixed; inset: -50%; z-index: 120; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  animation: grain-shift 0.9s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); } 25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); } 75% { transform: translate(-1%, 2%); }
  100% { transform: translate(2%, -1%); }
}

/* ---- Custom cursor -------------------------------------------------------- */
.cursor-dot, .cursor-ring { display: none; }
@media (pointer: fine) {
  .cursor-dot {
    display: block; position: fixed; z-index: 400; pointer-events: none;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--gold-hi); left: 0; top: 0;
    transform: translate(-50%, -50%);
  }
  .cursor-ring {
    display: flex; align-items: center; justify-content: center;
    position: fixed; z-index: 399; pointer-events: none;
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--gold-dim);
    left: 0; top: 0; transform: translate(-50%, -50%) scale(1);
    transition: transform 0.25s var(--ease-out), background 0.25s, border-color 0.25s;
  }
  .cursor-ring span {
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--ink); opacity: 0;
    transition: opacity 0.2s;
  }
  .cursor-ring.is-active {
    transform: translate(-50%, -50%) scale(1.55);
    background: var(--gold); border-color: var(--gold);
  }
  .cursor-ring.is-active span { opacity: 1; }
}

/* ---- Fixed chrome ---------------------------------------------------------- */
.site-head {
  position: fixed; inset: 0 0 auto 0; z-index: 200;
  height: var(--head-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  background: linear-gradient(180deg, rgba(7, 6, 4, 0.9), rgba(7, 6, 4, 0));
  pointer-events: none;
}
.site-head > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.brand__mark { width: 40px; height: auto; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6)); }
.brand__text strong {
  display: block; font-family: var(--font-display); font-weight: 600;
  font-size: 1.05rem; letter-spacing: 0.16em; color: var(--cream); line-height: 1.1;
}
.brand__text small {
  display: block; font-family: var(--font-mono); font-size: 0.58rem;
  letter-spacing: 0.08em; color: var(--muted); margin-top: 2px;
}
.head-note {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
}
.head-side { display: flex; align-items: center; gap: 1.4rem; }
.head-home {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--gold-hi); text-decoration: none;
  border-bottom: 1px solid var(--gold-dim); padding-bottom: 2px;
  transition: color 0.25s, border-color 0.25s;
}
.head-home:hover { color: var(--cream); border-color: var(--cream); }

/* ---- Load reveals ---------------------------------------------------------- */
.reveal-load { opacity: 0; transform: translateY(14px); animation: rise 1s var(--ease-out) forwards; animation-delay: var(--d, 0s); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ============================================================================
   THE LIBRARY SCENE
   ========================================================================== */
.library {
  position: relative;
  padding: calc(var(--head-h) + clamp(1.5rem, 4vh, 3.5rem)) var(--pad) clamp(2rem, 5vh, 4rem);
  display: grid; justify-items: center;
}
.library__halo {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(55% 40% at 50% 34%, var(--lamplight), transparent 70%),
    radial-gradient(30% 22% at 18% 8%, rgba(255, 180, 90, 0.05), transparent 70%),
    radial-gradient(30% 22% at 82% 8%, rgba(255, 180, 90, 0.05), transparent 70%);
}

.library__intro { text-align: center; margin-bottom: clamp(1.4rem, 3.5vh, 2.6rem); position: relative; }
.library__kicker {
  font-family: var(--font-mono); font-size: clamp(0.6rem, 0.55rem + 0.3vw, 0.75rem);
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--gold);
}
.library__title {
  font-family: var(--font-display); font-weight: 380; font-size: clamp(2.1rem, 1.5rem + 3vw, 3.6rem);
  letter-spacing: 0.02em; line-height: 1.05; margin: 0.35em 0 0.3em; color: var(--cream);
}
.library__title::after {
  content: ""; display: block; width: 72px; height: 1px; margin: 0.5em auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.library__sub {
  font-family: var(--font-mono); font-size: clamp(0.62rem, 0.55rem + 0.35vw, 0.78rem);
  letter-spacing: 0.16em; color: var(--cream-dim);
}

/* -- the case fits its column ---------------------------------------------- */
.case-viewport {
  position: relative; width: 100%; max-width: 1220px;
  min-width: 0; /* let the grid shrink it below the bookcase's min-width */
  overflow: visible;
}
/* On phones the whole bookcase scales down to fit the screen (the register
   below is the real way to browse there) — no sideways scroll, no cut-off.
   Labels size themselves via --fw/--fn, so nothing else changes here. */
@media (max-width: 800px) {
  .bookcase { min-width: 0; width: 100%; }
  .book { min-width: 0 !important; }           /* scale with the shelf, don't overflow the row */
  .case-pan-hint { display: none !important; }
}

.case-pan-hint { display: none; }

/* -- the bookcase ----------------------------------------------------------- */
.bookcase {
  position: relative;
  container-type: inline-size;
  filter: brightness(0.18) saturate(0.6);
  transition: filter 2s var(--ease-out);
  border-radius: 6px;
}
.bookcase.lit { filter: brightness(1) saturate(1); }

.bookcase__img { width: 100%; height: auto; border-radius: 6px; display: block; }

/* soft shading that marries the books to the photo */
.bookcase__shade {
  position: absolute; inset: 0; pointer-events: none; z-index: 3; border-radius: 6px;
  background:
    radial-gradient(90% 60% at 50% 108%, rgba(0, 0, 0, 0.42), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent 14% 84%, rgba(0, 0, 0, 0.3));
}
.bookcase__glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 4; border-radius: 6px;
  background:
    radial-gradient(70% 26% at 50% 4%, rgba(255, 208, 130, 0.16), transparent 75%),
    radial-gradient(46% 16% at 50% 36.5%, rgba(255, 200, 120, 0.06), transparent 80%),
    radial-gradient(46% 16% at 50% 55.4%, rgba(255, 200, 120, 0.05), transparent 80%),
    radial-gradient(46% 16% at 50% 74.2%, rgba(255, 200, 120, 0.05), transparent 80%);
  opacity: 0; transition: opacity 2.4s var(--ease-out) 0.3s;
}
.bookcase.lit .bookcase__glow { opacity: 1; }

/* the case throws light on the floor beneath it */
.case-floor {
  height: clamp(34px, 6vw, 64px); margin-top: -6px;
  max-width: 1220px; width: 100%;
  background: radial-gradient(60% 130% at 50% 0%, rgba(126, 92, 48, 0.28), rgba(30, 20, 10, 0.05) 55%, transparent 75%);
  mask-image: linear-gradient(180deg, #000, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent);
}

/* dust motes drifting through the lamplight */
.motes { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.motes i {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s); height: var(--s); border-radius: 50%;
  background: rgba(255, 214, 150, 0.55);
  filter: blur(0.6px);
  opacity: 0;
  animation: mote var(--t) linear infinite; animation-delay: var(--dl);
}
@keyframes mote {
  0%   { transform: translate3d(0, 30px, 0); opacity: 0; }
  12%  { opacity: var(--o); }
  85%  { opacity: calc(var(--o) * 0.5); }
  100% { transform: translate3d(var(--dx), -150px, 0); opacity: 0; }
}

.library__hint {
  margin-top: clamp(1.2rem, 3vh, 2rem); text-align: center;
  font-family: var(--font-display); font-style: italic; font-weight: 350;
  font-size: clamp(0.95rem, 0.9rem + 0.4vw, 1.15rem); color: var(--cream-dim);
}
.library__hint::before, .library__hint::after { content: "—"; color: var(--gold-dim); margin: 0 0.7em; }

/* ============================================================================
   SHELF ROWS · PLAQUES · BOOKS · SCROLLS   (built by JS)
   ========================================================================== */
.bookcase__rows { position: absolute; inset: 0; z-index: 2; }

/* Each row is anchored to a shelf board measured from the photograph.
   --sit  : y of the board's lit top edge (books stand on it)
   --open : height of the opening above the board                       */
.shelf-row {
  position: absolute; left: 15%; width: 70%;
  bottom: calc(100% - var(--sit));
  height: var(--open);
  display: flex; align-items: flex-end; justify-content: center;
  gap: 0.14cqw;
}
.shelf-row[data-row="1"] { --sit: 37.15%; --open: 14.6%; }
.shelf-row[data-row="2"] { --sit: 55.95%; --open: 16.1%; }
.shelf-row[data-row="3"] { --sit: 74.75%; --open: 16.1%; }
.shelf-row[data-row="4"] { --sit: 93.05%; --open: 16.0%; }

/* rows that overflow become browsable sideways */
.shelf-row.is-overflowing {
  justify-content: flex-start;
  overflow-x: auto; overflow-y: visible;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent, #000 3.5%, #000 96.5%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3.5%, #000 96.5%, transparent);
  cursor: grab;
}
.shelf-row.is-overflowing::-webkit-scrollbar { display: none; }
.shelf-row.is-dragging { cursor: grabbing; }

/* -- brass plaques on the shelf edges -------------------------------------- */
.plaque {
  position: absolute; left: 50%; z-index: 6;
  top: calc(var(--for-sit) + 0.55%);
  transform: translateX(-50%);
  padding: 0.28em 1.1em;
  font-family: var(--font-mono); font-size: clamp(7px, 0.72cqw, 11px);
  letter-spacing: 0.26em; text-transform: uppercase; white-space: nowrap;
  color: #2b1d0c;
  background: linear-gradient(180deg, #e8c987, #b78d4a 55%, #8a6430);
  border: 1px solid rgba(60, 40, 14, 0.75);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 240, 200, 0.5);
  opacity: 1; transition: opacity 1s var(--ease-out) 1.6s;
  pointer-events: none;
}
.bookcase:not(.lit) .plaque { opacity: 0; }
.plaque::before, .plaque::after {
  content: ""; position: absolute; top: 50%; width: 3px; height: 3px;
  border-radius: 50%; transform: translateY(-50%);
  background: radial-gradient(circle at 35% 35%, #f7e3b2, #6d4d22);
  box-shadow: inset 0 0 1px rgba(0,0,0,.6);
}
.plaque::before { left: 5px; } .plaque::after { right: 5px; }

/* ---------------------------------------------------------------------------
   BOOKS ON THE SHELF
   --------------------------------------------------------------------------- */
.book {
  position: relative; flex: 0 0 auto;
  width: var(--bw); height: var(--bh);
  transform-origin: bottom center;
  transform: translateY(0) rotate(var(--lean, 0deg));
  opacity: 1;
  transition:
    opacity 0.55s var(--ease-out) var(--d, 0s),
    transform 0.55s var(--ease-out) var(--d, 0s);
  border-radius: 2px 2px 0 0;
}
/* entrance: books rest hidden until the room lights come on */
.bookcase:not(.lit) .book { opacity: 0; transform: translateY(10%); }

/* the spine is a photograph (spine-bgm.png / spine-report.png), lettered with
   one clean golden label — the YEAR for minutes, the COUNTRY for reports */
.book__spine {
  position: absolute; inset: 0;
  display: block;
  border-radius: 2px;
  overflow: hidden;
  /* the photograph itself is set inline by js/documents.js as an ABSOLUTE
     background-image url — a url() inside a CSS variable resolves against
     this stylesheet's folder and 404s when the page is opened from disk */
  background-color: #241a10;
  background-size: 100% 100%; background-position: center; background-repeat: no-repeat;
  filter: brightness(1.5) saturate(1.22);
  box-shadow:
    inset 0 1px 1px rgba(255, 240, 210, 0.18),
    inset 0 -2px 3px rgba(0, 0, 0, 0.35),
    1px 0 1px rgba(0, 0, 0, 0.4);
}
.book::after { /* shadow cast on the shelf */
  content: ""; position: absolute; left: -12%; right: -12%; bottom: -2px; height: 8%;
  background: radial-gradient(50% 100% at 50% 100%, rgba(0, 0, 0, 0.55), transparent 75%);
  z-index: -1;
}

.book:hover .book__spine,
.book:focus-visible .book__spine { filter: brightness(1.18) saturate(1.06); }
.book:hover, .book:focus-visible {
  transform: translateY(-3.5%) rotate(var(--lean, 0deg)) !important;
  z-index: 8;
  transition-delay: 0s;
}

/* one golden label down the spine — a single horizontal line rotated 90° as
   a unit (like a real stamped spine): it stays legible and can never reorder.
   Wide screens show the full text ("BANGKOK · 1985" / "AUSTRALIA · 2025");
   below 1000px the .book__extra segment drops and only the year / country
   stays. --fw and --fn (set per book by JS from the text length) size the
   type so each label fills its spine at any bookcase size. */
.book__label {
  position: absolute; inset: 0; overflow: hidden;
  font-family: var(--font-display); font-weight: 640;
  color: #f0d089;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.9), 0 0 5px rgba(0, 0, 0, 0.45);
}
.book__label b {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  white-space: nowrap; font-weight: inherit;
  /* two constraints, whichever is smaller wins: --fw/--fn fits the text
     LENGTH into the spine's height; the var(--bw) term caps the letters to
     roughly half the spine's own WIDTH so short labels (a bare year) can
     never crowd edge-to-edge — --bw carries its own cqw unit already. */
  font-size: clamp(3.2px, min(calc(var(--bw, 3.1cqw) * 0.5), calc(var(--fw, 1) * 1cqw)), 15px);
  letter-spacing: 0.05em;
}
@media (max-width: 1000px) {
  .book__extra { display: none; }
  .book__label b {
    font-size: clamp(3.2px, min(calc(var(--bw, 3.1cqw) * 0.5), calc(var(--fn, 1) * 1cqw)), 14px);
    letter-spacing: 0.04em;
  }
}

/* ---------------------------------------------------------------------------
   SCROLLS ON THE TOP SHELF (Constitution & By-Laws) — photographed scrolls,
   lying flat on the board. The images carry their own titles and twine.
   --------------------------------------------------------------------------- */
.shelf-row[data-row="1"] { gap: 5.5cqw; align-items: flex-end; overflow: visible; }

.shelf-scroll {
  position: relative; flex: 0 0 auto;
  width: 21cqw;
  display: grid; align-items: end; justify-items: center;
  opacity: 1; transform: none;
  transition: opacity 0.7s var(--ease-out) var(--d, 0.9s), transform 0.7s var(--ease-out) var(--d, 0.9s);
}
.bookcase:not(.lit) .shelf-scroll { opacity: 0; transform: translateY(6%); }

.ss-img {
  width: 100%; height: auto; display: block;
  /* the twine bow dangles below the roll in the photo — push it over the
     shelf edge so the ROLL itself rests on the board */
  transform: translateY(13.5%);
  filter: drop-shadow(0 0.5cqw 0.6cqw rgba(0, 0, 0, 0.6)) brightness(0.96);
  transition: filter 0.4s var(--ease-out);
}
.shelf-scroll:hover .ss-img, .shelf-scroll:focus-visible .ss-img {
  filter: drop-shadow(0 0.5cqw 0.7cqw rgba(0, 0, 0, 0.65)) brightness(1.12);
}

/* ============================================================================
   DIALOG FOUNDATIONS
   ========================================================================== */
dialog { border: 0; padding: 0; background: transparent; color: var(--cream); }
dialog::backdrop {
  background: rgba(5, 4, 3, 0.78);
  backdrop-filter: blur(7px) saturate(0.8);
  transition: opacity 0.45s ease;
}
dialog.is-closing::backdrop { opacity: 0; }
dialog.is-closing { opacity: 0; transition: opacity 0.4s ease 0.15s; }

.dialog-close {
  position: fixed; top: clamp(0.8rem, 2.5vw, 1.6rem); right: clamp(0.8rem, 2.5vw, 1.6rem);
  z-index: 40;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--gold-dim);
  color: var(--cream); font-size: 1.5rem; line-height: 1;
  background: rgba(10, 9, 7, 0.5);
  transition: background 0.25s, transform 0.25s, color 0.25s;
}
.dialog-close:hover { background: var(--gold); color: var(--ink); transform: rotate(90deg); }

.btn {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none;
  color: inherit;
  padding: 0.7em 1.15em; border: 1px solid var(--gold-dim); border-radius: 2px;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
  cursor: pointer;
}
.btn:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn--gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn--gold:hover { background: var(--gold-hi); border-color: var(--gold-hi); }

/* ============================================================================
   THE OPENED BOOK
   ========================================================================== */
.book-dialog {
  position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none;
  display: none; overflow: hidden;
}
.book-dialog[open] { display: block; }

.bd-stage {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  perspective: 2400px;
}

.book3d {
  --bkH: min(74vh, 620px);
  --bkW: min(calc(var(--bkH) * 0.72), 46vw);
  --bkD: calc(var(--bkH) * 0.115);
  position: relative;
  width: var(--bkW); height: var(--bkH);
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease-fly); /* also covers the flight home */
}

/* flight: from the shelf (spine facing us, tiny) to centre stage */
.book-dialog.is-flying .book3d {
  transform: translate3d(var(--fromX, 0px), var(--fromY, 0px), 0) scale(var(--fromS, 0.2)) rotateY(90deg);
}
.book-dialog.is-arrived .book3d {
  transform: translate3d(0, 0, 0) scale(1) rotateY(0deg);
  transition: transform 0.72s var(--ease-fly);
}
.book-dialog.is-open .book3d {
  transform: translate3d(calc(var(--bkW) / 2), 0, 0) scale(1) rotateY(0deg) rotateX(2deg);
  transition: transform 0.95s var(--ease-page);
}

/* ---- the spread (base layer: endpaper left · document right) ------------- */
.bk-spread {
  position: absolute; top: 0; bottom: 0;
  left: calc(-1 * var(--bkW)); width: calc(2 * var(--bkW));
  transform: translateZ(calc(var(--bkD) * 0.36));
  transform-style: preserve-3d; /* the left paper & turning leaf float above the cover */
  display: grid; grid-template-columns: 1fr 1fr;
  border-radius: 6px 4px 4px 6px;
}
.bk-page {
  position: relative; overflow: hidden;
  background:
    linear-gradient(90deg, rgba(60, 40, 16, 0.16), transparent 7% 93%, rgba(60, 40, 16, 0.2)),
    linear-gradient(180deg, var(--paper), var(--paper-2));
}
.bk-page--left {
  border-radius: 4px 0 0 4px;
  background:
    radial-gradient(120% 100% at 100% 50%, rgba(60, 40, 16, 0.24), transparent 40%),
    linear-gradient(180deg, #d9cbae, #cbb996);
  /* hidden while the book is still closed — only the front cover shows */
  opacity: 0;
}
.book-dialog.is-open .bk-page--left {
  opacity: 1;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.8);
  transition: opacity 0.4s ease 0.35s;
}
.bk-page--right {
  border-radius: 0 4px 4px 0;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.8);
}
.bk-page--right::before { /* gutter shadow */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 9%;
  background: linear-gradient(90deg, rgba(50, 32, 12, 0.35), transparent);
  pointer-events: none; z-index: 2;
}

/* ---- the record's paper: one PDF page per book page --------------------- */
.bk-paper {
  position: absolute; inset: 3% 4.5% 3% 7%;
  border-radius: 2px; overflow: hidden;
  background: linear-gradient(180deg, #f4ecdb, #ece1c8);
  box-shadow: inset 0 0 0 1px rgba(110, 84, 40, 0.22);
  opacity: 0; cursor: pointer;
}
.book-dialog.is-open .bk-paper { opacity: 1; transition: opacity 0.5s ease 0.7s; }
.bk-paper canvas, .bk-paperL canvas, .bk-leaf canvas {
  position: absolute; inset: 0; margin: auto;
  max-width: 100%; max-height: 100%;
}
.bk-paper__wait {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 0.6rem;
  text-align: center; color: #6d5a35;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.24em; text-transform: uppercase;
  background: linear-gradient(180deg, #f4ecdb, #ece1c8);
}
.bk-paper__wait::before {
  content: ""; width: 26px; height: 26px; margin: 0 auto;
  border: 2px solid rgba(110, 84, 40, 0.25); border-top-color: #8a6a30;
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
.bk-paper__wait[hidden] { display: none; }
@keyframes spin { to { transform: rotate(1turn); } }

.bk-paper__num {
  position: absolute; bottom: 1.5%; left: 0; right: 0;
  text-align: center; font-family: var(--font-mono); font-size: 0.56rem;
  letter-spacing: 0.2em; color: rgba(110, 84, 40, 0.75);
  pointer-events: none;
}

/* the left paper sits ABOVE the opened cover (hidden until pages turn) */
.bk-paperL {
  position: absolute; top: 0; bottom: 0; left: 0; width: 50%;
  transform: translateZ(calc(var(--bkD) * 0.3)); /* clearly above the cover plane */
  cursor: pointer;
  border-radius: 6px 0 0 6px;
  background:
    linear-gradient(270deg, rgba(60, 40, 16, 0.3), transparent 10%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
}
.bk-paperL::after { /* inner page area frame like the right side */
  content: ""; position: absolute; inset: 3% 7% 3% 4.5%;
  border-radius: 2px;
  background: linear-gradient(180deg, #f4ecdb, #ece1c8);
  box-shadow: inset 0 0 0 1px rgba(110, 84, 40, 0.22);
}
.bk-paperL canvas { inset: 3% 7% 3% 4.5%; max-width: 88.5%; max-height: 94%; z-index: 1; }
.bk-paperL .bk-paper__num { z-index: 1; }

/* the turning leaf */
.bk-leaf {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 50%;
  transform-origin: left center;
  transform: translateZ(calc(var(--bkD) * 0.34)) rotateY(0deg);
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.34, 0.48, 0.28, 1);
  pointer-events: none;
}
.bk-leaf.is-turning-back { transform: translateZ(calc(var(--bkD) * 0.34)) rotateY(-178deg); }
.bk-leaf__face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
}
.bk-leaf__front {
  border-radius: 0 4px 4px 0;
  background:
    linear-gradient(90deg, rgba(50, 32, 12, 0.24), transparent 9%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
}
.bk-leaf__front canvas { inset: 3% 4.5% 3% 7%; max-width: 88.5%; max-height: 94%; }
.bk-leaf__back {
  transform: rotateY(180deg);
  border-radius: 4px 0 0 4px;
  background:
    linear-gradient(270deg, rgba(50, 32, 12, 0.24), transparent 9%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
}
.bk-leaf__back canvas { inset: 3% 7% 3% 4.5%; max-width: 88.5%; max-height: 94%; }

/* page-turn buttons + spread counter */
.bk-nav {
  position: absolute; bottom: 2.2%;
  z-index: 3; transform: translateZ(calc(var(--bkD) * 0.4));
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(138, 106, 48, 0.55);
  background: rgba(244, 236, 219, 0.85);
  color: #5b4520; font-size: 1.35rem; line-height: 1;
  display: grid; place-content: center;
  transition: background 0.25s, color 0.25s, opacity 0.25s;
}
.bk-nav:hover:not(:disabled) { background: #8a6a30; color: #f6edd8; }
.bk-nav:disabled { opacity: 0.22; cursor: default; }
.bk-nav--prev { left: 1.4%; }
.bk-nav--next { right: 1.4%; }
.bk-nav[hidden] { display: none; }
/* no page controls while the cover is still closed */
.book-dialog:not(.is-open) .bk-nav { opacity: 0; pointer-events: none; }

.bk-spread__pages {
  position: absolute; bottom: -2.4rem; left: 0; right: 0;
  transform: translateZ(calc(var(--bkD) * 0.4));
  text-align: center; font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.28em; color: var(--cream-dim);
  text-transform: uppercase;
  opacity: 0;
}
.book-dialog.is-open .bk-spread__pages { opacity: 1; transition: opacity 0.5s ease 0.9s; }

/* the archive slip (unreadable record / renderer failure) */
.bk-slip { display: grid; place-content: center; text-align: center; position: absolute; inset: 0; padding: 8%; }
.bk-slip .slip {
  background: #f6efdf; border: 1px solid rgba(110, 84, 40, 0.3); border-radius: 2px;
  padding: 1.6rem 1.4rem; color: #46351c;
  box-shadow: 0 10px 24px -12px rgba(50, 30, 5, 0.5);
}
.bk-slip .slip h3 {
  font-family: var(--font-display); font-weight: 550; font-size: 1.05rem; letter-spacing: 0.04em;
}
.bk-slip .slip p {
  font-family: var(--font-text); font-size: 0.8rem; line-height: 1.55; margin-top: 0.5rem; color: #6b5638;
}

/* ---- the turning cover ---------------------------------------------------- */
.bk-cover {
  position: absolute; inset: 0;
  transform-origin: left center;
  transform: translateZ(calc(var(--bkD) / 2));
  transform-style: preserve-3d;
  z-index: 5;
  transition: transform 0.62s var(--ease-page); /* the cover closing */
}
.book-dialog.is-open .bk-cover {
  /* exactly flat: a residual angle would cross the left paper's plane */
  transform: translateZ(calc(var(--bkD) / 2)) rotateY(-180deg);
  transition: transform 1s var(--ease-page);
}

.bk-cover__front, .bk-cover__back {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 3px 6px 6px 3px;
  overflow: hidden;
}

/* leather cover face — tinted per collection via --cvA/--cvB */
.bk-cover__front {
  background:
    radial-gradient(120% 90% at 18% 8%, rgba(255, 236, 190, 0.14), transparent 45%),
    linear-gradient(160deg, var(--cvA, #7a5a2c), var(--cvB, #4c3413) 70%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    inset -3px 0 6px rgba(0, 0, 0, 0.3),
    inset 4px 0 6px -3px rgba(255, 240, 200, 0.25),
    0 34px 70px -18px rgba(0, 0, 0, 0.8);
  display: grid; place-items: center;
}
/* waiting to be opened */
.book-dialog:not(.is-open) .bk-cover { cursor: pointer; }
.book-dialog:not(.is-open) .bk-cover:hover .bk-cover__front { filter: brightness(1.07); }
.bk-cover:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 4px; }
.bk-cover__hint {
  position: absolute; bottom: 7%; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.34em;
  text-transform: uppercase; color: rgba(243, 221, 166, 0.75);
  animation: hint-breathe 2.2s ease-in-out infinite;
}
@keyframes hint-breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
.bk-cover__frame {
  width: 82%; height: 88%;
  border: 1px solid rgba(238, 205, 130, 0.75);
  outline: 1px solid rgba(238, 205, 130, 0.3); outline-offset: 5px;
  border-radius: 2px;
  display: grid; place-content: center; gap: 1.1rem;
  text-align: center; padding: 1rem;
}
.bk-cover__org {
  font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: rgba(243, 221, 166, 0.75); line-height: 1.9;
}
.bk-cover__title {
  font-family: var(--font-display); font-weight: 550;
  font-size: clamp(1.3rem, 3.4vh, 1.9rem); line-height: 1.2; letter-spacing: 0.05em;
  color: #f3dda6; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.bk-cover__year {
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.5em;
  color: rgba(243, 221, 166, 0.85); padding-left: 0.5em;
}
.bk-cover__mark { width: 52px; margin: 0.4rem auto 0; opacity: 0.9; filter: sepia(0.3) saturate(0.8) brightness(1.6); }

/* inside of the cover = the colophon page (left page once opened) */
.bk-cover__back {
  transform: rotateY(180deg);
  background:
    linear-gradient(270deg, rgba(60, 40, 16, 0.28), transparent 12%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
  border-radius: 6px 3px 3px 6px;
}

.bk-colophon {
  position: absolute; inset: 6% 10% 5% 9%;
  display: flex; flex-direction: column;
  color: #3d2d15;
  opacity: 0;
}
.bk-colophon--mobile { display: none; }
.book-dialog.is-open .bk-colophon { opacity: 1; transition: opacity 0.6s ease 0.7s; }

.bk-kicker {
  font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: #8a6a30;
}
.bk-flag { height: 30px; margin-top: 1rem; }
.bk-flag:empty { display: none; }
.bk-flag img { height: 26px; width: auto; border-radius: 2px; box-shadow: 0 2px 6px rgba(40, 25, 5, 0.4); display: inline-block; }
.bk-title {
  font-family: var(--font-display); font-weight: 480;
  font-size: clamp(1.5rem, 4vh, 2.2rem); line-height: 1.12; letter-spacing: 0.01em;
  margin-top: 0.8rem; color: #35260f;
}
.bk-venue {
  font-family: var(--font-display); font-style: italic; font-weight: 380;
  font-size: 1rem; margin-top: 0.55rem; color: #6b5638;
}
.bk-rule { width: 58px; height: 1px; background: #a98d51; margin: 1.15rem 0; }
.bk-blurb { font-family: var(--font-text); font-size: 0.86rem; line-height: 1.6; color: #56431f; max-width: 34ch; }
.bk-actions { margin-top: auto; padding-top: 1.2rem; display: flex; flex-wrap: wrap; gap: 0.55rem; }
.bk-actions .btn { border-color: rgba(138, 106, 48, 0.55); color: #4c3a18; }
.bk-actions .btn:hover { background: #8a6a30; border-color: #8a6a30; color: #f6edd8; }
.bk-actions .btn--gold { background: #8a6a30; border-color: #8a6a30; color: #f6edd8; }
.bk-actions .btn--gold:hover { background: #6d5222; }
.bk-exlibris {
  margin-top: 1rem;
  font-family: var(--font-mono); font-size: 0.52rem; letter-spacing: 0.42em;
  color: rgba(138, 106, 48, 0.65); text-align: center;
}

/* ---- solid geometry: spine & page block ---------------------------------- */
.bk-spine3d {
  position: absolute; left: 0; top: 0; width: var(--bkD); height: 100%;
  transform: translateX(-50%) rotateY(90deg);
  background: linear-gradient(180deg, var(--cvA, #7a5a2c), var(--cvB, #4c3413));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  border-radius: 3px;
}
.bk-block {
  position: absolute; right: 0; top: 1.2%; width: var(--bkD); height: 97.6%;
  transform: translateX(50%) rotateY(90deg);
  background: repeating-linear-gradient(90deg,
    #e8dcc0 0 2px, #cfc0a0 2px 3px);
  box-shadow: inset 0 0 6px rgba(90, 65, 25, 0.5);
}
.book-dialog.is-open .bk-block, .book-dialog.is-open .bk-spine3d { opacity: 1; }

/* ---- small screens: the book becomes a simple folio ----------------------- */
@media (max-width: 820px) {
  .bd-stage { perspective: none; place-items: stretch; overflow-y: auto; }
  .book3d { width: 100%; height: auto; min-height: 100%; transform: none !important; transition: none !important; }
  .bk-spine3d, .bk-block { display: none; }
  .bk-cover { display: none; }
  .bk-spread {
    position: static; width: 100%; transform: none;
    display: block; border-radius: 0;
  }
  .bk-page--left, .bk-paperL, .bk-leaf { display: none; }
  .bk-page--right { min-height: 100vh; padding: 4.5rem 1rem 5.5rem; border-radius: 0; }
  .bk-paper { position: relative; inset: auto; height: 68vh; opacity: 1 !important; }
  .bk-nav { position: fixed; bottom: 1rem; transform: none; z-index: 30; }
  .bk-nav--prev { left: 1rem; } .bk-nav--next { right: 1rem; }
  .bk-spread__pages {
    position: fixed; bottom: 1.75rem; left: 0; right: 0; transform: none;
    opacity: 1 !important; z-index: 29;
  }
  .bk-colophon--mobile {
    position: relative; inset: auto; opacity: 1 !important;
    display: flex; flex-direction: column; margin-bottom: 1.2rem;
  }
}

/* ============================================================================
   THE UNROLLED SCROLL
   ========================================================================== */
.scroll-dialog {
  position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none;
  display: none; overflow: hidden;
}
.scroll-dialog[open] { display: grid; place-items: center; }

.sx {
  display: flex; flex-direction: column; align-items: center;
  width: min(94vw, 780px);
}

.sx-rod {
  position: relative; z-index: 3;
  width: 100%; height: 22px; border-radius: 100vmax;
  background: linear-gradient(180deg, #7c5a30 0%, #b98f52 30%, #5e4322 80%, #3e2c14 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 230, 180, 0.45);
}
.scroll-dialog[open] .sx-rod--top { animation: rod-in 0.5s var(--ease-out) backwards; }
.scroll-dialog[open] .sx-rod--bottom { animation: rod-in 0.5s var(--ease-out) 0.1s backwards; }
@keyframes rod-in { from { opacity: 0; transform: translateY(-14px); } }

.sx-rod i { /* turned finials */
  position: absolute; inset: 0;
}
.sx-rod i::before, .sx-rod i::after {
  content: ""; position: absolute; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  background:
    radial-gradient(circle at 35% 32%, #d8b06a, #7c5a30 45%, #3a2812 85%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55), inset 0 0 0 3px rgba(58, 40, 18, 0.55);
}
.sx-rod i::before { left: -16px; }
.sx-rod i::after { right: -16px; }

/* the parchment unrolls between the rods */
.sx-parchment {
  width: calc(100% - 44px);
  max-height: 0; overflow: hidden;
  transition: max-height 1.15s var(--ease-page);
  position: relative; z-index: 2;
  background:
    radial-gradient(90% 30% at 12% 8%, rgba(122, 89, 38, 0.10), transparent 60%),
    radial-gradient(70% 24% at 88% 30%, rgba(122, 89, 38, 0.09), transparent 60%),
    radial-gradient(80% 26% at 30% 82%, rgba(122, 89, 38, 0.11), transparent 60%),
    linear-gradient(90deg, var(--parch-2), var(--parch) 12% 88%, var(--parch-2)),
    var(--parch);
  box-shadow:
    inset 0 14px 18px -14px rgba(60, 40, 10, 0.75),
    inset 0 -14px 18px -14px rgba(60, 40, 10, 0.75),
    0 30px 70px -18px rgba(0, 0, 0, 0.85);
}
.scroll-dialog.is-unrolled .sx-parchment { max-height: min(74vh, 1000px); }

.sx-inner {
  max-height: min(74vh, 1000px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(1.8rem, 4.5vh, 3.2rem) clamp(1.4rem, 5vw, 4rem);
  scrollbar-width: thin; scrollbar-color: rgba(110, 84, 40, 0.5) transparent;
  color: var(--parch-ink);
}

.sx-head { text-align: center; margin-bottom: 2rem; }
.sx-mark { width: 58px; margin: 0 auto 0.9rem; filter: sepia(0.55) saturate(0.75) contrast(1.05); opacity: 0.85; }
.sx-org {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.34em;
  text-transform: uppercase; color: #7c6132;
}
.sx-title {
  font-family: var(--font-display); font-weight: 480;
  font-size: clamp(1.9rem, 5vh, 2.9rem); letter-spacing: 0.02em; line-height: 1.1;
  margin: 0.4rem 0 0.5rem; color: #33240e;
}
.sx-dateline {
  font-family: var(--font-display); font-style: italic; font-weight: 380;
  font-size: 0.95rem; color: #6d572e;
}
.sx-flourish { color: #8a6a30; font-size: 1.1rem; margin-top: 1.1rem; }

.sx-text { max-width: 60ch; margin: 0 auto; }
.sx-text h3 {
  font-family: var(--font-display); font-weight: 550; font-size: 1.06rem;
  letter-spacing: 0.06em; text-align: center; color: #4c370f;
  margin: 2.1rem 0 0.9rem;
  display: flex; align-items: center; gap: 0.8em; justify-content: center;
}
.sx-text h3::before, .sx-text h3::after {
  content: ""; height: 1px; flex: 1; max-width: 64px;
  background: linear-gradient(90deg, transparent, #a98d51);
}
.sx-text h3::after { background: linear-gradient(270deg, transparent, #a98d51); }
.sx-text p {
  font-family: var(--font-display); font-weight: 420; font-size: 0.94rem;
  line-height: 1.68; margin: 0.55rem 0; text-align: justify; text-justify: inter-word;
  hanging-punctuation: first;
}
.sx-text p.lv1 { padding-left: 1.3em; text-indent: -1.05em; }
.sx-text p.lv2 { padding-left: 2.55em; text-indent: -1.05em; font-size: 0.9rem; }
.sx-text p.lv3 { padding-left: 3.7em; text-indent: -1.05em; font-size: 0.9rem; }

.sx-foot { margin-top: 2.6rem; text-align: center; }
.sx-seal {
  width: 84px; height: 84px; margin: 0 auto 1rem;
  border-radius: 47% 53% 51% 49%;
  background:
    radial-gradient(circle at 36% 30%, #c2554d, var(--seal, var(--wax)) 48%, #430e0c 92%);
  box-shadow: 0 6px 16px rgba(40, 5, 5, 0.5), inset 0 0 0 5px rgba(0, 0, 0, 0.14), inset 0 0 0 11px rgba(255, 200, 180, 0.08);
  display: grid; place-content: center;
  transform: rotate(-6deg);
}
.sx-seal span {
  font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.22em;
  color: rgba(255, 214, 200, 0.85); text-align: center; line-height: 1.7;
}
.sx-seal i { font-style: normal; font-size: 0.5rem; opacity: 0.8; }
.sx-provenance {
  font-family: var(--font-display); font-style: italic; font-size: 0.85rem;
  color: #6d572e; max-width: 46ch; margin: 0 auto 1.4rem;
}
.sx-actions { display: flex; justify-content: center; gap: 0.55rem; flex-wrap: wrap; padding-bottom: 0.4rem; }
.sx-actions .btn { border-color: rgba(138, 106, 48, 0.55); color: #4c3a18; }
.sx-actions .btn:hover { background: #8a6a30; border-color: #8a6a30; color: #f6edd8; }
.sx-actions .btn--gold { background: #8a6a30; border-color: #8a6a30; color: #f6edd8; }
.sx-actions .btn--gold:hover { background: #6d5222; }

/* ============================================================================
   THE REGISTER (card catalogue)
   ========================================================================== */
.register {
  position: relative;
  max-width: 1020px; margin: 0 auto;
  padding: clamp(2.5rem, 7vh, 5.5rem) var(--pad) clamp(3rem, 8vh, 6rem);
}
.register::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: min(320px, 60%); height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.register__head { text-align: center; margin-bottom: clamp(1.8rem, 4vh, 3rem); }
.register__kicker {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--gold);
}
.register__title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.7rem, 1.3rem + 2vw, 2.6rem); margin: 0.35em 0 0.4em;
}
.register__note { color: var(--muted); font-size: 0.85rem; font-family: var(--font-mono); letter-spacing: 0.06em; }

.register__search { margin-top: 1.5rem; }
.register__search input {
  width: min(420px, 100%);
  background: var(--ink-2); color: var(--cream);
  border: 1px solid var(--line); border-radius: 2px;
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em;
  padding: 0.75em 1em;
  transition: border-color 0.25s;
}
.register__search input::placeholder { color: var(--muted); }
.register__search input:focus { border-color: var(--gold-dim); outline: none; }

.reg-section { margin-top: clamp(2rem, 5vh, 3.2rem); }
.reg-section > h3 {
  display: flex; align-items: baseline; gap: 1em; flex-wrap: wrap;
  font-family: var(--font-display); font-weight: 450; font-size: 1.25rem; letter-spacing: 0.02em;
  padding-bottom: 0.7rem; border-bottom: 1px solid var(--line);
}
.reg-section > h3 small {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--muted);
}

.reg-row {
  display: grid; grid-template-columns: 5.2rem 1fr auto; gap: 1.2rem; align-items: center;
  padding: 0.85rem 0.6rem;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.25s;
}
.reg-row:hover { background: rgba(237, 231, 216, 0.03); }
.reg-row.is-hidden { display: none; }

.reg-row__year { font-family: var(--font-mono); font-size: 0.85rem; color: var(--gold); letter-spacing: 0.04em; }
.reg-row__what { min-width: 0; }
.reg-row__title {
  display: block;
  font-family: var(--font-display); font-weight: 450; font-size: 1.02rem;
  color: var(--cream); background: none; border: 0; padding: 0; cursor: pointer;
  text-align: left; letter-spacing: 0.01em;
  transition: color 0.2s;
}
.reg-row__title:hover { color: var(--gold-hi); }
.reg-row__sub { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.reg-row__acts { display: flex; gap: 0.45rem; }
.reg-row__acts .btn { font-size: 0.56rem; padding: 0.6em 0.9em; }

.reg-empty {
  padding: 2.2rem 0.6rem; text-align: center; color: var(--muted);
  font-family: var(--font-display); font-style: italic; display: none;
}
.reg-empty.is-shown { display: block; }

@media (max-width: 640px) {
  .reg-row { grid-template-columns: 3.6rem 1fr; row-gap: 0.5rem; }
  .reg-row__acts { grid-column: 2; }
}

/* ---- footer ---------------------------------------------------------------- */
.site-foot {
  border-top: 1px solid var(--line-soft);
  padding: clamp(2.5rem, 7vh, 4.5rem) var(--pad);
  text-align: center;
}
.site-foot img { margin: 0 auto 1.1rem; opacity: 0.9; }
.site-foot__org {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 450; letter-spacing: 0.06em;
}
.site-foot__note { color: var(--muted); font-size: 0.82rem; margin-top: 0.7rem; line-height: 1.7; }
.site-foot__link { margin-top: 1.1rem; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; }
.site-foot__social { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin-top: 1.1rem; }
.site-foot__social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  color: var(--gold-hi); border: 1px solid var(--gold-dim);
  transition: color .25s ease, border-color .25s ease, transform .25s ease;
}
.site-foot__social a:hover { color: var(--cream); border-color: var(--cream); transform: translateY(-2px); }
.site-foot__social svg { display: block; width: 1.1rem; height: 1.1rem; }

.noscript-note { padding: 2rem var(--pad); text-align: center; color: var(--cream-dim); }

/* ---- reduced motion --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  .reveal-load { animation-duration: 0.01s; animation-delay: 0s; }
  .bookcase { transition: none; }
  .book, .shelf-scroll, .plaque { transition: none; }
  .motes { display: none; }
  .book-dialog .book3d, .book-dialog .bk-cover, .book-dialog .bk-colophon, .book-dialog .bk-paper,
  .book-dialog .bk-leaf, .book-dialog .bk-spread__pages,
  .sx-parchment, .sx-rod { transition: none !important; animation: none !important; }
  .cursor-dot, .cursor-ring { display: none !important; }
}

/* ---- print: the register is the record -------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .grain, .site-head, .library, .dialog-close, .site-foot, .cursor-dot, .cursor-ring,
  .register__search, .reg-row__acts { display: none !important; }
  .register { max-width: none; padding: 0; }
  .reg-row, .reg-section > h3 { border-color: #ccc; }
  .reg-row__year, .register__kicker { color: #000; }
  .reg-row__title { color: #000; }
}
