/* Four Corners Interactive 3D Sanctuary Bookshelf (Self-Hosted Three.js) */
.fc3d-shell {
  position: relative;
  margin: 22px 0 32px;
  border-radius: 22px;
  border: 1px solid rgba(212, 168, 75, 0.44);
  background: radial-gradient(120% 90% at 50% 0%, rgba(28, 55, 92, 0.94) 0%, rgba(11, 24, 44, 0.98) 65%, rgba(7, 15, 29, 1) 100%);
  box-shadow: 0 28px 64px -24px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 238, 196, 0.16);
  overflow: hidden;
  color: #FAF3E0;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
}

.fc3d-shell.fc3d-embed {
  margin: 0;
  border-radius: 16px;
}

.fc3d-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(212, 168, 75, 0.24);
  background: linear-gradient(180deg, rgba(16, 34, 60, 0.85), rgba(10, 22, 40, 0.55));
}

.fc3d-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 210px;
}

.fc3d-eyebrow {
  margin: 0;
  font: 700 0.72rem/1.2 'Figtree', system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #F0CD78;
}

.fc3d-title {
  margin: 0;
  font: 600 clamp(1.35rem, 2.6vw, 1.8rem)/1.12 'Cormorant', Georgia, serif;
  color: #FAF3E0;
  letter-spacing: 0.01em;
}

.fc3d-sub {
  margin: 0;
  font-size: 0.86rem;
  color: #C7D5E5;
}

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

.fc3d-langs {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.36);
  background: rgba(7, 15, 28, 0.72);
  gap: 2px;
}

.fc3d-lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #D7E2F0;
  font: 700 0.76rem/1 'Figtree', system-ui, sans-serif;
  letter-spacing: 0.06em;
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.fc3d-lang-btn:hover {
  color: #FFF7DF;
  background: rgba(212, 168, 75, 0.16);
}

.fc3d-lang-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #F0CD78, #C99634);
  color: #0B1628;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.fc3d-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.45);
  background: rgba(212, 168, 75, 0.1);
  color: #F6DF9B;
  font: 700 0.8rem/1.1 'Figtree', system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.fc3d-btn:hover {
  background: rgba(212, 168, 75, 0.24);
  border-color: rgba(240, 205, 120, 0.8);
  color: #FFF9E8;
  transform: translateY(-1px);
}

.fc3d-btn:focus-visible,
.fc3d-lang-btn:focus-visible,
.fc3d-arrow:focus-visible,
.fc3d-modal-btn:focus-visible {
  outline: 2px solid #F3D79A;
  outline-offset: 2px;
}

