/* Shared project stages (devices, book mockups, deck fans) and the children's book flipbook.
   Used by systems.html and showroom.html. */
/* each case gets a stage: the real work, set in devices, on a soft glow of its own colour */
.cstage { position: relative; aspect-ratio: 16 / 12; isolation: isolate; }
.cstage::before { content: ""; position: absolute; inset: 6% 4%; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: .5; background: radial-gradient(closest-side, var(--glow), transparent); }
.cstage .screen { position: absolute; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 34px 70px -26px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .08); }
.cstage .bar { flex: none; display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; direction: ltr; background: #f1f1f4; color: #666; font-size: 11px; }
.cstage .bar i { width: 9px; height: 9px; border-radius: 50%; background: #d3d3da; }
.cstage .bar span { flex: 1; text-align: center; padding-right: 36px; }
.cstage .view { position: relative; flex: 1; min-height: 0; overflow: hidden; container-type: size; }
.cstage .view img { display: block; width: 100%; height: auto; animation: site-roll 70s linear infinite alternate; will-change: transform; }
@keyframes site-roll { 0%, 3% { transform: translateY(0); } 97%, 100% { transform: translateY(calc(-100% + 100cqh)); } }
.cstage .big { inset: 0 0 12% 12%; }
.cstage .ph { left: 0; bottom: 0; width: 25%; aspect-ratio: 9 / 18.5; border-radius: 22px; border: 5px solid #10162f; }
.cstage .ph.dark { border-color: #2a3150; }
.cstage .badge { position: absolute; z-index: 3; display: grid; place-items: center; border-radius: 50%; box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .7); }
.cstage.peirot { --glow: #6fbf5a; }
.cstage.peirot .badge { right: -2%; top: -6%; width: 22%; aspect-ratio: 1; background: #fbf6e4; }
.cstage.peirot .badge img { width: 74%; }
.cstage.tal { --glow: #2f6bff; }
.cstage.tal .ph { left: 4%; }
.cstage.tal .mode { position: absolute; z-index: 3; right: 3%; bottom: 3%; display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: rgba(10, 18, 44, .85); border: 1px solid rgba(184, 167, 238, .3); direction: ltr; font-size: 12px; }
.cstage.tal .mode b { padding: 5px 12px; border-radius: 999px; font-weight: 500; color: #c3cce2; }
.cstage.tal .mode b.on { background: #fff; color: #0b1020; }
.cstage.olim { --glow: #36d6c6; }
.cstage.bari { --glow: #3f8f96; aspect-ratio: 16 / 13; }
.cstage.bari .big { inset: 0 0 30% 18%; }
.cstage.bari .decks { position: absolute; z-index: 2; right: 0; bottom: 0; width: 56%; aspect-ratio: 16 / 11.5; }
.cstage.bari .decks img { position: absolute; width: 84%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; box-shadow: 0 24px 44px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .1);
  transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.cstage.bari .decks img:nth-child(1) { right: 16%; top: 0; transform: rotate(-5deg); }
.cstage.bari .decks img:nth-child(2) { right: 8%; top: 12%; transform: rotate(-1.5deg); }
.cstage.bari .decks img:nth-child(3) { right: 0; top: 24%; transform: rotate(2deg); }
.cstage.bari:hover .decks img:nth-child(1) { transform: rotate(-9deg) translate(-6%, -6%); }
.cstage.bari:hover .decks img:nth-child(3) { transform: rotate(4deg) translate(3%, 4%); }
.cstage .bookimg { position: absolute; z-index: 3; left: -3%; bottom: -5%; width: 34%; height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); }
.cstage.bari .bookimg { width: 30%; }
.cstage.kids { --glow: #f0903a; cursor: pointer; }
.cstage.kids .spread { position: absolute; top: 2%; right: 0; width: 86%; aspect-ratio: 2 / 1; display: flex; direction: ltr; border-radius: 4px; overflow: hidden;
  box-shadow: 0 34px 70px -26px rgba(0, 0, 0, .85); transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.cstage.kids .spread img { width: 50%; height: 100%; object-fit: cover; display: block; }
.cstage.kids .spread::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent 44%, rgba(0, 0, 0, .14) 49.4%, rgba(0, 0, 0, .3) 50%, rgba(255, 255, 255, .12) 50.6%, transparent 56%); }
.cstage.kids .sheet { position: absolute; z-index: 2; right: 3%; bottom: 0; width: 44%; padding: 2.4%; background: #fff; border-radius: 6px; transform: rotate(2.5deg);
  box-shadow: 0 24px 44px -18px rgba(0, 0, 0, .8); transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.cstage.kids .sheet img { display: block; width: 100%; }
.cstage.kids:hover .spread { transform: translateY(-2%); }
.cstage.kids:hover .sheet { transform: rotate(4deg) translate(2%, 2%); }

/* flipbook: a few spreads only, the book itself stays closed */
.fb-dlg { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--text); }
.fb-dlg::backdrop { background: rgba(4, 8, 22, .9); backdrop-filter: blur(8px); }
.fb-wrap { position: relative; height: 100%; display: grid; place-items: center; padding: 70px 80px 90px; }
.fb { position: relative; width: min(1100px, 100%, (100vh - 180px) * 2); aspect-ratio: 2 / 1; perspective: 2400px; direction: ltr; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.fb.closed { transform: translateX(-25%); }
.fb.closed .pg.l { opacity: 0; }
.fb .pg { position: absolute; top: 0; width: 50%; height: 100%; object-fit: cover; background: #f6efe2; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .8); transition: opacity .35s; }
.fb .pg.l { left: 0; border-radius: 4px 0 0 4px; }
.fb .pg.r { right: 0; border-radius: 0 4px 4px 0; }
.fb .fold { position: absolute; inset: 0; pointer-events: none; z-index: 4; background: linear-gradient(90deg, transparent 45%, rgba(0, 0, 0, .12) 49.4%, rgba(0, 0, 0, .28) 50%, rgba(255, 255, 255, .1) 50.6%, transparent 55%); transition: opacity .35s; }
.fb.closed .fold { opacity: 0; }
.fb .leaf { position: absolute; top: 0; width: 50%; height: 100%; z-index: 5; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.45, .05, .25, 1); }
.fb .leaf img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fb .leaf img.back { transform: rotateY(180deg); }
.fb .leaf.fromL { left: 0; transform-origin: right center; }
.fb .leaf.fromR { right: 0; transform-origin: left center; }
.fb .leaf.fromL.go { transform: rotateY(180deg); }
.fb .leaf.fromR.go { transform: rotateY(-180deg); }
.fb .end { position: absolute; inset: 0 0 0 50%; display: none; flex-direction: column; justify-content: center; gap: 18px; padding: 8%; direction: rtl; text-align: right; border-radius: 0 6px 6px 0;
  background: radial-gradient(circle at 30% 20%, rgba(240, 144, 58, .25), transparent 60%), #0d1530; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(184, 167, 238, .2); }
.fb.last .end { display: flex; }
.fb .end h3 { margin: 0; font-size: clamp(22px, 2.4vw, 34px); font-weight: 300; line-height: 1.2; }
.fb .end p { margin: 0; color: #c3cce2; }
.fb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 54px; height: 54px; border-radius: 50%; border: 1px solid rgba(184, 167, 238, .45); background: rgba(10, 18, 44, .7);
  color: var(--text); font-size: 22px; cursor: pointer; display: grid; place-items: center; transition: opacity .3s, background .3s; }
.fb-nav:hover { background: rgba(139, 108, 255, .3); }
.fb-nav:disabled { opacity: .2; cursor: default; }
.fb-next { left: 18px; } .fb-prev { right: 18px; }
.fb-x { position: absolute; top: 18px; left: 18px; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(184, 167, 238, .45); background: rgba(10, 18, 44, .7); color: var(--text); font-size: 20px; cursor: pointer; }
.fb-count { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); font-size: 13px; letter-spacing: .24em; color: var(--lav); }
@media (max-width: 700px) {
  .fb-wrap { padding: 70px 16px 110px; }
  .fb { width: min(100%, 100vh - 220px); aspect-ratio: 1; perspective: none; }
  .fb.closed { transform: none; }
  .fb .pg { width: 100%; border-radius: 4px; }
  .fb .pg.l { display: none; }
  .fb .fold, .fb .leaf { display: none; }
  .fb .pg.r.swap { animation: pg-in .45s cubic-bezier(.2, .7, .2, 1); }
  .fb .end { inset: 0; border-radius: 6px; }
  .fb-nav { top: auto; bottom: 26px; transform: none; width: 48px; height: 48px; }
  .fb-count { bottom: 42px; }
}
@keyframes pg-in { from { opacity: 0; transform: translateX(var(--from, -14px)); } }
.cstage:focus:not(:focus-visible) { outline: none; }
@media (max-width: 900px) {
  .cstage .ph { width: 30%; border-width: 4px; border-radius: 16px; }
  .cstage .bar { height: 20px; font-size: 9px; }
  .cstage .bar i { width: 7px; height: 7px; }
}
@media (prefers-reduced-motion: reduce) { .cstage .view img { animation: none; } }
