/* AI Engineering Shelf — Logan brand shell + true 3D physical bookshelf */

html,
body {
  overflow-x: hidden;
}

.lb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Hero */
.hero-section {
  margin-block: var(--lb-space-12) 0;
  padding: 0;
}

.hero-section > h1 {
  margin-bottom: var(--lb-space-4);
}

.hero-section > .hero-summary {
  margin-top: 0;
  color: var(--lb-ink);
  font-size: 1.0625rem;
}

.newsletter-name-start {
  white-space: nowrap;
}

.newsletter-mark {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  vertical-align: -0.15em;
}

.newsletter-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.newsletter-mark .newsletter-mark-dark {
  display: none;
}

[data-theme="dark"] .newsletter-mark .newsletter-mark-light {
  display: none;
}

[data-theme="dark"] .newsletter-mark .newsletter-mark-dark {
  display: block;
}

/* Shelf section & picker above the books */
.shelf-section {
  margin-block: var(--lb-space-8) var(--lb-space-12);
  padding: 0;
}

.shelf-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0;
}

.shelf-nav-controls {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--lb-border);
  background: var(--lb-surface);
}

.shelf-step-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--lb-ink);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.shelf-step-btn:hover,
.shelf-step-btn:focus-visible {
  background: var(--lb-hover);
}

.shelf-step-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shelf-counter {
  font: 500 13px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--lb-muted);
  padding: 0 14px;
  border-left: 1px solid var(--lb-border);
  border-right: 1px solid var(--lb-border);
  height: 44px;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.04em;
}

/* Full-bleed 3D Bookshelf Stage */
.shelf-stage {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  height: calc(var(--shelf-h, 430px) + 48px);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  outline: none;
}

.shelf-stage:focus-visible {
  outline: 2px solid var(--lb-ink);
  outline-offset: -4px;
}

.shelf-track {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  isolation: isolate;
}

.shelf-ledge {
  display: none;
}

/* Individual 3D Book Prism */
.shelf-book {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  will-change: transform;
  cursor: pointer;
  transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

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

.shelf-book:focus-visible .book-face--spine,
.shelf-book:focus-visible .book-face--cover {
  outline: 2px solid var(--lb-ink);
  outline-offset: 3px;
}

.book-face {
  position: absolute;
  height: var(--h);
  top: calc(var(--shelf-h, 430px) * 0.5 - var(--h));
  backface-visibility: hidden;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
}

.book-face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #000000;
  opacity: var(--shade, 0);
  pointer-events: none;
  transition: opacity 0.45s ease;
}

/* Spine Face (+Z) */
.book-face--spine {
  width: var(--ws);
  left: calc(var(--ws) * -0.5);
  transform: translateZ(calc(var(--dd) * 0.5));
  background:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.26) 0%,
      rgba(255, 255, 255, 0.16) 10%,
      rgba(0, 0, 0, 0.08) 14%,
      rgba(255, 255, 255, 0.06) 24%,
      rgba(0, 0, 0, 0) 52%,
      rgba(0, 0, 0, 0.06) 84%,
      rgba(0, 0, 0, 0.28) 100%
    ),
    var(--spine-bg);
  color: var(--spine-text);
  flex-direction: column;
  align-items: stretch;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 3px rgba(0, 0, 0, 0.2),
    0 22px 36px -14px rgba(0, 0, 0, 0.38);
}

/* Front Cover Face (+X rotated 90deg -> swings forward when book rotates -90deg!) */
.book-face--cover {
  width: var(--dd);
  left: calc(var(--dd) * -0.5);
  transform: rotateY(90deg) translateZ(calc(var(--ws) * 0.5));
  background: var(--spine-bg);
  box-shadow:
    0 32px 60px -22px rgba(10, 12, 18, 0.55),
    0 8px 18px -6px rgba(10, 12, 18, 0.25);
}

.book-face--cover-book {
  background: #ffffff;
}

.cover-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-spine-overlay {
  position: absolute;
  inset: 0 auto 0 0;
  width: 16px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0%, rgba(0, 0, 0, 0.2) 55%, rgba(0, 0, 0, 0) 100%);
}

