/* =========================================================
   Πάρκο της Αγάπης — Flipbook παραμυθιών (παράθυρο)
   ========================================================= */
html.fb-open { overflow: hidden; }
html.fb-open .dock { opacity: 0; pointer-events: none; }

.fb {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: clamp(12px, 2.2vw, 28px) clamp(12px, 3vw, 40px) clamp(14px, 2.4vw, 26px);
  background: rgba(10, 21, 48, .97);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-family: var(--f, "Geologica", system-ui, sans-serif);
  overflow: hidden;
  opacity: 0; transition: opacity .38s ease;
  -webkit-tap-highlight-color: transparent;
}
.fb.is-open { opacity: 1; }
.fb[hidden] { display: none; }

.fb__glow {
  position: absolute; inset: -20% -10%; pointer-events: none; z-index: -1;
  background:
    radial-gradient(42% 46% at 50% 54%, rgba(244, 182, 63, .30), transparent 70%),
    radial-gradient(30% 30% at 12% 10%, rgba(214, 40, 57, .18), transparent 70%),
    radial-gradient(30% 30% at 90% 90%, rgba(30, 122, 126, .22), transparent 70%);
}

/* ---- πάνω μπάρα ---- */
.fb__top { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 16px; padding-bottom: clamp(10px, 1.6vw, 18px); }
.fb__kicker { grid-column: 1; margin: 0; font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold, #F4B63F); }
.fb__title { grid-column: 1; margin: 2px 0 0; font-size: clamp(1.05rem, .9rem + .8vw, 1.6rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: #fff; }
.fb__close {
  grid-column: 2; grid-row: 1 / span 2;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: #fff; color: var(--navy, #12244D);
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); transition: transform .25s, background-color .25s, color .25s;
}
.fb__close:hover { background: var(--red, #D62839); color: #fff; transform: rotate(90deg); }
.fb__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* ---- σκηνή & βιβλίο ---- */
.fb__stage { position: relative; min-height: 0; }

.fb__book {
  --pw: 300px; --ph: 420px; --shift: 0;
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--pw) * 2); height: var(--ph);
  margin: calc(var(--ph) / -2) 0 0 calc(var(--pw) * -1);
  transform: translateX(calc(var(--shift) * var(--pw)));
  /* perspective εδώ (όχι preserve-3d) ώστε η σειρά των φύλλων να ακολουθεί το z-index */
  perspective: 2600px;
  transition: transform .9s cubic-bezier(.645, .045, .355, 1);
  touch-action: pan-y; user-select: none; cursor: pointer;
}
/* σκιά κάτω από το ανοιχτό βιβλίο */
.fb__book::before {
  content: ""; position: absolute; left: 4%; right: 4%; bottom: -26px; height: 40px; z-index: -1;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.55), transparent 75%);
  filter: blur(6px);
}

.fb__leaf {
  position: absolute; top: 0; left: 50%; width: var(--pw); height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: transform .9s cubic-bezier(.645, .045, .355, 1);
}
.fb__leaf.is-turned { transform: rotateY(-180deg); }

