/* ==========================================================================
   Self-hosted turnable-page brochure (StPageFlip)
   ========================================================================== */

/* --- StPageFlip core styles (from page-flip/src/Style/stPageFlip.css) --- */
.stf__parent {
  position: relative;
  display: block;
  box-sizing: border-box;
  transform: translateZ(0);
  -ms-touch-action: pan-y;
  touch-action: pan-y;
}
.sft__wrapper {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}
.stf__parent canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
}
.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;
}

.brochure-flip-outer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 10px 16px 20px;
}

.brochure-flip-stage {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: center;
}

/* StPageFlip mounts here. Its inner sizing is driven by JS (size:"stretch"),
   so we only constrain the outer width. */
.brochure-flip {
  width: 100%;
  touch-action: pan-y;
}

.brochure-flip .stf__parent {
  margin: 0 auto;
}

/* Hide the raw page leaves until StPageFlip takes over (it adds `.stf__item`
   and drives visibility with inline styles). Prevents a flash of the 14
   images stacked vertically before initialisation. */
.brochure-flip .brochure-page {
  display: none;
}

/* The page image inside each generated leaf */
.brochure-flip .stf__item img,
.brochure-page img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #fff;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Controls */
.brochure-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brochure-btn {
  appearance: none;
  border: none;
  background: #2f4e78;
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.brochure-btn:hover:not(:disabled) {
  background: #223a5c;
  transform: translateY(-1px);
}

.brochure-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.brochure-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.brochure-page-indicator {
  font-size: 14px;
  font-weight: 600;
  color: #2f4e78;
  min-width: 96px;
  text-align: center;
  letter-spacing: 0.3px;
}

/* Loading state before StPageFlip initialises */
.brochure-flip-loading {
  width: 100%;
  max-width: 700px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: linear-gradient(100deg, #eef2f8 30%, #f7f9fc 50%, #eef2f8 70%);
  background-size: 200% 100%;
  animation: brochure-shimmer 1.3s ease-in-out infinite;
}

@keyframes brochure-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (max-width: 600px) {
  .brochure-btn {
    width: 42px;
    height: 42px;
  }
}
