/* ================================================================
   BATHOS INTERNATIONAL — PRODUCT CATALOGUE FLIPBOOK
   File: css/flipbook.css
   ================================================================ */

/* ── Section wrapper ── */
.bh-flipbook-section {
  background: #070e17;
  padding: 88px 0 0;
  position: relative;
  overflow: hidden;
}
.bh-flipbook-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 72px 72px;
  pointer-events: none;
  z-index: 0;
}

/* ── Section header ── */
.bh-flipbook-header {
  padding: 0 6% 52px;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}
.bh-flipbook-header__sub {
  font-size: 14px;
  font-weight: 300;
  color: rgba(255,255,255,0.38);
  max-width: 400px;
  line-height: 1.75;
  margin-top: 10px;
}
.bh-flipbook-header__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.bh-fb-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 20px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
  white-space: nowrap;
}
.bh-fb-action:hover {
  border-color: #B8862A;
  color: #D4A84B;
  background: rgba(184,134,42,0.07);
}
.bh-fb-action--gold {
  background: #B8862A;
  color: #0B1520;
  border-color: #B8862A;
  font-weight: 600;
}
.bh-fb-action--gold:hover {
  background: #D4A84B;
  border-color: #D4A84B;
  color: #0B1520;
}

/* ── Stage ── */
.bh-flipbook-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  background: #040b12;
}

/* ── Book viewport ── */
.bh-book-viewport {
  width: 100%;
  max-width: 1200px;
  padding: 48px 40px 0;
}

/* ── Perspective wrapper ── */
.bh-book-wrap {
  perspective: 2800px;
  perspective-origin: 50% 45%;
  width: 100%;
}

/* ── The book itself ── */
.bh-book {
  position: relative;
  width: 100%;
  display: flex;
  transform-style: preserve-3d;
  /* height set dynamically by JS */
}

/* ── Ambient shadow under book ── */
.bh-book::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: 5%;
  right: 5%;
  height: 30px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.6) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Book spine ── */
.bh-book-spine {
  position: absolute;
  top: 0; bottom: 0;
  left: calc(50% - 3px);
  width: 6px;
  background: linear-gradient(180deg,
    #c9a44a 0%,
    #7a500e 30%,
    #B8862A 50%,
    #7a500e 70%,
    #c9a44a 100%
  );
  z-index: 30;
  border-radius: 1px;
  box-shadow:
    -6px 0 20px rgba(0,0,0,0.7),
     6px 0 20px rgba(0,0,0,0.7),
     0   0 12px rgba(184,134,42,0.25);
}

/* ── Static page halves ── */
.bh-page-left,
.bh-page-right {
  width: 50%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #f9f7f4;
}
.bh-page-left {
  border-radius: 3px 0 0 3px;
  box-shadow: -12px 4px 28px rgba(0,0,0,0.7);
}
.bh-page-right {
  border-radius: 0 3px 3px 0;
  box-shadow: 12px 4px 28px rgba(0,0,0,0.7);
}
.bh-page-left canvas,
.bh-page-right canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Page number label */
.bh-page-label {
  position: absolute;
  bottom: 10px;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: rgba(0,0,0,0.2);
  pointer-events: none;
}
.bh-page-left .bh-page-label  { left: 14px; }
.bh-page-right .bh-page-label { right: 14px; }

/* ── Turning page ── */
.bh-turn-page {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  z-index: 25;
  pointer-events: none;
  will-change: transform;
}
.bh-turn-page--right { right: 0; transform-origin: left center; }
.bh-turn-page--left  { left: 0;  transform-origin: right center; }

.bh-turn-page--right.is-turning {
  animation: bhFlipRight 0.65s cubic-bezier(0.645, 0.045, 0.355, 1.000) forwards;
}
.bh-turn-page--left.is-turning {
  animation: bhFlipLeft 0.65s cubic-bezier(0.645, 0.045, 0.355, 1.000) forwards;
}

