/* ==========================================================================
   Rachel and the City - Interactive Bookshelf
   Self-contained stylesheet matching the RATC Design System & live site theme.
   Motion rule: default CSS is the finished, still state. Every animation and
   transition lives strictly inside the motion-allowed query at the bottom.
   ========================================================================== */

:root {
  /* Dark grounds (RATC Design System) */
  --ground-black: #0E080D;
  --ink-plum:     #1B0F19;
  --night-plum:   #2D192D;
  --wine:         #581D27;
  --mulberry:     #73363A;
  --slate-teal:   #3A585E;
  --dark-red:     #700404;

  /* Woodwork tones derived from RATC dark grounds */
  --wood-recess:  #120910;
  --wood-plank:   #3B1C22;
  --wood-edge:    #4A2329;
  --wood-lip:     #653137;
  --wood-shadow:  #090408;

  /* Type & rule colors (ivory #F8F5F0 is never a type color) */
  --bone:         #E8C392;
  --cream:        #F7D8A5;
  --paper-page:   #F5D7A8;
  --paper-shade:  #E6C08B;
  --paper-ink:    #1B0F19;
  --paper-muted:  #4B3745;

  /* Accents & objects */
  --mustard:      #D98C42;
  --lift-purple:  #A77FA0;
  --lift-teal:    #7FA8AD;
  --lift-rust:    #C4674A;
  --heart-red:    #983733;
  --dusk-violet:  #4B3745;
  --ivory-stroke: #F8F5F0;

  /* Fonts */
  --font-display: "Anton", Impact, "Arial Black", sans-serif;
  --font-body:    "Archivo Narrow", "Roboto Condensed", -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Layout & type scale (phone-first readable) */
  --max-wall:     1240px;
  --gutter:       clamp(16px, 4vw, 40px);
  --fs-body:      clamp(1.125rem, 1.06rem + 0.3vw, 1.25rem);
  --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);

  /* RATC Memphis mottled dark wall background */
  --wall-bg:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.91 0 0 0 0 0.76 0 0 0 0 0.57 0 0 0 .55 -.28'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E") 0 0 / 220px 220px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'%3E%3Cg fill='%23A77FA0' opacity='.22'%3E%3Crect x='34' y='44' width='20' height='5'/%3E%3Crect x='41.5' y='36.5' width='5' height='20'/%3E%3C/g%3E%3Cg fill='%237FA8AD' opacity='.2'%3E%3Crect x='310' y='60' width='4' height='4'/%3E%3Crect x='322' y='60' width='4' height='4'/%3E%3Crect x='334' y='60' width='4' height='4'/%3E%3Crect x='310' y='72' width='4' height='4'/%3E%3Crect x='322' y='72' width='4' height='4'/%3E%3Crect x='334' y='72' width='4' height='4'/%3E%3C/g%3E%3Cpolyline points='150,320 160,311 170,320 180,311 190,320' fill='none' stroke='%23983733' stroke-width='3.5' opacity='.26'/%3E%3Cpolygon points='355,260 367,281 343,281' fill='%237FA8AD' opacity='.18'/%3E%3C/svg%3E") 0 0 / 420px 420px,
    radial-gradient(ellipse 75% 55% at 25% 18%, rgba(88, 29, 39, 0.48), transparent 70%),
    radial-gradient(ellipse 70% 60% at 82% 72%, rgba(58, 88, 94, 0.34), transparent 70%),
    var(--ink-plum);

  /* Woodgrain SVG pattern for shelves */
  --wood-grain:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='64' viewBox='0 0 320 64'%3E%3Cg fill='none' stroke='%231B0F19' stroke-opacity='.38' stroke-width='1.4'%3E%3Cpath d='M0 11 Q 85 6, 170 12 T 320 10'/%3E%3Cpath d='M0 24 Q 110 29, 210 22 T 320 25'/%3E%3Cpath d='M0 39 Q 70 35, 160 41 T 320 37'/%3E%3Cpath d='M0 53 Q 130 58, 240 50 T 320 54'/%3E%3C/g%3E%3Cg fill='none' stroke='%23E8C392' stroke-opacity='.07' stroke-width='1'%3E%3Cpath d='M0 17 Q 95 14, 190 18 T 320 16'/%3E%3Cpath d='M0 46 Q 105 43, 215 47 T 320 45'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 320px 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background-color: var(--ink-plum);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100dvh;
  max-width: 100%;
  background: var(--wall-bg);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  overflow-x: clip;
}