.cover-img-framed {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Generic Spine Interior */
.spine-body {
  flex: 1;
  padding: 20px 6px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 0;
}

.spine-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 700 calc(var(--h) * 0.036) / 1.12 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: -0.01em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 6px 0;
  overflow: hidden;
}

.spine-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.spine-author {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 600 calc(var(--h) * 0.023) / 1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.8;
  white-space: nowrap;
}

/* Authentic Photo-Verified Publisher Treatments */

/* 1. Stripe Press (Hamming) — Olive cloth, gold serif, subtle S emblem at bottom */
.shelf-book--stripe .spine-body {
  padding: 24px 6px 18px;
}

.shelf-book--stripe .spine-title {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: calc(var(--h) * 0.036);
  letter-spacing: 0.015em;
  justify-content: flex-start;
  text-align: left;
  padding-top: 8px;
}

.shelf-book--stripe .spine-author {
  font-family: Georgia, "Times New Roman", serif;
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0.02em;
  font-size: calc(var(--h) * 0.024);
  opacity: 0.9;
}

.spine-stripe-emblem {
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font: 700 10px/16px Georgia, "Times New Roman", serif;
  text-align: center;
  opacity: 0.85;
}

/* 2. O'Reilly White (Hands-On ML, Designing ML Systems, AI Engineering)
   Pure white spine, NO colored top band, title top-aligned, muted author, vertical red O'REILLY® */
.shelf-book--oreilly-white .spine-body,
.shelf-book--oreilly-white-large .spine-body,
.shelf-book--oreilly-red .spine-body {
  padding: 22px 6px 16px;
}

.shelf-book--oreilly-white .spine-title,
.shelf-book--oreilly-white-large .spine-title,
.shelf-book--oreilly-red .spine-title {
  justify-content: flex-start;
  text-align: left;
  padding-top: 2px;
  font-weight: 600;
}

.shelf-book--oreilly-white .spine-title {
  font-size: calc(var(--h) * 0.034);
  line-height: 1.12;
}

.shelf-book--oreilly-white-large .spine-title {
  font-size: calc(var(--h) * 0.056);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.shelf-book--oreilly-red .spine-title {
  font-size: calc(var(--h) * 0.042);
  font-weight: 500;
  line-height: 1.1;
}

.shelf-book--oreilly-white .spine-author,
.shelf-book--oreilly-white-large .spine-author {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #6b7280;
  opacity: 1;
}

.shelf-book--oreilly-red .spine-author {
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(20, 12, 14, 0.72);
  opacity: 1;
}

.spine-oreilly-vert {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 700 calc(var(--h) * 0.028) / 1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.04em;
  color: var(--spine-accent);
  white-space: nowrap;
}

.spine-oreilly-vert sup {
  font-size: 0.55em;
}

/* 3. Packt Expert Insight (Mathematics of Machine Learning) */
.spine-packt-top {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 600 7px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.45);
  margin: 14px auto 0;
}

.shelf-book--packt .spine-body {
  padding: 12px 6px 14px;
}

.shelf-book--packt .spine-title {
  font-weight: 600;
  font-size: calc(var(--h) * 0.036);
}

.shelf-book--packt .spine-author {
  text-transform: none;
  color: #d4d4d8;
}

.spine-packt-bar {
  font: 700 10px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #e85a2a;
  letter-spacing: -0.02em;
}

/* 4. Manning (Build an LLM, Build a Reasoning Model, RLHF Book) */
.shelf-book--manning-dark .spine-body,
.shelf-book--manning-light .spine-body {
  padding: 20px 6px 14px;
}

.shelf-book--manning-dark .spine-title,
.shelf-book--manning-light .spine-title {
  font-weight: 600;
  font-size: calc(var(--h) * 0.034);
  justify-content: flex-start;
  text-align: left;
  padding-top: 4px;
}

