:root {
  --bg: #e4dccf;
  --paper: #e8e1d5;
  --paper-2: #f1ebe0;
  --red: #9b1b1b;
  --red-2: #b3161b;
  --ink: #3b2b26;
  --muted: #8a7d72;
  --pw: 360px;              /* page width, set by app.js */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .24 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.stage {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 16px;
}

/* ---------- Book & pages ---------- */
:root { --turn: 1000ms; --ease-turn: cubic-bezier(.645, .045, .355, 1); }
.book {
  position: relative;
  height: calc(var(--pw) * 4 / 3);
  perspective: 2400px;
  filter: drop-shadow(0 18px 26px rgba(60, 40, 25, .22));
}
.book.spread { width: calc(var(--pw) * 2); }
.book.single { width: var(--pw); }

/* the whole book slides so a closed cover (or the last page) sits in the middle */
.shift {
  position: absolute; inset: 0;
  perspective: 2400px;
  transform-origin: 50% 50%;
  transition: transform .9s var(--ease-turn), transform-origin .9s var(--ease-turn);
}
.spread.closed .shift { transform: translateX(-25%) rotateY(-10deg); transform-origin: 75% 50%; }
.spread.at-end .shift { transform: translateX(25%); }
.single.closed .shift { transform: rotateY(-10deg); }

/* one sheet of paper: front = right page, back = the next left page */
.leaf {
  position: absolute; top: 0; height: 100%;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform var(--turn) var(--ease-turn);
}
.spread .leaf { left: 50%; width: 50%; }
.single .leaf { left: 0; width: 100%; transition: transform var(--turn) var(--ease-turn), opacity .15s; }
.leaf.turned { transform: rotateY(-180deg); }
.single .leaf.turned { opacity: 0; pointer-events: none; transition: transform var(--turn) var(--ease-turn), opacity .3s calc(var(--turn) * .62); }
.spread .leaf:not(.turned) .face.back,
.spread .leaf.turned .face.front { pointer-events: none; }

.face {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.face.back { transform: rotateY(180deg); }
.face .page { width: 100%; height: 100%; }

/* light and shadow sweeping across a page while it turns */
.face::before { content: ""; position: absolute; inset: 0; z-index: 20; pointer-events: none; opacity: 0; }
.face.front::before { background: linear-gradient(to right, rgba(0,0,0,0) 20%, rgba(40,20,10,.32)); }
.face.back::before  { background: linear-gradient(to left, rgba(0,0,0,0) 20%, rgba(40,20,10,.32)); }
.leaf.turning .face::before { animation: shade var(--turn) ease-in-out; }
@keyframes shade { 45%, 55% { opacity: 1; } }
/* a gentle lift of the paper in the middle of the turn */
.leaf.turning.fwd  { animation: liftF var(--turn) var(--ease-turn); }
.leaf.turning.back { animation: liftB var(--turn) var(--ease-turn); }
@keyframes liftF { from { transform: rotateY(0); } 50% { transform: rotateY(-90deg) scaleX(1.03) translateZ(10px); } to { transform: rotateY(-180deg); } }
@keyframes liftB { from { transform: rotateY(-180deg); } 50% { transform: rotateY(-90deg) scaleX(1.03) translateZ(10px); } to { transform: rotateY(0); } }

/* page edges peeking out on phones, like a real booklet */
.book.single::after {
  content: ""; position: absolute; top: 1.2%; bottom: 1.2%; right: -6px; width: 6px; z-index: -1;
  background: repeating-linear-gradient(to right, #d6cdbf 0 1px, #f0e9de 1px 2px);
  border-radius: 0 3px 3px 0; box-shadow: 1px 0 2px rgba(0,0,0,.12);
}

.page {
  width: var(--pw);
  aspect-ratio: 3 / 4;
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  background: var(--noise), var(--paper);
}
.page.blank { background: var(--noise), #e3dbcd; }
.book.spread .page.left::after,
.book.spread .page.right::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 15;
}
.book.spread .page.left::after  { background: linear-gradient(to left, rgba(0,0,0,.16), rgba(0,0,0,0) 10%); }
.book.spread .page.right::after { background: linear-gradient(to right, rgba(0,0,0,.16), rgba(0,0,0,0) 10%); }
.book.closed .p-cover { cursor: pointer; }
.book.closed .p-cover::after { background: linear-gradient(to right, rgba(0,0,0,.10), rgba(0,0,0,0) 4%) !important; }

/* ---------- Navigation ---------- */
.nav { display: flex; align-items: center; gap: 22px; }
.nav-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(59,43,38,.25);
  font-size: 22px; line-height: 30px;
  transition: opacity .2s, background .2s;
}
.nav-btn:hover { background: rgba(255,255,255,.4); }
.nav-btn:disabled { opacity: .3; cursor: default; }
.nav-label { min-width: 90px; text-align: center; font-size: 11px; letter-spacing: .22em; color: var(--muted); }

/* ---------- Type helpers ---------- */
.script { font-family: "Great Vibes", cursive; color: var(--red); font-weight: 400; line-height: .95; }
.hand   { font-family: "Dancing Script", cursive; color: var(--ink); }
.anton  { font-family: "Anton", Impact, sans-serif; color: var(--red); text-transform: uppercase; line-height: .95; }
.caps   { font-family: "Inter", sans-serif; text-transform: uppercase; letter-spacing: .2em; font-weight: 600; }
.hint   { position: absolute; left: 0; right: 0; text-align: center; font-size: 2.6cqw; letter-spacing: .25em; color: var(--muted); text-transform: uppercase; }
.title  { font-size: 13cqw; }

/* ---------- Photos ---------- */
.photo { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
body.bw .in-color .photo, body.bw .in-color .svgphoto { filter: none; }
body.bw .photo, body.bw .svgphoto { filter: grayscale(1) contrast(1.06); }
.placeholder {
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: repeating-linear-gradient(45deg, #cfc6b8 0 6px, #c7bdae 6px 12px);
  color: #7a6d61; font-size: 2.6cqw; letter-spacing: .12em; text-transform: uppercase; padding: 4px;
}
.placeholder span { background: rgba(241,235,224,.85); padding: .4em .7em; border-radius: 3px; }

.polaroid { background: #f4f0e8; padding: 4% 4% 16%; box-shadow: 0 6px 14px rgba(0,0,0,.22); }
.polaroid .photo { aspect-ratio: 1; height: auto; }

/* ---------- 1. Cover ---------- */
.p-cover { text-align: center; }
.cover-date { margin-top: 6cqw; font-family: "Playfair Display", serif; font-style: italic; font-size: 5.2cqw; color: var(--ink); }
.cover-names.no-date { margin-top: 6cqw; font-size: 21cqw; }
.cover-names { margin-top: 1.5cqw; font-size: 17cqw; letter-spacing: -.01em; padding: 0 5cqw; }
.cover-names span { display: block; white-space: nowrap; }
.cover-photo { position: absolute; left: 7%; right: 7%; bottom: 6%; height: 49%; }
.washi {
  position: absolute; left: 50%; top: -2.2cqw; transform: translateX(-50%) rotate(-1deg);
  width: 34cqw; height: 4.4cqw; background: #efe6d6; box-shadow: 0 1px 2px rgba(0,0,0,.15);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 92'%3E%3Cpath d='M50 88C20 66 2 48 2 28C2 12 14 2 28 2C38 2 46 8 50 16C54 8 62 2 72 2C86 2 98 12 98 28C98 48 80 66 50 88Z' fill='%23b3161b'/%3E%3C/svg%3E"); background-repeat: repeat-x;
  background-size: 2.9cqw 2.4cqw; background-position: center;
}
.bow { position: absolute; right: -5cqw; bottom: -5cqw; width: 19cqw; transform: rotate(8deg); filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }

/* ---------- 2. Letter ---------- */
.letter-title { position: absolute; right: 8%; top: 3.5%; font-family: "Noto Nastaliq Urdu", serif; font-weight: 600; color: var(--red); font-size: 7.6cqw; line-height: 2.2; }
.letter {
  position: absolute; left: 8%; right: 8%; top: 17.5%;
  font-family: "Noto Nastaliq Urdu", "Vazirmatn", serif; font-size: 3.5cqw; line-height: 2.05;
  text-align: justify; text-align-last: right; color: var(--ink);
}
.letter p + p { margin-top: 1.6cqw; }
.letter p:last-child { color: var(--red); text-align: right; }
.heart-glyph { font-family: "Inter", sans-serif; color: var(--red-2); font-size: 1.05em; }
.seal { position: absolute; right: 7%; bottom: 3.5%; width: 12cqw; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.signature { position: absolute; left: 9%; bottom: 3%; font-family: "Noto Nastaliq Urdu", serif; font-weight: 600; color: var(--red); font-size: 8cqw; line-height: 2.2; }

/* ---------- 3. Story ---------- */
.story-title { position: absolute; right: 8%; top: 3.5%; font-family: "Noto Nastaliq Urdu", serif; font-weight: 600; color: var(--red); font-size: 9cqw; line-height: 2.2; }
.story-text {
  position: absolute; right: 8%; width: 52%; top: 20%;
  font-family: "Noto Nastaliq Urdu", "Vazirmatn", serif; font-size: 3.55cqw; line-height: 2.05;
  text-align: right; color: var(--ink);
}
.story-text p + p { margin-top: 2cqw; }
.story-text p:last-child { color: var(--red); font-size: 1.1em; margin-top: 3cqw; }
.strip {
  position: absolute; left: 7%; top: 13%; width: 28%;
  background: #f4f1ec; padding: 3cqw 2.2cqw; transform: rotate(2.5deg);
  box-shadow: 0 6px 12px rgba(0,0,0,.22);
  display: flex; flex-direction: column; gap: 2cqw;
}
.strip .photo, .strip .placeholder { aspect-ratio: 4 / 3; height: auto; }
.clip { position: absolute; top: -8cqw; left: 6cqw; width: 7cqw; transform: rotate(-12deg); }
.pom-small { position: absolute; left: 12%; bottom: 7%; width: 13cqw; transform: rotate(-14deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }

/* ---------- 4. You + Me ---------- */
.p-youme { background: var(--paper-2); cursor: pointer; }
.dots { position: absolute; inset: 0; background: radial-gradient(circle, #2e211d 0 .55cqw, transparent .65cqw) 0 0 / 4.4cqw 4.4cqw; opacity: .9; }
.youme-label { position: absolute; top: 6.5%; left: 0; right: 0; width: max-content; margin: auto; padding: .7em 1.3em; background: var(--paper-2); box-shadow: 0 0 0 1.2cqw var(--paper-2); text-align: center; color: var(--red); font-size: 3.1cqw; z-index: 1; }
.duo { position: absolute; left: 6%; right: 6%; top: 30%; display: flex; align-items: center; justify-content: space-between; transition: opacity .5s, transform .6s; }
.duo .polaroid { width: 40%; }
.duo .polaroid.l { transform: rotate(-6deg); }
.duo .polaroid.r { transform: rotate(5deg); }
.plus { font-family: "Anton"; color: var(--red-2); font-size: 13cqw; line-height: 1; text-shadow: 0 0 1.2cqw #f1ebe0, 0 0 .6cqw #f1ebe0; }
.heart-frame { position: absolute; left: 13%; right: 13%; top: 24%; opacity: 0; transform: scale(.4); transition: opacity .5s .15s, transform .7s cubic-bezier(.3,1.6,.5,1) .15s; filter: drop-shadow(0 8px 10px rgba(0,0,0,.35)); }
.p-youme.merged .duo { opacity: 0; transform: scale(.6); }
.p-youme.merged .heart-frame { opacity: 1; transform: none; }
.p-youme .hint { bottom: 6%; color: var(--red); background: var(--paper-2); box-shadow: 0 0 0 1.2cqw var(--paper-2); width: max-content; margin: auto; padding: .7em 1.3em; }

/* ---------- 5. Fal-e Hafez ---------- */
.fal-title { position: absolute; left: 0; right: 0; top: 3%; text-align: center; font-family: "Noto Nastaliq Urdu", serif; font-weight: 600; color: var(--red); font-size: 10cqw; line-height: 2.2; }
.fal-sub { position: absolute; left: 0; right: 0; top: 19%; text-align: center; font-family: "Noto Nastaliq Urdu", serif; color: var(--muted); font-size: 3.6cqw; line-height: 2; }

/* the Divan: Persian books are bound on the right, so the cover opens to the right */
.divan { position: absolute; left: 30%; top: 32%; width: 40%; aspect-ratio: 3 / 4; perspective: 1500px; z-index: 2; transition: opacity .5s .25s; }
.divan-aura {
  position: absolute; inset: -18%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(226,186,104,.45), rgba(226,186,104,0));
  animation: aura 3.2s ease-in-out infinite;
}
@keyframes aura { 50% { transform: scale(1.12); opacity: .55; } }
.divan-float { position: absolute; inset: 0; animation: divanFloat 3.2s ease-in-out infinite; transform-style: preserve-3d; }
@keyframes divanFloat { 50% { transform: translateY(-3.5%) rotate(-1.2deg); } }
.p-fal.shaking .divan-float, .p-fal.opening .divan-float { animation: none; }
.p-fal.opening .divan-aura { opacity: 0; transition: opacity .4s; }

.divan-body { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 1.1s cubic-bezier(.65, 0, .35, 1); }
.p-fal.opening .divan-body { transform: translateX(-50%) rotateX(8deg); }
.p-fal.shaking .divan-body { animation: divanShake .6s ease-in-out; }
@keyframes divanShake {
  15% { transform: rotate(-7deg) scale(1.05); } 35% { transform: rotate(6deg) scale(1.06); }
  55% { transform: rotate(-4deg) scale(1.05); } 75% { transform: rotate(3deg) scale(1.03); }
}
.divan:hover .divan-body { transform: rotate(-2deg) scale(1.03); }
.p-fal.opening .divan:hover .divan-body { transform: translateX(-50%) rotateX(8deg); }

.divan-shadow { position: absolute; left: 4%; right: 4%; bottom: -7%; height: 9%; border-radius: 50%; background: radial-gradient(closest-side, rgba(60,20,10,.4), transparent); transition: right 1.1s cubic-bezier(.65, 0, .35, 1); }
.p-fal.opening .divan-shadow { right: -96%; }

/* the block of pages under the cover (also the left page once open) */
.divan-block, .dface { background: var(--noise), #f3ead8; }
.divan-block { position: absolute; inset: 1.5% 0 1.5% 1%; border-radius: 1cqw 0 0 1cqw;
  box-shadow: inset 0 0 0 .2cqw #e0d3bb, -.7cqw .2cqw 0 #ebe0cb, -1.3cqw .4cqw 0 #d8c9ae, inset -2cqw 0 2cqw -1cqw rgba(0,0,0,.18); }
.divan-block::before, .dface::before {
  content: ""; position: absolute; inset: 15% 13% 13% 11%;
  background: repeating-linear-gradient(180deg, transparent 0 2.3cqw, rgba(59,43,38,.2) 2.3cqw 2.5cqw);
}
.divan-block::after, .dface::after { content: ""; position: absolute; left: 30%; right: 30%; top: 8%; height: 1.4cqw; border-radius: 1cqw; background: rgba(155,27,27,.45); }

/* the leaves that flutter past */
.dleaf { position: absolute; inset: 1.5% 0 1.5% 1%; transform-origin: right center; transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.45, .05, .3, 1); }
.dface { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: .4cqw 0 0 .4cqw; box-shadow: inset 0 0 0 .15cqw #e0d3bb; }
.dface-back { transform: rotateY(180deg); border-radius: 0 .4cqw .4cqw 0; box-shadow: inset 0 0 0 .15cqw #e0d3bb, inset 2cqw 0 2cqw -1cqw rgba(0,0,0,.15); }
.dl1 { transform: translateZ(-1px); transition-delay: .26s; }
.dl2 { transform: translateZ(-2px); transition-delay: .18s; }
.dl3 { transform: translateZ(-3px); transition-delay: .1s; }
.dl4 { transform: translateZ(-4px); transition-delay: .02s; }
.p-fal.opening .dl1 { transform: rotateY(180deg) translateZ(-1px); transition-delay: .55s; }
.p-fal.opening .dl2 { transform: rotateY(180deg) translateZ(-2px); transition-delay: .75s; }
.p-fal.opening .dl3 { transform: rotateY(180deg) translateZ(-3px); transition-delay: .95s; }
.p-fal.opening .dl4 { transform: rotateY(180deg) translateZ(-4px); transition-delay: 1.15s; }

/* the cover: front and inside */
.divan-cover { position: absolute; inset: 0; transform-origin: right center; transform-style: preserve-3d;
  transition: transform 1.05s cubic-bezier(.55, .05, .3, 1) .34s; }
.p-fal.opening .divan-cover { transform: rotateY(180deg); transition-delay: 0s; }
.cover-front, .cover-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 1.2cqw 2.4cqw 2.4cqw 1.2cqw; }
.cover-front {
  background: radial-gradient(120% 90% at 35% 25%, #a3191f, #6d0c10 70%, #4d070a);
  box-shadow: inset 0 0 0 .6cqw #5a080b, inset -1.5cqw 0 2cqw rgba(0,0,0,.25), 0 1.2cqw 2cqw rgba(60,20,10,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3cqw;
}
.cover-front::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 11%; border-radius: 0 2.4cqw 2.4cqw 0;
  background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(255,255,255,.1) 40%, rgba(0,0,0,.25)); }
.cover-back {
  transform: rotateY(180deg); border-radius: 2.4cqw 1.2cqw 1.2cqw 2.4cqw;
  background:
    radial-gradient(circle at 30% 30%, rgba(201,161,74,.35) 0 8%, transparent 9%) 0 0 / 6cqw 6cqw,
    radial-gradient(circle at 70% 70%, rgba(201,161,74,.25) 0 6%, transparent 7%) 0 0 / 6cqw 6cqw,
    linear-gradient(135deg, #7d1014, #5a080b);
  box-shadow: inset 0 0 0 .6cqw #5a080b, inset 0 0 0 1.1cqw #c9a14a;
}
.divan-frame { position: absolute; inset: 7%; border: .45cqw solid #c9a14a; border-radius: 1cqw; box-shadow: inset 0 0 0 1.25cqw rgba(201,161,74,.0), inset 0 0 0 1.5cqw rgba(201,161,74,.5); }
.divan-star { width: 38%; position: relative; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); animation: starSpin 12s linear infinite; }
@keyframes starSpin { to { transform: rotate(360deg); } }
.divan-name { position: relative; font-family: "Noto Nastaliq Urdu", serif; font-weight: 600; color: #e2c27a; font-size: 4.6cqw; line-height: 1.6; text-shadow: 0 1px 1px rgba(0,0,0,.45); }

/* golden light from the open pages */
.divan-glow { position: absolute; inset: -25% -25% -25% -25%; pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,226,150,.95), rgba(255,214,130,.45) 45%, rgba(255,214,130,0));
  opacity: 0; transform: translateZ(8px) scale(.4); transition: opacity .5s, transform .8s cubic-bezier(.2, 1.2, .4, 1); }
.p-fal.glow .divan-glow { opacity: 1; transform: translateZ(8px) translateX(50%) scale(1.25); }

/* sparkles: twinkle while waiting, burst when the book opens */
.spark { position: absolute; width: 2.2cqw; height: 2.2cqw; pointer-events: none; z-index: 3;
  background: radial-gradient(circle, #fff6d8 0 18%, #e2c27a 30%, transparent 62%);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: twinkle 2.6s ease-in-out var(--d) infinite; opacity: 0; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(45deg); } }
.p-fal.glow .spark { animation: burst 1s ease-out calc(var(--d) * .15) forwards; }
@keyframes burst { 0% { opacity: 1; transform: translate(0, 0) scale(1.4); } 100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(.3) rotate(180deg); } }
.p-fal.open .divan { opacity: 0; pointer-events: none; }

/* the verse card */
.fal-card {
  position: absolute; left: 7%; right: 7%; top: 27%;
  padding: 4cqw 5cqw 5cqw; text-align: center;
  background: var(--noise), #f4ecdc;
  border: .35cqw solid #c9a14a; outline: .35cqw solid #c9a14a; outline-offset: -1.6cqw;
  box-shadow: 0 10px 22px rgba(60,30,10,.25);
  opacity: 0; transform: translateY(16%) scale(.3); transform-origin: 50% 75%; pointer-events: none; z-index: 3;
  transition: opacity .45s, transform .75s cubic-bezier(.2, 1.3, .4, 1);
}
.p-fal.open .fal-card { opacity: 1; transform: none; pointer-events: auto; }
.fal-verse { display: flex; flex-direction: column; gap: 1cqw; font-family: "Noto Nastaliq Urdu", serif; color: var(--ink); font-size: 4.5cqw; line-height: 2.3; }
.fal-verse .m1 { text-align: right; }
.fal-verse .m2 { text-align: left; }
.fal-sep { width: 7cqw; margin: 2cqw auto 1cqw; }
.fal-meaning { font-family: "Noto Nastaliq Urdu", "Vazirmatn", serif; color: var(--red); font-size: 3.5cqw; line-height: 2.1; }
.fal-again {
  margin-top: 3cqw; padding: .6cqw 4.5cqw 1.6cqw; border-radius: 99px;
  background: var(--red); color: #f4ece0; font-family: "Noto Nastaliq Urdu", serif; font-size: 3.4cqw; line-height: 2;
}
.fal-pom { position: absolute; left: 8%; bottom: 5%; width: 12cqw; transform: rotate(-14deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.p-fal .hint { bottom: 6%; }
.p-fal.open .hint { opacity: 0; }

/* ---------- 6. Film ---------- */
.film-title { position: absolute; top: 14%; left: 0; right: 0; text-align: center; font-size: 3cqw; color: var(--ink); }
.film {
  position: absolute; left: -4%; right: -4%; height: 22%;
  background: #141414; overflow: hidden;
  box-shadow: 0 6px 12px rgba(0,0,0,.3);
}
/* the strip of frames rolls sideways forever, like film through a projector */
.film-track {
  position: absolute; top: 0; bottom: 0; left: 0;
  display: flex; width: max-content; padding: 3.4cqw 0;
  animation: filmRoll 38s linear infinite;
}
.f2 .film-track { animation-direction: reverse; animation-duration: 44s; }
.film-track::before, .film-track::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1.6cqw;
  background: repeating-linear-gradient(90deg, transparent 0 1.4cqw, #e9e2d6 1.4cqw 3cqw, transparent 3cqw 4cqw);
}
.film-track::before { top: .9cqw; } .film-track::after { bottom: .9cqw; }
.frame { flex: none; width: 30cqw; height: 100%; margin-right: 2cqw; overflow: hidden; background: #222; }
@keyframes filmRoll { to { transform: translateX(-50%); } }
.film.f1 { top: 21%; transform: rotate(-2deg); }
.film.f2 { top: 50%; transform: rotate(1.5deg); }
.washi-small { position: absolute; right: 4%; bottom: 13%; width: 26cqw; height: 3.6cqw; transform: rotate(-12deg); background: #efe6d6; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 92'%3E%3Cpath d='M50 88C20 66 2 48 2 28C2 12 14 2 28 2C38 2 46 8 50 16C54 8 62 2 72 2C86 2 98 12 98 28C98 48 80 66 50 88Z' fill='%23b3161b'/%3E%3C/svg%3E"); background-repeat: repeat-x; background-size: 2.3cqw 1.9cqw; background-position: center; box-shadow: 0 1px 2px rgba(0,0,0,.15); }

/* ---------- 7. Camera ---------- */
.p-camera .star { position: absolute; left: 9%; top: 6%; width: 9cqw; transform: rotate(-10deg); }
.fav-title { position: absolute; right: 7%; top: 5%; text-align: right; }
.fav-title .script { display: block; font-size: 11cqw; margin-bottom: -3cqw; color: var(--ink); }
.fav-title .anton { font-size: 13cqw; }
.camera { position: absolute; left: 10%; right: 10%; top: 32%; aspect-ratio: 1.55; }
.cam-top { position: absolute; right: 12%; top: -4%; width: 20%; height: 8%; border-radius: 1.2cqw 1.2cqw 0 0; background: linear-gradient(#d9d9d9, #a9a9a9); }
.cam-body {
  position: absolute; inset: 0; border-radius: 3cqw;
  background: linear-gradient(160deg, #f0f0f0, #b5b5b5 55%, #d8d8d8);
  box-shadow: inset 0 0 0 .5cqw rgba(255,255,255,.6), 0 8px 16px rgba(0,0,0,.3);
}
.cam-screen { position: absolute; left: 5%; top: 9%; width: 62%; height: 82%; border-radius: 1.5cqw; overflow: hidden; background: #111; border: 1.2cqw solid #2a2a2a; }
.cam-lens { position: absolute; right: 7%; top: 14%; width: 20%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #555 0 25%, #222 30%, #888 55%, #ccc 70%, #999 100%); }
.cam-btns { position: absolute; right: 9%; bottom: 13%; display: flex; flex-direction: column; gap: 1.4cqw; width: 16%; }
.cam-btns i { height: 2.2cqw; border-radius: 1cqw; background: #9a9a9a; box-shadow: inset 0 1px 1px rgba(0,0,0,.3); }
.flash { position: absolute; inset: -40%; background: radial-gradient(circle, #fff 0 30%, transparent 70%); opacity: 0; pointer-events: none; }
.camera.snap .flash { animation: flash .5s ease-out; }
@keyframes flash { 20% { opacity: 1; } }
.cam-caption { position: absolute; left: 0; right: 0; top: 76%; text-align: center; font-size: 5.5cqw; color: var(--red); }
.p-camera .hint { top: 87%; }

/* ---------- 8. Family voices ---------- */
.voices-title { position: absolute; left: 8%; top: 5%; font-size: 12cqw; }
.voices-sub { position: absolute; left: 8%; top: 23.5%; font-family: "Noto Nastaliq Urdu", "Vazirmatn", serif; font-size: 3.6cqw; color: var(--red); line-height: 2; }
.vinyl {
  position: absolute; right: -9%; top: 2%; width: 38%; aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #151515 0 .6cqw, #232323 .6cqw .9cqw), #111;
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
}
.vinyl::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 30deg, transparent 0 20%, rgba(255,255,255,.12) 25%, transparent 30% 70%, rgba(255,255,255,.1) 75%, transparent 80%); }
.vinyl-label { position: absolute; inset: 33%; border-radius: 50%; background: var(--red); color: #f4ece0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 2.1cqw; letter-spacing: .1em; font-weight: 600; text-transform: uppercase; line-height: 1.3; z-index: 1; }
.p-songs .vinyl.spin { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tracklist { position: absolute; left: 7%; right: 7%; top: 33%; bottom: 9%; list-style: none; display: flex; flex-direction: column; }
.tracklist li { flex: 1; min-height: 0; border-bottom: 1px dashed rgba(59,43,38,.25); }
.tracklist li:first-child { border-top: 1px solid rgba(59,43,38,.35); }
.track {
  position: relative; width: 100%; height: 100%;
  display: grid; grid-template-columns: 8cqw 1fr auto 6cqw; align-items: center; column-gap: 2cqw;
  text-align: left; padding: 0 1cqw; transition: background .2s;
}
.track:hover { background: rgba(155,27,27,.05); }
.tno { font-family: "Anton", sans-serif; color: var(--red); font-size: 3.6cqw; }
.tname { font-family: "Noto Nastaliq Urdu", "Great Vibes", serif; font-size: 4.4cqw; line-height: 1; transform: translateY(-1.3cqw); color: var(--ink); white-space: nowrap; text-align: start; }
.trel { font-size: 2.3cqw; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-family: "Inter", "Vazirmatn", sans-serif; white-space: nowrap; }
.tplay { justify-self: end; width: 5.4cqw; aspect-ratio: 1; border-radius: 50%; border: .35cqw solid var(--red); position: relative; }
.tplay::after { content: ""; position: absolute; left: 38%; top: 28%; border-left: 1.8cqw solid var(--red); border-top: 1.1cqw solid transparent; border-bottom: 1.1cqw solid transparent; }
.track.playing .tplay { background: var(--red); }
.track.playing .tplay::after { left: 30%; top: 30%; width: 1.9cqw; height: 1.9cqw; border: 0; background: linear-gradient(90deg, #f4ece0 0 35%, transparent 35% 65%, #f4ece0 65%); }
.track.playing .tname { color: var(--red); }
.tbar { position: absolute; left: 0; right: 0; bottom: -1px; height: .5cqw; pointer-events: none; }
.tbar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .25s linear; }
.track:not(.playing) .tbar i { width: 0 !important; }
.track.missing { opacity: .45; }
.track.missing .trel::after { content: " · soon"; }
.p-songs .hint { bottom: 3.5%; }

/* ---------- 9. Big photo ---------- */
.p-big .photo, .p-big .placeholder { position: absolute; inset: 0; }
.marker { position: absolute; left: 6%; right: 6%; bottom: 8%; font-family: "Permanent Marker", cursive; color: #d3191f; font-size: 11cqw; line-height: 1; transform: rotate(-4deg); text-shadow: 0 2px 6px rgba(0,0,0,.35); white-space: pre-line; }

/* ---------- 10. Calendar ---------- */
.p-calendar .title { position: absolute; top: 5%; left: 0; right: 0; text-align: center; font-size: 11cqw; }
.cal { position: absolute; left: 12%; right: 12%; top: 27%; }
.cal-month { text-align: center; font-size: 3cqw; margin-bottom: 2.5cqw; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: .6cqw; text-align: center; font-family: "Playfair Display", serif; font-style: italic; font-size: 3.6cqw; color: var(--ink); }
.cal-grid .dow { font-family: "Inter"; font-style: normal; font-size: 2.2cqw; letter-spacing: .1em; color: var(--muted); }
.cal-grid .wed { position: relative; color: var(--red); font-weight: bold; }
.cal-grid .wed svg { position: absolute; left: 50%; top: 50%; width: 9cqw; transform: translate(-50%, -50%); overflow: visible; }
.cal-pol { position: absolute; left: 34%; width: 32%; bottom: 4%; transform: rotate(-3deg); }
.pol-cap { position: absolute; left: 0; right: 0; bottom: 2%; text-align: center; font-size: 3.2cqw; color: var(--ink); }

/* ---------- 11. Yalda ---------- */
.p-yalda { text-align: center; }
.yalda-fa { margin-top: 6cqw; font-family: "Noto Nastaliq Urdu", "Vazirmatn", serif; font-weight: 600; color: var(--red); font-size: 9cqw; line-height: 2.4; direction: rtl; }
.p-yalda .title { margin-top: 0; font-size: 11.5cqw; }
.yalda-text {
  margin: 3cqw 11% 0; text-align: right; direction: rtl; white-space: pre-line;
  font-family: "Noto Nastaliq Urdu", "Vazirmatn", serif; font-size: 4.9cqw; line-height: 2.2; color: var(--ink);
}
.yalda-pol { position: absolute; left: 8%; width: 34%; bottom: 6%; transform: rotate(-5deg); }
.pom-half { position: absolute; right: 8%; bottom: 8%; width: 30cqw; transform: rotate(10deg); filter: drop-shadow(0 4px 5px rgba(0,0,0,.28)); }
.pom-whole { position: absolute; right: 34%; bottom: 4%; width: 15cqw; transform: rotate(-18deg); filter: drop-shadow(0 3px 3px rgba(0,0,0,.25)); }

/* ---------- 12. Final ---------- */
.p-final { background: var(--noise), #8f1717; color: #f3e8dc; text-align: center; display: flex; flex-direction: column; justify-content: center; padding-bottom: 1cqw; }
.final-title { color: #f3e8dc; font-size: 12cqw; margin-bottom: 1.5cqw; padding-top: 2cqw; }
.p-final .caps { font-size: 2.6cqw; color: #f0d6cf; }
.video-box { position: relative; margin: 3.5cqw auto 3cqw; width: 82%; aspect-ratio: 16 / 9; background: #000; border: 1.4cqw solid #f3e8dc; box-shadow: 0 8px 18px rgba(0,0,0,.35); }
.video-box.portrait { width: 50%; aspect-ratio: 9 / 16; }
.video-box.square { width: 62%; aspect-ratio: 1; }
.video-box video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.play-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 15cqw; aspect-ratio: 1; border-radius: 50%; background: rgba(243,232,220,.92); color: #8f1717;
  font-size: 6cqw; padding-left: 1cqw; box-shadow: 0 4px 14px rgba(0,0,0,.35); transition: transform .2s;
}
.play-btn:hover { transform: translate(-50%, -50%) scale(1.08); }
.video-box.playing .play-btn { display: none; }
.video-missing { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 4cqw; font-size: 2.8cqw; color: #ccc; letter-spacing: .08em; }
.final-heart { width: 7cqw; margin: 2.5cqw auto 0; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 15% { transform: scale(1.15); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } 60% { transform: scale(1); } }


/* ---------- Entrance animations (run each time a page comes into view) ---------- */
@keyframes develop { from { opacity: 0; filter: grayscale(1) brightness(2.4) blur(2px); } 60% { opacity: 1; } to { opacity: 1; filter: grayscale(1) contrast(1.06); } }
@keyframes popIn   { from { opacity: 0; scale: .3; } 70% { scale: 1.12; } to { opacity: 1; scale: 1; } }
@keyframes dropIn  { from { opacity: 0; transform: translateY(-14%) rotate(var(--r, 0deg)) scale(1.08); } to { opacity: 1; transform: rotate(var(--r, 0deg)); } }
@keyframes slideL  { from { opacity: 0; translate: -40% 0; } to { opacity: 1; translate: 0 0; } }
@keyframes slideR  { from { opacity: 0; translate: 40% 0; } to { opacity: 1; translate: 0 0; } }
@keyframes fadeUp  { from { opacity: 0; translate: 0 12%; } to { opacity: 1; translate: 0 0; } }
@keyframes draw    { from { stroke-dashoffset: 200; } to { stroke-dashoffset: 0; } }
@keyframes reveal  { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.is-visible .strip { animation: dropIn .7s ease-out backwards; --r: 2.5deg; }
.is-visible .strip .photo { animation: develop 1.6s ease-out backwards; }
.is-visible .strip .photo:nth-of-type(1) { animation-delay: .3s; }
.is-visible .strip .photo:nth-of-type(2) { animation-delay: .7s; }
.is-visible .strip .photo:nth-of-type(3) { animation-delay: 1.1s; }
.is-visible .strip .photo:nth-of-type(4) { animation-delay: 1.5s; }
.is-visible .story-text, .is-visible .letter p, .is-visible .yalda-text { animation: fadeUp .8s ease-out backwards; }
.is-visible .letter p:nth-child(2) { animation-delay: .25s; }
.is-visible .letter p:nth-child(3) { animation-delay: .5s; }
.is-visible .signature { animation: reveal 1.2s .8s ease-out backwards; }
.is-visible .divan { animation: dropIn .8s .2s backwards; --r: 0deg; }
.is-visible .seal, .is-visible .fal-pom, .is-visible .pom-small, .is-visible .pom-whole, .is-visible .lips, .is-visible .star { animation: popIn .6s .4s backwards; }
.is-visible .duo .polaroid.l { animation: dropIn .6s .1s backwards; --r: -6deg; }
.is-visible .duo .polaroid.r { animation: dropIn .6s .3s backwards; --r: 5deg; }
.is-visible .plus { animation: popIn .5s .6s backwards; }
.is-visible .reason { animation: popIn .5s backwards; }
.is-visible .reason:nth-child(1) { animation-delay: 0.05s; }
.is-visible .reason:nth-child(2) { animation-delay: 0.12s; }
.is-visible .reason:nth-child(3) { animation-delay: 0.19s; }
.is-visible .reason:nth-child(4) { animation-delay: 0.26s; }
.is-visible .reason:nth-child(5) { animation-delay: 0.33s; }
.is-visible .reason:nth-child(6) { animation-delay: 0.40s; }
.is-visible .reason:nth-child(7) { animation-delay: 0.47s; }
.is-visible .reason:nth-child(8) { animation-delay: 0.54s; }
.is-visible .reason:nth-child(9) { animation-delay: 0.61s; }
.is-visible .film.f1 { animation: slideL .9s ease-out backwards; }
.is-visible .film.f2 { animation: slideR .9s .2s ease-out backwards; }
.is-visible .film .photo { animation: develop 1.4s .6s ease-out backwards; }
.is-visible .camera { animation: fadeUp .7s .1s ease-out backwards; }
.is-visible .vinyl { animation: slideR .9s ease-out backwards; }
.is-visible .tracklist li { animation: fadeUp .5s ease-out backwards; }
.is-visible .tracklist li:nth-child(1) { animation-delay: 0.21s; }
.is-visible .tracklist li:nth-child(2) { animation-delay: 0.27s; }
.is-visible .tracklist li:nth-child(3) { animation-delay: 0.33s; }
.is-visible .tracklist li:nth-child(4) { animation-delay: 0.39s; }
.is-visible .tracklist li:nth-child(5) { animation-delay: 0.45s; }
.is-visible .tracklist li:nth-child(6) { animation-delay: 0.51s; }
.is-visible .tracklist li:nth-child(7) { animation-delay: 0.57s; }
.is-visible .tracklist li:nth-child(8) { animation-delay: 0.63s; }
.is-visible .tracklist li:nth-child(9) { animation-delay: 0.69s; }
.is-visible .tracklist li:nth-child(10) { animation-delay: 0.75s; }
.is-visible .tracklist li:nth-child(11) { animation-delay: 0.81s; }
.is-visible .tracklist li:nth-child(12) { animation-delay: 0.87s; }
.is-visible .tracklist li:nth-child(13) { animation-delay: 0.93s; }
.is-visible .tracklist li:nth-child(14) { animation-delay: 0.99s; }
.is-visible .tracklist li:nth-child(15) { animation-delay: 1.05s; }
.is-visible.p-big .photo { animation: develop 1.6s ease-out backwards; }
.is-visible .marker { animation: reveal 1.1s .7s steps(14) backwards; }
.cal-grid .wed svg path { stroke-dasharray: 200; }
.is-visible .cal-grid .wed svg path { animation: draw 1.2s .6s ease-out backwards; }
.is-visible .cal-pol { animation: dropIn .7s .3s backwards; --r: -3deg; }
.is-visible .yalda-pol { animation: dropIn .7s .3s backwards; --r: -5deg; }
.is-visible .pom-half { animation: popIn .7s .5s backwards; }
.is-visible .final-title { animation: reveal 1.4s ease-out backwards; }
.is-visible .video-box { animation: fadeUp .8s .4s ease-out backwards; }
@keyframes developColor { from { opacity: 0; filter: brightness(2.2) blur(2px); } 60% { opacity: 1; } to { opacity: 1; filter: none; } }
.is-visible.in-color .photo, body:not(.bw) .is-visible .photo { animation-name: developColor; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