body.has-open-book {
  overflow: hidden;
}

/* Focus ring - never removed anywhere */
:focus-visible {
  outline: 3px solid var(--bone);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--mustard);
  color: var(--ink-plum);
  font: 700 1rem/1 var(--font-body);
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
}

/* ---------- 1. Site Bar & Still Switch ---------- */
.site-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(27, 15, 25, 0.96);
  border-bottom: 3px solid var(--bone);
}

.site-bar__inner {
  max-width: var(--max-wall);
  margin: 0 auto;
  padding: 10px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--bone);
  text-decoration: none;
}

.brand-link__logo {
  height: 36px;
  width: auto;
  display: block;
}

.brand-link__tag {
  font: 600 0.75rem/1.1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream);
  padding-left: 12px;
  border-left: 2px solid var(--dusk-violet);
}

.bar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.still-toggle {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--night-plum);
  color: var(--cream);
  border: 2px solid var(--bone);
  font: 600 0.8125rem/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.still-toggle:hover {
  background: var(--dusk-violet);
}

.still-toggle[aria-pressed="true"] {
  background: var(--bone);
  color: var(--ink-plum);
}

.still-toggle svg {
  width: 18px;
  height: 12px;
  flex: none;
}

.still-toggle__flat {
  display: none;
}

.still-toggle[aria-pressed="true"] .still-toggle__wave {
  display: none;
}

.still-toggle[aria-pressed="true"] .still-toggle__flat {
  display: block;
}

/* ---------- 2. Hero & Shelf Jump Bar ---------- */
.wall-intro {
  max-width: var(--max-wall);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 44px) var(--gutter) 20px;
}

.kicker {
  margin: 0 0 8px;
  font: 600 0.8125rem/1.2 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lift-teal);
}

.wall-headline {
  margin: 0 0 14px;
  font: 400 clamp(2.4rem, 6vw, 4.4rem)/0.96 var(--font-display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--bone);
  text-shadow: 3px 3px 0 var(--ground-black);
  max-width: 18ch;
}

.wall-headline__punch {
  color: var(--lift-teal);
}

.wall-lede {
  margin: 0 0 14px;
  max-width: 60ch;
  font-size: var(--fs-body);
  color: var(--cream);
}

.wall-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 12px;
}

.disclose-note {
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--dusk-violet);
  background: rgba(14, 8, 13, 0.65);
  font: 500 0.875rem/1.35 var(--font-body);
  color: var(--cream);
}

.wall-count-note {
  margin: 0;
  font: 600 0.8125rem/1.3 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone);
}

/* Shelf jump, search, & filter strip */
.shelf-nav {
  max-width: var(--max-wall);
  margin: 0 auto;
  padding: 8px var(--gutter) 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shelf-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 280px;
  max-width: 440px;
}

.search-box__input {
  width: 100%;
  min-height: 44px;
  padding: 0 74px 0 14px;
  background: var(--ground-black);
  color: var(--cream);
  border: 2px solid var(--bone);
  font: 600 1.05rem/1.2 var(--font-body);
  border-radius: 0;
  appearance: none;
}

.search-box__input::placeholder {
  color: rgba(247, 216, 165, 0.62);
}

