/* Layout: a library wall of three carved walnut bays (Theologica, Naturalia, Artificia),
   each with a marble bust in its niche, densely packed leather spines, a brass name plate
   and linenfold cabinets below. Clicking a bay shows one bookcase close up, framed by
   barley-twist columns, with a brass subject tag on every shelf.
   Deliberately single-theme: an old library at night. Textures are generated SVG noise. */
:root {
  color-scheme: dark;
  --wall: #1b120d;
  --walnut: #3a2416;
  --walnut-hi: #6e4a2c;
  --walnut-lo: #1d1108;
  --gilt: #d8b56a;
  --gilt-dim: #9c8150;
  --parchment: #efe3c8;
  --ink: #2b1d12;
  --lamp: rgba(255, 196, 120, .20);

  --f-display: var(--f-script);
  --f-caps: var(--f-text);
  --f-body: var(--f-text);

  /* generated textures */
  --tex-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .7 -.18'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --tex-mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.045' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .05  0 0 0 0 .02  0 0 0 0 0  1.1 0 0 0 -.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  --tex-wood-h: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='180'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0035 .14' numOctaves='4' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .07  0 0 0 0 .035  0 0 0 0 .01  1.5 0 0 0 -.58'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E");
  --tex-wood-v: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='700'%3E%3Cfilter id='v'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.14 .0035' numOctaves='4' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .07  0 0 0 0 .035  0 0 0 0 .01  1.5 0 0 0 -.58'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23v)'/%3E%3C/svg%3E");

  /* raised bands on a spine, with gilt highlights */
  --rib-d: rgba(0,0,0,.55);
  --rib-l: rgba(230,196,125,.55);
  --ribs: linear-gradient(180deg,
    transparent 0 6%, var(--rib-d) 6% 6.6%, var(--rib-l) 6.6% 7.8%, var(--rib-d) 7.8% 8.4%,
    transparent 8.4% 30%, var(--rib-d) 30% 30.6%, var(--rib-l) 30.6% 31.8%, var(--rib-d) 31.8% 32.4%,
    transparent 32.4% 52%, var(--rib-d) 52% 52.6%, var(--rib-l) 52.6% 53.8%, var(--rib-d) 53.8% 54.4%,
    transparent 54.4% 74%, var(--rib-d) 74% 74.6%, var(--rib-l) 74.6% 75.8%, var(--rib-d) 75.8% 76.4%,
    transparent 76.4% 92%, var(--rib-d) 92% 92.6%, var(--rib-l) 92.6% 93.8%, var(--rib-d) 93.8% 94.4%,
    transparent 94.4%);
  --round: linear-gradient(90deg, rgba(0,0,0,.6), rgba(255,236,200,.13) 24%, rgba(255,255,255,.03) 48%, rgba(0,0,0,.28) 82%, rgba(0,0,0,.65));
  --brass: linear-gradient(180deg, #f6e2a6 0%, #d8b062 38%, #9c7430 52%, #c79c4c 78%, #e9cc85 100%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--wall); }
body {
  margin: 0; min-height: 100vh;
  color: var(--parchment); font-family: var(--f-body); font-size: 16px; line-height: 1.6;
  /* the green damask wall of the library photograph, across the whole site */
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255,214,150,.07), transparent 70%),
    linear-gradient(90deg, rgba(4,7,4,.55), rgba(4,7,4,0) 22%, rgba(4,7,4,0) 78%, rgba(4,7,4,.55)),
    linear-gradient(180deg, rgba(6,9,6,.5), rgba(6,9,6,.1) 280px, rgba(6,9,6,0) 600px),
    url("img/hall/damask-wall.jpg") center top / 220px auto,
    #121a12;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow-x: hidden;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gilt); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lamp-glow {
  position: fixed; inset: 0 0 auto; height: 90vh; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at 50% 15%, var(--lamp), transparent 65%);
}
.view, .hall-head, .colophon { position: relative; z-index: 1; }

