/* ==========================================================================
   LYUBOMIROFF — brandbook.css  (interactive brand book page)
   Link from templates/brand_book.html via {% block extra_css %}.
   ========================================================================== */

/* ---- Page header ------------------------------------------------------- */
.bb-header {
  background: var(--lm-black);
  padding: 5rem 0 2.5rem;
  border-bottom: 1px solid rgba(201, 145, 61, 0.15);
}
.bb-header-title {
  font-family: "Cormorant Garamond", "Playfair Display", serif;
  font-size: clamp(2rem, 4.2vw, 3.2rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--lm-cream);
  margin-bottom: 0.75rem;
}
.bb-header-lead { max-width: 620px; margin: 0 0 1.5rem; font-size: 1.05rem; line-height: 1.65; color: rgba(245, 240, 232, 0.8); }
.bb-header-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---- Viewer shell ------------------------------------------------------ */
.bb-section { background: #0d0d0d; padding: 1.5rem 0 3rem; }
.bb-container { max-width: 1500px; margin: 0 auto; padding: 0 12px; }

.bb-viewer { position: relative; background: #0d0d0d; }
.bb-viewer [hidden] { display: none !important; }

.bb-stage {
  position: relative;
  height: clamp(440px, calc(100vh - 250px), 980px);
  height: clamp(440px, calc(100svh - 250px), 980px);
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #1d1914 0%, #0d0d0d 70%);
  border: 1px solid rgba(201, 145, 61, 0.14);
  border-radius: 12px;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.bb-zoom  { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.bb-shift { position: absolute; inset: 0; transition: transform 0.5s ease; }
.bb-book  { position: absolute; inset: 0; }

/* StPageFlip overrides: the library ships a typo (.sft__wrapper) and sets inline min sizes */
.bb-book.stf__parent { min-width: 0 !important; min-height: 0 !important; width: 100%; height: 100%; }
.bb-book .stf__wrapper { position: relative; width: 100%; height: 100%; box-sizing: border-box; }
.stf__block  { position: absolute; width: 100%; height: 100%; box-sizing: border-box; perspective: 2000px; }
.stf__item   { display: none; position: absolute; transform-style: preserve-3d; }
.stf__outerShadow, .stf__innerShadow, .stf__hardShadow, .stf__hardInnerShadow { position: absolute; left: 0; top: 0; }

/* ---- Pages ------------------------------------------------------------- */
.bb-page { background: #16130f; overflow: hidden; }
.bb-page .bb-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; display: block;
}
.bb-page.is-loading .bb-page-spin { opacity: 1; }
.bb-page-spin {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 2px solid rgba(201, 145, 61, 0.25); border-top-color: var(--lm-gold);
  border-radius: 50%; opacity: 0; animation: bb-spin 0.9s linear infinite;
  pointer-events: none;
}
@keyframes bb-spin { to { transform: rotate(360deg); } }

/* ---- Overlays ---------------------------------------------------------- */
.bb-loading, .bb-error {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; text-align: center; padding: 1.5rem;
  color: var(--lm-cream); background: rgba(13, 13, 13, 0.82);
}
.bb-loading-spin {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(201, 145, 61, 0.25); border-top-color: var(--lm-gold);
  animation: bb-spin 0.9s linear infinite;
}
.bb-loading p, .bb-error p { margin: 0; font-size: 0.95rem; color: rgba(245, 240, 232, 0.85); }
.bb-stage.is-ready .bb-loading { display: none; }

.bb-pan { position: absolute; inset: 0; z-index: 5; cursor: grab; touch-action: none; }
.bb-pan:active { cursor: grabbing; }

/* ---- Controls ---------------------------------------------------------- */
.bb-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0.35rem 0.5rem; padding: 0.85rem 0 0;
}
.bb-group { display: inline-flex; align-items: center; gap: 0.35rem; }
.bb-sep { width: 1px; height: 26px; background: rgba(245, 240, 232, 0.14); margin: 0 0.35rem; }

.bb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 0.7rem;
  background: transparent; color: var(--lm-cream);
  border: 1px solid rgba(201, 145, 61, 0.35); border-radius: 999px;
  font: inherit; font-size: 0.8rem; letter-spacing: 0.04em; line-height: 1;
  text-decoration: none; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.bb-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bb-btn:hover:not(:disabled) { background: rgba(201, 145, 61, 0.14); border-color: var(--lm-gold); color: var(--lm-cream); }
.bb-btn:focus-visible, .bb-jump-input:focus-visible { outline: 2px solid var(--lm-gold); outline-offset: 2px; }
.bb-btn:disabled { opacity: 0.32; cursor: default; }
.bb-btn.is-on { background: var(--lm-gold); border-color: var(--lm-gold); color: var(--lm-black); }
.bb-btn--text { min-width: 64px; }
.bb-btn--download { color: var(--lm-gold); }

.bb-jump { display: inline-flex; align-items: center; gap: 0.4rem; color: rgba(245, 240, 232, 0.7); font-size: 0.85rem; }
.bb-jump-input {
  width: 4.6rem; height: 44px; text-align: center;
  background: rgba(245, 240, 232, 0.06); color: var(--lm-cream);
  border: 1px solid rgba(201, 145, 61, 0.3); border-radius: 999px;
  font: inherit; font-size: 0.95rem;
}

.bb-fallback { margin: 1rem 0 0; text-align: center; font-size: 0.85rem; color: rgba(245, 240, 232, 0.6); }
.bb-fallback a { color: var(--lm-gold); }

/* ---- Full screen (native and iPhone fallback) -------------------------- */
html.bb-lock { overflow: hidden; }
.bb-viewer.is-pseudo-fs { position: fixed; inset: 0; z-index: 2000; }
.bb-viewer.is-fs, .bb-viewer:fullscreen, .bb-viewer:-webkit-full-screen {
  display: flex; flex-direction: column; height: 100%; width: 100%;
  padding: 10px; background: #0d0d0d;
}
.bb-viewer.is-fs .bb-stage, .bb-viewer:fullscreen .bb-stage, .bb-viewer:-webkit-full-screen .bb-stage {
  flex: 1 1 auto; height: auto; min-height: 0; border-radius: 8px;
}
.bb-viewer.is-fs .bb-controls { padding-bottom: max(0.4rem, env(safe-area-inset-bottom)); }

/* ---- Intro text under the viewer --------------------------------------- */
.bb-intro { background: #faf7f2; padding: 3.5rem 0 0.5rem; }
.bb-intro .container { max-width: 820px; }
.bb-intro h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); margin-bottom: 1rem; color: var(--lm-slate); }
.bb-intro p { font-size: 1.02rem; line-height: 1.75; color: #444; margin-bottom: 1rem; }
.bb-intro + .bb-contents { padding-top: 2.5rem; }

/* ---- Contents list (crawlable text for the page) ----------------------- */
.bb-contents { background: #faf7f2; padding: 3.5rem 0 4.5rem; }
.bb-contents h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); margin-bottom: 1.25rem; color: var(--lm-slate); }
.bb-contents-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem 2rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bb-contents-list li { padding: 0.55rem 0; border-bottom: 1px solid rgba(28, 25, 23, 0.08); font-size: 0.95rem; color: #444; }
.bb-contents-list strong { color: var(--lm-slate); font-weight: 600; }
.bb-contents-list .bb-pg { display: inline-block; min-width: 4.2rem; color: #8a5f1c; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
@media (max-width: 640px) { .bb-contents-list { grid-template-columns: 1fr; } }

.bb-empty { background: #faf7f2; padding: 5rem 0; text-align: center; }

@media (max-width: 576px) {
  .bb-header { padding: 3.5rem 0 2rem; }
  .bb-stage { height: clamp(420px, calc(100svh - 270px), 760px); }
  .bb-sep { display: none; }
  .bb-controls { gap: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .bb-shift { transition: none; }
  .bb-page-spin, .bb-loading-spin { animation-duration: 2.4s; }
}
@media print { .bb-viewer { display: none; } }