.shelf-book--manning-dark .spine-author,
.shelf-book--manning-light .spine-author {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.shelf-book--manning-light .spine-author,
.shelf-book--manning-light .spine-manning-lockup {
  color: #2b2d33;
}

.spine-manning-lockup {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font: 700 6.5px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.manning-icon {
  width: 14px;
  height: 11px;
  fill: currentColor;
}

/* 5. Baseten (Inference Engineering — matte PCB forest green) */
.shelf-book--baseten .book-face--spine {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(210, 235, 200, 0.07) 0 1px,
      transparent 1px 14px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(210, 235, 200, 0.06) 0 1px,
      transparent 1px 12px
    ),
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.28) 0%,
      rgba(255, 255, 255, 0.1) 12%,
      rgba(0, 0, 0, 0) 45%,
      rgba(0, 0, 0, 0.3) 100%
    ),
    var(--spine-bg);
}

.shelf-book--baseten .spine-title {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: calc(var(--h) * 0.038);
  font-weight: 800;
}

.shelf-book--baseten .spine-author {
  font-size: calc(var(--h) * 0.022);
  letter-spacing: 0.08em;
}

.spine-baseten-mark {
  font: 700 7px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.12em;
  opacity: 0.72;
}

/* 6. Real Molded Black Plastic VHS Cassette (#04 3Blue1Brown) */
.shelf-book--vhs .book-face--spine {
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0.02) 14%,
      rgba(0, 0, 0, 0.08) 50%,
      rgba(0, 0, 0, 0.48) 100%
    ),
    #191b20;
  border-radius: 3px;
  padding: 8px 6px;
  justify-content: space-between;
  align-items: center;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 2px 3px rgba(255, 255, 255, 0.08),
    inset 0 -3px 4px rgba(0, 0, 0, 0.55),
    0 22px 36px -14px rgba(0, 0, 0, 0.45);
}

.vhs-shell-top,
.vhs-shell-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.vhs-notch {
  width: 16px;
  height: 5px;
  border-radius: 1px;
  background: #0a0b0e;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.1);
}

.vhs-ribs {
  width: 100%;
  height: 16px;
  border-radius: 1px;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.14) 0 1.5px,
    rgba(0, 0, 0, 0.65) 1.5px 4px
  );
}

.vhs-recess {
  flex: 1;
  width: 100%;
  margin: 8px 0;
  padding: 3px;
  border-radius: 2px;
  background: #0d0e12;
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.85),
    0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
}

.vhs-sticker {
  flex: 1;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 9px,
      rgba(62, 136, 181, 0.16) 9px 10px
    ),
    #f5f0e1;
  border-radius: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  padding-bottom: 6px;
}

.vhs-retro-bars {
  width: 100%;
  height: 14px;
  display: flex;
  flex-direction: column;
}

.vhs-retro-bars i {
  flex: 1;
  display: block;
}

.vhs-retro-bars i:nth-child(1) {
  background: #c9382b;
}

.vhs-retro-bars i:nth-child(2) {
  background: #df8f27;
}

.vhs-retro-bars i:nth-child(3) {
  background: #2f7fb0;
}

.vhs-sticker-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 3px 4px;
  gap: 6px;
}

.vhs-label-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 700 calc(var(--h) * 0.031) / 1.12 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-align: center;
  color: #161820;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vhs-label-author {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 700 calc(var(--h) * 0.021) / 1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  color: #2f7fb0;
}

.vhs-t120 {
  font: 800 8px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  color: #161820;
  border-top: 1px solid rgba(22, 24, 32, 0.22);
  padding-top: 4px;
  width: 82%;
  text-align: center;
}

.vhs-logo-box {
  font: 900 10px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-style: italic;
  letter-spacing: 0.08em;
  color: #f3f5f8;
  border: 1.5px solid rgba(243, 245, 248, 0.72);
  padding: 3px 7px;
  border-radius: 2px;
}

/* Open Face: Authentic Vertical VHS Videocassette (hinged dust door on right long edge,
   D-shaped upper & lower reel windows, adhesive label between the reels, molded rail on left) */
.book-face--cover-vhs {
  background: #17191e;
  border-radius: 5px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 2px 6px rgba(255, 255, 255, 0.06),
    0 32px 60px -22px rgba(0, 0, 0, 0.65);
}

.vhs-cassette {
  flex: 1;
  display: flex;
  flex-direction: row;
  background: linear-gradient(90deg, #1b1e24 0%, #15171c 82%, #111318 100%);
}

/* Main cassette body (left ~85%) */
.vhs-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  padding: calc(var(--h) * 0.025) calc(var(--h) * 0.02) calc(var(--h) * 0.025) calc(var(--h) * 0.015);
  gap: calc(var(--h) * 0.015);
  min-width: 0;
}

