/* Nadulite brochure FLIPBOOK shell master — local-design/base/flipbook
   Extracted from docs/brochure/ordinary_ceramic_flipbook.css */
/**
 * Nadulite Flipbook — Publuu soft curl + UI
 * https://publuu.com/flip-book/4712/1606824
 *
 * - Cover/back: real single-page width (not translated double)
 * - Thumbnails: left sidebar (Publuu THUMBNAILS)
 * - No hover corner peel (press/drag only)
 */
:root {
  --pb-bg: #0c1214;
  --pb-ink: #f4f7f7;
  --pb-mute: rgba(244, 247, 247, 0.62);
  --pb-accent: #b8a898;
  --pb-line: rgba(255, 255, 255, 0.18);
  --pb-header-h: 48px;
  --pb-footer-h: 44px;
  --pb-thumbs-w: 200px;
  --paper: #f0ebe3;
}

* { box-sizing: border-box; }

html,
body.flip-app {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--pb-bg);
  color: var(--pb-ink);
  font-family: Manrope, system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
}

.flip-app {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.pb-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, #243238 0%, transparent 68%),
    linear-gradient(180deg, #12191c 0%, var(--pb-bg) 100%);
  pointer-events: none;
}

.pb-bg.has-image {
  background-color: #0a1012;
  background-size: cover;
  background-position: center;
}

.pb-bg.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  backdrop-filter: blur(22px) saturate(0.8);
  background: rgba(6, 10, 12, 0.68);
}

