/* ==========================================================================
   Stripe Press — Scroll-Driven Featured Releases & 3D Bookshelf Styles
   ========================================================================== */

:root {
  --surface-bg: #E2E9F0;
  --surface-fg: #1C1B19;
  --canvas-bg: #E2E9F0;
  --surface-border: color-mix(in srgb, var(--surface-fg) 32%, transparent);
  --surface-rule: color-mix(in srgb, var(--surface-fg) 42%, transparent);
  --surface-muted: color-mix(in srgb, var(--surface-fg) 75%, transparent);
  --surface-subtle: color-mix(in srgb, var(--surface-fg) 12%, transparent);
  --surface-card: color-mix(in srgb, var(--surface-bg) 90%, #000000 10%);

  --font-serif-display: 'Newsreader', 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --font-serif-text: 'Newsreader', 'Libre Baskerville', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --header-height: 62px;
  --ticker-height: 60px;
  --bottom-bar-height: 32px;
  --transition-theme: background-color 0.65s cubic-bezier(0.22, 1, 0.36, 1),
                      color 0.65s cubic-bezier(0.22, 1, 0.36, 1),
                      border-color 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--surface-bg);
  color: var(--surface-fg);
  font-family: var(--font-sans);
  transition: var(--transition-theme);
  overflow-x: hidden;
  min-height: 100vh;
}

::selection {
  background: var(--surface-fg);
  color: var(--surface-bg);
}

button, a, input {
  font-family: inherit;
  color: inherit;
}

/* ==========================================================================
   Scroll Spacer Driving the 5 Scroll Stages (4 Featured + 1 3D Bookshelf)
   Nothing exists below the 3D Bookshelf stage.
   ========================================================================== */
.scroll-driver-spacer {
  position: relative;
  width: 100%;
  height: 500vh;
  pointer-events: none;
  z-index: 1;
}

body.detail-open,
body.reader-open {
  overflow: hidden;
}

/* ==========================================================================
   Fixed Editorial Top Header
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--transition-theme);
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 32px;
  border-bottom: 1px solid var(--surface-rule);
}

.brand-wordmark {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.header-nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mono-tag-btn {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--surface-fg);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease;
  padding: 2px 4px;
}

.mono-tag-btn:hover,
.mono-tag-btn.active {
  opacity: 1;
}

.mono-tag-btn.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.header-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 30px;
}

.sub-row-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.section-bracket-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--surface-fg);
}

.back-to-shelf-btn {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--surface-fg);
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 3px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--surface-border);
}

body.detail-open:not(.reader-open) .back-to-shelf-btn {
  display: inline-flex;
}

.reader-header-close-btn {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--surface-fg);
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 3px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--surface-border);
}

body.reader-open .reader-header-close-btn {
  display: inline-flex;
}

body.reader-open .section-bracket-label {
  display: none;
}

.sub-row-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-open-book-btn {
  font-size: 9.5px;
  opacity: 0.9;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--surface-border);
  background: var(--surface-subtle);
}

body.reader-open .header-open-book-btn {
  display: none;
}

.angle-pill-primary {
  background: rgba(245, 240, 228, 0.92) !important;
  color: #161513 !important;
  border-color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
}

/* Mobile Shelf Pagination Controls ([ ← ]  11 / 21  [ → ], shown on mobile in Full Catalogue) */
.mobile-shelf-pagination {
  display: none;
  position: absolute;
  bottom: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  align-items: center;
  gap: 28px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--surface-fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.mobile-page-btn {
  background: none;
  border: none;
  color: var(--surface-fg);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0.85;
}

.mobile-page-btn:active {
  opacity: 1;
  transform: scale(0.95);
}

.mobile-shelf-counter {
  font-size: 11.5px;
  opacity: 0.9;
  min-width: 58px;
  text-align: center;
}

/* ==========================================================================
   Synchronized Horizontal Book Title Strip (Stripe Press Ticker)
   ========================================================================== */
.title-ticker-strip {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--ticker-height);
  z-index: 85;
  display: flex;
  align-items: center;
  overflow: hidden;
  pointer-events: auto;
  background: color-mix(in srgb, var(--surface-bg) 94%, transparent);
  transition: var(--transition-theme);
  mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
}

.title-ticker-track {
  display: flex;
  align-items: baseline;
  gap: 38px;
  white-space: nowrap;
  will-change: transform;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 0 50vw;
}

.ticker-item {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-serif-display);
  font-size: clamp(23px, 2.55vw, 37px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
  color: var(--surface-fg);
  opacity: 0.45;
  transition: opacity 0.35s ease, transform 0.35s ease;
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  padding: 2px 0;
}