.search-box__clear {
  position: absolute;
  right: 6px;
  min-height: 32px;
  padding: 0 10px;
  background: var(--night-plum);
  color: var(--bone);
  border: 1px solid var(--bone);
  font: 600 0.75rem/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.shelf-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.shelf-jump {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--night-plum);
  color: var(--cream);
  border: 2px solid var(--dusk-violet);
  font: 700 0.95rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}

.shelf-jump:hover {
  border-color: var(--bone);
  color: var(--bone);
}

.shelf-jump[aria-pressed="true"] {
  background: var(--bone);
  border-color: var(--bone);
  color: var(--ink-plum);
}

.shelf-jump__count {
  font: 600 0.75rem/1 var(--font-mono);
  opacity: 0.85;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- 3. The Tall Wooden Bookcase Wall ---------- */
.bookcase-wrap {
  max-width: var(--max-wall);
  margin: 0 auto 64px;
  padding: 0 var(--gutter);
}

.bookcase {
  background: var(--wood-recess);
  border: 4px solid var(--bone);
  box-shadow: 10px 10px 0 var(--wood-shadow);
  position: relative;
}

/* Top carved cornice of the bookcase */
.bookcase__crown {
  height: 22px;
  background: var(--wood-grain), linear-gradient(180deg, var(--wood-lip) 0%, var(--wood-plank) 65%, var(--wood-shadow) 100%);
  border-bottom: 2px solid var(--bone);
}

.shelf-unit {
  position: relative;
  border-bottom: 4px solid var(--wood-shadow);
}

/* Recessed interior bay behind the books */
.shelf-bay {
  position: relative;
  background:
    linear-gradient(180deg, rgba(9, 4, 8, 0.82) 0%, rgba(18, 9, 16, 0.35) 26%, rgba(18, 9, 16, 0.2) 82%, rgba(9, 4, 8, 0.78) 100%),
    var(--wall-bg);
  padding: 28px 0 0;
}

/* Side-to-side scroll controls mounted on the wooden shelf ledge for mouse users */
.shelf-ledge__right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.shelf-ledge__arrows {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.shelf-ledge__arrows[hidden] {
  display: none;
}

.shelf-scroll-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--ink-plum);
  color: var(--bone);
  border: 2px solid var(--bone);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--wood-shadow);
}

.shelf-scroll-btn:hover:not([disabled]) {
  background: var(--bone);
  color: var(--ink-plum);
}

.shelf-scroll-btn[disabled] {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}

.shelf-scroll-btn svg {
  width: 18px;
  height: 18px;
}

/* Horizontal scrolling track on each shelf */
.shelf-track {
  display: flex;
  align-items: flex-end;
  gap: clamp(22px, 3.2vw, 38px);
  overflow-x: auto;
  padding: 22px clamp(24px, 4.5vw, 52px) 0;
  scroll-padding-inline: clamp(24px, 4.5vw, 52px);
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--dusk-violet) var(--wood-recess);
}

.shelf-track::-webkit-scrollbar {
  height: 8px;
}

.shelf-track::-webkit-scrollbar-track {
  background: var(--wood-recess);
}

.shelf-track::-webkit-scrollbar-thumb {
  background: var(--dusk-violet);
}

/* Individual book sitting on the wooden plank */
.shelf-book {
  flex: 0 0 auto;
  width: clamp(148px, 20vw, 192px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cream);
  text-align: left;
  cursor: pointer;
  position: relative;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.shelf-book[hidden] {
  display: none;
}

/* Physical 3D standing book wrapper */
.shelf-book__object {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--night-plum);
  border: 3px solid var(--bone);
  /* Hard screenprint shadow + left spine edge */
  box-shadow:
    -6px 4px 0 var(--wine),
    -8px 4px 0 var(--bone),
    8px 6px 0 rgba(9, 4, 8, 0.85);
}

/* Top paper block edge hint */
.shelf-book__object::before {
  content: "";
  position: absolute;
  top: -7px;
  left: -5px;
  right: 3px;
  height: 5px;
  background: var(--paper-shade);
  border-top: 2px solid var(--bone);
  border-left: 2px solid var(--bone);
  transform: skewX(-35deg);
}