@keyframes bhFlipRight {
  0%   { transform: rotateY(0deg);    }
  100% { transform: rotateY(-180deg); }
}
@keyframes bhFlipLeft {
  0%   { transform: rotateY(0deg);   }
  100% { transform: rotateY(180deg); }
}

/* Turn page faces */
.bh-turn-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background: #f9f7f4;
}
.bh-turn-face--front {}
.bh-turn-face--back  { transform: rotateY(180deg); }

/* Dynamic shadow on turning pages */
.bh-turn-page--right.is-turning .bh-turn-face--front {
  box-shadow: inset -20px 0 40px rgba(0,0,0,0.18);
}
.bh-turn-page--right.is-turning .bh-turn-face--back {
  box-shadow: inset 20px 0 40px rgba(0,0,0,0.18);
}

.bh-turn-face canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ── Loading state ── */
.bh-fb-loader {
  position: absolute;
  inset: 0;
  background: #040b12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 200;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.bh-fb-loader.done {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}
.bh-fb-spinner {
  width: 56px; height: 56px;
  border: 2px solid rgba(255,255,255,0.06);
  border-top: 2px solid #B8862A;
  border-radius: 50%;
  animation: fbSpin 0.85s linear infinite;
}
@keyframes fbSpin { to { transform: rotate(360deg); } }
.bh-fb-loader-label {
  font-size: 10.5px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
}
.bh-fb-progress-bar {
  width: 200px; height: 1px;
  background: rgba(255,255,255,0.06);
  border-radius: 1px;
  overflow: hidden;
}
.bh-fb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #B8862A, #D4A84B);
  width: 0%;
  transition: width 0.2s ease;
}
.bh-fb-progress-pct {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 1px;
}

/* ── Controls row ── */
.bh-fb-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  width: 100%;
  max-width: 1200px;
  gap: 16px;
}
.bh-fb-controls-left,
.bh-fb-controls-right { display: flex; align-items: center; gap: 8px; }
.bh-fb-controls-center { display: flex; align-items: center; gap: 16px; }

.bh-fb-btn {
  width: 42px; height: 42px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 2px;
  background: transparent;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.bh-fb-btn:hover:not(:disabled) {
  border-color: #B8862A;
  color: #D4A84B;
  background: rgba(184,134,42,0.08);
}
.bh-fb-btn:disabled { opacity: 0.2; cursor: not-allowed; }

.bh-fb-pagenum {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
  min-width: 120px;
  text-align: center;
}
.bh-fb-pagenum strong { color: rgba(255,255,255,0.65); font-weight: 500; }

/* Keyboard hint */
.bh-fb-hint {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.18);
  white-space: nowrap;
}

/* ── Thumbnail strip ── */
.bh-fb-thumbstrip {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border-top: 1px solid rgba(255,255,255,0.04);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(184,134,42,0.25) transparent;
}
.bh-fb-thumbstrip::-webkit-scrollbar { height: 3px; }
.bh-fb-thumbstrip::-webkit-scrollbar-thumb { background: rgba(184,134,42,0.25); }

.bh-fb-thumbs-inner {
  display: flex;
  gap: 5px;
  padding: 12px 24px 14px;
  width: max-content;
}
.bh-fb-thumb {
  flex-shrink: 0;
  width: 82px;
  height: 58px;
  border: 1.5px solid rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  background: #0f1820;
  position: relative;
}
.bh-fb-thumb:hover { border-color: rgba(255,255,255,0.3); transform: translateY(-2px); }
.bh-fb-thumb.is-active { border-color: #B8862A; box-shadow: 0 0 8px rgba(184,134,42,0.3); }
.bh-fb-thumb canvas { width: 100% !important; height: 100% !important; display: block; }
.bh-fb-thumb-n {
  position: absolute;
  bottom: 2px; right: 4px;
  font-size: 8px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.5px;
  pointer-events: none;
}

/* ── Error state ── */
.bh-fb-error {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 32px;
  text-align: center;
}
.bh-fb-error__icon { font-size: 40px; opacity: 0.4; }
.bh-fb-error__title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: rgba(255,255,255,0.6);
}
.bh-fb-error__msg {
  font-size: 14px;
  font-weight: 300;
  color: rgba(255,255,255,0.3);
  line-height: 1.75;
  max-width: 400px;
}
.bh-fb-error code {
  background: rgba(255,255,255,0.07);
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 12px;
  color: #D4A84B;
}

