:root {
  --ink: #fffaf0;
  --sun: #ffc93c;
  --shadow: rgba(20, 12, 0, .55);
}
* { box-sizing: border-box; margin: 0; }
html { background: #0b0a08; }
body {
  background: #0b0a08;
  color: var(--ink);
  font-family: "Fredoka", system-ui, sans-serif;
}

.stage { position: fixed; inset: 0; overflow: hidden; }
#film, #dust { position: absolute; inset: 0; width: 100%; height: 100%; }
#film { transform-origin: 50% 50%; will-change: transform; }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(0,0,0,.45) 100%);
}

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 28px;
  font-weight: 600; letter-spacing: .02em;
  text-shadow: 0 2px 12px var(--shadow);
}
.top { transition: opacity .4s ease; }
.top.gone { opacity: 0; pointer-events: none; }
.brand { font-size: 1.1rem; }
.loader { font-size: .9rem; opacity: .85; transition: opacity .6s; }
.loader.done { opacity: 0; }

/* the scroll track: 1800vh of scrolling for the 90 s film */
#scroller { position: relative; z-index: 2; height: 1800vh; }
.beat {
  position: fixed; left: 6vw; bottom: 12vh; max-width: min(560px, 88vw);
  opacity: 0; transform: translateY(24px);
  transition: opacity .5s ease, transform .5s ease;
  text-shadow: 0 3px 18px var(--shadow);
  pointer-events: none;
}
.beat.on { opacity: 1; transform: none; }
.kicker { color: var(--sun); font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
h1, h2 { font-weight: 700; line-height: 1.02; font-size: clamp(2.2rem, 6vw, 4.6rem); }
.lead { margin-top: 12px; font-size: clamp(1.05rem, 1.8vw, 1.35rem); font-weight: 500; }

.hint {
  position: fixed; z-index: 3; left: 50%; bottom: 22px; transform: translateX(-50%);
  font-weight: 600; opacity: .8; text-shadow: 0 2px 10px var(--shadow);
  animation: bob 1.6s ease-in-out infinite; transition: opacity .4s;
}
.hint.gone { opacity: 0; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

@media (prefers-reduced-motion: reduce) { .hint { animation: none; } }

/* opening: the walk to the storybook plays as a video above the scroll film */
.intro { position: absolute; inset: 0; z-index: 1; }   /* opacity follows the scroll (main.js) */
.frame16 {
  /* same cover-fit (+6%) as the canvas, so the hand-off to frame 1 lines up */
  position: absolute; left: 50%; top: 50%;
  width: max(106vw, calc(106vh * 16 / 9)); aspect-ratio: 16 / 9;
  translate: -50% -50%;
  transform-origin: 50% 50%; will-change: transform;
}
#introVid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* the empty gold plaque on the cover gets the title in the visitor's language */
.plaque {
  /* a flat box mapped onto the plaque's 4 corners with matrix3d (set in main.js),
     so the title follows the cover's perspective */
  position: absolute; left: 0; top: 0; width: 400px; height: 100px;
  transform-origin: 0 0;
  display: grid; place-items: center; container-type: inline-size;
}
#bookTitle {
  font-family: "Fredoka", sans-serif; font-weight: 700; white-space: pre-line; text-align: center;
  font-size: var(--title-size, 13cqw); line-height: .98;
  /* one gold gradient per line, so a two-line title shines the same on both */
  background: linear-gradient(180deg, #fff1b8 0%, #f2c14e 45%, #b9801f 100%) 0 0 / 100% .98em repeat-y;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(60, 35, 0, .7)) drop-shadow(0 0 10px rgba(255, 200, 90, .55));
  opacity: 0; transform: scale(.94);
  transition: opacity 1.4s ease, transform 1.4s ease;
}
html[lang="ar"] #bookTitle { font-family: "Baloo Bhaijaan 2", sans-serif; font-weight: 800; }
.intro.titled #bookTitle { opacity: 1; transform: none; }

.cta {
  position: fixed; z-index: 4; left: 50%; bottom: 56px; translate: -50% 0;
  display: flex; gap: 12px; align-items: center; justify-content: center;
  width: max-content; max-width: calc(100vw - 32px); flex-wrap: wrap;
  opacity: 0; pointer-events: none; transition: opacity .6s ease;
}
.cta.on { opacity: 1; pointer-events: auto; }
.open {
  font: 600 1.05rem "Fredoka", sans-serif; color: #2b1a00;
  padding: 14px 26px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #ffe08a, #f2b632);
  box-shadow: 0 8px 30px rgba(255, 190, 60, .45), inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .2s ease, background-color .2s ease;
}
.spark { width: 1.05em; height: 1.05em; margin-left: .4em; vertical-align: -.17em; fill: #a8640f; }
.open.alt {
  color: #fff4d6; background: rgba(30, 18, 6, .45);
  box-shadow: inset 0 0 0 1.5px rgba(255, 215, 106, .7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.open.alt:hover { background-color: rgba(30, 18, 6, .65); }
.open:hover { transform: translateY(-2px); }
.open:active { transform: scale(.97); }

/* golden burst that carries the visitor straight to the shop */
.warp {
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
  background:
    radial-gradient(circle at var(--x, 50%) var(--y, 80%), #fff8dc 0, #ffd76a 18%, #f2a93b 42%, #3a2108 75%);
  clip-path: circle(0% at var(--x, 50%) var(--y, 80%));
  opacity: 1;
}
.warp.go { transition: clip-path .75s cubic-bezier(.6, 0, .4, 1); clip-path: circle(150% at var(--x, 50%) var(--y, 80%)); }
.warp.out { transition: opacity .7s ease; opacity: 0; clip-path: circle(150% at var(--x, 50%) var(--y, 80%)); }
.warp::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 70% 20%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 40% 70%, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 85% 60%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 10% 85%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 55% 45%, #fff 50%, transparent 51%);
  animation: twinkle .8s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .3; transform: translateY(-12px); } }
@media (prefers-reduced-motion: reduce) { .warp.go { transition: none; } }
html[lang="ar"] .open, html[lang="ar"] .beat { font-family: "Baloo Bhaijaan 2", sans-serif; }

/* ---- shop: a normal page section that slides up over the last frame ---- */
.store {
  position: relative; z-index: 3;
  padding: 18vh 6vw 0;
  background: linear-gradient(180deg, rgba(26, 15, 6, 0) 0, rgba(26, 15, 6, .88) 14vh, #1a0f06 30vh);
}
.store-in { max-width: 1180px; margin: 0 auto; }
.store h2 { font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.02; }
.store .lead { color: #f3e2c4; max-width: 60ch; }
.grid {
  list-style: none; padding: 0; margin: 48px 0 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px;
}
.prod {
  background: #fff8ec; color: #2b1a00; border-radius: 26px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.2), box-shadow .3s ease;
}
.prod:hover, .prod.is-touched { transform: translateY(-6px); box-shadow: 0 26px 60px rgba(0, 0, 0, .45); }
.prod-img {
  aspect-ratio: 1; display: grid; place-items: center;
  background: #fff;
}
.prod-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .4s ease; }
.prod:hover .prod-img img, .prod.is-touched .prod-img img { transform: scale(1.04); }
.prod-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prod-tag { color: #b5741a; font-weight: 600; font-size: .92rem; }
.prod h3 { font-size: 1.4rem; line-height: 1.1; }
.prod-body p { font-size: 1rem; line-height: 1.45; color: #5a4220; }
.prod-soon {
  margin-top: auto; align-self: start; padding: 8px 16px; border-radius: 999px;
  background: #2b1a00; font-weight: 600; font-size: .92rem;
}
.prod-body .prod-soon { color: #ffe08a; /* beats .prod-body p */
}
.foot { text-align: center; padding: 70px 0 40px; color: #c9b48f; font-size: .95rem; }
.credit { display: block; margin-top: 10px; font-size: .85rem; color: #a8946f; }
.credit a { color: #ffd76a; text-decoration: none; font-weight: 600; border-bottom: 1px solid rgba(255, 215, 106, .35); transition: border-color .2s ease; }
.credit a:hover { border-color: #ffd76a; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; } }
@media (max-width: 520px) {
  .store { padding: 14vh 16px 0; }
  .grid { gap: 12px; margin-top: 32px; }
  .prod { border-radius: 18px; }
  .prod-body { padding: 12px 12px 14px; gap: 4px; }
  .prod h3 { font-size: 1.08rem; }
  .prod-body p { font-size: .95rem; }
  .prod-tag { font-size: .85rem; }
  .prod-soon { padding: 6px 11px; font-size: .85rem; }
}
html[lang="ar"] .store { font-family: "Baloo Bhaijaan 2", sans-serif; }