.shelf-book__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--night-plum);
}

/* Badges on shelf books: "New on the shelf" glow + "Free full book" stamp */
.shelf-book--new .shelf-book__object {
  border-color: var(--mustard);
  box-shadow:
    -6px 4px 0 var(--wine),
    -8px 4px 0 var(--mustard),
    0 0 0 3px rgba(217, 140, 66, 0.35),
    0 -6px 24px rgba(217, 140, 66, 0.55),
    8px 6px 0 rgba(9, 4, 8, 0.85);
}

.book-flag {
  position: absolute;
  z-index: 3;
  font: 700 0.6875rem/1.1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 8px;
  pointer-events: none;
}

.book-flag--new {
  top: -14px;
  right: -8px;
  background: var(--mustard);
  color: var(--ink-plum);
  border: 2px solid var(--ink-plum);
  box-shadow: 3px 3px 0 var(--wood-shadow);
}

.book-flag--free {
  bottom: 8px;
  left: 8px;
  background: var(--ink-plum);
  color: var(--lift-teal);
  border: 2px solid var(--lift-teal);
}

/* Title & author plaque below/on hover for quick scanning & accessibility */
.shelf-book__caption {
  width: 100%;
  padding: 10px 4px 12px;
}

.shelf-book__title {
  display: block;
  font: 700 1rem/1.2 var(--font-body);
  color: var(--bone);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shelf-book__author {
  display: block;
  margin-top: 3px;
  font: 500 0.8125rem/1.25 var(--font-mono);
  color: var(--cream);
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Wooden bookend plaque at the end of each shelf track */
.shelf-endcard {
  flex: 0 0 auto;
  width: 220px;
  min-height: 210px;
  margin-bottom: 14px;
  padding: 18px 16px;
  background: rgba(27, 15, 25, 0.9);
  border: 2px dashed var(--dusk-violet);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  color: var(--cream);
}

.shelf-endcard__kicker {
  font: 600 0.75rem/1.2 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lift-purple);
}

.shelf-endcard__text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--cream);
}

/* Front wooden shelf plank with painted shelf name */
.shelf-ledge {
  position: relative;
  z-index: 4;
  min-height: 58px;
  padding: 10px clamp(18px, 4vw, 48px);
  background:
    var(--wood-grain),
    linear-gradient(180deg, var(--wood-lip) 0%, var(--wood-edge) 16%, var(--wood-plank) 84%, #220E13 100%);
  border-top: 3px solid var(--bone);
  border-bottom: 3px solid #16080C;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Painted shelf label on the wooden shelf front edge */
.shelf-ledge__name {
  margin: 0;
  font: 400 clamp(1.35rem, 2.6vw, 1.95rem)/1 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bone);
  text-shadow: 2px 2px 0 var(--wood-shadow);
}

.shelf-ledge__meta {
  font: 600 0.75rem/1.3 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream);
}

.empty-filter-msg {
  padding: 36px 24px;
  text-align: center;
  font-size: 1.15rem;
  color: var(--cream);
}

/* ---------- 4. The Open Two-Page Book Modal ---------- */
.book-stage {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.5vw, 28px);
  background: rgba(14, 8, 13, 0.94);
}

.book-stage[hidden] {
  display: none;
}

.open-book-shell {
  position: relative;
  width: min(1080px, 100%);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  perspective: 1800px;
}

/* Top bar above the open book */
.open-book__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.open-book__shelf-tag {
  font: 600 0.78rem/1.2 var(--font-mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bone);
  background: var(--night-plum);
  border: 2px solid var(--dusk-violet);
  padding: 7px 12px;
}

.close-book-btn {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--night-plum);
  color: var(--bone);
  border: 2px solid var(--bone);
  font: 700 0.875rem/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.close-book-btn:hover {
  background: var(--bone);
  color: var(--ink-plum);
}

