/* The Reading Room: a private library after hours, for Archie.
   Library green, walnut, oxblood leather, gilt and lamplight. */

:root {
  --damask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='72' height='112' viewBox='0 0 72 112'><g fill='none' stroke='%23e9d9a6' stroke-opacity='.07' stroke-width='1.2'><path d='M36 0C56 18 56 38 36 56 16 74 16 94 36 112M36 0C16 18 16 38 36 56 56 74 56 94 36 112'/></g><g fill='%23e9d9a6' fill-opacity='.06'><path d='M36 22c4 6 4 10 0 16-4-6-4-10 0-16z'/><path d='M0 78c4 6 4 10 0 16-4-6-4-10 0-16zM72 78c4 6 4 10 0 16-4-6-4-10 0-16z'/><circle cx='36' cy='56' r='2'/><circle cx='0' cy='0' r='2'/><circle cx='72' cy='0' r='2'/><circle cx='0' cy='112' r='2'/><circle cx='72' cy='112' r='2'/></g></svg>");
  --green: #1F3A2E;
  --green-deep: #142a20;
  --green-ink: #0c1a13;
  --walnut: #3B2618;
  --walnut-deep: #22150c;
  --walnut-hi: #6a4529;
  --oxblood: #6E1F25;
  --gilt: #C9A54C;
  --gilt-hi: #F3DC8E;
  --gilt-lo: #7d5f22;
  --lamp: #F6D88C;
  --cream: #F3EAD7;
  --page: #F3EAD7;
  --ink: #2a1d14;
  --ink-soft: #6a5038;
  --blue-ink: #1b2a55;

  --display: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --sc: "Playfair Display SC", "Playfair Display", Georgia, serif;
  --serif: "Libre Baskerville", Baskerville, Georgia, serif;

  --k: 1;
  --lampv: 1;

  --grain: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' seed='5' stitchTiles='stitch'/><feDiffuseLighting lighting-color='%23fff' surfaceScale='1.7' diffuseConstant='1.05'><feDistantLight azimuth='230' elevation='50'/></feDiffuseLighting><feComponentTransfer><feFuncA type='linear' slope='.5'/></feComponentTransfer></filter><rect width='160' height='160' filter='url(%23g)'/></svg>");
  --mottle: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='m' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='3' seed='14' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.15 .74'/></filter><rect width='300' height='300' filter='url(%23m)'/></svg>");
  --wood: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='700' height='140'><filter id='w' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.003 .11' numOctaves='4' seed='8' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .1  0 0 0 0 .055  0 0 0 0 .02  0 0 0 -2.6 1.62'/></filter><rect width='700' height='140' filter='url(%23w)'/></svg>");
  --paper-tex: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='p' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .33  0 0 0 0 .2  0 0 0 -1.3 .7'/></filter><rect width='220' height='220' filter='url(%23p)'/></svg>");
  --ink-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='90'><filter id='i' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' seed='9' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -3.2 2.2'/></filter><rect width='180' height='90' filter='url(%23i)'/></svg>");
  --marble: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='600'><filter id='m' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'><feTurbulence type='fractalNoise' baseFrequency='.006 .02' numOctaves='3' seed='11'/><feColorMatrix values='1.9 0 0 0 -.45  1.9 0 0 0 -.45  1.9 0 0 0 -.45  0 0 0 0 1'/><feComponentTransfer><feFuncR type='table' tableValues='.12 .08 .12 .18 .74 .18 .12 .08 .43 .08 .12 .18 .12 .08 .79 .08'/><feFuncG type='table' tableValues='.23 .16 .23 .34 .66 .34 .23 .16 .12 .16 .23 .34 .23 .16 .65 .16'/><feFuncB type='table' tableValues='.18 .13 .18 .26 .48 .26 .18 .13 .15 .13 .18 .26 .18 .13 .30 .13'/></feComponentTransfer></filter><rect width='420' height='600' filter='url(%23m)'/></svg>");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--green-ink); }
html.is-reading { overflow: hidden; }
body {
  margin: 0;
  color: var(--cream);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  background: var(--green-deep);
  overflow-x: hidden;
  overflow-x: clip;
}
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gilt-hi); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--cream); color: var(--ink); padding: 8px 14px; border-radius: 4px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- gilt lettering ---------- */
.gilt {
  --hi: color-mix(in srgb, #fff6cf calc(var(--glow, 1) * 100%), #c9a54c);
  background-image: linear-gradient(var(--gdir, 180deg),
    #6d521c 0%, #a98634 calc(var(--g, 50%) - 30%), #e2c272 calc(var(--g, 50%) - 9%),
    var(--hi) var(--g, 50%), #e2c272 calc(var(--g, 50%) + 9%), #a98634 calc(var(--g, 50%) + 30%), #6d521c 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.gilt-solid { color: var(--gilt); }
html.lamp-off .gilt { --hi: #b8963f; }

/* ---------- buttons ---------- */
.btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px;
  font: 700 16px/1.1 var(--display); letter-spacing: .02em;
  border-radius: 6px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-leather {
  color: #fbe9b9;
  background-color: var(--oxblood);
  background-image: linear-gradient(180deg, rgba(255,220,170,.18), rgba(0,0,0,.25)), var(--grain);
  background-size: auto, 120px;
  background-blend-mode: normal, soft-light;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), inset 0 0 0 3px rgba(201,165,76,.55), inset 0 1px 0 4px rgba(255,220,170,.08), 0 6px 14px rgba(0,0,0,.45);
  text-shadow: 0 -1px 0 rgba(0,0,0,.5);
  transition: transform .15s, box-shadow .15s, filter .2s;
}
.btn-leather:hover { filter: brightness(1.08); }
.btn-leather:active { transform: translateY(1px) scale(.985); box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), inset 0 0 0 3px rgba(201,165,76,.55), 0 2px 6px rgba(0,0,0,.45); }
.btn-leather[disabled] { filter: grayscale(.4) brightness(.8); cursor: default; }
.btn-ghost {
  background: transparent; color: var(--gilt-hi);
  border: 1px solid rgba(201,165,76,.5);
}
.btn-link {
  -webkit-appearance: none; appearance: none; background: none; border: 0; cursor: pointer;
  padding: 10px 4px; min-height: 44px;
  font: italic 16px/1.2 var(--serif); color: #4b3420;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}

/* ---------- sound toggle ---------- */
.sound-toggle {
  position: fixed; z-index: 80; top: max(10px, env(safe-area-inset-top)); right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 12px 6px 9px;
  border: 0; border-radius: 999px; cursor: pointer;
  font: 700 13px/1 var(--display); letter-spacing: .03em; color: #3a2610;
  background: linear-gradient(180deg, #f3dc8e, #c9a54c 55%, #9b7a2e);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -1px 0 rgba(0,0,0,.25), 0 4px 12px rgba(0,0,0,.4);
  -webkit-tap-highlight-color: transparent;
}
.sound-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle .spk { fill: currentColor; }
.sound-toggle .cross { opacity: 0; }
.sound-toggle[aria-pressed="false"] .waves { opacity: 0; }
.sound-toggle[aria-pressed="false"] .cross { opacity: 1; }
@media (max-width: 420px) { .eb-open { display: none; } }
@media (max-width: 559px) {
  .sound-toggle { padding: 0; width: 40px; justify-content: center; }
  .sound-toggle .st-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
html.is-reading .sound-toggle { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); right: 10px; }

/* =========================================================
   THE ROOM (hero)
   ========================================================= */
.room {
  position: relative;
  overflow: hidden;
  overflow: clip; /* clip, not a scroll box: focus and scrollIntoView must never shift the room */
  isolation: isolate;
  padding: 18px 0 0;
  min-height: 100svh;
}
.room-wall {
  position: absolute; inset: 0; z-index: -2;
  background-color: var(--green);
  background-image:
    radial-gradient(120% 70% at 50% 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.45) 100%),
    var(--damask),
    var(--mottle);
  background-size: auto, 72px 112px, 640px;
}
.room-glow {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(46% 30% at var(--lx, 26%) var(--ly, 74%), rgba(246,216,140,.36), rgba(246,216,140,.1) 55%, transparent 78%),
    radial-gradient(90% 50% at var(--lx, 26%) 100%, rgba(246,216,140,.12), transparent 70%);
  opacity: var(--lampv);
  transition: opacity .5s;
}
html.lamp-off { --lampv: 0; }
html.lamp-off .room-wall { filter: brightness(.72) saturate(.8); }
/* with the lamp off the whole room falls into shadow (and it comes up as you walk in) */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, rgba(2,7,4,.5), rgba(2,7,4,.74));
  opacity: calc(1 - var(--lampv));
  transition: opacity .45s;
}
#motes {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 6; pointer-events: none;
}
.room-inner { position: relative; z-index: 2; }

.eyebrow {
  display: flex; justify-content: center; align-items: center; gap: 9px;
  min-height: 40px;
  padding: 0 58px;
  font: 700 11px/1.3 var(--sc); letter-spacing: .16em; text-transform: uppercase;
  white-space: nowrap;
  color: #d8bd73;
  text-align: center;
}
.eb-dot { width: 4px; height: 4px; transform: rotate(45deg); background: var(--gilt); flex: none; }
@media (max-width: 559px) { .eyebrow { padding: 0 54px; letter-spacing: .13em; gap: 8px; } }

.frieze {
  position: relative;
  margin: 14px auto 0;
  text-align: center;
  line-height: .9;
  font-family: var(--display);
  --gdir: 100deg;
}
.fr-the {
  display: block;
  font: italic 400 20px/1 var(--display);
  color: #d8bd73;
  letter-spacing: .04em;
  margin-bottom: 2px;
}
.fr-name {
  display: block;
  font-size: clamp(64px, 19vw, 132px);
  font-weight: 800;
  font-style: italic;
  letter-spacing: -.01em;
  padding: 0 .08em .06em;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.45)) drop-shadow(0 0 18px rgba(246,216,140,calc(.18 * var(--lampv))));
}
.fr-coll {
  display: block;
  font: 700 clamp(17px, 5vw, 26px)/1 var(--sc);
  letter-spacing: .42em;
  margin-top: 2px;
  padding-left: .42em;
}
.lede {
  margin: 12px auto 0;
  padding: 0 20px;
  max-width: 34ch;
  text-align: center;
  font: italic 17px/1.5 var(--serif);
  color: #efe3c8;
}

