/* book-flip.css — scoped styles; no fonts, dependencies, or remote requests. */
.bf-root {
  --bf-paper: var(--paper, #fbfaf8);
  --bf-ink: var(--ink, #22388f);
  --bf-pink: var(--pink, #f3a7c9);
  box-sizing: border-box;
  width: 100%;
  max-width: 1168px;
  margin-inline: auto;
  color: var(--bf-ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.bf-view { position: relative; }

/* phones: one page at a time; the two page stage is twice the window's width and slides under it */
.bf-single .bf-view {
  overflow: hidden;
  aspect-ratio: var(--bf-half-ratio, .75);
  background: var(--bf-paper);
  box-shadow: 0 10px 22px rgba(18, 24, 35, .15);
}
.bf-single .bf-stage {
  width: 200%;
  box-shadow: none;
}

.bf-root *,
.bf-root *::before,
.bf-root *::after { box-sizing: border-box; }

.bf-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--bf-ratio, 1.5);
  overflow: visible;
  isolation: isolate;
  perspective: 4200px;
  background: var(--bf-paper);
  box-shadow: 0 20px 48px rgba(18, 24, 35, .17), 0 2px 5px rgba(18, 24, 35, .1);
  cursor: pointer;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.bf-stage:focus-visible {
  outline: 3px solid var(--bf-ink);
  outline-offset: 5px;
}

.bf-still,
.bf-turn-scene,
.bf-gutter {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bf-still {
  display: block;
  object-fit: fill; /* preserve the exact two-page composition */
  pointer-events: none;
}

.bf-turn-scene {
  transform-style: preserve-3d;
  pointer-events: none;
}

.bf-turn-scene[hidden] { display: none; }

.bf-stationary {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  overflow: hidden;
  background: var(--bf-paper);
}

.bf-stationary--left { left: 0; }
.bf-stationary--right { right: 0; }

.bf-crop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.bf-crop img {
  position: absolute;
  top: 0;
  width: 200%;
  max-width: none;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  -webkit-user-drag: none;
}

.bf-crop--left img { left: 0; }
.bf-crop--right img { left: -100%; }

.bf-leaf {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}

.bf-leaf--forward {
  left: 50%;
  transform-origin: left center;
}

.bf-leaf--backward {
  left: 0;
  transform-origin: right center;
}

.bf-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bf-paper);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(.15px);
}

.bf-face--back {
  transform: rotateY(180deg) translateZ(.15px);
}

.bf-face-shading {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
}

.bf-leaf--forward .bf-face--front .bf-face-shading {
  background: linear-gradient(to right, rgba(20, 17, 24, .28), transparent 68%);
}
.bf-leaf--backward .bf-face--front .bf-face-shading {
  background: linear-gradient(to left, rgba(20, 17, 24, .28), transparent 68%);
}
.bf-face--back .bf-face-shading {
  background: linear-gradient(to right, rgba(20, 17, 24, .22), transparent 85%);
}
.bf-is-turning .bf-face--front .bf-face-shading {
  animation: bf-front-shade var(--bf-duration, 760ms) linear both;
}
.bf-is-turning .bf-face--back .bf-face-shading {
  animation: bf-back-shade var(--bf-duration, 760ms) linear both;
}

@keyframes bf-front-shade {
  0% { opacity: .08; }
  38% { opacity: .8; }
  100% { opacity: .12; }
}
@keyframes bf-back-shade {
  0% { opacity: .6; }
  55% { opacity: .45; }
  100% { opacity: .04; }
}

.bf-gutter {
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to right,
    transparent calc(50% - 16px),
    rgba(15, 13, 18, .045) calc(50% - 5px),
    rgba(15, 13, 18, .16) 50%,
    rgba(255, 255, 255, .11) calc(50% + 5px),
    transparent calc(50% + 16px));
}

.bf-message {
  display: none;
  position: absolute;
  z-index: 3;
  inset: 0;
  place-items: center;
  padding: 20px;
  background: var(--bf-paper);
  font-size: 13px;
  text-align: center;
}
.bf-is-loading .bf-message,
.bf-has-error .bf-message { display: grid; }
.bf-is-turning .bf-message { display: none; }
.bf-is-busy .bf-stage { cursor: progress; }

.bf-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

.bf-control {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  width: fit-content;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: none;
  color: var(--bf-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .025em;
  cursor: pointer;
}
.bf-control--next { justify-self: end; }
.bf-control--previous { justify-self: start; }
.bf-control:focus-visible {
  outline: 2px solid var(--bf-ink);
  outline-offset: 4px;
}
.bf-control:disabled { opacity: .35; cursor: default; }
.bf-counter {
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: .1em;
  font-variant-numeric: tabular-nums;
}
.bf-hint {
  margin: 13px 0 0;
  color: var(--bf-ink);
  opacity: .7;
  font-size: 11px;
  text-align: center;
}
.bf-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 620px) {
  .bf-stage { box-shadow: 0 10px 22px rgba(18, 24, 35, .15); }
  .bf-controls { margin-top: 14px; gap: 7px; }
  .bf-control { font-size: 11px; gap: 5px; }
  .bf-counter { font-size: 11px; }
  .bf-hint { max-width: 320px; margin-inline: auto; line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  .bf-face-shading { animation: none !important; }
  .bf-leaf { will-change: auto; }
}