.close-book-btn svg {
  width: 16px;
  height: 16px;
}

/* Clothbound outer hardcover casing */
.open-book {
  position: relative;
  background: var(--wine);
  border: 4px solid var(--bone);
  padding: clamp(8px, 1.4vw, 16px);
  box-shadow: 12px 12px 0 var(--ground-black);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform-origin: center center;
}

/* Two-page paper spread inside hardcover */
.book-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper-page);
  color: var(--paper-ink);
  border: 2px solid var(--paper-ink);
  box-shadow:
    inset 0 0 0 3px var(--paper-shade),
    4px 0 0 var(--paper-shade),
    -4px 0 0 var(--paper-shade);
  position: relative;
}

/* Central book spine crease on desktop */
.book-spread::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 24px;
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    rgba(27, 15, 25, 0) 0%,
    rgba(27, 15, 25, 0.18) 46%,
    rgba(27, 15, 25, 0.34) 50%,
    rgba(27, 15, 25, 0.18) 54%,
    rgba(27, 15, 25, 0) 100%
  );
  pointer-events: none;
}

.book-page {
  padding: clamp(20px, 3vw, 36px);
  display: flex;
  flex-direction: column;
  min-height: 490px;
  position: relative;
}

.book-page--left {
  border-right: 1px solid rgba(27, 15, 25, 0.25);
  cursor: pointer;
}

.book-page--left:hover .expand-hint {
  background: var(--paper-ink);
  color: var(--bone);
}

.book-page--left:focus-visible {
  outline: 3px solid var(--dark-red);
  outline-offset: -6px;
}

.page-running-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--paper-ink);
  font: 700 0.75rem/1.2 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

.book-page__title {
  margin: 0 0 6px;
  font: 400 clamp(1.6rem, 2.8vw, 2.25rem)/1.02 var(--font-display);
  text-transform: uppercase;
  color: var(--paper-ink);
}

.book-page__author {
  margin: 0 0 16px;
  font: 700 1.05rem/1.3 var(--font-body);
  color: var(--dark-red);
}

/* Rachel's approved take callout on a bone/cream page */
.rachel-take {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: rgba(232, 195, 146, 0.55);
  border-left: 5px solid var(--dark-red);
}

.rachel-take__label {
  display: block;
  margin-bottom: 4px;
  font: 700 0.72rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dark-red);
}

.rachel-take__quote {
  margin: 0;
  font: 700 1.125rem/1.35 var(--font-body);
  color: var(--paper-ink);
}

/* Summary preview on Left Page */
.summary-preview {
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.15rem);
  line-height: 1.55;
  color: var(--paper-ink);
  display: -webkit-box;
  -webkit-line-clamp: 9;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 18px;
}

.summary-preview p {
  margin: 0 0 12px;
}

.expand-hint {
  margin-top: auto;
  align-self: flex-start;
  min-height: 42px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--paper-ink);
  background: transparent;
  color: var(--paper-ink);
  font: 700 0.8125rem/1.1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Right Page: The Book Itself */
.right-page-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.right-cover-card {
  width: min(190px, 58%);
  border: 3px solid var(--paper-ink);
  box-shadow: 6px 6px 0 var(--paper-ink);
  background: var(--night-plum);
}

.right-cover-card img {
  width: 100%;
  height: auto;
  display: block;
}

.book-page--right.is-free-tap {
  cursor: pointer;
}

.book-page--right.is-free-tap:hover .btn--paper-primary {
  background: var(--wine);
  color: var(--cream);
}

.book-page--right.is-free-tap:focus-visible {
  outline: 3px solid var(--dark-red);
  outline-offset: -6px;
}

.right-status-note {
  margin: 0;
  max-width: 34ch;
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--paper-ink);
}

.right-actions {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  min-height: 48px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 700 1.0625rem/1.15 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  border: 2px solid var(--paper-ink);
}

