/* ==========================================================================
   NPH Interactive Booklet
   ========================================================================== */
:root {
  --navy-900: #061f33;
  --navy-800: #082f4b;
  --navy-700: #0b3f63;
  --blue: #0b5583;
  --blue-2: #1f78b4;
  --green: #3fae5a;
  --teal: #12a08f;
  --mint: #85bba2;
  --paper: #fbfbf8;
  --ink: #0d2a40;
  --glass: rgba(255, 255, 255, .08);
  --glass-line: rgba(255, 255, 255, .14);
  --pw: 400px;
  --ph: 566px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: "Cairo", "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
  color: #fff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--navy-700) 0%, var(--navy-800) 45%, var(--navy-900) 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
img { -webkit-user-drag: none; user-select: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .flip-x { transform: scaleX(-1); }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

/* ---------- Ambient backdrop ---------- */
.backdrop { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.glow { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; will-change: transform; }
.g1 { width: 46vmax; height: 46vmax; background: #1b6fa3; top: -18vmax; inset-inline-start: -12vmax; animation: drift1 22s ease-in-out infinite alternate; }
.g2 { width: 36vmax; height: 36vmax; background: #1f8f6e; bottom: -16vmax; inset-inline-end: -10vmax; opacity: .38; animation: drift2 26s ease-in-out infinite alternate; }
.g3 { width: 22vmax; height: 22vmax; background: #3fae5a; top: 40%; left: 55%; opacity: .16; animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(8vmax, 6vmax) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-6vmax, -8vmax) scale(1.15); } }
@keyframes drift3 { to { transform: translate(-14vmax, 10vmax) scale(.9); } }

/* ==========================================================================
   Language gate
   ========================================================================== */
.gate {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 24px calc(24px + var(--safe-b));
  overflow-y: auto;
  transition: opacity .6s var(--ease-out), visibility .6s;
}
.gate.leaving { opacity: 0; visibility: hidden; pointer-events: none; }
.gate-inner {
  width: min(1040px, 100%); margin: auto;
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: center; gap: clamp(28px, 6vw, 88px);
}
.gate-book-wrap { position: relative; justify-self: center; perspective: 1600px; width: min(330px, 34vw); }
.gate-book {
  position: relative; aspect-ratio: 420 / 595; width: 100%;
  transform-style: preserve-3d;
  transform: rotateY(-18deg) rotateX(4deg);
  animation: bookIn 1.1s var(--ease-out) both, bookFloat 6s ease-in-out 1.1s infinite;
}
.gate-book .gate-cover {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: 3px 8px 8px 3px; display: block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
  backface-visibility: hidden; overflow: hidden; background: #0a3a5c;
}
.gate-book::after { /* spine highlight */
  content: ""; position: absolute; inset: 0; border-radius: 3px 8px 8px 3px; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.28) 0, rgba(255,255,255,.35) 1.6%, rgba(0,0,0,.08) 3.5%, transparent 9%, transparent 80%, rgba(255,255,255,.12) 100%);
}
.gate-book-edge { /* page block thickness */
  position: absolute; top: 1.2%; bottom: 1.2%; right: 0; width: 18px;
  transform-origin: right center; transform: rotateY(90deg);
  background: repeating-linear-gradient(90deg, #f3f2ec 0 1px, #d9d7cf 1px 2px);
}
.gate-book-shadow {
  position: absolute; left: 8%; right: 0; bottom: -28px; height: 30px;
  background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent);
  filter: blur(6px);
  animation: shadowPulse 6s ease-in-out 1.1s infinite;
}
@keyframes bookIn { from { opacity: 0; transform: translateY(40px) rotateY(-55deg) rotateX(10deg); } }
@keyframes bookFloat { 50% { transform: translateY(-12px) rotateY(-12deg) rotateX(2deg); } }
@keyframes shadowPulse { 50% { transform: scale(.85); opacity: .7; } }

.gate-copy { display: flex; flex-direction: column; gap: 18px; }
.gate-copy > * { animation: rise .9s var(--ease-out) both; }
.gate-copy > :nth-child(1) { animation-delay: .15s; }
.gate-copy > :nth-child(2) { animation-delay: .25s; }
.gate-copy > :nth-child(3) { animation-delay: .35s; }
.gate-copy > :nth-child(4) { animation-delay: .45s; }
.gate-copy > :nth-child(5) { animation-delay: .55s; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } }

.gate-brand {
  align-self: flex-start;
  background: #fff; border-radius: 18px; padding: 10px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.gate-logo { display: block; height: 46px; width: auto; }
.gate-title { margin: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.gate-title .t-ar { font-size: clamp(22px, 2.6vw, 32px); font-weight: 800; text-align: left; text-wrap: balance; }
.gate-title .t-en { font-size: clamp(17px, 1.9vw, 23px); font-weight: 600; color: #cfe3f1; }
.gate-prompt {
  margin: 6px 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  color: var(--mint); font-weight: 600; font-size: 15px; letter-spacing: .2px;
}
.gate-prompt .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6; }

.lang-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.lang-btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center;
  column-gap: 12px; text-align: start;
  padding: 18px 20px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,.06));
  border: 1px solid var(--glass-line);
  box-shadow: 0 12px 30px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.12);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .35s var(--ease-spring), border-color .3s, box-shadow .3s, opacity .4s;
}
.lang-btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: linear-gradient(135deg, var(--blue-2), var(--teal) 70%, var(--green));
  transition: opacity .35s;
}
.lang-btn:hover, .lang-btn:focus-visible { transform: translateY(-4px); border-color: rgba(255,255,255,.35); box-shadow: 0 18px 40px rgba(0,0,0,.3); }
.lang-btn:hover::before, .lang-btn:focus-visible::before, .lang-btn.chosen::before { opacity: 1; }
.lang-btn:active { transform: translateY(-1px) scale(.98); }
.lang-big { font-size: 26px; font-weight: 800; line-height: 1.2; }
.lang-small { grid-row: 2; font-size: 14px; color: #d6e8f3; font-weight: 600; }
.lang-arrow { grid-row: 1 / span 2; grid-column: 2; width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: rgba(255,255,255,.14); transition: transform .35s var(--ease-out); }
.lang-btn[dir="ltr"]:hover .lang-arrow { transform: translateX(4px); }
.lang-btn[dir="rtl"]:hover .lang-arrow { transform: translateX(-4px); }
.gate.choosing .lang-btn:not(.chosen) { opacity: .25; transform: scale(.96); }
.gate.choosing .lang-btn.chosen { transform: scale(1.03); }

.gate-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.gate-meta .chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.06); border: 1px solid var(--glass-line); color: #cfe3f1; font-size: 13px; font-weight: 600;
}
.gate-meta .chip b { color: #fff; font-size: 15px; font-weight: 800; }
.gate-meta .chip [lang="ar"] { opacity: .8; }
.gate-links { display: flex; flex-wrap: wrap; gap: 10px; }
.gate-link {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px;
  background: rgba(255,255,255,.06); border: 1px solid var(--glass-line); color: #e6f1f8; text-decoration: none;
  font-size: 14px; font-weight: 700; transition: background .25s, transform .25s var(--ease-spring), border-color .25s;
}
.gate-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.gate-link [lang="ar"] { opacity: .75; font-weight: 600; }
.gate-link:hover { background: rgba(255,255,255,.14); transform: translateY(-2px); }
.gate-link.wa:hover { background: #25d366; border-color: #25d366; color: #fff; }
.gate-link.wa:hover [lang="ar"] { opacity: .95; }


@media (max-width: 760px) {
  .gate { padding: 28px 18px calc(28px + var(--safe-b)); }
  .gate-inner { grid-template-columns: 1fr; gap: 26px; text-align: center; }
  .gate-book-wrap { width: min(210px, 52vw); margin-top: 8px; }
  .gate-copy { align-items: center; }
  .gate-brand { display: none; }        /* the cover already shows the logo */
  .gate-logo { height: 38px; }
  .gate-title, .gate-title .t-ar { text-align: center; align-items: center; }
  .gate-prompt { justify-content: center; }
  .lang-buttons { width: 100%; grid-template-columns: 1fr; }
  .gate-meta { justify-content: center; }
  .gate-links { justify-content: center; }
}

/* ==========================================================================
   Reader
   ========================================================================== */
.reader {
  position: fixed; inset: 0; z-index: 2;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  opacity: 0; transition: opacity .5s var(--ease-out);
}
.reader.show { opacity: 1; }

.topbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 12px clamp(12px, 3vw, 28px) 0;
  height: 64px;
}
.brand-btn {
  justify-self: start; max-width: 100%;
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 6px 14px 6px 8px; border-radius: 16px;
  transition: background .25s;
}
[dir="rtl"] .brand-btn { padding: 6px 8px 6px 14px; }
.brand-btn:hover { background: var(--glass); }
.brand-btn img { height: 38px; width: auto; background: #fff; border-radius: 11px; padding: 5px 8px; box-sizing: content-box; height: 26px; }
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e6f1f8; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line);
  font-weight: 700; font-size: 15px;
  transition: background .25s, transform .25s var(--ease-spring);
}
.pill-btn:hover { background: rgba(255,255,255,.16); transform: translateY(-1px); }
.pill-btn.icon-only { width: 40px; padding: 0; justify-content: center; }
.pill-btn svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
a.pill-btn { color: inherit; text-decoration: none; }
.pill-btn.wa:hover { background: #25d366; border-color: #25d366; color: #fff; }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }

/* current section, centred in the top bar */
.now { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: min(46vw, 560px); text-align: center; line-height: 1.25; }
.now-k { font-size: 11.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mint); }
[dir="rtl"] .now-k { letter-spacing: 0; font-size: 12.5px; }
.now-t { max-width: 100%; font-size: 16px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now.swap > * { animation: nowIn .45s var(--ease-out) both; }
.now.swap .now-t { animation-delay: .04s; }
@keyframes nowIn { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } }
.pill-btn svg { width: 18px; height: 18px; }