/* ---------- the bookcase ---------- */
.bookcase { position: relative; margin-top: 18px; }
.case-cornice {
  position: relative; z-index: 3;
  height: 16px;
  margin: 0 -2px;
  background-color: var(--walnut);
  background-image: linear-gradient(180deg, #7a5233 0, #4a2f1b 3px, #2e1c10 9px, #573923 10px, #2a190d 16px), var(--wood);
  background-blend-mode: normal, multiply;
  box-shadow: 0 6px 12px rgba(0,0,0,.55);
}
.shelf-wrap { position: relative; }
.case-back {
  position: absolute; left: 0; right: 0; top: 0; bottom: 70px; z-index: 0;
  background-color: #1d120a;
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.65), rgba(0,0,0,.05) 35%, rgba(0,0,0,.3)),
    repeating-linear-gradient(90deg, rgba(0,0,0,.35) 0 1px, rgba(255,220,170,.03) 1px 2px, transparent 2px 92px),
    var(--mottle);
  background-size: auto, auto, 300px;
  box-shadow: inset 0 12px 24px rgba(0,0,0,.7);
}
html:not(.lamp-off) .case-back::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 90% at var(--lx, 26%) 120%, rgba(246,216,140,.22), transparent 70%);
}
.shelf {
  position: relative; z-index: 1;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf-track {
  display: inline-flex; flex-direction: column;
  min-width: 100%;
  padding: 0 0 calc(62px * var(--k));
}
.shelf-row {
  position: relative; z-index: 2;
  list-style: none; margin: 0;
  display: flex; align-items: flex-end; justify-content: center;
  gap: calc(2px * var(--k));
  height: calc(300px * var(--k) + 18px);
  padding: 0 22px;
}
.shelf-board {
  position: relative;
  height: calc(28px * var(--k));
  background-color: #3d2717;
  background-image:
    linear-gradient(180deg, #8a5c38 0, #5a3a22 2px, #3b2618 45%, #24170e 100%),
    var(--wood);
  background-blend-mode: normal, multiply;
  box-shadow: 0 1px 0 rgba(255,220,170,.18) inset, 0 14px 22px rgba(0,0,0,.55);
}
.shelf-board::before { /* the top surface of the shelf, just visible */
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 7px;
  background: linear-gradient(180deg, rgba(0,0,0,.6), #4a301d);
}
.shelf-labels { position: absolute; inset: 0; }
.shelf-label {
  position: absolute; top: 50%;
  transform: translate(0, -50%);
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 2px 9px 3px;
  font: 700 calc(9.5px * var(--k))/1.2 var(--sc); letter-spacing: .16em; text-transform: uppercase;
  color: #3a2a18;
  background: linear-gradient(180deg, #f5ecd6, #e6d7b5);
  border: 2px solid #b48a3a;
  border-image: linear-gradient(180deg, #f0d68f, #8a6a28) 1;
  box-shadow: 0 1px 2px rgba(0,0,0,.5);
  white-space: nowrap;
}
.shelf-label b { font-family: var(--display); font-style: italic; text-transform: none; letter-spacing: 0; font-size: 1.15em; }
.shelf-label[data-for="610"] { transform: translate(-50%, -50%); }
.shelf-fade {
  position: absolute; top: 0; bottom: 64px; width: 26px; z-index: 2; pointer-events: none;
  transition: opacity .3s;
}
.fade-l { left: 0; background: linear-gradient(90deg, rgba(10,6,3,.75), transparent); }
.fade-r { right: 0; background: linear-gradient(270deg, rgba(10,6,3,.75), transparent); }
.shelf-wrap.at-start .fade-l, .shelf-wrap.at-end .fade-r { opacity: 0; }

.shelf-hint {
  position: relative; z-index: 2;
  margin: -6px auto 0; padding: 0 22px;
  max-width: 36ch;
  text-align: center;
  font: italic 14.5px/1.45 var(--serif);
  color: #d9c9a2;
}
.sh-swipe { display: inline; }

/* ---------- a book on the shelf ---------- */
.slot {
  position: relative;
  flex: none;
  width: calc(var(--w) * var(--k) * 1px);
  height: calc(var(--h) * var(--k) * 1px);
  scroll-snap-align: center;
  perspective: 900px;
  perspective-origin: 50% 0%;
  --fs: calc(min(var(--w) * .4, 15.5) * var(--k) * 1px);
}
.spine {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 100%;
  padding: 0; margin: 0; border: 0; background: none;
  cursor: grab;
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.2,.9,.25,1.15);
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-x;
}
.spine.is-dragging { transition: none; cursor: grabbing; }
.spine:focus-visible { outline-offset: 2px; }
.sp-face {
  position: absolute; inset: 0;
  display: block;
  border-radius: 3px 3px 2px 2px / 5px 5px 2px 2px;
  background-color: var(--leather);
  background-image: var(--grain), var(--mottle);
  background-size: 120px, 300px;
  background-blend-mode: soft-light, multiply;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), 0 0 1px rgba(0,0,0,.8);
}
.sp-shade {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.62) 0%, rgba(0,0,0,.18) 13%, rgba(255,236,200,.13) 32%, rgba(255,236,200,.05) 48%, rgba(0,0,0,.1) 70%, rgba(0,0,0,.66) 100%);
  pointer-events: none;
}
.sp-shade::after { /* lamplight falling across the spine */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 60% at 50% 115%, rgba(255,214,140,.28), transparent 70%);
  opacity: calc(var(--glow, .6) * var(--lampv));
  transition: opacity .5s;
}
.sp-shade::before { /* the shimmer that runs down the shelf as the lamp comes on */
  content: ""; position: absolute; left: -20%; right: -20%; top: 0; height: 40%;
  background: linear-gradient(180deg, transparent, rgba(255,240,200,.22), transparent);
  transform: translateY(-120%);
  opacity: 0;
}
html.lights-up .sp-shade::before { animation: shimmer 1.4s cubic-bezier(.3,.1,.3,1) forwards; animation-delay: calc(.5s + var(--i, 0) * 90ms); }
@keyframes shimmer { 0% { transform: translateY(-120%); opacity: 1; } 100% { transform: translateY(300%); opacity: 1; } }
.sp-head {
  position: absolute; top: 0; left: 3px; right: 3px; height: 3px;
  background: repeating-linear-gradient(90deg, #c9a54c 0 2px, #7a1c22 2px 4px);
  opacity: .8;
  border-radius: 2px 2px 0 0;
}
.sp-rules {
  position: absolute; left: 0; right: 0; height: 9px;
  border-top: 1.5px solid rgba(201,165,76,.85); border-bottom: 1.5px solid rgba(201,165,76,.85);
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.6));
}
.sp-rules.top { top: 6%; }
.sp-rules.bot { bottom: 6%; }
.sp-rules::after {
  content: ""; position: absolute; left: 0; right: 0; top: 2px; bottom: 2px;
  border-top: .8px solid rgba(201,165,76,.6); border-bottom: .8px solid rgba(201,165,76,.6);
}
.sp-v {
  position: absolute; left: 0; right: 0; top: 12%; bottom: 17%;
  display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl;
  white-space: nowrap;
  font-size: var(--fs);
  overflow: hidden;
}
.sp-title {
  font: 700 1em/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .14em;
  filter: drop-shadow(0 -.5px 0 rgba(0,0,0,.65)) drop-shadow(0 .6px 0 rgba(255,225,160,.12));
}
.sp-subt {
  font: italic 400 .86em/1 var(--display);
  letter-spacing: .03em;
  margin-top: .7em;
  filter: drop-shadow(0 -.5px 0 rgba(0,0,0,.65));
}
.sp-subt::before {
  content: ""; display: inline-block; width: .32em; height: .32em; margin: 0 .2em .55em 0;
  vertical-align: middle;
  background: currentColor;
  background-image: inherit;
  transform: rotate(45deg);
}
.sp-v > span { position: relative; }
.sp-v.has-strip::before {
  content: ""; position: absolute; left: 15%; right: 15%; top: 1%; bottom: 1%;
  background-color: #14100c;
  background-image: var(--grain);
  background-size: 90px;
  background-blend-mode: soft-light;
  box-shadow: inset 0 0 0 1px rgba(201,165,76,.75), inset 0 0 0 3px #14100c, inset 0 0 0 3.8px rgba(201,165,76,.4), 0 1px 1px rgba(0,0,0,.5);
  border-radius: 1px;
}
.sp-foot {
  position: absolute; left: 50%; bottom: 8.5%; transform: translateX(-50%);
  width: calc(var(--fs) * 1.25); opacity: .85;
}
.sp-foot svg { display: block; width: 100%; }
.sp-top {
  position: absolute; left: 0; right: 0; top: 0; height: calc(var(--w) * var(--k) * 1.6px);
  transform-origin: 50% 0;
  transform: rotateX(90deg);
  background:
    linear-gradient(90deg, var(--leather) 0 3px, transparent 3px calc(100% - 3px), var(--leather) calc(100% - 3px)),
    repeating-linear-gradient(90deg, #efe4cb 0 1px, #dccdab 1px 2px),
    linear-gradient(180deg, #f3ead7, #b9a985);
  background-blend-mode: normal, multiply, normal;
  pointer-events: none;
}
.sp-dewey {
  position: absolute; left: 50%; bottom: 21%;
  transform: translateX(-50%);
  min-width: 70%;
  padding: 3px 3px 2px;
  font: 700 calc(9.5px * var(--k))/1.15 var(--serif);
  letter-spacing: .04em;
  text-align: center;
  color: #1d1610;
  background: linear-gradient(180deg, #faf6ea, #ebe3cf);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.45);
}

/* panel spines: raised bands and leather labels */
.hub {
  position: absolute; left: -1px; right: -1px; top: var(--y); height: 7px; margin-top: -3.5px;
  background: linear-gradient(180deg, rgba(0,0,0,.5), rgba(255,236,200,.24) 40%, rgba(255,236,200,.06) 62%, rgba(0,0,0,.55));
  border-top: 1px solid rgba(201,165,76,.85);
  border-bottom: 1px solid rgba(201,165,76,.85);
  box-shadow: 0 2px 2px rgba(0,0,0,.35);
}
.sp-panel { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
.sp-label {
  position: absolute; left: 9%; right: 9%; top: var(--t1, 14%); height: var(--h1, 16%);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  background-color: #17110c;
  background-image: var(--grain);
  background-size: 90px;
  background-blend-mode: soft-light;
  border-radius: 1px;
  box-shadow: inset 0 0 0 1px rgba(201,165,76,.7), inset 0 0 0 3px #17110c, inset 0 0 0 3.8px rgba(201,165,76,.45), 0 1px 1px rgba(0,0,0,.5);
  font: 700 calc(12.5px * var(--k))/1.12 var(--sc);
  letter-spacing: .06em;
  padding: 4px 3px;
}
.slot[data-id="wedidit"] .sp-label { background-color: #6E1F25; box-shadow: inset 0 0 0 1px rgba(201,165,76,.7), inset 0 0 0 3px #6E1F25, inset 0 0 0 3.8px rgba(201,165,76,.45), 0 1px 1px rgba(0,0,0,.5); font-size: calc(13.5px * var(--k)); }
.sp-sub2 {
  position: absolute; left: 0; right: 0; top: var(--t2, 40%); height: var(--h2, 14%);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font: italic 600 calc(12px * var(--k))/1.1 var(--display);
  --hi: #fff6cf;
  padding: 0 4px;
}
.sp-orns { position: absolute; left: 0; right: 0; top: var(--t3, 62%); bottom: 8%; display: flex; flex-direction: column; align-items: center; justify-content: space-around; }
.sp-orns > span { width: calc(12px * var(--k)); opacity: .85; filter: drop-shadow(0 -.5px 0 rgba(0,0,0,.6)); }
.sp-orns svg { display: block; width: 100%; }

/* the letter: a slim vellum first edition with a red ribbon */
.slot--letter .sp-face {
  background-image: linear-gradient(90deg, rgba(120,90,40,.25), transparent 20%, transparent 80%, rgba(120,90,40,.3)), var(--paper-tex), var(--mottle);
  background-size: auto, 220px, 300px;
  background-blend-mode: normal, multiply, soft-light;
}
.slot--letter .sp-shade { background: linear-gradient(90deg, rgba(60,30,10,.4) 0%, rgba(60,30,10,.08) 16%, rgba(255,255,255,.2) 38%, rgba(255,255,255,.06) 55%, rgba(60,30,10,.1) 75%, rgba(60,30,10,.45) 100%); }
.slot--letter .sp-title { background: none; color: var(--ink, #6E1F25); -webkit-text-fill-color: var(--ink, #6E1F25); filter: none; letter-spacing: .12em; font-size: .92em; }
.slot--letter .sp-rules { border-color: rgba(110,31,37,.7); filter: none; }
.slot--letter .sp-rules::after { border-color: rgba(110,31,37,.45); }
.slot--letter .sp-foot { color: #6E1F25; }
.slot--letter .sp-head { background: repeating-linear-gradient(90deg, #a3262c 0 2px, #f3ead7 2px 4px); }
.sp-ribbon {
  position: absolute; left: 58%; top: 100%; z-index: 3;
  width: calc(7px * var(--k)); height: calc(44px * var(--k));
  margin-top: -6px;
  background: linear-gradient(90deg, rgba(0,0,0,.35), transparent 30%, rgba(255,255,255,.18) 50%, rgba(0,0,0,.25)), var(--ribbon);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  transform: rotate(-4deg);
  transform-origin: 50% 0;
  pointer-events: none;
}
.sp-tag {
  position: absolute; left: 50%; top: 100%; z-index: 4;
  margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 0;
  animation: tagSwing 5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
.tag-string {
  position: absolute; left: 50%; top: -14px; width: 1.2px; height: calc(30px * var(--k));
  background: #d9cba7;
  transform: translateX(-50%);
}
.tag-card {
  position: relative; display: block;
  margin-top: calc(14px * var(--k));
  margin-left: -50px;
  width: 100px;
  padding: 9px 6px 8px 16px;
  font: italic 700 15px/1.05 var(--display);
  color: #5a1519;
  text-align: center;
  white-space: nowrap;
  background: linear-gradient(180deg, #fbf3df, #ecdcb6);
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%);
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.5));
  transform: rotate(-8deg);
}
.tag-hole { position: absolute; left: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #3b2618; box-shadow: 0 0 0 1.5px #c9a54c; }
.sp-tag.is-pending .tag-card { color: #5b4024; font-size: 12.5px; width: 104px; margin-left: -52px; }
@keyframes tagSwing { 0%, 100% { transform: rotate(5deg); } 50% { transform: rotate(-6deg); } }

/* the letter, still at the bindery: wrapped in kraft paper and string */
.slot.is-parcel .sp-face { background-color: #a9814f; background-image: var(--paper-tex), var(--mottle); background-size: 220px, 300px; background-blend-mode: multiply, soft-light; }
.slot.is-parcel .sp-title { color: #3d2814; -webkit-text-fill-color: #3d2814; background: none; }
.slot.is-parcel .sp-rules, .slot.is-parcel .sp-foot { opacity: 0; }
.parcel i { position: absolute; background: #e8dcc2; box-shadow: 0 1px 1px rgba(0,0,0,.4); }
.parcel i:nth-child(1) { left: 0; right: 0; top: 30%; height: 2px; }
.parcel i:nth-child(2) { left: 0; right: 0; top: 70%; height: 2px; }
.slot.nudge .spine { animation: nudge .5s ease; }
@keyframes nudge { 20% { transform: rotate(-3deg); } 45% { transform: rotate(2.4deg); } 70% { transform: rotate(-1.2deg); } }

/* states */
.slot.is-out > * { visibility: hidden; }
.slot.lean-l .spine { transform-origin: 0% 100%; transform: rotate(calc(-1 * var(--lean))); transition-duration: .7s; }
.slot.lean-r .spine { transform-origin: 100% 100%; transform: rotate(var(--lean)); transition-duration: .7s; }
.slot.peek .spine { transform: translateY(-5px); }
.slot.settle .spine { animation: settle .45s ease-out; }
@keyframes settle { 0% { transform: translateY(-10px); } 60% { transform: translateY(1px); } 100% { transform: none; } }

.steth-wrap {
  position: absolute; z-index: 3; pointer-events: none;
  left: -33.33%; top: -66.67%;
  width: 166.67%;
  top: calc(var(--w) * var(--k) * -.6667px);
}
.steth { display: block; width: 100%; height: auto; filter: drop-shadow(1px 3px 2px rgba(0,0,0,.55)); }

/* objects on the shelf */
.obj { flex: none; list-style: none; align-self: flex-end; }
.obj-clock { width: calc(62px * var(--k)); margin-right: calc(10px * var(--k)); }
.clock { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.clock svg { display: block; width: 100%; height: auto; filter: drop-shadow(2px 4px 4px rgba(0,0,0,.55)); }
.ck-pend { transform-origin: 40px 66px; animation: pend 2s ease-in-out infinite alternate; }
.obj-clock.is-ticking .ck-pend { animation-duration: .42s; }
@keyframes pend { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.ck-s { transition: transform .2s cubic-bezier(.3,1.8,.5,1); }
.obj-bookend { width: calc(36px * var(--k)); margin-left: calc(6px * var(--k)); }
.obj-bookend svg { display: block; width: 100%; filter: drop-shadow(-2px 4px 4px rgba(0,0,0,.55)); }

/* ---------- the desk, the lamp and the call slip ---------- */
.desk {
  position: relative;
  display: flex; align-items: flex-end; justify-content: center; gap: 4px;
  padding: 0 12px 30px;
  margin-top: 4px;
  z-index: 3;
}
.desk-top {
  position: absolute; left: 0; right: 0; bottom: 0; height: 128px; z-index: -1;
  background:
    linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0) 30%),
    linear-gradient(180deg, transparent 0 calc(100% - 26px), #6a4529 calc(100% - 26px), #3b2618 calc(100% - 22px), #24170e 100%),
    radial-gradient(70% 90% at var(--lx, 28%) 0%, rgba(246,216,140,calc(.38 * var(--lampv))), transparent 70%),
    linear-gradient(180deg, #24432f, #173123 calc(100% - 26px));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.3);
}
.desk-top::before { /* tooled gilt border on the leather inlay */
  content: ""; position: absolute; left: 12px; right: 12px; top: 10px; bottom: 36px;
  border: 1px solid rgba(201,165,76,.45);
  box-shadow: inset 0 0 0 3px transparent, inset 0 0 0 4px rgba(201,165,76,.25);
  border-radius: 2px;
}
.lamp {
  position: relative; flex: none;
  width: 132px;
  margin-bottom: 18px;
  margin-right: -6px;
  z-index: 2;
}
.lamp-svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 6px 6px rgba(0,0,0,.5)); }
.lamp-glass-glow { opacity: calc(.0 + .22 * var(--lampv)); mix-blend-mode: screen; transition: opacity .4s; }
.lamp-mouth { opacity: var(--lampv); transition: opacity .4s; }
.lamp-light {
  position: absolute; left: 50%; top: 36%; width: 330%; height: 216%;
  transform: translateX(-50%);
  background: radial-gradient(50% 44% at 50% 11%, rgba(255,232,175,.62), rgba(246,216,140,.2) 45%, transparent 74%);
  /* the light starts at the mouth of the shade, so feather its top edge */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0,0,0,.5) 7%, #000 16%);
  mask-image: linear-gradient(180deg, transparent 0, rgba(0,0,0,.5) 7%, #000 16%);
  opacity: var(--lampv);
  pointer-events: none;
  mix-blend-mode: screen;
  transition: opacity .45s;
}
.lamp-shade-hit { position: absolute; left: 5%; top: 18%; width: 90%; height: 32%; pointer-events: none; }
.lamp-chain {
  position: absolute; left: 63%; top: 40%;
  width: 44px; height: 64px;
  margin-left: -16px;
  padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lamp-tag {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-30%) rotate(6deg);
  padding: 1px 6px 2px;
  font: italic 700 12px/1.2 var(--display);
  color: #3a2610;
  background: linear-gradient(180deg, #f6ecd2, #e2cfa4);
  border-radius: 2px;
  box-shadow: 0 2px 3px rgba(0,0,0,.45);
  pointer-events: none;
}
.lamp-chain-g { transform-box: view-box; transition: transform .3s cubic-bezier(.3,1.6,.5,1); }
.lamp-chain.pulled ~ .lamp-svg .lamp-chain-g, .lamp.pulled .lamp-chain-g { transform: translateY(10px); }
html.flicker { animation: flick .8s steps(1) 1; }
@keyframes flick { 0% { --lampv: .2; } 12% { --lampv: .9; } 22% { --lampv: .3; } 34% { --lampv: 1; } 46% { --lampv: .6; } 58% { --lampv: 1; } }
@property --lampv { syntax: "<number>"; inherits: true; initial-value: 1; }
html.lights-up { animation: lightsUp 1.6s ease-out 1; }
@keyframes lightsUp { 0% { --lampv: 0; } 18% { --lampv: .55; } 26% { --lampv: .1; } 40% { --lampv: .9; } 48% { --lampv: .5; } 70%, 100% { --lampv: 1; } }

.call-slip {
  position: relative;
  flex: 1 1 auto;
  max-width: 270px;
  margin-bottom: 12px;
  padding: 14px 16px 10px;
  color: var(--ink);
  background-color: #f6eedb;
  background-image: linear-gradient(180deg, rgba(255,255,255,.4), rgba(0,0,0,0) 40%), var(--paper-tex);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 14px 22px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.35);
  transform: rotate(-1.6deg);
}
.call-slip::before { /* a paperclip */
  content: ""; position: absolute; right: 22px; top: -10px; width: 14px; height: 34px;
  border: 2px solid #b9bcc0; border-radius: 8px; border-bottom-color: transparent;
  box-shadow: 0 1px 1px rgba(0,0,0,.4);
  transform: rotate(8deg);
}
.cs-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 1.5px solid #8e2a22;
  font: 700 11px/1.2 var(--sc); letter-spacing: .16em; text-transform: uppercase; color: #8e2a22;
}
.cs-head b { font: italic 700 15px/1 var(--display); letter-spacing: 0; text-transform: none; color: var(--ink); }
.cs-title { font: italic 800 22px/1.1 var(--display); color: #4a1418; }
.cs-meta { margin-top: 4px; font: 14.5px/1.4 var(--serif); color: #4b3420; }
.cs-status { margin-top: 6px; font: italic 13.5px/1.35 var(--serif); color: #6a5038; }
.cs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin-top: 10px; }
.cs-actions .btn { width: 100%; }
.cs-actions .btn-link { margin: 0 auto; }
.call-slip.is-pending .btn-leather { filter: grayscale(.35) brightness(.85); }

/* =========================================================
   BAYS (sections below the room)
   ========================================================= */
main { position: relative; background: var(--green-deep); }
main::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--damask), var(--mottle);
  background-size: 72px 112px, 640px;
  opacity: .9;
}
.bay {
  position: relative;
  padding: 76px 18px 84px;
  overflow-x: hidden;
  overflow-x: clip; /* nothing on the desk may widen the page on a phone */
}
.bay + .bay::before { /* chair rail between bays */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px;
  background-color: var(--walnut);
  background-image: linear-gradient(180deg, #7a5233 0, #4a2f1b 3px, #2e1c10 8px, #573923 9px, #22150c 14px), var(--wood);
  background-blend-mode: normal, multiply;
  box-shadow: 0 6px 12px rgba(0,0,0,.45);
}
.bay-head { max-width: 640px; margin: 0 auto 34px; text-align: center; }
.bay-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font: 700 12.5px/1.2 var(--sc); letter-spacing: .22em; text-transform: uppercase; color: #d8bd73;
}
.bay-kicker::before, .bay-kicker::after { content: ""; width: 22px; height: 1px; background: linear-gradient(90deg, transparent, var(--gilt)); }
.bay-kicker::after { transform: scaleX(-1); }
.bay-title {
  margin-top: 10px;
  font: italic 800 clamp(34px, 9vw, 56px)/1.02 var(--display);
  color: #f6e7bd;
  text-shadow: 0 2px 0 rgba(0,0,0,.4);
}
.bay-lede { margin-top: 12px; font: italic 17px/1.55 var(--serif); color: #e6d9bb; }

/* ---------- circulation desk ---------- */
.circ-desk {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  padding: 36px 14px 40px;
  border-radius: 8px;
  background-color: #3a2416;
  background-image: radial-gradient(80% 60% at 30% 10%, rgba(246,216,140,calc(.18 * var(--lampv))), transparent 70%), linear-gradient(180deg, #4d311d, #2e1c10), var(--wood);
  background-blend-mode: normal, normal, multiply;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,220,170,.15), 0 24px 40px rgba(0,0,0,.45);
}
.loan-card {
  position: relative;
  width: min(100%, 360px);
  margin: 0 auto;
  padding: 16px 18px 18px;
  color: #3a2a1c;
  background-color: #efe0bc;
  background-image: linear-gradient(180deg, rgba(255,255,255,.3), transparent 30%), var(--paper-tex);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 18px 30px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.4);
  transform: rotate(-1.4deg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .5s cubic-bezier(.3,1.3,.5,1), opacity .4s;
}
.loan-card.jolt { animation: jolt .3s ease-out; }
@keyframes jolt { 0% { transform: rotate(-1.4deg) translateY(0); } 30% { transform: rotate(-1.1deg) translateY(3px) scale(.995); } 100% { transform: rotate(-1.4deg); } }
.loan-card.is-filed { transform: translate(-120%, 10px) rotate(-14deg); opacity: 0; }
.loan-card.is-issued { animation: issue .55s cubic-bezier(.2,1.2,.4,1); }
@keyframes issue { from { transform: translate(110%, -10px) rotate(10deg); opacity: 0; } to { transform: rotate(-1.4deg); opacity: 1; } }
.lc-head {
  display: flex; justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 2px solid #8e2a22;
  font: 700 11px/1.2 var(--sc); letter-spacing: .16em; text-transform: uppercase; color: #8e2a22;
}
.lc-title { margin: 10px 0 8px; font: italic 800 26px/1.05 var(--display); color: #3b2618; }
.lc-fields { margin: 0; }
.lc-fields div { display: grid; grid-template-columns: 6.4em 1fr; align-items: baseline; padding: 5px 0 4px; border-bottom: 1px solid rgba(142,42,34,.35); }
.lc-fields dt { font: 700 10.5px/1.2 var(--sc); letter-spacing: .14em; text-transform: uppercase; color: #8e2a22; }
.lc-fields dd { margin: 0; font: italic 16px/1.35 var(--serif); color: var(--blue-ink); }
.lc-dates { width: 100%; margin-top: 12px; border-collapse: collapse; }
.lc-dates th { padding: 4px 0; font: 700 10.5px/1.2 var(--sc); letter-spacing: .14em; text-transform: uppercase; color: #8e2a22; text-align: left; border-bottom: 1.5px solid #8e2a22; }
.lc-dates th + th, .lc-dates td + td { border-left: 1.5px solid rgba(142,42,34,.6); padding-left: 10px; }
.lc-dates td { height: 32px; border-bottom: 1px solid rgba(142,42,34,.3); vertical-align: middle; }
.datestamp {
  display: inline-block;
  font: 700 13.5px/1 var(--serif); letter-spacing: .1em;
  color: rgba(76,46,128,.86);
  transform: rotate(-2.5deg);
  -webkit-mask-image: var(--ink-mask); mask-image: var(--ink-mask);
  -webkit-mask-size: 120px 60px; mask-size: 120px 60px;
}
.lc-dash { display: inline-block; width: 50%; height: 1px; background: rgba(27,42,85,.6); vertical-align: middle; transform: rotate(-3deg); }
.lc-fine { margin-top: 14px; padding-top: 8px; border-top: 2px solid #8e2a22; }
.lc-fine-l { font: 700 10.5px/1.2 var(--sc); letter-spacing: .16em; text-transform: uppercase; color: #8e2a22; }
.lc-fine-v { font: 900 46px/1 var(--display); color: #6E1F25; letter-spacing: -.01em; margin-top: 2px; }
.lc-fine-p { margin-top: 4px; font: italic 16px/1.4 var(--serif); color: #3a2a1c; }
.lc-fine-p span { white-space: nowrap; color: var(--blue-ink); }
.imps { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 3px; }
.imp {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--rot));
  white-space: nowrap;
  animation: inkIn .18s ease-out both;
}
@keyframes inkIn { from { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot)) scale(1.18); } to { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); } }
.imp-in {
  display: inline-block;
  padding: .2em .5em .16em;
  border: .12em solid currentColor;
  outline: .05em solid currentColor; outline-offset: .14em;
  border-radius: .12em;
  font: 900 24px/1 var(--sc);
  letter-spacing: .08em;
  text-transform: uppercase;
  -webkit-mask-image: var(--ink-mask); mask-image: var(--ink-mask);
  -webkit-mask-size: 180px 90px; mask-size: 180px 90px;
  mix-blend-mode: multiply;
}
.imp--big .imp-in { font-size: 38px; }
.imp--red { color: rgba(178,26,32,.84); }
.imp--blue { color: rgba(30,58,140,.82); }
.imp--green { color: rgba(26,108,58,.84); }
.imp--violet { color: rgba(76,46,128,.84); }
.stamp-tool {
  position: absolute; right: 0; top: -44px; z-index: 4;
  width: 76px; height: 102px;
  padding: 0; border: 0; background: none; cursor: pointer;
  transform: rotate(14deg);
  transform-origin: 50% 100%;
  filter: drop-shadow(4px 10px 8px rgba(0,0,0,.5));
  -webkit-tap-highlight-color: transparent;
}
.stamp-tool svg { width: 100%; height: 100%; display: block; }
.stamp-tool.is-moving { z-index: 6; }
.inkpad {
  position: absolute; left: 10px; bottom: 10px; z-index: 0;
  width: 92px; height: 56px;
  border-radius: 5px;
  background: linear-gradient(180deg, #5c6168, #2d3035);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 10px rgba(0,0,0,.5);
  transform: rotate(-6deg);
}
.inkpad-felt { position: absolute; inset: 6px; border-radius: 3px; background: radial-gradient(circle at 40% 40%, #7b2a35, #3c0f16); box-shadow: inset 0 2px 4px rgba(0,0,0,.6); }
.inkpad-label { position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%); font: 700 8px/1 var(--sc); letter-spacing: .2em; color: #cfd3d8; opacity: .7; }
.loan-small { max-width: 380px; margin: 18px auto 0; text-align: center; font: italic 14px/1.5 var(--serif); color: #cdbf9f; }
.circ-actions { margin-top: 22px; text-align: center; }
.stamp-count { min-height: 1.5em; margin-top: 12px; font: italic 16px/1.5 var(--serif); color: #efe3c8; }

/* ---------- gallery ---------- */
.gallery {
  display: grid; justify-items: center; align-items: start;
  gap: 74px 34px;
  max-width: 1100px; margin: 0 auto;
  padding-top: 30px;
}
.frame { position: relative; margin: 0; width: min(100%, 520px); }
.frame--tall { width: min(80%, 340px); }
.frame-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; -webkit-tap-highlight-color: transparent; }
.moulding {
  display: block;
  padding: 15px;
  background:
    linear-gradient(135deg, rgba(255,250,220,.55), transparent 25%, transparent 75%, rgba(0,0,0,.35)),
    linear-gradient(135deg, #f3dc8e, #a77e33 22%, #6d4c19 40%, #d9b768 58%, #8a6a28 78%, #e9cf7f);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px #3d2a0c, inset 0 0 0 4px #e9cf7f, inset 0 0 0 5px #7d5f22,
    inset 0 0 0 8px #c9a54c, inset 0 0 0 9px #5a3f15,
    0 26px 44px rgba(0,0,0,.6), 0 3px 6px rgba(0,0,0,.5);
}
.liner {
  display: block;
  padding: 9px;
  background: linear-gradient(180deg, #ece0c3, #d8c9a5);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.25);
}
.liner img { display: block; width: 100%; height: auto; aspect-ratio: var(--r); object-fit: cover; box-shadow: 0 0 0 1px rgba(0,0,0,.3); filter: sepia(.08) saturate(.95); transition: filter .8s; }
.frame.is-lit .liner img { filter: none; }
.pic-light { position: absolute; left: 50%; top: -30px; z-index: 2; width: 56%; height: 22px; transform: translateX(-50%); pointer-events: none; }
.pl-bar {
  position: absolute; left: 0; right: 0; top: 0; height: 12px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #f3dc8e, #a77e33 60%, #5b3f14);
  box-shadow: 0 3px 5px rgba(0,0,0,.5);
}
.pl-bar::after { content: ""; position: absolute; left: 50%; top: 12px; width: 4px; height: 18px; margin-left: -2px; background: linear-gradient(90deg, #6b4d1c, #e2c071, #6b4d1c); }
.pl-glow {
  position: absolute; left: -30%; right: -30%; top: 10px; height: 340px;
  background: radial-gradient(60% 50% at 50% 0%, rgba(255,232,170,.5), rgba(246,216,140,.12) 50%, transparent 75%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 1.2s ease .2s;
}
.frame.is-lit .pl-glow { opacity: var(--lampv); }
.plaque {
  display: block; width: fit-content; max-width: 92%;
  margin: 16px auto 0;
  padding: 7px 16px 8px;
  font: italic 15.5px/1.35 var(--serif);
  text-align: center;
  color: #2f2008;
  background: linear-gradient(180deg, #f0d68f, #c9a54c 50%, #a17d2f);
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -1px 0 rgba(0,0,0,.25), 0 4px 8px rgba(0,0,0,.45);
  text-shadow: 0 1px 0 rgba(255,240,200,.45);
}

/* ---------- prescription pad ---------- */
.pad-wrap { position: relative; width: min(100%, 360px); margin: 0 auto; }
.pad { position: relative; padding-top: 10px; }
.sheet {
  position: relative;
  color: #1F3A2E;
  background-color: #f7f6f0;
  background-image:
    repeating-linear-gradient(45deg, rgba(31,58,46,.018) 0 1px, transparent 1px 7px),
    var(--paper-tex);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.sheet--under { position: absolute; left: 0; right: 0; top: 10px; bottom: 0; transform: translate(2px, 4px) rotate(.7deg); box-shadow: 0 16px 30px rgba(0,0,0,.45); }
.sheet--under.s2 { transform: translate(4px, 8px) rotate(1.4deg); }
.sheet--top { padding: 22px 20px 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sheet--torn {
  position: absolute; left: 0; right: 0; top: 10px; z-index: 5;
  padding: 22px 20px 16px;
  animation: tearAway 1.05s cubic-bezier(.4,0,.6,1) forwards;
  transform-origin: 20% 0%;
  pointer-events: none;
}
@keyframes tearAway {
  0% { transform: none; }
  18% { transform: rotate(-3deg) translate(-4px, -4px); }
  100% { transform: translate(140px, -160px) rotate(28deg); opacity: 0; }
}
.pad-binding {
  position: absolute; left: -4px; right: -4px; top: 0; height: 18px; z-index: 3;
  border-radius: 3px 3px 1px 1px;
  background-color: #1F3A2E;
  background-image: linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.3)), var(--grain);
  background-size: auto, 100px;
  background-blend-mode: normal, soft-light;
  box-shadow: 0 3px 4px rgba(0,0,0,.4);
}
.pad-binding::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -3px; height: 3px; background: repeating-linear-gradient(90deg, rgba(0,0,0,.25) 0 2px, transparent 2px 5px); }
.rx-head { text-align: center; padding-bottom: 10px; border-bottom: 2px solid #1F3A2E; }
.rx-doc { font: 800 28px/1.1 var(--display); color: #1F3A2E; }
.rx-doc-aside { font: italic 400 16px/1 var(--display); color: #3e6a55; }
.rx-dept { margin-top: 3px; font: 700 10.5px/1.3 var(--sc); letter-spacing: .18em; text-transform: uppercase; color: #3e6a55; }
.rx-meta { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; margin-top: 12px; font: 14px/1.5 var(--serif); }
.rx-k { font: 700 10px/1 var(--sc); letter-spacing: .16em; text-transform: uppercase; color: #3e6a55; margin-right: 4px; }
.fill { font: italic 15px/1.4 var(--serif); color: var(--blue-ink); border-bottom: 1px dotted rgba(31,58,46,.45); padding: 0 2px; }
.rx-body { position: relative; margin-top: 14px; padding-left: 52px; min-height: 128px; }
.rx-sym { position: absolute; left: 0; top: -2px; font: 800 44px/1 var(--display); color: #1F3A2E; }
.rx-sym i { font-style: italic; font-size: .6em; margin-left: -.22em; position: relative; top: .3em; }
.rx-line { position: relative; display: flex; align-items: flex-end; gap: 8px; min-height: 52px; padding-bottom: 6px; border-bottom: 1px dotted rgba(31,58,46,.4); }
.rx-2 { min-height: 46px; }
.rx-label { font: italic 700 15px/1.3 var(--display); color: #1F3A2E; flex: none; }
.rx-text { font: italic 19px/1.3 var(--serif); color: var(--blue-ink); }
.rx-2 .rx-text { font-size: 17px; }
.rx-text .w { display: inline-block; opacity: 0; filter: blur(5px); transform: translateY(2px) skewX(-8deg); animation: resolve .55s ease-out forwards; animation-delay: calc(var(--i) * 75ms); }
@keyframes resolve { to { opacity: 1; filter: blur(0); transform: none; } }
.scrawl { position: absolute; left: 0; bottom: 4px; overflow: visible; pointer-events: none; }
.rx-2 .scrawl { left: 38px; }
.scrawl path { fill: none; stroke: var(--blue-ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.scrawl.is-fading { opacity: 0; filter: blur(3px); transform: translateY(-3px); transition: opacity .7s, filter .7s, transform .7s; }
.rx-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 14px; font: 14px/1.5 var(--serif); }
.rx-sign { width: 112px; height: 38px; }
.rx-fine { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(31,58,46,.3); font: italic 12.5px/1.4 var(--serif); color: #3e6a55; text-align: center; }
.pen {
  position: absolute; left: 84%; top: 58%; z-index: 7;
  width: 24px; height: 150px; margin-top: -150px;
  transform-origin: 0 100%;
  transform: rotate(24deg);
  pointer-events: none;
  filter: drop-shadow(6px 8px 5px rgba(0,0,0,.45));
  transition: left .35s, top .35s, transform .35s;
}
.pen svg { display: block; width: 100%; height: 100%; margin-left: -12px; }
.pen.is-writing { left: 0; top: 0; transition: transform .06s linear; }
.rx-actions { margin-top: 30px; text-align: center; }

/* ---------- card catalogue ---------- */
.drawer { position: relative; max-width: 560px; margin: 0 auto; }
.drawer-box {
  padding: 22px 16px 26px;
  border-radius: 8px 8px 0 0;
  background-color: #2e1c10;
  background-image: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.1) 40%), var(--wood);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.5), inset 0 10px 22px rgba(0,0,0,.6);
}
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ccard {
  position: relative;
  padding: 12px 16px 14px;
  color: var(--ink);
  background-color: #f6efdc;
  background-image: linear-gradient(180deg, transparent 0 33px, rgba(178,58,50,.6) 33px 34.5px, transparent 34.5px), repeating-linear-gradient(180deg, transparent 0 25px, rgba(60,100,160,.18) 25px 26px), var(--paper-tex);
  background-position: 0 0, 0 22px, 0 0;
  border-radius: 3px;
  box-shadow: 0 6px 12px rgba(0,0,0,.4);
  transform: rotate(var(--tilt));
}
.ccard::after { content: ""; position: absolute; left: 50%; bottom: 8px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #2e1c10; box-shadow: inset 0 1px 2px rgba(0,0,0,.6); }
.cc-call { display: flex; justify-content: space-between; font: 700 12px/1.6 var(--serif); letter-spacing: .08em; color: #6a5038; }
.cc-name { margin-top: 8px; font: 700 20px/1.25 var(--display); color: #3b2618; text-wrap: balance; }
.cc-meta { font: 15px/1.6 var(--serif); }
.cc-teacher { font: italic 15px/1.6 var(--serif); color: #4b3420; }
.cc-foot { margin-top: 4px; padding-bottom: 14px; font: italic 13px/1.4 var(--serif); color: #8a6f52; }
.drawer-front {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 16px 0 18px;
  border-radius: 0 0 8px 8px;
  background-color: var(--walnut);
  background-image: linear-gradient(180deg, #6a4529, #3b2618 30%, #24170e), var(--wood);
  background-blend-mode: normal, multiply;
  box-shadow: 0 20px 34px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,220,170,.25);
}
.drawer-label { padding: 3px 14px; font: 700 12px/1.3 var(--sc); letter-spacing: .18em; text-transform: uppercase; color: #3a2a18; background: linear-gradient(180deg, #f5ecd6, #e6d7b5); border: 2px solid #b48a3a; }
.drawer-pull { width: 74px; height: 16px; border-radius: 0 0 40px 40px; background: linear-gradient(180deg, #f3dc8e, #a77e33 50%, #5b3f14); box-shadow: 0 4px 6px rgba(0,0,0,.5); }

/* ---------- footer: the bookplate ---------- */
.foot {
  position: relative;
  padding: 70px 18px calc(90px + env(safe-area-inset-bottom));
  text-align: center;
  background: linear-gradient(180deg, var(--green-deep), var(--green-ink));
}
.foot::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px;
  background-color: var(--walnut);
  background-image: linear-gradient(180deg, #7a5233 0, #4a2f1b 3px, #2e1c10 8px, #573923 9px, #22150c 14px), var(--wood);
  background-blend-mode: normal, multiply;
}
.ex-libris {
  width: min(100%, 340px);
  margin: 0 auto 30px;
  padding: 12px;
  color: #3b2618;
  background-color: #f4ead2;
  background-image: var(--paper-tex);
  box-shadow: 0 20px 36px rgba(0,0,0,.55);
  transform: rotate(.8deg);
}
.exl-in { padding: 18px 18px 20px; border: 1.5px solid #6E1F25; outline: 1px solid rgba(110,31,37,.5); outline-offset: -6px; }
.exl-k { font: 700 13px/1.2 var(--sc); letter-spacing: .3em; text-transform: uppercase; color: #6E1F25; }
.exl-art { width: 120px; color: #6E1F25; margin: 10px auto 2px; display: block; }
.exl-name { font: italic 800 48px/1 var(--display); color: #4a1418; }
.exl-line { margin-top: 12px; font: 16px/1.55 var(--serif); }
.exl-aside { margin-top: 6px; font: italic 14.5px/1.5 var(--serif); color: #6a5038; }
.exl-from { text-wrap: balance; margin-top: 14px; font: 700 11.5px/1.4 var(--sc); letter-spacing: .14em; text-transform: uppercase; color: #6E1F25; }
.lt-sub { font: italic 400 14px/1 var(--serif); opacity: .75; }

/* =========================================================
   THE READING TABLE
   ========================================================= */
.reader {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  color: var(--cream);
  -webkit-user-select: none; user-select: none;
}
.reader[hidden] { display: none; }
.reader-bg {
  position: absolute; inset: 0;
  background-color: #173123;
  background-image:
    radial-gradient(70% 55% at 30% 0%, rgba(246,216,140,calc(.32 * var(--lampv))), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 40%, rgba(0,0,0,.55)),
    var(--grain), var(--mottle);
  background-size: auto, auto, 140px, 560px;
  background-blend-mode: normal, normal, soft-light, multiply;
  opacity: 0;
  transition: opacity .55s ease .25s;
}
.reader-bg::before { /* tooled border on the desk leather */
  content: ""; position: absolute; inset: 10px;
  border: 1px solid rgba(201,165,76,.35);
  outline: 1px solid rgba(201,165,76,.18); outline-offset: -5px;
  border-radius: 3px;
}
.reader.is-preparing .reader-bg, .reader.is-in .reader-bg { opacity: 1; }
.reader.is-leaving .reader-bg, .reader.is-flying-home .reader-bg { opacity: 0; transition-delay: 0s; transition-duration: .7s; }
.reader-bar, .reader-nav, .reader-hint { position: relative; z-index: 2; opacity: 0; transition: opacity .4s; }
.reader.is-in .reader-bar, .reader.is-in .reader-nav, .reader.is-in .reader-hint { opacity: 1; }
.reader.is-leaving .reader-bar, .reader.is-leaving .reader-nav, .reader.is-leaving .reader-hint { opacity: 0; }
.reader.is-preparing .book { opacity: 0; }
.reader-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 6px 20px;
}
.reader-meta { min-width: 0; }
.reader-kicker { font: 700 10.5px/1.2 var(--sc); letter-spacing: .2em; text-transform: uppercase; color: #d8bd73; }
.reader-title { font: italic 800 20px/1.1 var(--display); color: #f6e7bd; text-wrap: balance; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.reader-by { font: italic 13.5px/1.3 var(--serif); color: #cdbf9f; }
.reader-close {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 8px 12px 8px 14px;
  border: 0; border-radius: 6px; cursor: pointer;
  font: 700 14px/1.1 var(--display); color: #fbe9b9;
  background-color: var(--oxblood);
  background-image: linear-gradient(180deg, rgba(255,220,170,.16), rgba(0,0,0,.25)), var(--grain);
  background-size: auto, 100px;
  background-blend-mode: normal, soft-light;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), inset 0 0 0 3px rgba(201,165,76,.5), 0 4px 10px rgba(0,0,0,.4);
}
.reader-close svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.reader-stage {
  position: relative; z-index: 1;
  flex: 1 1 auto;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
  min-height: 0;
}
.reader-nav {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 4px 16px 2px;
}
.rn {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  color: #3a2610;
  background: radial-gradient(circle at 35% 30%, #fbe9b0, #c9a54c 55%, #8a6a28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -2px 3px rgba(0,0,0,.3), 0 4px 10px rgba(0,0,0,.45);
  -webkit-tap-highlight-color: transparent;
}
.rn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rn:disabled { opacity: .35; cursor: default; }
.reader-folio { min-width: 9.5em; text-align: center; font: italic 15px/1.3 var(--serif); color: #efe3c8; }
@media (max-width: 420px) {
  .reader-title { font-size: 18.5px; }
  .reader-nav { gap: 12px; }
  .reader-folio { min-width: 7.6em; }
}
.reader-hint { padding: 2px 16px max(14px, env(safe-area-inset-bottom)); text-align: center; font: italic 13.5px/1.4 var(--serif); color: #bfb08e; }
.reader.at-letter .reader-hint { visibility: hidden; }
.reader.no-hint .reader-hint { display: none; }
.reader.no-hint .reader-nav { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.reader-measure { position: absolute; left: -9999px; top: 0; visibility: hidden; }
.reader-measure { --ov: 6px; --pfs: max(16px, min(18px, calc(var(--pw) * .047))); --lfs: max(16px, min(20px, calc(var(--pw) * .043))); font-size: var(--pfs); }
.reader-measure .measure { position: relative; }

.book {
  --ov: 6px;
  --pfs: max(16px, min(18px, calc(var(--pw) * .047)));
  --lfs: max(16px, min(20px, calc(var(--pw) * .043)));
  position: relative;
  width: var(--pw); height: var(--ph);
  transform: translateX(calc(var(--shift, 0) * var(--pw) * -.5));
  perspective: 2600px;
  font-size: var(--pfs);
}
.book.is-spread { width: calc(var(--pw) * 2); }
.book.arrive { animation: arrive .55s cubic-bezier(.2,.9,.3,1); }
@keyframes arrive { from { opacity: 0; translate: 0 18px; scale: .97; } to { opacity: 1; translate: 0 0; scale: 1; } }
.book.fade-turn .pslot { animation: fadeTurn .35s ease; }
@keyframes fadeTurn { from { opacity: .2; } to { opacity: 1; } }
.book-shadow {
  position: absolute; left: 4%; right: 4%; bottom: -16px; height: 34px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.6), transparent 70%);
  pointer-events: none;
}
.book.is-spread.is-closed .book-shadow { left: 52%; right: 2%; }
.board {
  position: absolute; top: 0; width: var(--pw); height: var(--ph);
  background-color: var(--leather);
  background-image: linear-gradient(90deg, rgba(0,0,0,.4), rgba(0,0,0,.05) 8%, rgba(255,230,200,.05) 50%, rgba(0,0,0,.25)), var(--grain);
  background-size: auto, 130px;
  background-blend-mode: normal, soft-light;
  box-shadow: 0 18px 34px rgba(0,0,0,.55), 0 3px 6px rgba(0,0,0,.4);
}
.board-r { left: 0; border-radius: 2px 5px 5px 2px; }
.is-spread .board-r { left: var(--pw); }
.board-l { left: 0; border-radius: 5px 2px 2px 5px; display: none; }
.is-spread:not(.is-closed) .board-l { display: block; }
.pslot { position: absolute; top: 0; width: var(--pw); height: var(--ph); }
.slot-r { left: 0; z-index: 1; }
.is-spread .slot-r { left: var(--pw); }
.slot-l { left: 0; display: none; z-index: 1; }
.is-spread .slot-l { display: block; }
.cast { position: absolute; top: 0; width: var(--pw); height: var(--ph); pointer-events: none; z-index: 3; }
.cast-r { left: 0; }
.is-spread .cast-r { left: var(--pw); }
.cast-l { left: 0; }
.leaf {
  position: absolute; top: 0;
  width: var(--pw); height: var(--ph);
  transform-style: preserve-3d;
  z-index: 5;
  pointer-events: none;
}
.strip { position: absolute; top: 0; height: 100%; transform-origin: 0 50%; transform-style: preserve-3d; }
.sf { position: absolute; inset: 0; overflow: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.sf-back { transform: rotateY(180deg); }
.sf > .side { inset: auto; top: 0; width: var(--pw); height: var(--ph); }
.sf-shade { position: absolute; inset: 0; pointer-events: none; }

/* ---------- sides of leaves ---------- */
.side { position: absolute; inset: 0; }
.paper > .pg {
  position: absolute; top: var(--ov); bottom: var(--ov); left: 0; right: var(--ov);
  display: flex; flex-direction: column;
  padding: 9% 10% 6.5% 12%;
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--pfs);
  line-height: 1.6;
  background-color: var(--page);
  background-image:
    linear-gradient(90deg, rgba(90,60,30,.3), rgba(90,60,30,.1) 4%, rgba(90,60,30,0) 12%, rgba(90,60,30,0) 94%, rgba(90,60,30,.08)),
    radial-gradient(130% 100% at 50% 50%, transparent 60%, rgba(150,110,60,.12)),
    var(--paper-tex);
  box-shadow: var(--stack-r, none);
  border-radius: 0 2px 2px 0;
}
.slot-l .paper > .pg, .sf-back .paper > .pg {
  left: var(--ov); right: 0;
  padding: 9% 12% 6.5% 10%;
  background-image:
    linear-gradient(270deg, rgba(90,60,30,.3), rgba(90,60,30,.1) 4%, rgba(90,60,30,0) 12%, rgba(90,60,30,0) 94%, rgba(90,60,30,.08)),
    radial-gradient(130% 100% at 50% 50%, transparent 60%, rgba(150,110,60,.12)),
    var(--paper-tex);
  box-shadow: var(--stack-l, none);
  border-radius: 2px 0 0 2px;
}
.sf .paper > .pg { box-shadow: none; }
.prose, .pg-body, .entry { -webkit-user-select: text; user-select: text; }
.rh { margin: 0 0 1.5em; text-align: center; font: 700 .64em/1 var(--sc); letter-spacing: .2em; text-transform: uppercase; color: #8a6a4a; }
.folio { margin-top: auto; padding-top: .8em; text-align: center; font: .76em/1 var(--serif); color: #8a6a4a; }
.pg-h { margin: .3em 0 .9em; text-align: center; font: italic 800 1.55em/1.1 var(--display); color: #3b2618; }
.pg-body p { margin: 0 0 .7em; }
.pg-note { margin-top: 1em; text-align: center; font: italic .92em/1.5 var(--serif); color: #6a5038; }
.side--center .pg { justify-content: center; }
.side--center .pg-body { margin: auto 0; text-align: center; font: italic 1.32em/1.45 var(--display); color: #3b2618; }
.side--center .pg-note { margin-top: 0; margin-bottom: 1em; }
.side--center .rh { margin-bottom: 0; }

/* title page */
.side--title .pg { align-items: center; text-align: center; padding-top: 12%; }
.tp-press { font: 700 .62em/1.2 var(--sc); letter-spacing: .26em; text-transform: uppercase; color: #8a6a4a; }
.tp-main { margin: auto 0; }
.tp-title { font: 800 1.95em/1.05 var(--display); color: #3b2618; text-wrap: balance; }
.tp-sub { margin-top: .4em; font: italic 1.12em/1.3 var(--display); color: #6E1F25; }
.tp-orn { width: 5.2em; margin: 1.1em auto; color: #a07c3a; }
.tp-orn svg, .end-orn svg, .cv-orn svg { display: block; width: 100%; }
.tp-by { font: italic 1em/1.4 var(--serif); }
.tp-ed { margin-top: .8em; font: .8em/1.45 var(--serif); color: #6a5038; text-wrap: balance; }
.tp-imprint { display: flex; flex-direction: column; align-items: center; gap: .3em; font: 700 .6em/1 var(--sc); letter-spacing: .3em; color: #8a6a4a; }
.tp-imprint .orn-lamp { width: 2.2em; color: #6E1F25; }

/* contents, blurbs, dictionary, ruled page */
.toc { list-style: none; margin: 0; padding: 0; }
.toc li { display: flex; align-items: baseline; gap: .4em; margin-bottom: .55em; }
.toc-n { flex: none; min-width: 2.2em; font: italic .92em/1.3 var(--display); color: #6E1F25; }
.toc-t { flex: none; max-width: 70%; }
.toc-dots { flex: 1 1 auto; border-bottom: 1.5px dotted rgba(90,60,30,.45); transform: translateY(-.25em); min-width: 1em; }
.toc-p { flex: none; font-variant-numeric: oldstyle-nums; color: #6a5038; }
.blurb { margin: 1em 0 1.2em; padding: 0; text-align: center; }
.blurb p { font: italic 700 1.28em/1.35 var(--display); color: #3b2618; text-wrap: balance; }
.blurb cite { display: block; margin-top: .5em; font: normal .62em/1.3 var(--sc); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #8a6a4a; }
.blurb cite::before { content: ""; display: inline-block; width: 1.6em; height: 1px; margin: 0 .6em .3em 0; background: currentColor; vertical-align: middle; }
.stars { display: flex; justify-content: center; gap: .2em; margin-bottom: .4em; color: #b48a3a; }
.stars .orn-star { width: 1.05em; }
.guide { display: flex; justify-content: space-between; padding-bottom: .4em; margin-bottom: 1em; border-bottom: 1.5px solid #3b2618; font: 700 .8em/1 var(--display); letter-spacing: .04em; color: #3b2618; }
.entry { font-size: .95em; }
.hw { line-height: 1.4; }
.hw b { font: 800 1.45em/1 var(--display); color: #3b2618; }
.pron { font-family: var(--serif); color: #6a5038; margin-left: .2em; }
.pos { color: #6E1F25; }
.senses { margin: .7em 0 0; padding-left: 1.4em; }
.senses li { margin-bottom: .45em; padding-left: .2em; }
.senses li::marker { font: 700 .9em var(--display); color: #6E1F25; }
.see { margin-top: .6em; font-style: italic; color: #4b3420; }
.entry-foot { margin-top: auto; font-size: .8em; }
.ruled { flex: 1 1 auto; margin: .2em 0 .6em; background: repeating-linear-gradient(180deg, transparent 0 1.55em, rgba(60,100,160,.28) 1.55em calc(1.55em + 1px)); }
.pencil { color: #7d7468; font-size: .86em; }

/* plates with tissue guards */
.side--plate .pg { align-items: center; }
.plate-no { font: 700 .66em/1 var(--sc); letter-spacing: .26em; text-transform: uppercase; color: #8a6a4a; margin-bottom: .9em; }
.plate { position: relative; margin: auto 0; width: 100%; }
.plate-img { position: relative; padding: .45em; background: #fbf7ec; box-shadow: 0 1px 3px rgba(60,40,20,.35), 0 0 0 1px rgba(60,40,20,.12); }
.plate-img img { display: block; width: 100%; height: auto; aspect-ratio: var(--r); object-fit: cover; }
.plate--tall .plate-img { width: 74%; margin: 0 auto; }
.plate figcaption { margin-top: .9em; text-align: center; font: italic .9em/1.4 var(--serif); color: #4b3420; }
.tissue {
  position: absolute; left: -.2em; right: -.2em; top: -.3em;
  height: calc(100% - 1.6em);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3em;
  padding: 0; border: 0; cursor: pointer;
  background: linear-gradient(180deg, rgba(250,246,236,.84), rgba(240,234,220,.8)), var(--paper-tex);
  -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px);
  box-shadow: 0 1px 2px rgba(60,40,20,.25);
  transform-origin: 0 50%;
  transition: transform .75s cubic-bezier(.3,.7,.3,1), opacity .75s;
  -webkit-tap-highlight-color: transparent;
}
.plate--tall .tissue { left: 11%; right: 11%; }
.tissue-print { font: 700 .72em/1 var(--sc); letter-spacing: .3em; text-transform: uppercase; color: #6a5038; }
.tissue-hint { font: italic .72em/1 var(--serif); color: #8a6f52; }
.tissue.is-lifted { transform: perspective(900px) rotateY(-150deg); opacity: 0; pointer-events: none; }
.sf .tissue { display: none; }

/* the letter */
.side--letter .pg { padding-top: 8%; font-size: var(--lfs, var(--pfs)); }
.prose { flex: 1 1 auto; min-height: 0; overflow: hidden; hyphens: manual; -webkit-hyphens: manual; }
.prose p { margin: 0 0 .85em; text-wrap: pretty; }
.prose .greet { font: italic 1.12em/1.4 var(--serif); color: #3b2618; margin-bottom: .9em; }
.prose .drop::first-letter {
  float: left;
  font: 800 3.25em/.8 var(--display);
  color: #6E1F25;
  padding: .07em .09em 0 0;
}
.signoff { margin-top: 1.1em; }
.signoff .so { font-style: italic; margin: 0; }
.signoff .sig { margin: .15em 0 0 .6em; font: italic 700 2.1em/1 var(--display); color: #6E1F25; }
.end-orn { width: 4.4em; margin: 1.1em auto 0; color: #b3925a; }

/* covers */
.side--cover {
  border-radius: 2px 5px 5px 2px;
  background-color: var(--leather);
  background-image:
    linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,0,0,.08) 5%, rgba(255,240,210,.06) 9%, transparent 14%, transparent 85%, rgba(0,0,0,.18)),
    radial-gradient(90% 70% at 35% 20%, rgba(255,230,190,.12), transparent 70%),
    var(--grain), var(--mottle);
  background-size: auto, auto, 130px, 300px;
  background-blend-mode: normal, normal, soft-light, multiply;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.45), inset -2px 0 3px rgba(255,230,200,.08);
  overflow: hidden;
  --gdir: 160deg;
}
.cv-frame {
  position: absolute; inset: 7% 8% 7% 11%;
  border: 1.6px solid rgba(201,165,76,.85);
  outline: 1px solid rgba(201,165,76,.55); outline-offset: -6px;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 -.5px 0 rgba(0,0,0,.5));
}
.cv-c { position: absolute; width: 13%; color: rgba(201,165,76,.9); }
.cv-c svg { display: block; width: 100%; }
.cv-c.tl { left: 6px; top: 6px; }
.cv-c.tr { right: 6px; top: 6px; transform: scaleX(-1); }
.cv-c.bl { left: 6px; bottom: 6px; transform: scaleY(-1); }
.cv-c.br { right: 6px; bottom: 6px; transform: scale(-1); }
.cv-in { text-align: center; padding: 0 10%; }
.cv-ed { font: 700 .62em/1 var(--sc); letter-spacing: .3em; text-transform: uppercase; margin-bottom: 1.2em; }
.cv-title { font: 800 1.95em/1.06 var(--display); text-wrap: balance; letter-spacing: .01em; }
.cv-sub { margin-top: .45em; font: italic 1.05em/1.3 var(--display); }
.cv-orn { width: 5em; margin: 1.2em auto; color: var(--gilt); }
.cv-by { font: 700 .74em/1 var(--sc); letter-spacing: .3em; text-transform: uppercase; }
.cover--vellum {
  background-color: #ece0c4;
  background-image:
    linear-gradient(90deg, rgba(120,90,40,.3), rgba(120,90,40,.06) 6%, transparent 14%, transparent 85%, rgba(120,90,40,.15)),
    radial-gradient(90% 70% at 35% 20%, rgba(255,255,255,.35), transparent 70%),
    var(--paper-tex), var(--mottle);
  background-size: auto, auto, 220px, 300px;
  background-blend-mode: normal, normal, multiply, soft-light;
}
.cover--vellum .cv-frame { border-color: rgba(110,31,37,.75); outline-color: rgba(201,165,76,.7); filter: none; }
.cover--vellum .cv-c { color: rgba(110,31,37,.7); }
.cover--vellum .cv-title, .cover--vellum .cv-by, .cover--vellum .cv-ed { background: none; color: #6E1F25; -webkit-text-fill-color: #6E1F25; }
.cover--vellum .cv-orn { color: #b08a3e; }
.cv-ribbon {
  position: absolute; left: 62%; bottom: -1px; width: 12px; height: 9%;
  background: linear-gradient(90deg, rgba(0,0,0,.3), transparent 40%, rgba(255,255,255,.2) 55%, rgba(0,0,0,.25)), var(--ribbon);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}

/* endpapers */
.side--end {
  background-color: var(--leather);
  background-image: var(--grain);
  background-size: 130px;
  background-blend-mode: soft-light;
  border-radius: 5px 2px 2px 5px;
}
.end--back { border-radius: 2px 5px 5px 2px; }
.end-paper {
  position: absolute; top: 4%; bottom: 4%; left: 5%; right: 1%;
  background-color: #6a3b2a;
  background-image: linear-gradient(90deg, transparent 90%, rgba(0,0,0,.25)), var(--marble);
  background-size: auto, cover;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25), inset 0 0 12px rgba(0,0,0,.25);
}
.end--back .end-paper { left: 1%; right: 5%; background-image: linear-gradient(270deg, transparent 90%, rgba(0,0,0,.25)), var(--marble); background-position: 0 0, 60% 30%; }
.bookplate {
  position: absolute; left: 50%; top: 50%;
  width: 62%;
  transform: translate(-50%, -50%) rotate(-1deg);
  padding: .5em;
  color: #6E1F25;
  background: #f6eedb;
  background-image: var(--paper-tex);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  text-align: center;
  font-size: var(--pfs);
}
.bp-in { padding: .9em .6em 1em; border: 1px solid #6E1F25; outline: 1px solid rgba(110,31,37,.4); outline-offset: -4px; }
.bp-ex { font: 700 .62em/1 var(--sc); letter-spacing: .3em; text-transform: uppercase; }
.bookplate .orn-lamp { display: block; width: 2.4em; margin: .5em auto .3em; }
.bp-name { font: italic 800 1.7em/1 var(--display); color: #4a1418; }
.bp-note { margin-top: .4em; font: italic .7em/1.2 var(--serif); color: #6a5038; }
.colophon {
  position: absolute; left: 50%; top: 50%;
  width: 66%;
  transform: translate(-50%, -50%);
  padding: 1.1em 1em 1em;
  color: var(--ink);
  background: #f6eedb;
  background-image: var(--paper-tex);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  text-align: center;
  font-size: calc(var(--pfs) * .92);
  line-height: 1.5;
}
.col-h { font: 700 .66em/1 var(--sc); letter-spacing: .3em; text-transform: uppercase; color: #6E1F25; margin-bottom: .6em; }
.col-small { margin-top: .6em; font: italic .74em/1.4 var(--serif); color: #6a5038; }
.colophon .orn-lamp { display: block; width: 1.8em; margin: .7em auto 0; color: #6E1F25; }

/* the library pocket in the back of the letter */
.pocket { position: absolute; left: 9%; right: 9%; bottom: 6%; height: 74%; font-size: var(--pfs); }
.pocket-card {
  position: absolute; left: 6%; right: 6%; top: 0; height: 88%;
  padding: .8em .9em;
  color: #3a2a1c;
  background-color: #efe0bc;
  background-image: var(--paper-tex);
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(0,0,0,.35);
  cursor: pointer;
  transition: transform .5s cubic-bezier(.3,1.2,.5,1);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.pocket.is-up .pocket-card { transform: translateY(-22%) rotate(-2.5deg); }
.pocket-card.jolt { animation: joltSmall .3s ease-out; }
@keyframes joltSmall { 30% { translate: 0 2px; } }
.pc-head { display: flex; justify-content: space-between; padding-bottom: .3em; border-bottom: 1.5px solid #8e2a22; font: 700 .56em/1.2 var(--sc); letter-spacing: .16em; text-transform: uppercase; color: #8e2a22; }
.pc-title { margin: .4em 0 .3em; font: italic 800 1.05em/1.1 var(--display); color: #3b2618; }
.pc-fine { display: flex; flex-direction: column; margin: .2em 0 .5em; padding: .3em 0 .45em; border-bottom: 1.5px solid #8e2a22; }
.pc-fine span { font: 700 .55em/1.2 var(--sc); letter-spacing: .16em; text-transform: uppercase; color: #8e2a22; }
.pc-fine b { font: 900 2.1em/1 var(--display); color: #6E1F25; }
.pc-fine em { font: italic .78em/1.35 var(--serif); }
.pc-due { position: relative; }
.pc-row { display: flex; gap: .6em; align-items: baseline; padding: .15em 0; border-bottom: 1px solid rgba(142,42,34,.3); font-size: .8em; }
.pc-row > span:not(.imp) { flex: none; width: 7.8em; font: 700 .68em/1.2 var(--sc); letter-spacing: .14em; text-transform: uppercase; color: #8e2a22; }
.pc-row b { font: italic 400 1em/1.3 var(--serif); color: var(--blue-ink); }
.pc-date { color: rgba(76,46,128,.9) !important; font-style: normal !important; font-weight: 700 !important; letter-spacing: .08em; }
.pocket .imp-in { font-size: .98em; }
.pocket .imp--big .imp-in { font-size: 1.3em; }
.pocket .pc-due .imp-in { font-size: 1.6em; }
.imp.is-gone { opacity: 0; transition: opacity .18s; }
.pocket-front {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  padding: 1.5em .8em .6em;
  text-align: center;
  color: #4b3420;
  background-color: #dcc595;
  background-image: linear-gradient(180deg, rgba(255,255,255,.2), transparent 40%), var(--paper-tex);
  clip-path: polygon(0 0, 38% 0, 50% 16%, 62% 0, 100% 0, 100% 100%, 0 100%);
  box-shadow: 0 -2px 6px rgba(0,0,0,.25);
  filter: drop-shadow(0 -2px 3px rgba(0,0,0,.25));
  pointer-events: none;
}
.pf-1 { font: 700 .7em/1.2 var(--sc); letter-spacing: .24em; text-transform: uppercase; color: #6E1F25; }
.pf-2 { margin-top: .4em; font: .66em/1.35 var(--serif); }
.pf-3 { font: italic .66em/1.35 var(--serif); color: #6a5038; }

/* ---------- the flying book ---------- */
.fly-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; perspective: 1700px; }
.fly-box { position: absolute; transform-style: preserve-3d; font-size: max(16px, min(18px, calc(var(--W) * .047))); --pfs: max(16px, min(18px, calc(var(--W) * .047))); }
.fb { position: absolute; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.fb-front { left: 0; top: 0; width: var(--W); height: var(--H); transform: translateZ(calc(var(--D) / 2)); }
.fb-back { left: 0; top: 0; width: var(--W); height: var(--H); transform: rotateY(180deg) translateZ(calc(var(--D) / 2)); background-color: var(--leather); background-image: var(--grain); background-size: 130px; background-blend-mode: soft-light; }
.fb-spine { top: 0; height: var(--H); width: var(--D); left: calc((var(--W) - var(--D)) / 2); transform: rotateY(-90deg) translateZ(calc(var(--W) / 2)); overflow: hidden; }
.fb-spine-in { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fb-spine .spine { cursor: default; }
.fb-fore { top: 2%; height: 96%; width: var(--D); left: calc((var(--W) - var(--D)) / 2); transform: rotateY(90deg) translateZ(calc(var(--W) / 2 - 4px)); background: repeating-linear-gradient(90deg, #efe4cb 0 1px, #d6c6a2 1px 2px); }
.fb-top { left: 0; width: calc(var(--W) - 4px); height: var(--D); top: calc((var(--H) - var(--D)) / 2); transform: rotateX(90deg) translateZ(calc(var(--H) / 2 - 3px)); background: linear-gradient(180deg, var(--leather) 0 3px, transparent 3px calc(100% - 3px), var(--leather) calc(100% - 3px)), repeating-linear-gradient(180deg, #efe4cb 0 1px, #d6c6a2 1px 2px); }
.fb-bot { left: 0; width: calc(var(--W) - 4px); height: var(--D); top: calc((var(--H) - var(--D)) / 2); transform: rotateX(-90deg) translateZ(calc(var(--H) / 2 - 3px)); background: #cdbb94; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 60px 14px 30px; opacity: 0; transition: opacity .25s; }
.lightbox.is-on { opacity: 1; }
.lightbox[hidden] { display: none; }
.lb-bg { position: absolute; inset: 0; background: rgba(8,14,10,.92); }
.lb-frame { position: relative; margin: 0; max-width: min(1100px, 100%); text-align: center; }
.lb-frame img { display: block; max-width: 100%; max-height: calc(100svh - 160px); width: auto; height: auto; margin: 0 auto; box-shadow: 0 0 0 8px #e9cf7f, 0 0 0 10px #6d4c19, 0 30px 60px rgba(0,0,0,.7); }
.lb-cap { margin-top: 22px; font: italic 16px/1.4 var(--serif); color: #efe3c8; }
.lb-close { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; min-height: 44px; padding: 8px 16px; border: 1px solid rgba(201,165,76,.6); border-radius: 6px; background: rgba(20,30,24,.8); color: var(--gilt-hi); font: 700 15px/1 var(--display); cursor: pointer; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 95;
  width: max-content;
  max-width: min(92vw, 380px);
  padding: 12px 18px;
  color: var(--ink);
  background-color: #f6eedb;
  background-image: var(--paper-tex);
  border-left: 4px solid #8e2a22;
  box-shadow: 0 14px 30px rgba(0,0,0,.5);
  font: italic 15.5px/1.45 var(--serif);
  transform: translate(-50%, 160%) rotate(-1deg);
  transition: transform .45s cubic-bezier(.3,1.3,.5,1), visibility 0s .45s;
  pointer-events: none;
  visibility: hidden;
}
.toast.is-on { transform: translate(-50%, 0) rotate(-1deg); visibility: visible; transition-delay: 0s; }

/* =========================================================
   WIDER SCREENS
   ========================================================= */
@media (min-width: 560px) {
  .shelf-row { gap: 3px; }
  .call-slip { max-width: 300px; }
  .lamp { width: 150px; }
}
@media (min-width: 900px) {
  :root { --k: 1.18; }
  .room { padding-top: 26px; }
  .eyebrow { font-size: 13px; }
  .frieze { margin-top: 10px; }
  .fr-name { font-size: 104px; display: inline; }
  .fr-the { display: inline; font-size: 32px; margin-right: .3em; vertical-align: .9em; }
  .fr-coll { display: block; margin-top: 6px; font-size: 22px; }
  .lede { margin-top: 10px; max-width: none; }
  .bookcase { width: min(1080px, calc(100% - 80px)); margin: 20px auto 0; }
  .case-cornice { height: 22px; margin: 0 -26px; border-radius: 3px 3px 0 0; }
  .shelf-wrap::before, .shelf-wrap::after { /* the bookcase uprights */
    content: ""; position: absolute; top: 0; bottom: 64px; width: 24px; z-index: 3;
    background-color: var(--walnut);
    background-image: linear-gradient(90deg, #22150c, #5a3a22 30%, #3b2618 70%, #1a0f08), var(--wood);
    background-blend-mode: normal, multiply;
    box-shadow: 0 0 16px rgba(0,0,0,.6);
  }
  .shelf-wrap::before { left: -24px; }
  .shelf-wrap::after { right: -24px; }
  .shelf-fade { display: none; }
  .sh-swipe { display: none; }
  .desk { gap: 40px; padding-bottom: 40px; margin-top: -10px; }
  .desk-top { height: 160px; }
  .lamp { width: 200px; margin-right: 0; }
  .call-slip { max-width: 330px; padding: 18px 22px 14px; }
  .cs-title { font-size: 26px; }
  .cs-actions .btn { width: auto; }
  .cs-actions .btn-link { margin: 0; }
  .bay { padding: 100px 40px 110px; }
  .gallery { grid-template-columns: 1.15fr 1fr .78fr; align-items: center; gap: 60px 46px; }
  .frame, .frame--tall { width: 100%; }
  .frame:nth-child(2) { margin-top: 70px; }
  .circ-desk { max-width: 620px; padding: 46px 40px 50px; }
  .stamp-tool { right: 18px; top: -30px; width: 96px; height: 128px; }
  .inkpad { left: 30px; }
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .bookcase { width: fit-content; max-width: calc(100% - 80px); }
}
@media (min-width: 1100px) {
  :root { --k: 1.12; }
  .room { display: flex; flex-direction: column; justify-content: center; padding-bottom: 2vh; }
  .room-inner {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 500px;
    column-gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 48px;
    align-items: end;
  }
  .eyebrow, .frieze, .lede { grid-column: 1 / -1; }
  .bookcase { grid-column: 1; grid-row: 4; width: auto; margin: 24px 0 0 26px; }
  .desk { grid-column: 2; grid-row: 4; margin: 0 0 0 -10px; padding: 0 16px 40px; justify-content: flex-start; gap: 18px; }
  .desk-top { height: 150px; border-radius: 4px 4px 0 0; }
  .lamp { width: 176px; margin-bottom: 26px; }
  .call-slip { max-width: 300px; margin-bottom: 30px; }
  .shelf-hint { margin-top: -10px; }
}
@media (min-width: 1380px) and (min-height: 860px) {
  :root { --k: 1.26; }
}
@media (min-width: 900px) and (max-height: 820px) {
  :root { --k: 1.02; }
  .fr-name { font-size: 84px; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .15s !important; }
  .sp-tag { animation: none; }
  .ck-pend { animation: none; }
  html.lights-up, html.flicker { animation: none; }
}
.lights-out svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