.fb__face {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: #FBF4E4;
}
.fb__face--front { border-radius: 2px 10px 10px 2px; }
.fb__face--back  { border-radius: 10px 2px 2px 10px; transform: rotateY(180deg); }
.fb__face img, .fb__blank { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.fb__blank { background: linear-gradient(135deg, #FBF4E4, #F1E4C6); }

/* σκιά στη ράχη */
.fb__face::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.fb__face--front::after { background: linear-gradient(90deg, rgba(60,30,0,.34) 0, rgba(60,30,0,.10) 3.5%, transparent 9%, transparent 96%, rgba(255,255,255,.10)); }
.fb__face--back::after  { background: linear-gradient(270deg, rgba(60,30,0,.34) 0, rgba(60,30,0,.10) 3.5%, transparent 9%); }

/* φως που περνά πάνω στη σελίδα όσο γυρίζει */
.fb__face::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent 20%, rgba(255,255,255,.35) 50%, rgba(0,0,0,.18) 80%);
}
.fb__leaf.is-moving .fb__face::before { animation: fbShade .9s ease; }
@keyframes fbShade { 0%, 100% { opacity: 0; } 45% { opacity: 1; } }

/* γωνία που «σηκώνεται» στο hover */
@media (hover: hover) {
  .fb__leaf:not(.is-turned) .fb__face--front { transition: clip-path .3s; }
  .fb__book:not(.is-single) .fb__leaf:not(.is-turned):hover { transform: rotateY(-8deg); }
  .fb__book:not(.is-single) .fb__leaf.is-turned:hover { transform: rotateY(-172deg); }
}

/* κινητό: μία σελίδα, οι γυρισμένες σελίδες σβήνουν */
.fb__book.is-single .fb__leaf.is-turned { opacity: 0; transition: transform .9s cubic-bezier(.645, .045, .355, 1), opacity .35s .5s; }
.fb__book.is-single .fb__leaf { transition: transform .9s cubic-bezier(.645, .045, .355, 1), opacity .2s; }
.fb__book.is-single .fb__face--front { border-radius: 4px 12px 12px 4px; }

.no-anim, .no-anim .fb__leaf, .fb__leaf.no-anim { transition: none !important; }

/* ---- κάτω μπάρα ---- */
.fb__bar { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 2vw, 22px); padding-top: clamp(14px, 2vw, 24px); }
.fb__nav {
  min-width: 52px; height: 52px; padding: 0; border-radius: 999px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--gold, #F4B63F); color: var(--navy, #12244D); font: inherit; font-weight: 700; font-size: .86rem;
  box-shadow: 0 12px 26px -12px rgba(244,182,63,.8); transition: transform .2s, background-color .25s, opacity .25s;
}
.fb__nav:hover:not(:disabled) { transform: translateY(-2px); background: #fff; }
.fb__nav:disabled { opacity: .28; cursor: default; box-shadow: none; }
.fb__nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.fb__nav.is-restart { padding: 0 20px 0 16px; white-space: nowrap; background: var(--red, #D62839); color: #fff; box-shadow: 0 12px 26px -12px rgba(214,40,57,.8); }
.fb__nav.is-restart:hover { background: var(--red-2, #B81D2E); }
.fb__nav.is-restart svg { width: 18px; height: 18px; }

.fb__meta { display: grid; gap: 7px; justify-items: center; min-width: 170px; }
.fb__count { font-size: .84rem; font-weight: 600; color: rgba(255,255,255,.86); font-variant-numeric: tabular-nums; }
.fb__progress { width: 150px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.16); overflow: hidden; }
.fb__progress i { display: block; height: 100%; background: var(--gold, #F4B63F); transform-origin: left; transform: scaleX(0); transition: transform .6s ease; }

.fb__hint {
  font-size: .72rem; color: rgba(255,255,255,.62); white-space: nowrap; max-height: 20px;
  transition: opacity .5s, max-height .5s; animation: fbHint 2.4s ease-in-out 1s 2;
}
.fb__hint.is-gone { opacity: 0; max-height: 0; }
@keyframes fbHint { 50% { color: var(--gold, #F4B63F); } }

@media (max-width: 600px) {
  .fb__kicker { font-size: .66rem; }
  .fb__close { width: 42px; height: 42px; }
  .fb__meta { min-width: 130px; }
  .fb__progress { width: 110px; }
  .fb__hint { font-size: .66rem; }
  .fb__nav.is-restart { padding: 0; width: 52px; }
  .fb__nav.is-restart span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fb, .fb__book, .fb__leaf { transition-duration: .01s !important; }
  .fb__leaf.is-moving .fb__face::before, .fb__hint { animation: none; }
}

/* ---- στην αρχική: τα εξώφυλλα ανοίγουν κι αυτά το βιβλίο ---- */
.tales__book[data-flip] { cursor: pointer; }