/* Closing cover: show the tabletop plane, not the blurred cover photo */
.pb-bg.is-plain-desk,
.pb-bg.is-plain-desk.has-image {
  background-image: none !important;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, #243238 0%, transparent 68%),
    linear-gradient(180deg, #12191c 0%, var(--pb-bg) 100%) !important;
}

.pb-bg.is-plain-desk::after {
  display: none !important;
}

/* —— Header (responsive icon toolbar) —— */
.pb-header {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
  min-height: var(--pb-header-h);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

.pb-header__left {
  flex: 0 1 auto;
  min-width: 0;
}

.pb-header__name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  white-space: nowrap;
}

.pb-header__icons {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
}

.pb-icon {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pb-icon:hover,
.pb-icon:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.pb-icon[aria-pressed="true"],
.pb-icon[aria-expanded="true"] {
  color: var(--pb-accent);
  background: rgba(184, 168, 152, 0.16);
}

.pb-icon--text {
  width: auto;
  min-width: 0;
  padding: 0 10px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
}

.pb-icon--sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

/* —— Body: left thumbs + stage —— */
.pb-body {
  position: relative;
  z-index: 10;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.pb-main {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

.pb-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  /* no transform — would flatten StPageFlip soft 3D */
}

/* Publuu: arrows hug the book, not the viewport */
.pb-arrow {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  width: 36px;
  height: 72px;
  font-size: 40px;
  font-weight: 200;
  line-height: 1;
  cursor: pointer;
  position: relative;
  flex: 0 0 36px;
  z-index: 20;
  transition: opacity 0.2s, visibility 0.2s;
  touch-action: manipulation;
}

.pb-arrow:hover { color: #fff; }
.pb-arrow.is-hidden,
.pb-arrow:disabled {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/*
 * Book window. Idle may clip; DURING flip overflow MUST be visible
 * or soft curl becomes a black polygon (Publuu keeps curl outside the page box).
 */
.pb-frame {
  position: relative;
  overflow: hidden;
  flex: 0 1 auto;
  width: min(98vw, calc((100dvh - var(--pb-header-h) - var(--pb-footer-h) - 8px) * 1.414));
  height: min(
    calc(100dvh - var(--pb-header-h) - var(--pb-footer-h) - 8px),
    calc(98vw / 1.414)
  );
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.pb-frame.is-flipping {
  overflow: visible;
  z-index: 15;
}

/*
 * Closing cover (contents → cover): desk shows where interior was.
 * JS also force-hides left/right every frame (engine resets styles).
 */
.pb-frame.is-closing-to-cover {
  background: transparent !important;
  box-shadow: none !important;
}

.pb-frame.is-closing-to-cover .stf__block {
  background: transparent !important;
  box-shadow: none !important;
}

.pb-frame.is-closing-to-cover .page-leaf--left,
.pb-frame.is-closing-to-cover .page-leaf--right,
.pb-frame.is-closing-to-cover .page-leaf--cover,
.pb-frame.is-closing-to-cover .stf__item {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.pb-frame.is-closing-to-cover .pb-thickness {
  opacity: 0 !important;
}

/* Cover sheet 3D open/close (engine jumps underneath — no cover remnant / Contents under close) */
.pb-sheet.is-opening-away {
  display: block !important;
  z-index: 9;
  transform-origin: left center;
  animation: pbCoverOpen 0.58s ease-in forwards;
  pointer-events: none;
}

.pb-sheet.is-closing-in {
  display: block !important;
  z-index: 9;
  transform-origin: left center;
  animation: pbCoverClose 0.65s ease-out forwards;
  pointer-events: none;
}

@keyframes pbCoverOpen {
  0% { transform: perspective(1400px) rotateY(0deg); opacity: 1; }
  100% { transform: perspective(1400px) rotateY(-118deg); opacity: 0.15; }
}

@keyframes pbCoverClose {
  /* Keep cover face opaque so ambient desk never bleeds through as a “wrong page” */
  0% { transform: perspective(1400px) rotateY(-118deg); opacity: 0.92; }
  100% { transform: perspective(1400px) rotateY(0deg); opacity: 1; }
}

/* While closing: book chrome transparent so desk (pb-bg) reads as tabletop */
.pb-frame.is-closing-to-cover .pb-book {
  /* interiors force-hidden in JS; keep engine mounted for size */
}

/* Full A3 landscape sheet for idle cover / back */
.pb-sheet {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #0e1214;
  cursor: grab;
  touch-action: none;
}

.pb-sheet:active { cursor: grabbing; }

.pb-sheet[hidden] {
  display: none !important;
}

.pb-sheet img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.pb-frame.is-cover:not(.is-flipping) .pb-book,
.pb-frame.is-back:not(.is-flipping) .pb-book {
  /* Engine mounted under sheet; sheet starts the flip then hides */
  visibility: hidden;
  pointer-events: none;
}

.pb-frame.is-flipping .pb-book,
.pb-frame.is-open .pb-book {
  visibility: visible;
  pointer-events: auto;
}

.pb-book {
  position: relative;
  /* Engine parent: ALWAYS double-page size (JS). */
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: block;
  margin-left: 0;
  cursor: grab;
}

.pb-book:active,
.pb-book.is-grabbing,
.pb-book.is-flipping { cursor: grabbing; }

/* Engine book always fills the landscape frame (double-page width) */
.pb-frame .pb-book {
  width: 100%;
  height: 100%;
  margin-left: 0;
}

.pb-thickness {
  position: absolute;
  top: 1.4%;
  bottom: 1.4%;
  width: 8px;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  right: -7px;
  border-radius: 0 2px 2px 0;
  background: repeating-linear-gradient(
    to right,
    #f3eee6 0 1.5px,
    #d2cbc0 1.5px 3px
  );
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.pb-frame:not(.is-back) .pb-thickness { opacity: 1; }

/* Cover/back letterbox leaf — never crop titles again */
.page-leaf--cover img,
.page-leaf--back img {
  object-fit: contain;
  object-position: center;
  background: #0e1214;
}

.pb-bottom-glow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -6px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

.stf-book {
  margin: 0 auto;
  width: 100% !important;
  height: 100% !important;
  position: relative;
  z-index: 2;
}

.stf-book.stf__parent {
  min-width: 0 !important;
  max-width: none !important;
}

.stf__wrapper.--landscape {
  margin: 0 auto;
  overflow: visible;
}

.stf-book .stf__block {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  border-radius: 1px;
  overflow: visible;
  background: transparent;
}

.pb-book.is-flipping .stf__item:not(.--simple) {
  z-index: 30 !important;
}

.stf__outerShadow,
.stf__innerShadow,
.stf__hardShadow,
.stf__hardInnerShadow {
  pointer-events: none;
}

.page-leaf.stf__item {
  background: var(--paper);
  overflow: hidden;
}

.page-leaf img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* —— Left thumbnail sidebar (Publuu) —— */
.pb-thumbs {
  flex: 0 0 var(--pb-thumbs-w);
  width: var(--pb-thumbs-w);
  max-width: 42vw;
  z-index: 35;
  background: rgba(12, 16, 20, 0.96);
  border-right: 1px solid var(--pb-line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.35);
}

.pb-thumbs[hidden] { display: none !important; }

.pb-thumbs__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--pb-line);
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.pb-thumbs__grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
}

.pb-thumb {
  flex: 0 0 auto;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--pb-mute);
  cursor: pointer;
  padding: 0;
  text-align: left;
  touch-action: manipulation;
}

.pb-thumb:hover .pb-thumb__pair {
  border-color: rgba(184, 168, 152, 0.45);
}

.pb-thumb.is-active .pb-thumb__pair {
  border-color: var(--pb-accent);
  box-shadow: 0 0 0 1px var(--pb-accent);
}

.pb-thumb__nums {
  display: flex;
  justify-content: space-between;
  padding: 0 2px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
}

.pb-thumb__pair {
  display: flex;
  gap: 2px;
  border: 1px solid var(--pb-line);
  border-radius: 3px;
  overflow: hidden;
  background: #0a0e10;
}

.pb-thumb__pair img {
  display: block;
  width: 50%;
  height: auto;
  aspect-ratio: 396 / 560;
  object-fit: cover;
  background: #111;
}

.pb-thumb__pair--single img {
  width: 100%;
}

/* Cover/back thumbs: full A3 landscape cropped to fill (no letterbox bars) */
.pb-thumb__pair.pb-thumb__pair--fill {
  aspect-ratio: 792 / 560; /* same footprint as L|R spread pair */
  align-items: stretch;
}

.pb-thumb__pair.pb-thumb__pair--fill img {
  width: 100% !important;
  height: 100% !important;
  max-height: none;
  aspect-ratio: unset !important;
  object-fit: cover !important;
  object-position: center center;
}

.pb-thumb__label {
  display: block;
  padding: 5px 2px 0;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* —— Footer —— */
.pb-footer {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
  height: var(--pb-footer-h);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

.pb-pager {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--pb-mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pb-pager__input {
  width: 52px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: center;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.pb-pager__input:focus { outline: 1px solid var(--pb-accent); }

.pb-slider-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
}

.pb-slider {
  width: 100%;
  height: 4px;
  appearance: none;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.pb-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* —— Splash —— */
.pb-splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a2a30;
  transition: opacity 0.45s ease, visibility 0.45s;
}

.pb-splash.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pb-splash__card { text-align: center; padding: 24px; }

.pb-splash__brand {
  margin: 0 0 18px;
  letter-spacing: 0.28em;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.pb-splash__icon {
  color: rgba(255, 255, 255, 0.9);
  margin: 0 auto 16px;
  animation: pbPulse 1.4s ease-in-out infinite;
}

.pb-splash__title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}

.pb-splash__msg {
  margin: 0;
  font-size: 13px;
  color: var(--pb-mute);
  line-height: 1.5;
}

.pb-splash__msg.is-error { color: #e8a0a0; }

@keyframes pbPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1); }
}

/* —— Responsive —— */
@media (max-width: 900px) {
  :root { --pb-thumbs-w: 168px; }
  .pb-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }
}

@media (max-width: 720px) {
  .pb-hide-sm { display: none !important; }

  .pb-header {
    padding: 4px 8px;
  }

  .pb-header__name {
    letter-spacing: 0.12em;
    font-size: 11px;
  }

  .pb-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .pb-icon svg {
    width: 16px;
    height: 16px;
  }

  .pb-arrow {
    width: 28px;
    height: 56px;
    font-size: 30px;
  }

  /* On phone: thumbs overlay instead of shrinking stage too much */
  .pb-thumbs {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 45;
    max-width: min(200px, 72vw);
    width: min(200px, 72vw);
  }

  .pb-footer {
    padding: 0 10px;
    gap: 8px;
  }

  .pb-pager__input { width: 44px; height: 26px; font-size: 11px; }
}

@media (max-width: 420px) {
  .pb-header__icons { gap: 0; }
  .pb-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }
}