/* ── Fullscreen adjustments ── */
.bh-flipbook-stage:fullscreen,
.bh-flipbook-stage:-webkit-full-screen,
.bh-flipbook-stage:-moz-full-screen {
  background: #040b12;
  overflow-y: auto;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .bh-book-spine { display: none; }
  .bh-page-left { display: none; }
  .bh-page-right {
    width: 100%;
    border-radius: 3px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
  }
  .bh-turn-page--right { width: 100%; }
  .bh-book-viewport { padding: 32px 20px 0; }
  .bh-fb-controls { padding: 14px 20px; }
  .bh-fb-hint { display: none; }
}
@media (max-width: 540px) {
  .bh-flipbook-header { padding: 0 5% 36px; }
  .bh-flipbook-header__actions { display: none; }
  .bh-fb-pagenum { min-width: 80px; font-size: 11px; }
  .bh-fb-thumb { width: 64px; height: 45px; }
}

/* ================================================================
   FLIPBOOK — 3D TURNING LEAF ADDITIONS
   ================================================================ */

/* Page images fill their containers */
.bh-page-left  img,
.bh-page-right img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.fb-blank {
  width: 100%; height: 100%;
  background: #f9f7f4;
}

/* ── Turning leaf wrapper ── */
.fb-turn-wrap {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  z-index: 40;
  pointer-events: none;
}
.fb-turn-right {
  right: 0;
  transform-origin: left center;
}
.fb-turn-left {
  left: 0;
  transform-origin: right center;
}

/* ── Front and back faces ── */
.fb-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background: #f9f7f4;
}
.fb-face img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.fb-face-front {
  /* Default: faces viewer */
}
.fb-face-back {
  /* Faces away; un-mirror with rotateY(180deg) */
  transform: rotateY(180deg);
}

/* Shadow on turning page edges */
.fb-turn-right .fb-face-front::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.18) 0%, transparent 25%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.fb-turn-right[style*="rotateY"] .fb-face-front::after { opacity: 1; }

.fb-turn-left .fb-face-front::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, rgba(0,0,0,0.18) 0%, transparent 25%);
  pointer-events: none;
}

/* ── Cover hint overlay ── */
#bh-cover-hint {
  position: absolute;
  bottom: 32px;
  right: 8%;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(11,21,32,0.72);
  border: 1px solid rgba(184,134,42,0.5);
  backdrop-filter: blur(8px);
  border-radius: 3px;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  animation: bh-hint-pulse 2.4s ease-in-out infinite;
}
#bh-cover-hint:hover {
  background: rgba(184,134,42,0.25);
  border-color: var(--gold-lt);
}
#bh-cover-hint span {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
}
#bh-cover-hint svg { flex-shrink: 0; }

@keyframes bh-hint-pulse {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

/* ── Page hover cursors ── */
.bh-page-right { cursor: pointer; }
.bh-page-left  { cursor: pointer; }

/* ── Page fold shadow (right page — left edge shadow) ── */
.bh-page-right::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 20px;
  background: linear-gradient(to right, rgba(0,0,0,0.12), transparent);
  pointer-events: none;
  z-index: 2;
}
/* ── Page fold shadow (left page — right edge shadow) ── */
.bh-page-left::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 20px;
  background: linear-gradient(to left, rgba(0,0,0,0.12), transparent);
  pointer-events: none;
  z-index: 2;
}