/* Left spine rail (opposite the dust door — molded grip ribs + embossed VHS / T-120) */
.vhs-spine-rail {
  width: calc(var(--h) * 0.062);
  flex: 0 0 calc(var(--h) * 0.062);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--h) * 0.016) 0;
  border-right: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.06);
}

.vhs-emboss-logo {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 900 calc(var(--h) * 0.026) / 1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-style: italic;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: calc(var(--h) * 0.012) calc(var(--h) * 0.005);
  border-radius: 2px;
}

.vhs-rail-grooves {
  width: calc(var(--h) * 0.026);
  flex: 1;
  margin: calc(var(--h) * 0.03) 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.08) 0 1.5px,
    rgba(0, 0, 0, 0.55) 1.5px 3.5px
  );
}

.vhs-emboss-spec {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 700 calc(var(--h) * 0.021) / 1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.42);
}

/* Middle column: upper D-window, center label, lower D-window */
.vhs-middle {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: calc(var(--h) * 0.02);
  min-width: 0;
}

.vhs-window {
  height: 24%;
  flex: 0 0 24%;
  background: radial-gradient(circle at 50% 50%, #090b0f 0%, #12151d 100%);
  border: 2px solid #0b0c10;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.92),
    0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Real VHS D-shaped arched windows hugging the top and bottom of the center sticker */
.vhs-window--top {
  border-radius: calc(var(--h) * 0.14) calc(var(--h) * 0.14) 5px 5px;
}

.vhs-window--bottom {
  border-radius: 5px 5px calc(var(--h) * 0.14) calc(var(--h) * 0.14);
}

.vhs-window::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.16) 0%, transparent 48%, rgba(255, 255, 255, 0.04) 100%);
  pointer-events: none;
}

.vhs-tape-pack {
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #211915 0 2px, #120d0b 2px 4px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.vhs-tape-pack--top {
  width: calc(var(--h) * 0.25);
  height: calc(var(--h) * 0.25);
}

.vhs-tape-pack--bottom {
  width: calc(var(--h) * 0.17);
  height: calc(var(--h) * 0.17);
}

.vhs-reel {
  width: calc(var(--h) * 0.095);
  height: calc(var(--h) * 0.095);
  border-radius: 50%;
  background: #eceae2;
  border: calc(var(--h) * 0.01) solid #d4d0c5;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 calc(var(--h) * 0.015) #17191e;
}

.vhs-reel i {
  position: absolute;
  width: max(2px, calc(var(--h) * 0.008));
  height: calc(var(--h) * 0.032);
  background: #eceae2;
}

.vhs-reel i:nth-child(1) {
  transform: rotate(0deg);
}

.vhs-reel i:nth-child(2) {
  transform: rotate(60deg);
}

.vhs-reel i:nth-child(3) {
  transform: rotate(120deg);
}

/* Center rectangular adhesive face label sitting snugly between the two reel windows */
.vhs-face-label {
  flex: 1;
  background: #f5f0e1;
  border-radius: 3px;
  border: 2px solid #0b0c10;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.vhs-face-bars {
  height: calc(var(--h) * 0.022);
  flex: 0 0 calc(var(--h) * 0.022);
  display: flex;
}

.vhs-face-bars i {
  flex: 1;
  display: block;
}

.vhs-face-bars i:nth-child(1) {
  background: #c9382b;
}

.vhs-face-bars i:nth-child(2) {
  background: #df8f27;
}

.vhs-face-bars i:nth-child(3) {
  background: #2f7fb0;
}

.vhs-face-art {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #0d131a;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
}

.vhs-face-text {
  padding: calc(var(--h) * 0.018) calc(var(--h) * 0.02);
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #161820;
}

.vhs-face-title {
  font: 700 calc(var(--h) * 0.029) / 1.15 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: -0.01em;
}

.vhs-face-author {
  font: 700 calc(var(--h) * 0.022) / 1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  color: #2f7fb0;
}