.btn--mustard {
  background: var(--mustard);
  color: var(--ink-plum);
  box-shadow: 4px 4px 0 var(--paper-ink);
}

.btn--mustard:hover {
  background: #e3984e;
}

.btn--paper-primary {
  background: var(--paper-ink);
  color: var(--bone);
  box-shadow: 4px 4px 0 var(--mulberry);
}

.btn--paper-secondary {
  background: transparent;
  color: var(--paper-ink);
}

.btn--paper-secondary:hover {
  background: rgba(27, 15, 25, 0.08);
}

.right-affiliate-note {
  margin: 2px 0 0;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--paper-muted);
}

/* ---------- 5. Full-Size Summary View & Full-Book Reader Overlay ---------- */
.reader-sheet {
  background: var(--paper-page);
  color: var(--paper-ink);
  border: 2px solid var(--paper-ink);
  padding: clamp(18px, 3.5vw, 42px);
  min-height: 490px;
  display: flex;
  flex-direction: column;
}

.reader-sheet[hidden] {
  display: none;
}

.reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 3px solid var(--paper-ink);
}

.reader-back-btn {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-ink);
  color: var(--bone);
  border: 2px solid var(--paper-ink);
  font: 700 0.8125rem/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.reader-back-btn:hover {
  background: var(--wine);
  border-color: var(--wine);
}

.reader-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.reader-select {
  min-height: 42px;
  max-width: min(320px, 68vw);
  padding: 0 12px;
  background: #fff8ec;
  color: var(--paper-ink);
  border: 2px solid var(--paper-ink);
  font: 700 0.95rem/1.2 var(--font-body);
}

.reader-size-btn {
  min-height: 42px;
  padding: 0 12px;
  background: transparent;
  color: var(--paper-ink);
  border: 2px solid var(--paper-ink);
  font: 700 0.8125rem/1 var(--font-mono);
  cursor: pointer;
}

.reader-size-btn[aria-pressed="true"] {
  background: var(--paper-ink);
  color: var(--bone);
}

.reader-prose {
  max-width: 64ch;
  width: 100%;
  margin: 0 auto;
  font-size: clamp(1.15rem, 1.08rem + 0.35vw, 1.28rem);
  line-height: 1.65;
  color: var(--paper-ink);
}

.reader-prose.is-large-text {
  font-size: clamp(1.32rem, 1.24rem + 0.4vw, 1.5rem);
  line-height: 1.7;
}

.reader-prose h2 {
  font: 400 clamp(1.65rem, 3vw, 2.3rem)/1.06 var(--font-display);
  text-transform: uppercase;
  margin: 0 0 16px;
  color: var(--paper-ink);
}

.reader-prose h3 {
  font: 700 1.25rem/1.3 var(--font-body);
  margin: 24px 0 10px;
  color: var(--dark-red);
}

.reader-prose p {
  margin: 0 0 16px;
}

.reader-prose blockquote {
  margin: 18px 0;
  padding: 10px 18px;
  border-left: 4px solid var(--dark-red);
  background: rgba(232, 195, 146, 0.4);
}

.reader-prose pre {
  overflow-x: auto;
  padding: 12px;
  background: rgba(27, 15, 25, 0.06);
  font: 0.9rem/1.45 var(--font-mono);
}

.reader-fig {
  margin: 20px 0;
  text-align: center;
}

.reader-fig img {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--paper-ink);
}