.ticker-item:hover {
  opacity: 0.78;
}

.ticker-item.active {
  font-style: normal;
  opacity: 1;
}

.ticker-item sup {
  font-family: var(--font-serif-text);
  font-size: 9.5px;
  font-style: normal;
  letter-spacing: 0.01em;
  opacity: 0.75;
  margin-top: 2px;
}

/* ==========================================================================
   Fixed Full-Viewport Stage: Painterly Cards Layer + 3D WebGL Canvas + Side Panel
   ========================================================================== */
.stage-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 10;
  display: flex;
  align-items: stretch;
}

/* Vertically Scrolling Painterly Landscape Cards for [ NEW & FEATURED RELEASES ] (00:00–00:11) */
.featured-cards-viewport {
  position: absolute;
  top: calc(var(--header-height) + var(--ticker-height) + 2px);
  left: 16px;
  right: 16px;
  bottom: 14px;
  overflow: hidden;
  border-radius: 6px;
  z-index: 12;
  pointer-events: auto;
  transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

body.detail-open .featured-cards-viewport {
  opacity: 0 !important;
  pointer-events: none !important;
}

.featured-cards-track {
  width: 100%;
  will-change: transform;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.featured-painting-card {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-height) - var(--ticker-height) - 16px);
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.featured-card-bottom-pill {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  background: rgba(24, 25, 22, 0.86);
  color: #F3EAD2;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 5px 16px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.featured-card-bottom-pill:hover {
  transform: translateX(-50%) scale(1.04);
  background: rgba(24, 25, 22, 0.96);
}

/* Interactive "[ ← DRAG ] • [ TO ROTATE → ]" Cursor Badge on Featured 3D Books (frame 00:11) */
.drag-rotate-badge {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.94);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.drag-rotate-badge.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.drag-pill-half {
  background: rgba(235, 192, 92, 0.92);
  color: #22231B;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.drag-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #F9C350;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

/* 3D WebGL Canvas Wrapper */
.canvas-stage-wrapper {
  position: relative;
  z-index: 20;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
              padding 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

body:not(.detail-open) .canvas-stage-wrapper {
  clip-path: inset(calc(var(--header-height) + var(--ticker-height) + 2px) 0 0 0);
}

body.detail-open .canvas-stage-wrapper {
  width: 52%;
  padding: 128px 24px 44px 24px;
}

.detail-backdrop-frame {
  position: absolute;
  inset: 0;
  border-radius: 0;
  overflow: hidden;
  transition: all 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

body.detail-open .detail-backdrop-frame {
  inset: 128px 20px 44px 20px;
  border-radius: 6px;
  border: 1px solid var(--surface-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.detail-painterly-bg {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  transition: opacity 0.65s ease;
}

body.detail-open .detail-painterly-bg {
  opacity: 0.42;
}

#bookshelf-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  cursor: grab;
}

#bookshelf-canvas:active {
  cursor: grabbing;
}

.book-3d-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

body.detail-open .book-3d-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.angle-pill-btn {
  background: color-mix(in srgb, var(--surface-bg) 82%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--surface-border);
  color: var(--surface-fg);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.angle-pill-btn:hover,
.angle-pill-btn.active {
  background: var(--surface-fg);
  color: var(--surface-bg);
}

/* ==========================================================================
   Right Editorial Side Panel (Book Details, Description, Action Buttons)
   ========================================================================== */
.detail-side-panel {
  position: absolute;
  top: 128px;
  right: 0;
  bottom: var(--bottom-bar-height);
  width: 48%;
  overflow-y: auto;
  padding: 0 36px 64px 24px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transform: translateX(36px);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-border) transparent;
}

body.detail-open .detail-side-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.editorial-block {
  border-top: 1px solid var(--surface-rule);
  padding-top: 12px;
  margin-bottom: 34px;
}

.editorial-block-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--surface-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-book-title {
  font-family: var(--font-serif-display);
  font-size: clamp(30px, 3.3vw, 48px);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.detail-book-subtitle {
  font-family: var(--font-serif-display);
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 300;
  font-style: italic;
  line-height: 1.25;
  opacity: 0.88;
  margin-bottom: 12px;
}

.detail-book-author {
  font-family: var(--font-serif-text);
  font-size: 16px;
  font-style: italic;
  opacity: 0.9;
}

.detail-description {
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.58;
  color: var(--surface-fg);
  opacity: 0.94;
  text-indent: 2em;
}

.detail-description p + p {
  margin-top: 12px;
}

.purchase-list {
  margin-top: 22px;
  border-top: 1px solid var(--surface-border);
}

.purchase-row {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px dashed var(--surface-border);
  padding: 11px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--surface-fg);
  cursor: pointer;
  transition: background-color 0.2s ease, padding-left 0.2s ease;
  text-align: left;
}

.purchase-row:hover {
  background-color: var(--surface-subtle);
  padding-left: 10px;
}

.purchase-row-price {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.detail-pill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.editorial-pill-btn {
  background: none;
  border: 1px solid var(--surface-rule);
  color: var(--surface-fg);
  border-radius: 999px;
  padding: 7px 16px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.editorial-pill-btn:hover {
  background: var(--surface-fg);
  color: var(--surface-bg);
}

.colophon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
  font-size: 13px;
}

.colophon-item-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.68;
  margin-bottom: 3px;
}

.colophon-item-value {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
}

.praise-quote {
  font-family: var(--font-serif-text);
  font-size: 15px;
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 8px;
}

.praise-attribution {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

/* ==========================================================================
   Persistent Bottom Control Bar (Visible on 3D Shelf & Detail Views)
   ========================================================================== */
.bottom-persistent-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  z-index: 100;
  background: color-mix(in srgb, var(--surface-bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--surface-rule);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: var(--transition-theme), opacity 0.35s ease, transform 0.35s ease;
}

.bottom-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  border-right: 1px solid var(--surface-border);
  flex: 1;
}

.audio-toggle-btn,
.drawer-toggle-btn {
  background: none;
  border: none;
  color: var(--surface-fg);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0.9;
}

.audio-toggle-btn:hover,
.drawer-toggle-btn:hover {
  opacity: 1;
}

.audio-visualizer {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.audio-visualizer.playing {
  display: inline-flex;
}

.audio-visualizer span {
  width: 2px;
  background: var(--surface-fg);
  animation: eqPulse 0.8s ease-in-out infinite alternate;
}

.audio-visualizer span:nth-child(1) { height: 4px; animation-delay: 0s; }
.audio-visualizer span:nth-child(2) { height: 9px; animation-delay: 0.2s; }
.audio-visualizer span:nth-child(3) { height: 6px; animation-delay: 0.4s; }

@keyframes eqPulse {
  from { height: 3px; }
  to { height: 10px; }
}

.bottom-bar-right {
  display: flex;
  align-items: stretch;
}

.bottom-action-btn {
  background: none;
  border: none;
  border-left: 1px solid var(--surface-border);
  padding: 0 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--surface-fg);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.bottom-action-btn:hover {
  background-color: var(--surface-subtle);
}

/* ==========================================================================
   Site Menu Library Drawer (Bottom-Left Anchored 2-Column Panel)
   ========================================================================== */
.site-menu-drawer {
  position: fixed;
  left: 16px;
  bottom: calc(var(--bottom-bar-height) + 12px);
  width: min(640px, calc(100vw - 32px));
  max-height: 70vh;
  background: var(--surface-card);
  border: 1px solid var(--surface-rule);
  border-radius: 4px;
  z-index: 120;
  padding: 20px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  overflow-y: auto;
}

.site-menu-drawer.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.drawer-col-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--surface-muted);
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.drawer-book-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-book-btn {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 5px 6px;
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--surface-fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.15s ease;
}

.drawer-book-btn:hover,
.drawer-book-btn.active {
  background-color: var(--surface-subtle);
}

.drawer-book-author {
  font-size: 11px;
  opacity: 0.65;
}

/* ==========================================================================
   True 3D SkinnedMesh Hardcover Book Reader Canvas & Floating Bar
   ========================================================================== */
.book-reader-overlay {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: var(--bottom-bar-height);
  z-index: 180;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.book-reader-overlay.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.reader-backdrop-bg {
  display: none;
}

body.reader-open #bookshelf-canvas {
  opacity: 0;
  transition: opacity 0.18s ease;
}

body.reader-open .drag-rotate-badge,
body.reader-open .book-3d-controls {
  opacity: 0 !important;
  pointer-events: none !important;
}

.reader-webgl-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  z-index: 2;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Minimal Unobtrusive Floating Pill Bar at Bottom of Open 3D Book */
.reader-floating-bar {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 16, 20, 0.84);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  color: #F2EDE2;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.reader-pill-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #F2EDE2;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.reader-pill-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.reader-pill-btn:disabled {
  opacity: 0.34;
  cursor: default;
}

.reader-pill-btn.active {
  background: rgba(244, 210, 43, 0.22);
  border-color: rgba(244, 210, 43, 0.55);
  color: #FFE79B;
}

.reader-page-indicator {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(242, 237, 226, 0.92);
  padding: 0 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.reader-bar-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.reader-close-pill {
  border-color: rgba(255, 255, 255, 0.2);
}

.toast-notification {
  position: fixed;
  top: 74px;
  right: 20px;
  z-index: 250;
  background: var(--surface-fg);
  color: var(--surface-bg);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-notification.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 960px) {
  body.detail-open .canvas-stage-wrapper {
    width: 100%;
    height: 46vh;
    padding: 96px 16px 12px 16px;
  }

  body.detail-open .detail-backdrop-frame {
    inset: 96px 16px 12px 16px;
  }

  .detail-side-panel {
    top: 48vh;
    width: 100%;
    padding: 16px 20px 56px;
    background: var(--surface-bg);
    border-top: 1px solid var(--surface-rule);
  }

  .header-nav-links {
    display: none;
  }
}

/* ==========================================================================
   Dedicated Smartphone Mobile Version (<= 768px, e.g. 390x844 iPhone)
   Matches the attached mobile videos & stripe.press mobile
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
    --ticker-height: 50px;
    --bottom-bar-height: 36px;
  }

  .header-top-row {
    padding: 0 14px;
    height: 32px;
  }

  .header-sub-row {
    padding: 0 14px;
    height: 28px;
  }

  /* Compact Floating Bottom Pill on Mobile 3D Reader (fits cleanly on 390px single line) */
  .reader-floating-bar {
    bottom: 12px;
    gap: 3px;
    padding: 5px 8px;
    max-width: calc(100vw - 16px);
    font-size: 10px;
  }

  .reader-pill-btn {
    font-size: 10px;
    padding: 5px 6px;
  }

  .reader-page-indicator {
    font-size: 10px;
    padding: 0 3px;
  }

  .reader-zoom-label {
    display: none;
  }

  .ticker-item {
    font-size: clamp(24px, 7.2vw, 31px);
  }

  /* Match stripe.press mobile: omit desktop "(Hardcover)" superscript on narrow screens */
  .ticker-item sup {
    display: none;
  }

  .title-ticker-track {
    gap: 24px;
  }

  /* Rounded portrait painterly background card with clean side insets */
  .featured-cards-viewport {
    top: calc(var(--header-height) + var(--ticker-height) + 4px);
    left: 12px;
    right: 12px;
    bottom: calc(var(--bottom-bar-height) + 10px);
    border-radius: 10px;
  }

  body:not(.detail-open):not(.in-shelf-mode) .canvas-stage-wrapper {
    clip-path: inset(
      calc(var(--header-height) + var(--ticker-height) + 4px)
      0
      calc(var(--bottom-bar-height) + 10px)
      0
    );
  }

  body.in-shelf-mode:not(.detail-open) .canvas-stage-wrapper {
    clip-path: inset(calc(var(--header-height) + var(--ticker-height) + 4px) 0 0 0);
  }

  .featured-painting-card {
    height: calc(100vh - var(--header-height) - var(--ticker-height) - var(--bottom-bar-height) - 14px);
    border-radius: 10px;
  }

  .featured-card-bottom-pill {
    bottom: 14px;
    font-size: 11px;
    padding: 5px 14px;
  }

  /* Show centered [ ← ]  11 / 21  [ → ] controls beneath the 3D bookshelf on mobile */
  .mobile-shelf-pagination {
    display: flex;
  }

  body.in-shelf-mode:not(.detail-open) .mobile-shelf-pagination {
    opacity: 1;
    pointer-events: auto;
  }

  /* Compact mobile bottom bar matching video (00:00–00:05) */
  .bottom-bar-left {
    padding: 0 14px;
    border-right: none;
    justify-content: space-between;
  }

  .bottom-bar-right {
    display: none;
  }

  .drag-rotate-badge {
    display: none !important;
  }

  /* Stacked Mobile Detail View */
  body.detail-open .canvas-stage-wrapper {
    width: 100%;
    height: 44vh;
    padding: 0;
  }

  body.detail-open .detail-backdrop-frame {
    inset: 114px 12px 8px 12px;
    border-radius: 10px;
  }

  .book-3d-controls {
    top: 8px;
    right: 8px;
    gap: 4px;
  }

  .angle-pill-btn {
    font-size: 8.5px;
    padding: 4px 7px;
  }

  .detail-side-panel {
    top: 44vh;
    width: 100%;
    padding: 16px 16px 64px;
  }

  .colophon-grid {
    grid-template-columns: 1fr;
  }

  .site-menu-drawer {
    grid-template-columns: 1fr;
    max-height: 62vh;
  }
}
