: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; }

/* words over the walk-in video, gone once the visitor reaches the book */
.magic {
  position: fixed; inset: 0; z-index: 2; width: 100%; height: 100%;
  pointer-events: none; mix-blend-mode: screen; opacity: .85;
  transition: opacity 1.8s ease-in-out;    /* the light dims slowly, no sudden darkening */
}
.magic.gone { opacity: 0; }
.intro-title {
  position: fixed; z-index: 3; left: 0; right: 0; top: 14vh; padding: 0 6vw;
  text-align: center; pointer-events: none;
  transition: opacity .9s ease, transform .9s ease;
}
.intro-title .badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px; margin-bottom: 18px;
  background: rgba(40, 22, 4, .38); border: 1px solid rgba(255, 215, 106, .45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #fff1cc; font-size: .95rem; font-weight: 600; letter-spacing: .02em;
}
.intro-title .badge svg { width: 16px; height: 16px; fill: #ffd76a; }
.intro-title .it-1 {
  color: #fff8e6; font-weight: 600; font-size: clamp(1.4rem, 3.2vw, 2.2rem);
  text-shadow: 0 3px 20px rgba(20, 10, 0, .6);
}
.intro-title .it-h {
  font-size: clamp(3rem, 8.5vw, 6.4rem); line-height: 1; margin-top: 2px;
  background: linear-gradient(100deg, #ffe9a8 0%, #ffc94a 30%, #fff6d8 50%, #f5b13a 70%, #ffe9a8 100%) 0 0 / 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(30, 14, 0, .55));
  animation: rise 1s ease .9s forwards, shine 4.5s linear 1.9s infinite;
}
@keyframes shine { to { background-position: -220% 0; } }
.intro-title .lead { max-width: 32ch; margin: 16px auto 0; color: #fff1d6; text-shadow: 0 3px 20px rgba(20, 10, 0, .65); }
.intro-title > * { opacity: 0; transform: translateY(18px); animation: rise .9s ease forwards; }
.intro-title > .badge { transform: translateY(-14px); animation-delay: .3s; }
.intro-title > .it-1 { animation-delay: .6s; }
.intro-title > .lead { animation-delay: 1.4s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.intro-title.gone { opacity: 0; transform: translateY(-14px); transition-duration: 1.3s; }
@media (prefers-reduced-motion: reduce) {
  .intro-title > *, .intro-title .it-h { animation: none; opacity: 1; transform: none; }
}
.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;
}
/* on portrait screens the book sits a little left of centre, so the
   whole plaque (and the title on it) stays on screen */
@media (orientation: portrait) { .frame16 { translate: -53% -50%; } }
#introVid, #loopVid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* the walk-in dissolves into the book loop playing underneath (the two
   videos end and start on nearly the same frame, so a cut would jump) */
#introVid { transition: opacity .8s ease-in-out; }
#introVid.fading { opacity: 0; }

/* 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; transition-delay: .5s; }

.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; transition-delay: .9s; }
.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 star portal that carries the visitor to the shop (drawn in main.js) */
.warp { position: fixed; inset: 0; z-index: 10; width: 100%; height: 100%; pointer-events: none; }
/* on arrival the shop title and crystal cards rise in, one after another */
.store.enter .store-in > :not(.grid), .store.enter .prod {
  animation: shop-in .9s cubic-bezier(.2, .8, .2, 1) both;
}
.store.enter .store-in > :nth-child(2) { animation-delay: .08s; }
.store.enter .store-in > :nth-child(3) { animation-delay: .16s; }
.store.enter .store-in > :nth-child(4) { animation-delay: .2s; }
.store.enter .prod { animation-name: card-in; }
.store.enter .prod:nth-child(1) { animation-delay: .25s; }
.store.enter .prod:nth-child(2) { animation-delay: .35s; }
.store.enter .prod:nth-child(3) { animation-delay: .45s; }
.store.enter .prod:nth-child(4) { animation-delay: .55s; }
.store.enter .prod:nth-child(5) { animation-delay: .65s; }
.store.enter .prod:nth-child(6) { animation-delay: .75s; }
@keyframes shop-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes card-in { from { opacity: 0; transform: translateY(60px) rotateX(18deg) scale(.94); } }
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; }
/* language of the products (songs, stories, books), separate from the site language */
.shop-lang { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 26px; }
.shop-lang-label { color: #f3e2c4; font-weight: 600; margin-right: 4px; }
.shop-lang button {
  font: 600 1rem "Fredoka", sans-serif; color: var(--ink);
  padding: 10px 20px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid rgba(255, 201, 60, .55); background: rgba(30, 18, 6, .55);
  transition: background-color .2s ease, transform .2s ease;
}
@media (max-width: 520px) { .shop-lang-label { flex-basis: 100%; } }
.shop-lang button:hover { background-color: rgba(255, 201, 60, .16); }
.shop-lang button:active { transform: scale(.97); }
.shop-lang button[aria-pressed="true"] {
  color: #2b1a00; border-color: transparent;
  background: linear-gradient(180deg, #ffe08a, #f2b632);
  box-shadow: 0 6px 22px rgba(255, 190, 60, .4);
}
.grid {
  list-style: none; padding: 0; margin: 48px 0 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px;
}
/* crystal cards: frosted glass with an iridescent rim, tilting in 3D toward
   the pointer; the product sits on a raised white tile */
.prod { perspective: 900px; }
.prod-card {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative; height: 100%; display: flex; flex-direction: column;
  padding: 14px; border-radius: 28px; color: #fff6e6;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04) 45%, rgba(255, 220, 160, .07));
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .35);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .4s ease;
}
.prod.lit .prod-card { transition: transform .12s linear, box-shadow .4s ease; }
/* iridescent rim: a gradient border drawn with a mask so the inside stays clear */
.prod-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from 210deg at var(--mx) var(--my),
    #ffe7a3, #ffb8d9, #b9d4ff, #c6ffe9, #ffe7a3);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .55; transition: opacity .4s ease; pointer-events: none;
}
/* the light spot under the pointer */
.prod-shine {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, .32), rgba(255, 240, 210, .08) 28%, transparent 55%);
  mix-blend-mode: overlay; opacity: 0; transition: opacity .4s ease;
}
.prod.lit .prod-shine, .prod.is-touched .prod-shine { opacity: 1; }
.prod.lit .prod-card::before, .prod.is-touched .prod-card::before { opacity: 1; }
.prod.lit .prod-card, .prod.is-touched .prod-card {
  box-shadow: 0 40px 70px -24px rgba(0, 0, 0, .75), 0 0 40px -10px rgba(255, 200, 110, .35), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.prod-img {
  aspect-ratio: 1; display: grid; place-items: center; overflow: hidden;
  border-radius: 18px; background: #fff;
  transform: translateZ(40px);
  box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .55);
}
.prod-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .5s ease; }
.prod.lit .prod-img img, .prod.is-touched .prod-img img { transform: scale(1.05); }
.prod-body { padding: 16px 6px 6px; display: flex; flex-direction: column; gap: 6px; flex: 1; transform: translateZ(26px); }
.prod-tag { color: #ffd76a; font-weight: 600; font-size: .92rem; letter-spacing: .02em; }
.prod h3 { font-size: 1.4rem; line-height: 1.1; color: #fff8ec; }
.prod-body p { font-size: 1rem; line-height: 1.45; color: rgba(255, 244, 222, .78); }
.prod-soon {
  margin-top: auto; align-self: start; padding: 8px 16px; border-radius: 999px;
  background: rgba(255, 215, 106, .12); border: 1px solid rgba(255, 215, 106, .5);
  font-weight: 600; font-size: .92rem; transform: translateZ(14px);
}
.prod-body .prod-soon { color: #ffe08a; /* beats .prod-body p */ margin-top: 12px; }
@media (prefers-reduced-motion: reduce) { .prod-card { transform: none; } }
.foot { text-align: center; padding: 70px 0 40px; color: #c9b48f; font-size: .95rem; }
.foot-about { margin-bottom: 10px; color: #f3e2c4; }
.foot-lang { margin-bottom: 14px; }
.lang-link { color: #ffd76a; text-decoration: none; font-weight: 600; border-bottom: 1px solid rgba(255, 215, 106, .35); transition: border-color .2s ease; }
.lang-link:hover { border-color: #ffd76a; }
.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-card { padding: 9px; border-radius: 20px; }
  .prod-img { border-radius: 13px; }
  .prod-body { padding: 10px 3px 4px; 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; }

/* ---- social links: little golden stars that float at the side of the film,
   and a plain row in the footer ---- */
.social { display: flex; gap: 14px; }
.social-float {
  position: fixed; z-index: 5; right: 22px; top: 50%; translate: 0 -50%;
  flex-direction: column; gap: 18px; transition: opacity .5s ease;
}
.social-float.gone { opacity: 0; pointer-events: none; }
.soc {
  position: relative; display: grid; place-items: center;
  width: 50px; height: 50px; color: #2b1a00; text-decoration: none;
  animation: soc-float 4.2s ease-in-out infinite;
}
.soc:nth-child(2) { animation-delay: -1.4s; }
.soc:nth-child(3) { animation-delay: -2.8s; }
.soc:nth-child(4) { animation-delay: -.7s; }
@keyframes soc-float { 50% { transform: translateY(-6px); } }
/* a soft four-point star turning slowly behind each round badge */
.soc-star {
  position: absolute; inset: -12px; width: calc(100% + 24px); height: calc(100% + 24px);
  fill: rgba(255, 215, 106, .28); filter: blur(.3px);
  animation: soc-spin 9s linear infinite; transition: fill .3s ease, transform .3s ease;
}
@keyframes soc-spin { to { rotate: 360deg; } }
.soc-ico {
  position: relative; display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #ffd25a 55%, #e9a42c);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), 0 0 18px rgba(255, 200, 90, .35), inset 0 1px 0 rgba(255, 255, 255, .7);
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.3), box-shadow .3s ease;
}
.soc-ico svg { width: 23px; height: 23px; }
.soc-tip {
  position: absolute; right: calc(100% + 14px); top: 50%; translate: 0 -50%;
  white-space: nowrap; padding: 7px 14px; border-radius: 999px;
  background: rgba(30, 18, 6, .72); border: 1px solid rgba(255, 215, 106, .5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #fff1cc; font: 600 .9rem "Fredoka", sans-serif;
  opacity: 0; transform: translateX(8px); pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.soc:hover .soc-ico, .soc:focus-visible .soc-ico { transform: scale(1.14); box-shadow: 0 8px 22px rgba(0,0,0,.4), 0 0 30px rgba(255, 200, 90, .75), inset 0 1px 0 rgba(255,255,255,.7); }
.soc:hover .soc-star, .soc:focus-visible .soc-star { fill: rgba(255, 230, 150, .6); transform: scale(1.15); }
.soc:hover .soc-tip, .soc:focus-visible .soc-tip { opacity: 1; transform: none; }
.soc:focus-visible { outline: none; }
.soc:focus-visible .soc-ico { outline: 3px solid #fff3c4; outline-offset: 3px; }
/* footer row: same badges, still, no tips */
.social-foot { justify-content: center; margin-bottom: 18px; }
.social-foot .soc { animation: none; width: 46px; height: 46px; }
.social-foot .soc-star, .social-foot .soc-tip { display: none; }
@media (max-width: 640px) {
  .social-float { right: 10px; top: 42%; gap: 14px; }
  .social-float .soc { width: 40px; height: 40px; }
  .social-float .soc-ico svg { width: 19px; height: 19px; }
  .soc-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) { .soc, .soc-star { animation: none; } }

/* ---- 404 page ---- */
.lost { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; text-align: center; }
.lost-in h1 { font-size: clamp(2.2rem, 7vw, 4rem); line-height: 1.05; margin: 8px 0 14px; }
.lost-in .lead { color: #f3e2c4; margin-top: 22px; }
.lost-link { display: inline-block; margin-top: 8px; color: #ffd76a; font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(255, 215, 106, .35); }
.lost-link:hover { border-color: #ffd76a; }
.lost-copy { margin-top: 36px; font-size: .85rem; color: #a8946f; }