/* ---------- Stage & book ---------- */
.stage {
  position: relative; display: grid; place-items: center; min-height: 0; min-width: 0;
  overflow: hidden;
  touch-action: none;
}
.book {
  position: relative;
  width: calc(var(--pw) * 2); height: var(--ph);
  perspective: calc(var(--pw) * 4.2);
  transition: transform .75s var(--ease-out);
  user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.book.single { width: var(--pw); }
.book::after {
  content: ""; position: absolute; z-index: -1; left: 3%; right: 3%; bottom: -22px; height: 44px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 8, 16, .55), transparent); filter: blur(10px);
}
.book.dragging { cursor: grabbing; }
.book.enter { animation: bookEnter .7s var(--ease-out) both; }
@keyframes bookEnter { from { opacity: 0; transform: var(--shift, translateX(0)) scale(.92) translateY(14px); } }
.book.swap-out { transition: opacity .25s, transform .25s; opacity: 0; transform: var(--shift, translateX(0)) scale(.96); }

.slot, .leaf {
  position: absolute; top: 0; width: var(--pw); height: var(--ph);
}
.slot { background: var(--paper); box-shadow: 0 30px 60px -20px rgba(0,0,0,.55), 0 10px 22px -8px rgba(0,0,0,.35); }
.slot.empty { visibility: hidden; }
.book:not(.single) .slot.side-l { border-radius: 4px 0 0 4px; }
.book:not(.single) .slot.side-r { border-radius: 0 4px 4px 0; }
.book.single .slot { border-radius: 4px; }
.content, .face-content { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
.content > img, .face-content > img { width: 100%; height: 100%; display: block; object-fit: cover; }

/* page-block thickness on the outer edges */
.slot.side-l::before, .slot.side-r::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; width: var(--edge, 0px);
  background: repeating-linear-gradient(90deg, #ecebe4 0 1px, #c9c7bf 1px 2px);
  border-radius: 2px;
}
.slot.side-l::before { right: 100%; }
.slot.side-r::before { left: 100%; }

/* fold shading at the spine */
.fold { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
.book:not(.single) .side-l .fold { background: linear-gradient(to left, rgba(0,0,0,.20), rgba(0,0,0,.06) 4%, transparent 12%), linear-gradient(to right, rgba(255,255,255,.18), transparent 3%); }
.book:not(.single) .side-r .fold { background: linear-gradient(to right, rgba(0,0,0,.20), rgba(0,0,0,.06) 4%, transparent 12%), linear-gradient(to left, rgba(255,255,255,.18), transparent 3%); }
.book.single .fold { background: linear-gradient(to var(--spine-dir, right), transparent 92%, rgba(0,0,0,.05)); }

/* shadow cast by a turning page */
.cast { position: absolute; inset: 0; pointer-events: none; opacity: 0; border-radius: inherit; }
.side-l .cast { background: linear-gradient(to left, rgba(0,0,0,.45), rgba(0,0,0,.12) 30%, transparent 65%); }
.side-r .cast { background: linear-gradient(to right, rgba(0,0,0,.45), rgba(0,0,0,.12) 30%, transparent 65%); }

/* corner peel affordance on the page you can turn */
.peel {
  position: absolute; bottom: 0; width: 0; height: 0; pointer-events: none;
  transition: width .3s var(--ease-out), height .3s var(--ease-out);
  filter: drop-shadow(-2px -2px 3px rgba(0,0,0,.25));
}
.side-r .peel { right: 0; background: linear-gradient(135deg, #f7f6f1 0 50%, transparent 50%); border-radius: 0 0 4px 0; }
.side-l .peel { left: 0; background: linear-gradient(225deg, #f7f6f1 0 50%, transparent 50%); filter: drop-shadow(2px -2px 3px rgba(0,0,0,.25)); }
.slot.turnable:hover .peel { width: 34px; height: 34px; }
.slot.turnable.hinting .peel { animation: peelHint 1.6s ease-in-out 3; }
@keyframes peelHint { 0%, 100% { width: 0; height: 0; } 45% { width: 46px; height: 46px; } }
@media (hover: none) { .slot.turnable:hover .peel { width: 0; height: 0; } }

/* the turning leaf */
.leaf {
  z-index: 5; transform-style: preserve-3d; -webkit-transform-style: preserve-3d;
  will-change: transform; pointer-events: none;
}
.face {
  position: absolute; inset: 0; background: var(--paper);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.face.back { transform: rotateY(180deg); }
.leaf.origin-l .face.front, .leaf.origin-r .face.back { border-radius: 0 4px 4px 0; }
.leaf.origin-r .face.front, .leaf.origin-l .face.back { border-radius: 4px 0 0 4px; }
.book.single .leaf .face { border-radius: 4px; }
.ffold { position: absolute; inset: 0; pointer-events: none; }
.book:not(.single) .leaf.origin-l .front .ffold,
.book:not(.single) .leaf.origin-r .back .ffold { background: linear-gradient(to right, rgba(0,0,0,.20), rgba(0,0,0,.06) 4%, transparent 12%); }
.book:not(.single) .leaf.origin-r .front .ffold,
.book:not(.single) .leaf.origin-l .back .ffold { background: linear-gradient(to left, rgba(0,0,0,.20), rgba(0,0,0,.06) 4%, transparent 12%); }
.face.paper-back { background: linear-gradient(90deg, #ecebe5, #f8f7f2 40%, #f1f0ea); }
.face .shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.leaf.origin-l .face.front .shade { background: linear-gradient(to right, rgba(0,0,0,.05), rgba(0,0,0,.35)); }
.leaf.origin-r .face.front .shade { background: linear-gradient(to left, rgba(0,0,0,.05), rgba(0,0,0,.35)); }
.leaf.origin-l .face.back .shade { background: linear-gradient(to left, rgba(0,0,0,.05), rgba(0,0,0,.3)); }
.leaf.origin-r .face.back .shade { background: linear-gradient(to right, rgba(0,0,0,.05), rgba(0,0,0,.3)); }
.face .gloss { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: soft-light; }
.leaf.origin-l .face.front .gloss { background: linear-gradient(to right, transparent 40%, rgba(255,255,255,.9) 70%, transparent 95%); }
.leaf.origin-r .face.front .gloss { background: linear-gradient(to left, transparent 40%, rgba(255,255,255,.9) 70%, transparent 95%); }

/* side arrows (desktop) */
.side-nav {
  position: absolute; top: 50%; z-index: 6;
  width: 52px; height: 52px; margin-top: -26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .25s, transform .3s var(--ease-spring), opacity .3s;
}
.side-nav:hover { background: rgba(255,255,255,.18); transform: scale(1.08); }
.side-nav:disabled { opacity: 0; pointer-events: none; }
.side-nav.prev { inset-inline-start: clamp(10px, 2vw, 28px); }
.side-nav.next { inset-inline-end: clamp(10px, 2vw, 28px); }
.side-nav svg { width: 26px; height: 26px; }
@media (max-width: 899px), (hover: none) { .side-nav { display: none; } }

.hint {
  position: absolute; left: 50%; bottom: 8px; z-index: 7;
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  background: rgba(6, 31, 51, .78); border: 1px solid var(--glass-line);
  font-size: 14px; font-weight: 600;
  transition: opacity .4s, transform .4s var(--ease-out);
}
.hint.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Dock ---------- */
.dock {
  position: relative;
  justify-self: center;
  display: flex; align-items: center; gap: 6px;
  margin: 0 12px calc(14px + var(--safe-b));
  padding: 6px; border-radius: 22px;
  background: rgba(6, 31, 51, .55); border: 1px solid var(--glass-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0,0,0,.3);
  max-width: calc(100vw - 24px);
}
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 14px;
  display: grid; place-items: center;
  transition: background .2s, transform .25s var(--ease-spring), opacity .2s;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn:active { transform: scale(.92); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.icon-btn.active { background: rgba(133, 187, 162, .25); color: #c9f0dc; }
.icon-btn.dark { color: var(--ink); }
.icon-btn.dark:hover { background: rgba(11, 85, 131, .08); }
.dock-sep { width: 1px; height: 26px; background: var(--glass-line); margin: 0 4px; flex-shrink: 0; }
.dock-progress { position: relative; display: flex; align-items: center; gap: 12px; padding: 0 8px; min-width: 0; }
.dock-meter { display: none; }

.scrub {
  position: absolute; bottom: calc(100% + 20px); left: var(--x, 50%); z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 8px 8px 7px; border-radius: 14px;
  background: rgba(6, 31, 51, .94); border: 1px solid var(--glass-line);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transform: translate(-50%, 8px) scale(.94); transform-origin: 50% 100%;
  transition: opacity .18s, transform .22s var(--ease-out);
}
.scrub.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.scrub::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -7px; border: 7px solid transparent; border-top-color: rgba(6, 31, 51, .94); }
.scrub-pages { display: flex; --k: .14; direction: ltr; }
.scrub .mini { width: 84px; flex-shrink: 0; border-radius: 3px; box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.scrub .mini + .mini { border-radius: 0 3px 3px 0; }
.scrub .mini:first-child:not(:last-child) { border-radius: 3px 0 0 3px; }
.scrub-label { display: flex; align-items: baseline; gap: 7px; max-width: 190px; font-size: 12.5px; font-weight: 700; color: #dbeaf4; white-space: nowrap; }
.scrub-label b { color: var(--mint); font-variant-numeric: tabular-nums; direction: ltr; }
.scrub-label span { overflow: hidden; text-overflow: ellipsis; }
.indicator { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; color: #dbeaf4; min-width: 64px; text-align: center; direction: ltr; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: clamp(120px, 22vw, 280px); height: 22px; background: transparent; margin: 0; cursor: pointer;
  --fill: 0%;
}
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 99px; background: linear-gradient(90deg, var(--mint) var(--fill), rgba(255,255,255,.18) var(--fill)); }
[dir="rtl"] input[type="range"]::-webkit-slider-runnable-track { background: linear-gradient(270deg, var(--mint) var(--fill), rgba(255,255,255,.18) var(--fill)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6.5px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: transform .2s; }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 99px; background: rgba(255,255,255,.18); }
input[type="range"]::-moz-range-progress { height: 5px; border-radius: 99px; background: var(--mint); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }

@media (max-width: 900px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .brand-name { display: none; }
  .now { align-items: flex-start; text-align: start; max-width: 100%; }
}
@media (max-width: 640px) {
  .topbar { height: 56px; padding-top: 8px; gap: 8px; }
  .now-t { font-size: 14.5px; }
  .now-k { font-size: 10.5px; }
  .pill-btn { padding: 0 12px; font-size: 14px; }
  .pill-btn.icon-only { width: 40px; padding: 0; }
  .top-actions { gap: 6px; }
  .pill-btn.icon-only { width: 36px; height: 36px; }
  .pill-btn { height: 36px; }
  .dock-meter { display: block; position: absolute; top: -1px; left: 18px; right: 18px; height: 2px; border-radius: 2px; overflow: hidden; background: rgba(255,255,255,.1); }
  .dock-meter i { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: var(--p, 0%); background: linear-gradient(90deg, var(--teal), var(--mint)); border-radius: 2px; transition: width .5s var(--ease-out); }
  .dock { gap: 2px; }
  .dock-progress { padding: 0 2px; }
  input[type="range"] { display: none; }
  .icon-btn { width: 42px; height: 42px; }
  .hint { white-space: normal; text-align: center; width: max-content; max-width: 86vw; }
}
@media (max-width: 380px) { #langBtnText { font-size: 13px; } }

/* ==========================================================================
   Contents drawer
   ========================================================================== */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 20; background: rgba(3, 16, 27, .5);
  opacity: 0; transition: opacity .35s;
}
.drawer-scrim.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 21;
  width: min(460px, 100vw);
  display: flex; flex-direction: column;
  background: #f5f8fa; color: var(--ink);
  box-shadow: -20px 0 60px rgba(0,0,0,.35);
  transform: translateX(105%); visibility: hidden;
  transition: transform .45s var(--ease-out), visibility .45s;
}
[dir="rtl"] .drawer { transform: translateX(-105%); box-shadow: 20px 0 60px rgba(0,0,0,.35); }
.drawer.open { transform: none !important; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px 22px; }
.drawer-head h2 { margin: 0; font-size: 22px; font-weight: 800; color: var(--blue); }
.search {
  display: flex; align-items: center; gap: 10px; margin: 6px 18px 10px;
  padding: 0 14px; height: 46px; border-radius: 14px;
  background: #fff; border: 1px solid #dbe5ec; color: #6a8597;
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--blue-2); box-shadow: 0 0 0 4px rgba(31,120,180,.12); }
.search input { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: 15px; color: var(--ink); min-width: 0; }
.search svg { width: 19px; height: 19px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 18px calc(24px + var(--safe-b)); overscroll-behavior: contain; }
.toc-section {
  position: sticky; top: -4px; z-index: 2; display: flex; align-items: center; gap: 8px;
  margin: 6px -18px 8px; padding: 10px 18px 8px; background: rgba(245, 248, 250, .94); backdrop-filter: blur(6px);
  font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: #7a95a7;
}
[dir="rtl"] .toc-section { letter-spacing: 0; font-size: 13px; }
.toc-section .cnt { padding: 1px 8px; border-radius: 999px; background: #e3edf3; color: var(--blue); font-size: 11.5px; letter-spacing: 0; }
.toc-group[data-group="about"] .toc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.toc-group[data-group="about"] .toc-item .name { font-size: 12px; }
.toc-group[data-group="products"] .toc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.toc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.toc-item {
  display: flex; flex-direction: column; gap: 6px; text-align: start;
  padding: 6px; border-radius: 12px;
  transition: background .2s, transform .25s var(--ease-out);
  animation: rise .5s var(--ease-out) both;
}
.toc-item:hover { background: #e6eef4; transform: translateY(-2px); }
.toc-item .mini, .toc-item .prod {
  display: block; width: 100%; aspect-ratio: 600 / 850; border-radius: 6px; overflow: hidden; position: relative;
  background: #e4ebf0; box-shadow: 0 4px 14px rgba(13,42,64,.14);
}
/* product cards */
.toc-item.p { padding: 0; gap: 0; overflow: hidden; border-radius: 16px; background: #fff; border: 1px solid #e3ebf0; box-shadow: 0 6px 18px -10px rgba(13,42,64,.35); }
.toc-item.p:hover { background: #fff; transform: translateY(-3px); box-shadow: 0 14px 28px -14px rgba(13,42,64,.45); }
.toc-item.p .prod { aspect-ratio: 1100 / 790; border-radius: 0; box-shadow: none; }
.toc-item.p .meta { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px; padding: 8px 11px 10px; }
.toc-item.p .no { grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #eef4f7; color: var(--blue); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.toc-item.p .name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-item.p.current { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal), 0 10px 24px -12px rgba(18,160,143,.6); }
.toc-item.p.current .prod { outline: 0; }
.toc-item.p.current .no { background: var(--teal); color: #fff; }
.toc-item .prod { display: grid; place-items: center; overflow: hidden; background: linear-gradient(165deg, #e3f4f0, #fff 80%); }
.toc-item .prod.acc-1 { background: linear-gradient(165deg, #e4eff8, #fff 80%); }
.toc-item .prod.acc-2 { background: linear-gradient(165deg, #e7f5ea, #fff 80%); }
.toc-item .prod.acc-3 { background: linear-gradient(165deg, #e2edf4, #fff 80%); }
.toc-item .prod img { width: 100%; height: 100%; object-fit: contain; transition: transform .35s var(--ease-out); }
.toc-item.p:hover .prod img { transform: scale(1.05); }
.toc-item .name { font-size: 13px; font-weight: 700; line-height: 1.25; color: var(--ink); }
.toc-item .pg-n { font-size: 11.5px; color: #7a95a7; font-weight: 600; }
.toc-item.current .mini, .toc-item.current .prod { outline: 3px solid var(--teal); outline-offset: 2px; }
.toc-empty { padding: 30px 0; text-align: center; color: #7a95a7; font-weight: 600; }

/* ==========================================================================
   Zoom viewer
   ========================================================================== */
.zoom {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(3, 14, 24, .94);
  animation: fadeIn .3s ease both;
}
@keyframes fadeIn { from { opacity: 0; } }
.zoom-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.zoom-viewport.panning { cursor: grabbing; }
.zoom-canvas {
  position: absolute; left: 0; top: 0; display: flex; gap: 0;
  transform-origin: 0 0; will-change: transform;
}
.zpage { position: relative; height: 100%; flex: 1; background: #fff; overflow: hidden; }
.zoom-canvas.animate { transition: transform .3s var(--ease-out); }
.zoom-tools {
  position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 20px;
  background: rgba(6, 31, 51, .8); border: 1px solid var(--glass-line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}

@media (prefers-reduced-motion: reduce) {
  .glow, .gate-book, .gate-book-shadow { animation: none !important; }
  .gate-copy > * { animation-duration: .01s; }
}

/* narrow phones: four buttons in the top bar, so the language button shows its globe icon only */
@media (max-width: 480px) {
  #langBtnText { display: none; }
  #langBtn { width: 36px; padding: 0; justify-content: center; }
}