.reader-pager {
  max-width: 64ch;
  width: 100%;
  margin: 28px auto 0;
  padding-top: 18px;
  border-top: 2px solid var(--paper-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reader-pager__status {
  font: 600 0.8125rem/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-muted);
  text-align: center;
}

/* ---------- 6. Footer with RATC Logo Plaque ---------- */
.wall-footer {
  border-top: 4px solid var(--bone);
  background: var(--ground-black);
  padding: 28px var(--gutter) 40px;
}

.wall-footer__inner {
  max-width: var(--max-wall);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.wall-footer__copy {
  margin: 0;
  font-size: 0.95rem;
  color: var(--cream);
  max-width: 58ch;
}

.logo-plaque {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--ink-plum);
  border-radius: 12px;
}

.logo-plaque img {
  height: 30px;
  width: auto;
  display: block;
}

/* ---------- 7. Phone-First Responsive Layout ---------- */
@media (max-width: 799px) {
  .brand-link__tag {
    display: none;
  }

  .search-box {
    max-width: 100%;
    flex-basis: 100%;
  }

  .shelf-jumps {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .shelf-jumps .shelf-jump {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .bookcase {
    box-shadow: 6px 6px 0 var(--wood-shadow);
  }

  .shelf-ledge__arrows {
    display: none;
  }

  .shelf-ledge__right {
    width: 100%;
    flex-shrink: 1;
  }

  .shelf-track {
    padding-inline: 18px;
    scroll-padding-inline: 18px;
    gap: 18px;
  }

  .shelf-book {
    width: 146px;
  }

  .shelf-ledge {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 18px;
  }

  .book-stage {
    padding: 0;
    align-items: stretch;
  }

  .open-book-shell {
    max-height: 100dvh;
    height: 100dvh;
    padding: 10px 10px 14px;
  }

  .open-book {
    flex: 1;
    border-width: 3px;
    box-shadow: none;
  }

  .book-spread {
    grid-template-columns: 1fr;
  }

  .book-spread::after {
    display: none;
  }

  .book-page {
    min-height: auto;
    padding: 20px 18px;
  }

  .book-page--left {
    border-right: 0;
    border-bottom: 3px dashed var(--paper-ink);
  }

  .summary-preview {
    -webkit-line-clamp: 7;
  }
}

/* ---------- 8. Motion (ONLY when OS reduced-motion is off AND Still switch is off) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="still"]) {
    scroll-behavior: smooth;
  }

  html:not([data-motion="still"]) .shelf-book__object {
    transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
  }

  @media (hover: hover) {
    html:not([data-motion="still"]) .shelf-book:hover .shelf-book__object,
    html:not([data-motion="still"]) .shelf-book:focus-visible .shelf-book__object {
      transform: translateY(-10px) rotate(-1.2deg);
    }
  }

  html:not([data-motion="still"]) .shelf-book.is-pulling .shelf-book__object {
    transform: translateY(-18px) scale(1.06);
  }

  html:not([data-motion="still"]) .shelf-book--new .shelf-book__object {
    animation: shelfNewGlow 3.2s ease-in-out infinite alternate;
  }

  html:not([data-motion="still"]) .book-stage {
    animation: stageFadeIn 200ms ease-out;
  }

  html:not([data-motion="still"]) .open-book.is-opening {
    animation: bookOpenTurn 440ms var(--ease-out);
  }

  @keyframes shelfNewGlow {
    from {
      box-shadow:
        -6px 4px 0 var(--wine),
        -8px 4px 0 var(--mustard),
        0 0 0 2px rgba(217, 140, 66, 0.3),
        0 -4px 16px rgba(217, 140, 66, 0.4),
        8px 6px 0 rgba(9, 4, 8, 0.85);
    }
    to {
      box-shadow:
        -6px 4px 0 var(--wine),
        -8px 4px 0 var(--mustard),
        0 0 0 4px rgba(232, 195, 146, 0.5),
        0 -8px 28px rgba(217, 140, 66, 0.72),
        8px 6px 0 rgba(9, 4, 8, 0.85);
    }
  }

  @keyframes stageFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  @keyframes bookOpenTurn {
    0% {
      opacity: 0;
      transform: translateY(28px) scale(0.84) rotateY(-28deg) rotateX(6deg);
    }
    60% {
      opacity: 1;
      transform: translateY(-4px) scale(1.01) rotateY(4deg) rotateX(0deg);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1) rotateY(0deg) rotateX(0deg);
    }
  }
}