/* Hinged dust-flap door running vertically along the RIGHT LONG EDGE (the side inserted into a VCR!) */
.vhs-door {
  width: calc(var(--h) * 0.076);
  flex: 0 0 calc(var(--h) * 0.076);
  background: linear-gradient(90deg, #252932 0%, #1d2028 65%, #161920 100%);
  border-left: 2px solid #08090c;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--h) * 0.03) 0;
}

.vhs-door-hinge {
  width: calc(var(--h) * 0.036);
  height: calc(var(--h) * 0.026);
  border-radius: 1px;
  background: #0d0f14;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.1);
}

.vhs-door-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 700 calc(var(--h) * 0.018) / 1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.44);
  white-space: nowrap;
}

/* 7. arXiv-Style Printed Web Monograph (#12 How to Scale Your Model) */
.shelf-book--arxiv .book-face--spine {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.04) 0 1px,
      transparent 1px 4px
    ),
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.16) 0%,
      rgba(255, 255, 255, 0.25) 14%,
      rgba(0, 0, 0, 0) 48%,
      rgba(0, 0, 0, 0.18) 100%
    ),
    #faf9f5;
  color: #18181b;
  border-radius: 1px;
  position: relative;
}

.arxiv-staple {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 16px;
  border-radius: 1px;
  background: linear-gradient(90deg, #737882 0%, #d4d8df 50%, #636871 100%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

.arxiv-staple--top {
  top: 28px;
}

.arxiv-staple--bottom {
  bottom: 28px;
}

.arxiv-spine-tag {
  margin: 10px auto 0;
  font: 700 7.5px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.08em;
  color: #b31b1b;
}

.shelf-book--arxiv .spine-body {
  padding: 26px 4px 26px;
}

.shelf-book--arxiv .spine-title {
  font-family: "Computer Modern Serif", Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: calc(var(--h) * 0.035);
  color: #141518;
}

.shelf-book--arxiv .spine-author {
  font-family: "Computer Modern Serif", Georgia, "Times New Roman", serif;
  text-transform: none;
  font-weight: 400;
  font-size: calc(var(--h) * 0.023);
  color: #4b5059;
  opacity: 1;
}

.arxiv-spine-url {
  font: 600 7px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #b31b1b;
  letter-spacing: 0.02em;
}

/* Open Face: Authentic arXiv / LaTeX Technical Paper Front Page */
.book-face--cover-arxiv {
  background: #fcfbf8;
  color: #141518;
  border-radius: 1px;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.14),
    inset 14px 0 18px -12px rgba(0, 0, 0, 0.18),
    0 30px 56px -22px rgba(10, 12, 18, 0.52);
}

.arxiv-page {
  position: relative;
  flex: 1;
  display: flex;
  padding: calc(var(--h) * 0.042) calc(var(--h) * 0.046) calc(var(--h) * 0.042) calc(var(--h) * 0.068);
  font-family: Georgia, "Times New Roman", Times, serif;
  overflow: hidden;
}

/* Iconic vertical arXiv margin watermark along the left edge */
.arxiv-margin-stamp {
  position: absolute;
  left: calc(var(--h) * 0.016);
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font: 600 calc(var(--h) * 0.022) / 1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.05em;
  color: rgba(179, 27, 27, 0.62);
  white-space: nowrap;
  pointer-events: none;
}

.arxiv-staple-mark {
  position: absolute;
  left: 3px;
  width: 2px;
  height: calc(var(--h) * 0.035);
  background: linear-gradient(180deg, #9aa0aa, #5a6069);
  border-radius: 1px;
}

.arxiv-staple-mark--top {
  top: calc(var(--h) * 0.08);
}

.arxiv-staple-mark--bottom {
  bottom: calc(var(--h) * 0.08);
}

.arxiv-sheet {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: calc(var(--h) * 0.018);
  min-width: 0;
}

.arxiv-header-url {
  font: 500 calc(var(--h) * 0.021) / 1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #6b7280;
  letter-spacing: 0.01em;
}

.arxiv-rule {
  width: 100%;
  height: 1px;
  background: #1c1e24;
  flex: 0 0 auto;
}

.arxiv-rule--thick {
  height: 2px;
}

.arxiv-title {
  font: 700 calc(var(--h) * 0.048) / 1.15 Georgia, "Times New Roman", serif;
  color: #111216;
  margin-top: 1px;
}

.arxiv-subtitle {
  font: 400 calc(var(--h) * 0.028) / 1.24 Georgia, "Times New Roman", serif;
  font-style: italic;
  color: #3f444e;
}

.arxiv-authors {
  font: 600 calc(var(--h) * 0.026) / 1.2 Georgia, "Times New Roman", serif;
  color: #262930;
  letter-spacing: 0.02em;
}

.arxiv-abstract {
  width: 94%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 1px;
}

.arxiv-abstract-head {
  font: 700 calc(var(--h) * 0.024) / 1.1 Georgia, "Times New Roman", serif;
  color: #141518;
}

.arxiv-abstract-body {
  font: 400 calc(var(--h) * 0.022) / 1.35 Georgia, "Times New Roman", serif;
  text-align: justify;
  color: #2f333b;
}

.arxiv-figure {
  width: 100%;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.arxiv-figure-img {
  width: 100%;
  height: calc(var(--h) * 0.24);
  border: 1px solid rgba(20, 21, 24, 0.22);
  overflow: hidden;
  background: #122036;
}

.arxiv-caption {
  font: 400 calc(var(--h) * 0.021) / 1.22 Georgia, "Times New Roman", serif;
  color: #4b5059;
  text-align: left;
}

/* Detail Panel below shelf */
.detail-panel {
  margin-top: 0;
}

.detail-panel[hidden] {
  display: none;
}

.detail-card {
  border: 1px solid var(--lb-border);
  padding: var(--lb-space-6);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-card[hidden] {
  display: none;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: var(--lb-space-3);
  margin-bottom: var(--lb-space-2);
}

.detail-number {
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--lb-red);
  letter-spacing: 0.06em;
}

.detail-stage {
  font: 500 12.5px/1 var(--lb-font-body);
  color: var(--lb-muted);
}

.detail-title {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.25;
}

.detail-author {
  margin: var(--lb-space-1) 0 0;
  font: 500 14.5px/1.4 var(--lb-font-body);
  color: var(--lb-muted);
}

.detail-summary {
  margin: var(--lb-space-4) 0 0;
  font-size: 16px;
  line-height: 1.7;
  max-width: 72ch;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lb-space-3);
  margin-top: var(--lb-space-5);
}

.lb-footer {
  margin-block-start: 0;
}

.detail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 0;
  font: 600 14px/1 var(--lb-font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.detail-btn:focus-visible {
  outline: 2px solid var(--lb-ink);
  outline-offset: 2px;
}

.detail-btn--primary {
  background: var(--lb-ink);
  color: var(--lb-canvas);
  border: 1px solid var(--lb-ink);
}

.detail-btn--primary .lb-arrow {
  color: var(--lb-canvas);
}

.detail-btn--primary:hover,
.detail-btn--primary:focus-visible {
  background: var(--lb-red);
  border-color: var(--lb-red);
  color: #ffffff;
}

.detail-btn--primary:hover .lb-arrow,
.detail-btn--primary:focus-visible .lb-arrow {
  color: #ffffff;
}

.detail-btn--secondary {
  background: var(--lb-surface);
  color: var(--lb-ink);
  border: 1px solid var(--lb-border);
}

.detail-btn--secondary:hover,
.detail-btn--secondary:focus-visible {
  background: var(--lb-hover);
  color: var(--lb-ink);
  border-color: var(--lb-ink);
}

/* Mobile Responsive */
@media (max-width: 680px) {
  .hero-section {
    margin-block: var(--lb-space-8) 0;
  }

  .shelf-section {
    margin-block: var(--lb-space-6) var(--lb-space-8);
  }

  .shelf-nav-controls {
    width: 100%;
    justify-content: space-between;
  }

  .shelf-counter {
    flex: 1;
    justify-content: center;
  }

  .detail-card {
    padding: var(--lb-space-5);
  }

  .detail-summary {
    font-size: 15.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shelf-book,
  .book-face::after,
  .shelf-step-btn,
  .detail-btn {
    transition: none;
  }
}