/* ---------- Title plaque ---------- */
.hall-head { display: flex; justify-content: center; padding-block: 40px 28px; }
.plaque {
  text-align: center; max-width: 640px;
  padding: 16px clamp(20px, 5vw, 56px) 14px;
  border: 1px solid var(--gilt-dim); outline: 1px solid var(--gilt-dim); outline-offset: 5px;
  background: linear-gradient(180deg, rgba(216,181,106,.08), rgba(0,0,0,.2));
}
.plaque-eyebrow { margin: 0; font-family: var(--f-caps); letter-spacing: .3em; font-size: 12px; color: var(--gilt-dim); text-transform: uppercase; }
.plaque h1 {
  margin: 2px 0; font-family: var(--f-display); font-weight: 400;
  font-size: clamp(48px, 8vw, 84px); line-height: 1.1; color: var(--gilt);
  text-shadow: 0 1px 0 #000, 0 0 24px rgba(216,181,106,.25); text-wrap: balance;
}
.plaque-sub { margin: 0; font-style: italic; color: #cdbb98; }

/* ---------- Reading desk ---------- */
.desk { max-width: 1180px; margin: 0 auto 22px; }
.desk-label { margin: 0 0 6px; font-weight: 400; font-size: 12px; letter-spacing: .2em; color: var(--gilt-dim); text-transform: uppercase; }
.desk-card {
  display: grid; gap: 4px; max-width: 520px; padding: 12px 18px;
  text-decoration: none; color: var(--parchment);
  background: var(--tex-wood-h), linear-gradient(180deg, #4a2f1c, #33200f);
  border: 1px solid #6b4a2c; border-radius: 3px; box-shadow: 0 10px 24px rgba(0,0,0,.45);
}
.desk-card:hover { border-color: var(--gilt); }
.desk-title { font-family: var(--f-display); font-size: 30px; line-height: 1.2; color: var(--gilt); }
.desk-meta { font-size: 14px; color: #cdbb98; }
.desk-bar { height: 4px; background: rgba(0,0,0,.4); border-radius: 2px; overflow: hidden; }
.desk-bar span { display: block; height: 100%; width: 0; background: var(--gilt); }
/* one card per bookcase */
.desk-cards { display: grid; gap: 12px; }
.desk-cards .desk-card { max-width: none; gap: 3px; padding: 10px 16px 12px; }
.desk-cat {
  font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--gilt-dim);
  padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px solid rgba(216,181,106,.22);
}
.desk-cards .desk-title { font-size: 25px; line-height: 1.15; }
.desk-cards .desk-meta { font-size: 13px; }
.desk-card.empty { background: linear-gradient(180deg, rgba(58,36,22,.72), rgba(36,22,12,.72)); border-color: rgba(107,74,44,.7); box-shadow: 0 8px 18px rgba(0,0,0,.35); }
.desk-card.empty .desk-meta { font-style: italic; color: #b8a888; }

/* =================================================================
   Spines (shared by the hall and the close-up shelves)
   ================================================================= */
.sp {
  --c: #6b1e1e; --lab: #7a1d1a;
  position: relative; flex: none; display: block;
  width: var(--w, 20px); height: var(--h, 80%);
  background: var(--ribs), var(--round), var(--tex-grain), var(--tex-mottle), var(--c);
  border-radius: 2px 2px 1px 1px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.45), 1px 0 2px rgba(0,0,0,.65);
}
.sp.plain { background: var(--round), var(--tex-grain), var(--tex-mottle), var(--c); }
.sp.tooled { background:
  repeating-linear-gradient(180deg, transparent 0 5px, rgba(226,190,120,.30) 5px 6px), var(--ribs), var(--round), var(--tex-grain), var(--tex-mottle), var(--c); }
/* title and volume labels */
.sp.lab::before, .sp.lab2::after {
  content: ""; position: absolute; left: 10%; right: 10%;
  background: var(--tex-grain), var(--lab);
  box-shadow: inset 0 0 0 1px rgba(226,190,120,.75), 0 0 0 1px rgba(0,0,0,.35);
}
.sp.lab::before { top: 11%; height: 15%; }
.sp.lab2::after { top: 58%; height: 10%; background: var(--tex-grain), #1a120c; }
/* a book that leans against its neighbour */
.sp.lean { transform: rotate(-7deg); transform-origin: bottom left; margin-left: 8px; }

/* =================================================================
   The hall
   ================================================================= */
.hall { max-width: 1180px; margin: 0 auto; overflow-x: clip; padding-inline: 14px; }
.wall { position: relative; box-shadow: 0 40px 70px rgba(0,0,0,.65); }
.cornice {
  position: relative; height: 50px; margin: 0 -14px; z-index: 2;
  background: var(--tex-wood-h),
    linear-gradient(180deg, #7a5233 0, #4a2f1b 22%, #2a180c 24%, #5a3a22 26%, #3a2416 55%, #1d1108 57%, #4a2f1b 60%, #2a180c 100%);
  box-shadow: 0 10px 16px rgba(0,0,0,.6);
}
.dentils { position: absolute; left: 0; right: 0; bottom: 6px; height: 9px; background: repeating-linear-gradient(90deg, #5d3d24 0 10px, #1d1108 10px 15px); }
.bays { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bay {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  padding: 0 20px; text-decoration: none; color: var(--parchment);
  background: var(--tex-wood-v), linear-gradient(90deg, #2c1a0d, var(--walnut) 15%, var(--walnut) 85%, #2c1a0d);
}
/* fluted pilasters between bays */
.bay::before, .bay::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 14px; z-index: 1;
  background: linear-gradient(90deg, rgba(0,0,0,.5), transparent 30%, transparent 70%, rgba(0,0,0,.5)),
    repeating-linear-gradient(90deg, #24150a 0 2px, #6e4a2c 2px 4px, #4a2f1b 4px 7px);
}
.bay::before { left: 0; } .bay::after { right: 0; }

.niche {
  height: 116px; margin: 16px 6px 12px; display: flex; align-items: flex-end; justify-content: center;
  background: radial-gradient(ellipse at 50% 25%, rgba(255,205,140,.14), transparent 65%), linear-gradient(180deg, #0e0804, #22150b);
  border-radius: 50% 50% 3px 3px / 46px 46px 3px 3px;
  box-shadow: inset 0 10px 18px rgba(0,0,0,.85), inset 0 0 0 3px #22140a, 0 0 0 2px #7a5233, 0 0 0 4px #2a180c;
}
.bust { width: 72px; height: 86px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.7)); }
/* marble busts with their pedestals, lit warmly as if by the lamp */
.niche:has(.bust-img) { height: 196px; padding-top: 14px; }
.bust-img {
  display: block; height: 100%; width: auto; max-width: 92%; object-fit: contain;
  filter: sepia(.18) brightness(.92) drop-shadow(0 8px 10px rgba(0,0,0,.8));
}

.interior {
  position: relative; padding: 22px 10px 0;
  background: linear-gradient(180deg, rgba(0,0,0,.6), rgba(0,0,0,.25) 30%, rgba(0,0,0,.5)), var(--tex-wood-v), #160c05;
  border-radius: 46% 46% 0 0 / 34px 34px 0 0;
  box-shadow: inset 0 16px 24px rgba(0,0,0,.85), inset 0 0 0 3px #1d1108, 0 0 0 2px #7a5233;
}
.mini-row {
  --row: 62px;
  position: relative; height: var(--row); display: flex; align-items: flex-end; gap: 1px;
  padding: 0 2px 9px; overflow: hidden;
  background: linear-gradient(180deg, transparent calc(100% - 9px), #8a6038 calc(100% - 9px), #5a3a22 calc(100% - 6px), #2a190d 100%);
}
.mini-row + .mini-row { box-shadow: inset 0 8px 10px -6px rgba(0,0,0,.8); }
.mini-row .sp.lab::before { top: 14%; height: 13%; }

.rail {
  position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin: 0 -6px; padding: 12px 8px 10px;
  background: var(--tex-wood-h), linear-gradient(180deg, #7a5233, #4a2f1b 30%, #3a2416 70%, #24150a);
  box-shadow: 0 -3px 6px rgba(0,0,0,.5), 0 6px 10px rgba(0,0,0,.55);
}
.brass {
  display: inline-block; position: relative;
  padding: 5px 26px 4px; border-radius: 2px;
  font-family: var(--f-text); font-weight: 700; font-size: 13px; letter-spacing: .32em; text-transform: uppercase;
  color: #3a2410; text-shadow: 0 1px 0 rgba(255,240,200,.55);
  background:
    radial-gradient(circle at 10px 50%, #5a3d18 0 1.6px, #f3dc9c 2px 2.6px, transparent 3px),
    radial-gradient(circle at calc(100% - 10px) 50%, #5a3d18 0 1.6px, #f3dc9c 2px 2.6px, transparent 3px),
    var(--brass);
  box-shadow: inset 0 0 0 1px rgba(90,60,20,.55), inset 0 1px 0 rgba(255,250,225,.6), 0 2px 4px rgba(0,0,0,.65);
}
.rail-count { font-size: 12px; font-style: italic; color: #cdbb98; }

.cabinet { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 6px 16px; height: 168px; }
.door {
  position: relative;
  background: var(--tex-wood-v), linear-gradient(90deg, #4a2f1b, #3a2416 50%, #2c1a0d);
  box-shadow: inset 0 0 0 2px #1d1108, inset 0 0 0 4px #7a5233, inset 0 0 0 9px #3a2416, inset 0 0 0 10px #1d1108, 0 3px 6px rgba(0,0,0,.5);
}
.door::before { /* linenfold carving */
  content: ""; position: absolute; inset: 18px 16px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.45), transparent 14%, transparent 86%, rgba(0,0,0,.5)),
    repeating-linear-gradient(90deg, #22130a 0 2px, #7a5233 2px 5px, #5a3a22 5px 9px, #3a2416 9px 12px, #1d1108 12px 14px);
  border-radius: 45% 45% 45% 45% / 9% 9% 9% 9%;
}
.door::after { /* brass pull */
  content: ""; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -3px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f6e2a6, #9c7430 70%); box-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.door:first-child::after { right: 6px; } .door:last-child::after { left: 6px; }

.skirting { height: 26px; margin: 0 -14px; background: var(--tex-wood-h), linear-gradient(180deg, #5a3a22, #2a180c 40%, #1d1108); }
.floor {
  height: 70px; margin: 0 -40px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.65), rgba(0,0,0,.2) 40%, rgba(0,0,0,.75)),
    repeating-linear-gradient(90deg, #120a05 0 2px, transparent 2px 160px),
    var(--tex-wood-h), #3b2617;
}

/* hover: the lamp finds the bay */
.bay .interior, .bay .brass { transition: box-shadow .3s ease, filter .3s ease; }
.bay:hover .interior, .bay:focus-visible .interior {
  box-shadow: inset 0 16px 24px rgba(0,0,0,.6), inset 0 0 0 3px #1d1108, 0 0 0 2px var(--gilt), 0 0 28px rgba(216,181,106,.25);
}
.bay:hover .brass, .bay:focus-visible .brass { filter: brightness(1.15); }
.bay:focus-visible { outline: none; }
.bay-hint { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gilt-dim); opacity: 0; transition: opacity .3s; }
.bay:hover .bay-hint, .bay:focus-visible .bay-hint { opacity: 1; }

@media (max-width: 860px) {
  .bays { grid-template-columns: minmax(0, 1fr); }
  .bay + .bay { border-top: 18px solid transparent; border-image: linear-gradient(180deg, #1d1108, #4a2f1b, #1d1108) 1; }
  .cabinet { height: 120px; }
  .bay-hint { opacity: 1; }
}

/* =================================================================
   The hall: one scene. The library photograph stands against its own green damask wall,
   which continues upward (a tile cut from the photo) to hold the title box and reading desk.
   ================================================================= */
html { background: #0b0806; } /* below the floor */
.hall { max-width: none; overflow-x: clip; padding-inline: 0; padding-top: 0; }

/* Stacked (laptops and smaller): title, reading desk, then the bookcase sized to fit the screen's height. */
.scene { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; }
.scene .hall-head { padding: 22px 16px 16px; }
.scene .plaque { background: linear-gradient(180deg, rgba(10,14,10,.6), rgba(0,0,0,.55)); }
.scene .desk { width: 100%; max-width: 440px; margin: 0 auto 14px; }
.hall-case { position: relative; width: min(100%, calc((100vh - 24px) * .85)); min-width: min(100%, 560px); }

/* Wide screens: the bookcase fills the height of the window; the title hangs on the wall to its left
   and the reading desk to its right. */
@media (min-width: 1150px) {
  .scene { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: clamp(20px, 3vw, 56px); align-items: start; }
  .scene .hall-head { grid-column: 1; grid-row: 1; justify-self: end; padding: 14vh 0 0; max-width: 520px; }
  .scene .plaque { padding-inline: clamp(18px, 2.4vw, 44px); }
  .scene .plaque h1 { font-size: clamp(46px, 4.4vw, 78px); }
  .hall-case { grid-column: 2; grid-row: 1 / span 2; width: calc((100vh - 16px) * .85); min-width: 600px; max-width: 1360px; margin-top: 8px; }
  .scene .desk { grid-column: 3; grid-row: 1; justify-self: start; margin: 0; padding-top: 16vh; max-width: 400px; }
}

/* The room around the photo: its wainscot (78.25%–87.25% of the photo's height) and a checkered
   marble floor (from 87.25%) run the full width of the page. */
.room-wainscot, .room-floor { position: absolute; left: 50%; width: 100vw; transform: translateX(-50%); z-index: 0; pointer-events: none; }
.room-wainscot {
  top: 78.25%; height: 9%;
  background:
    linear-gradient(90deg, rgba(0,0,0,.6), rgba(0,0,0,0) 25%, rgba(0,0,0,0) 75%, rgba(0,0,0,.6)),
    linear-gradient(180deg, #3a2c20 0, #5a4a3e 6%, #2a1e15 13%, #050200 14.5%, #24180f 17%, #3a2a1c 21%, #120802 25%, #22150c 28%, #1d130a 80%, #120c06 100%);
  box-shadow: 0 -6px 14px rgba(0,0,0,.35);
}
.room-floor { top: 87.25%; height: calc(12.75% + 150px); overflow: hidden; perspective: 700px; perspective-origin: 50% 0; }
.floor-plane {
  position: absolute; left: -60%; width: 220%; top: 0; height: 520%;
  transform-origin: 50% 0; transform: rotateX(70deg);
  /* the shading lives on the tilted floor itself: lamplit near the case, falling into shadow at the sides */
  background:
    radial-gradient(ellipse 20% 9% at 50% 0, rgba(0,0,0,.15), rgba(0,0,0,.55) 60%, rgba(0,0,0,.9) 100%),
    repeating-conic-gradient(#b9b1a4 0 25%, #121010 0 50%) 50% 0 / 130px 130px;
}
.room-floor::after { /* lamplight on the floor near the case; shadow towards the edges of the room */
  content: ""; position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(ellipse 40% 140% at 50% 0, rgba(0,0,0,.2), rgba(0,0,0,.6) 55%, rgba(0,0,0,.88) 85%),
    linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,.1) 22%, rgba(0,0,0,.75));
}

.case-frame { position: relative; z-index: 1; container-type: inline-size; }
.case-img {
  position: relative; z-index: 1; display: block; width: 100%; max-width: 100%; height: auto;
  /* the photo's edges dissolve into the wall, wainscot and floor around it */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6.5%, #000 93.5%, transparent 100%), linear-gradient(180deg, transparent 0, #000 5%, #000 94%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(90deg, transparent 0, #000 6.5%, #000 93.5%, transparent 100%), linear-gradient(180deg, transparent 0, #000 5%, #000 94%, transparent 100%);
          mask-composite: intersect;
}
.bay-links { position: absolute; inset: 0; z-index: 2; }
.bay-hit { position: absolute; top: 0; bottom: 0; display: block; text-decoration: none; color: var(--parchment); }
.bay-hit:focus-visible { outline: none; }
/* lamplight falls on the bay you point at */
.bay-glow {
  position: absolute; left: 4%; right: 4%; top: 29.5%; height: 39%;
  border-radius: 4px;
  background: radial-gradient(ellipse at 50% 38%, rgba(255,205,130,.34), rgba(255,205,130,.08) 55%, transparent 75%);
  mix-blend-mode: screen; opacity: 0; transition: opacity .35s ease;
}
.bay-hit:hover .bay-glow, .bay-hit:focus-visible .bay-glow { opacity: 1; }
/* name plate on the rail below the grates; count and button just beneath, on the doors' top rail */
.bay-label {
  position: absolute; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .75cqw;
  padding-top: .1cqw; text-align: center;
}
.bay-label .brass { font-size: clamp(9px, 1.6cqw, 17px); padding: .45cqw 2.8cqw .3cqw; letter-spacing: .26em; }
.bay-label .rail-count {
  font-size: clamp(9px, 1.45cqw, 15px); line-height: 1.25; padding: .1cqw 1.2cqw; border-radius: 2px;
  background: rgba(12,7,3,.6); text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.open-btn {
  display: inline-block; font-size: clamp(9px, 1.35cqw, 14px); line-height: 1.3; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gilt); padding: .35cqw 1.4cqw; border: 1px solid rgba(216,181,106,.55); border-radius: 2px;
  background: rgba(10,5,2,.35); transition: background .25s ease, color .25s ease;
}
.bay-hit:hover .open-btn, .bay-hit:focus-visible .open-btn { background: var(--gilt); color: #2a1a0e; }
.bay-hit:focus-visible .brass { box-shadow: 0 0 0 2px var(--gilt), 0 2px 4px rgba(0,0,0,.65); }
/* narrow screens: the bookcase stays as a picture you can tap, with the three cases listed below it */
.bay-list { display: none; }
@media (max-width: 640px) {
  .bay-label { display: none; }
  .scene .hall-head { padding: 18px 4px 12px; }
  .room-floor { height: calc(12.75% + 430px); } /* the list and footer stand on the floor */
  .bay-list { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; max-width: 520px; margin: 0 auto; padding: 14px 0; }
  .bay-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: var(--parchment);
    background: linear-gradient(180deg, #4a2f1b, #2c1a0d); border: 1px solid #6b4a2c; border-radius: 3px;
  }
  .bay-row .rail-count { flex: 1; min-width: 0; font-size: 13px; line-height: 1.25; }
  .bay-row .brass { font-size: 10px; letter-spacing: .18em; padding: 4px 16px 3px; white-space: nowrap; }
  .bay-row .open-btn { font-size: 10px; padding: 3px 8px; white-space: nowrap; }
}

/* =================================================================
   One bookcase, close up
   ================================================================= */
.case-view { max-width: 1180px; margin: 0 auto; }
.case-nav { margin-bottom: 4px; }
.return { display: inline-block; color: var(--gilt); text-decoration: none; font-size: 14px; letter-spacing: .06em; padding: 6px 0; }
.return:hover { text-decoration: underline; }
.case-head { text-align: center; margin-bottom: 20px; }
.case-head h2 {
  margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(54px, 9vw, 92px); line-height: 1.05;
  color: var(--gilt); text-shadow: 0 1px 0 #000, 0 0 24px rgba(216,181,106,.25);
}
.case-head p { margin: 2px 0 0; font-style: italic; color: #cdbb98; }

.case-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 28px; align-items: start; }
.case { min-width: 0; box-shadow: 0 30px 60px rgba(0,0,0,.65); }
.case-top {
  position: relative; height: 46px;
  background: var(--tex-wood-h),
    linear-gradient(180deg, #8a6038 0, #4a2f1b 20%, #2a180c 23%, #6e4a2c 26%, #3a2416 60%, #1d1108 63%, #4a2f1b 66%, #2a180c);
}
.case-top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 7px; height: 8px; background: repeating-linear-gradient(90deg, #6e4a2c 0 9px, #1d1108 9px 14px); }
.case-foot { height: 34px; background: var(--tex-wood-h), linear-gradient(180deg, #6e4a2c, #2a180c 40%, #1d1108); }
.case-body { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; background: var(--tex-wood-v), var(--walnut); }

/* carved barley-twist columns */
.column { display: flex; flex-direction: column; align-items: center; padding: 6px 0; }
.capital, .base {
  width: 44px; flex: none; border-radius: 3px;
  background: linear-gradient(90deg, rgba(0,0,0,.55), transparent 35%, rgba(255,225,180,.12) 50%, transparent 65%, rgba(0,0,0,.6)),
    repeating-linear-gradient(180deg, #2a170b 0 3px, #7a5434 3px 7px, #4a2f1b 7px 10px), #4a2f1b;
}
.capital { height: 46px; } .base { height: 56px; }
.twist {
  flex: 1; width: 32px; margin: 4px 0; border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.7), rgba(0,0,0,0) 32%, rgba(255,226,180,.18) 50%, rgba(0,0,0,0) 66%, rgba(0,0,0,.75)),
    repeating-linear-gradient(150deg, #24130a 0 5px, #6b4527 8px, #a37647 11px, #6b4527 14px, #24130a 19px);
  box-shadow: 0 0 6px rgba(0,0,0,.6);
}

.rows {
  min-width: 0; padding: 0 0 6px;
  background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.15) 12%, rgba(0,0,0,.15) 88%, rgba(0,0,0,.55)), var(--tex-wood-v), #1f1209;
  box-shadow: inset 0 12px 20px rgba(0,0,0,.8);
}
.shelf-row { position: relative; padding: 22px 14px 0; }
.shelf-row + .shelf-row { box-shadow: inset 0 12px 16px -8px rgba(0,0,0,.85); }
.shelf-books { height: 252px; display: flex; align-items: flex-end; gap: 2px; overflow: hidden; }
.plank {
  position: relative; z-index: 1; height: 32px; margin: 0 -14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tex-wood-h), linear-gradient(180deg, #9a6c40 0, #7a5233 12%, #5a3a22 55%, #3a2416 85%, #1d1108);
  box-shadow: 0 10px 14px rgba(0,0,0,.6);
}
.plank .brass { font-size: 11px; padding: 4px 26px 3px; letter-spacing: .28em; }
.plank .brass.blank { color: rgba(58,36,16,.6); font-weight: 400; font-style: italic; letter-spacing: .08em; text-transform: none; }

/* titled volumes */
.sp.real { cursor: pointer; transition: transform .25s ease, box-shadow .25s ease; text-decoration: none; }
.sp.real .title-label {
  position: absolute; left: 13%; right: 13%; top: 13%; bottom: 23%;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--tex-grain), var(--lab);
  box-shadow: inset 0 0 0 1px rgba(226,190,120,.85), inset 0 0 0 3px var(--lab), inset 0 0 0 4px rgba(226,190,120,.5), 0 0 0 1px rgba(0,0,0,.4);
}
.sp.real .title-label span {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--f-display); font-size: 21px; line-height: 1.02; color: var(--gilt);
  text-align: center; text-shadow: 0 1px 0 rgba(0,0,0,.7); max-height: 100%;
}
.sp.real .vol {
  position: absolute; left: 0; right: 0; top: 81%; text-align: center;
  font-family: var(--f-text); font-size: 10px; letter-spacing: .1em; color: var(--gilt);
}
.sp.real:hover, .sp.real:focus-visible { transform: translateY(-14px); box-shadow: inset 0 0 0 1px rgba(0,0,0,.45), 0 14px 18px rgba(0,0,0,.7); outline: none; }
.sp.real:focus-visible { box-shadow: inset 0 0 0 1px rgba(0,0,0,.45), 0 0 0 2px var(--gilt), 0 14px 18px rgba(0,0,0,.7); }
.ribbon { position: absolute; left: 50%; bottom: -12px; width: 8px; height: 26px; margin-left: -4px; background: #b0262a; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.sp.done .ribbon { background: var(--gilt); }

/* photographed spines (assets/img/spines): the leather, bands and blank panels come from the photo */
.sp.photo {
  background: var(--img) center / 100% 100% no-repeat, #2a1a10;
  border-radius: 3px 3px 1px 1px;
  box-shadow: 1px 0 2px rgba(0,0,0,.7), -1px 0 1px rgba(0,0,0,.35);
}
.sp.photo.real { box-shadow: 1px 0 2px rgba(0,0,0,.7), -1px 0 1px rgba(0,0,0,.35); }
.sp.photo.real:hover, .sp.photo.real:focus-visible { box-shadow: 0 14px 18px rgba(0,0,0,.7); }
.sp.photo.real:focus-visible { box-shadow: 0 0 0 2px var(--gilt), 0 14px 18px rgba(0,0,0,.7); }
/* the title, tooled in gold into the blank panel */
.plate-title {
  position: absolute; left: 9%; right: 9%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2px 0 1px; overflow: hidden;
  font-family: var(--f-text); font-weight: 700; font-size: 10.5px; line-height: 1.12;
  letter-spacing: .06em; text-transform: uppercase; text-align: center; white-space: nowrap;
  color: #e6c579;
  text-shadow: 0 1px 0 rgba(0,0,0,.85), 0 0 1px rgba(0,0,0,.6), 0 -1px 0 rgba(255,236,190,.15);
}
.plate-title span { display: block; width: max-content; }
.sp.photo.real .vol {
  display: flex; align-items: center; justify-content: center; top: 74%;
  font-weight: 700; font-size: 9px; text-shadow: 0 1px 0 rgba(0,0,0,.85); color: #e6c579;
}
.stack .flat.photo { background: var(--img) center / 100% 100% no-repeat; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* books lying flat in a stack */
.stack { flex: none; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 1px; padding-left: 4px; }
.stack .flat {
  display: block; height: var(--t, 22px); width: var(--w, 120px); margin-left: var(--x, 0);
  background: linear-gradient(180deg, rgba(255,236,200,.12), rgba(0,0,0,.35)),
    linear-gradient(90deg, transparent 0 10%, rgba(226,190,120,.45) 10% 11%, transparent 11% 89%, rgba(226,190,120,.45) 89% 90%, transparent 90%),
    var(--tex-grain), var(--tex-mottle), var(--c);
  border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.45);
}

/* catalog card */
.card-catalog {
  position: sticky; top: 24px; color: var(--ink);
  background: repeating-linear-gradient(180deg, transparent 0 25px, rgba(43,90,140,.18) 25px 26px), var(--parchment);
  padding: 16px 18px 18px; border-radius: 2px; border-top: 2px solid rgba(160,40,40,.45);
  box-shadow: 0 12px 30px rgba(0,0,0,.55);
}
.cc-label { margin: 0; font-size: 12px; letter-spacing: .14em; color: #8a2f2f; text-transform: uppercase; }
.cc-title { margin: 6px 0 4px; font-family: var(--f-display); font-weight: 400; font-size: 32px; line-height: 1.15; text-wrap: balance; }
.cc-desc { margin: 0 0 8px; font-size: 15px; line-height: 26px; }
.cc-meta { margin: 0; font-size: 14px; font-style: italic; color: #5b4630; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .case-layout { grid-template-columns: minmax(0, 1fr); }
  .card-catalog { position: static; order: -1; }
  .case-body { grid-template-columns: 30px minmax(0, 1fr) 30px; }
  .capital, .base { width: 26px; } .twist { width: 18px; }
  .shelf-books { height: 220px; }
}

.colophon { text-align: center; padding-block: 36px 48px; font-style: italic; color: #a8977a; font-size: 14px; }
@media (prefers-reduced-motion: reduce) {
  .sp.real, .bay .interior, .bay .brass, .bay-hint { transition: none; }
}