.fc3d-btn.fc3d-btn-gold {
  background: linear-gradient(180deg, #F0CD78, #C99634);
  color: #0B1628;
  border-color: rgba(255, 240, 195, 0.6);
}

.fc3d-btn.fc3d-btn-gold:hover {
  background: linear-gradient(180deg, #F7DB93, #D7A441);
  color: #091322;
}

.fc3d-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.fc3d-stage {
  position: relative;
  width: 100%;
  height: clamp(360px, 48vh, 470px);
  background:
    radial-gradient(65% 75% at 50% 18%, rgba(240, 205, 120, 0.14) 0%, rgba(212, 168, 75, 0.04) 45%, transparent 72%),
    linear-gradient(180deg, #0D1D34 0%, #091526 55%, #07101D 100%);
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
}

.fc3d-shell.fc3d-standalone .fc3d-stage,
.fc3d-shell.fc3d-embed .fc3d-stage {
  height: clamp(410px, 64vh, 560px);
}

.fc3d-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.fc3d-canvas.is-dragging {
  cursor: grabbing;
}

.fc3d-canvas.is-hovering {
  cursor: pointer;
}

.fc3d-arrow {
  position: absolute;
  top: 46%;
  transform: translateY(-50%);
  z-index: 8;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(240, 205, 120, 0.55);
  background: rgba(9, 20, 38, 0.82);
  color: #F6DF9B;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  transition: background 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.fc3d-arrow:hover {
  background: rgba(212, 168, 75, 0.28);
  border-color: #F6DF9B;
  transform: translateY(-50%) scale(1.06);
}

.fc3d-arrow.prev { left: 12px; }
.fc3d-arrow.next { right: 12px; }

/* Floating HUD Pill on Book Hover / Selection */
.fc3d-hud {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translate(-50%, 10px);
  z-index: 9;
  width: min(560px, calc(100% - 28px));
  padding: 11px 16px;
  border-radius: 16px;
  border: 1px solid rgba(240, 205, 120, 0.55);
  background: rgba(8, 19, 36, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fc3d-hud.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
  cursor: pointer;
}

.fc3d-hud-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.fc3d-hud-title {
  margin: 0;
  font: 700 1.05rem/1.2 'Cormorant', Georgia, serif;
  color: #FFF8E7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc3d-hud-sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: #C7D5E5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc3d-hud-cta {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #F0CD78, #C99634);
  color: #0B1628;
  font: 800 0.78rem/1.1 'Figtree', system-ui, sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.fc3d-hud-cta.is-bookmark {
  background: linear-gradient(180deg, #F7DC94, #D9A13B);
  box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.45), 0 4px 16px rgba(212, 168, 75, 0.4);
}

/* Bottom Shelf Rail & Hint Bar */
.fc3d-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 20px 12px;
  border-top: 1px solid rgba(212, 168, 75, 0.2);
  background: rgba(6, 14, 26, 0.82);
  font-size: 0.8rem;
  color: #B7C7DA;
}

.fc3d-rail-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 220px;
  max-width: 340px;
}

.fc3d-rail {
  width: 100%;
  accent-color: #D4A84B;
  cursor: pointer;
}

.fc3d-hint {
  margin: 0;
  color: #B7C7DA;
}

.fc3d-bm-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #F6DF9B;
  font-weight: 600;
}

.fc3d-bm-swatch {
  width: 10px;
  height: 14px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, #D4A84B 0 18%, #B91C1C 18% 82%, #D4A84B 82% 100%);
  box-shadow: 0 0 8px rgba(212, 168, 75, 0.65);
  display: inline-block;
}

/* Non-WebGL Graceful Fallback Shelf */
.fc3d-fallback {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 24px 20px 28px;
  background: linear-gradient(180deg, rgba(13, 29, 52, 0.95) 0%, rgba(13, 29, 52, 0.95) 82%, #5A3519 82%, #3D220F 100%);
  border-bottom: 4px solid #D4A84B;
  scrollbar-width: thin;
  scrollbar-color: #D4A84B rgba(10, 22, 40, 0.6);
}

.fc3d-fb-book {
  position: relative;
  flex: 0 0 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: none;
  border: 0;
  color: #FAF3E0;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease;
}

.fc3d-fb-book:hover {
  transform: translateY(-8px) scale(1.03);
}

.fc3d-fb-book img {
  width: 122px;
  height: 175px;
  object-fit: cover;
  border-radius: 5px 8px 8px 5px;
  box-shadow: -5px 6px 18px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(212, 168, 75, 0.45);
  display: block;
}

.fc3d-fb-ribbon {
  position: absolute;
  top: -4px;
  right: 14px;
  width: 14px;
  height: 28px;
  background: linear-gradient(90deg, #F0CD78 0 20%, #B91C1C 20% 80%, #F0CD78 80% 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  box-shadow: 0 2px 10px rgba(240, 205, 120, 0.7);
}

.fc3d-fb-title {
  margin-top: 8px;
  font: 700 0.78rem/1.25 'Figtree', sans-serif;
  color: #FAF3E0;
  max-width: 128px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Full-Screen Reader Overlay (#fc-shelf-reader-modal) */
#fc-shelf-reader-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  background: #060E1B;
  color: #FAF3E0;
  font-family: 'Figtree', system-ui, sans-serif;
}

#fc-shelf-reader-modal[hidden] {
  display: none;
}

.fc3d-modal-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #091529 0%, #122646 50%, #091529 100%);
  border-bottom: 1px solid rgba(212, 168, 75, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.fc3d-modal-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 220px;
}

.fc3d-modal-title {
  margin: 0;
  font: 700 1.2rem/1.15 'Cormorant', Georgia, serif;
  color: #FAF3E0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc3d-modal-page {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.35);
  background: rgba(212, 168, 75, 0.12);
  color: #F6DF9B;
  font-size: 0.78rem;
  font-weight: 700;
}

.fc3d-modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fc3d-modal-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.5);
  background: rgba(212, 168, 75, 0.12);
  color: #FAF3E0;
  font: 700 0.84rem/1.1 'Figtree', system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.fc3d-modal-btn:hover {
  background: rgba(212, 168, 75, 0.26);
  transform: translateY(-1px);
}

.fc3d-modal-btn.is-active {
  background: rgba(185, 28, 28, 0.32);
  border-color: #F0CD78;
  color: #FFF7DF;
}

.fc3d-modal-putback {
  background: linear-gradient(180deg, #F5D786, #CE9631);
  color: #091529;
  border-color: rgba(255, 244, 214, 0.72);
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(212, 168, 75, 0.35);
}

.fc3d-modal-putback:hover {
  background: linear-gradient(180deg, #FAE3A1, #DEA63E);
  color: #06101F;
}

.fc3d-modal-frame-wrap {
  position: relative;
  flex: 1 1 auto;
  background: #07101E;
}

.fc3d-modal-iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0B172B;
}

/* Share & Embed Dialog Overlay */
.fc3d-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 11, 22, 0.78);
  backdrop-filter: blur(6px);
}

.fc3d-dialog-backdrop[hidden] {
  display: none;
}

.fc3d-dialog {
  position: relative;
  width: min(540px, 100%);
  border-radius: 20px;
  border: 1px solid rgba(212, 168, 75, 0.55);
  background: linear-gradient(180deg, #10233F 0%, #091528 100%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.75);
  padding: 24px 24px 22px;
  color: #FAF3E0;
  font-family: 'Figtree', system-ui, sans-serif;
}

.fc3d-dialog h3 {
  margin: 0 36px 8px 0;
  font: 700 1.45rem/1.15 'Cormorant', Georgia, serif;
  color: #FFF7DF;
}

.fc3d-dialog p {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: #C7D5E5;
  line-height: 1.5;
}

.fc3d-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(212, 168, 75, 0.35);
  background: rgba(212, 168, 75, 0.1);
  color: #F6DF9B;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.fc3d-dialog-box {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(212, 168, 75, 0.38);
  background: rgba(5, 11, 22, 0.85);
  color: #FAF3E0;
  font: 500 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
  margin-bottom: 12px;
}

.fc3d-dialog-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.fc3d-share-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.42);
  background: rgba(212, 168, 75, 0.12);
  color: #F6DF9B;
  text-decoration: none;
  font: 700 0.82rem/1 'Figtree', system-ui, sans-serif;
  cursor: pointer;
}

.fc3d-share-pill:hover {
  background: rgba(212, 168, 75, 0.26);
  color: #FFF8E7;
}

@media (max-width: 720px) {
  .fc3d-head {
    padding: 14px 14px 12px;
  }
  .fc3d-stage {
    height: 340px;
  }
  .fc3d-hud {
    padding: 9px 12px;
    bottom: 10px;
  }
  .fc3d-arrow {
    width: 38px;
    height: 38px;
  }
  .fc3d-foot {
    padding: 10px 14px;
  }
  .fc3d-modal-bar {
    padding: 8px 12px;
  }
  .fc3d-modal-title {
    font-size: 1.02rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fc3d-btn,
  .fc3d-arrow,
  .fc3d-hud,
  .fc3d-fb-book {
    transition: none;
  }
}

