/* Fonts (self-hosted; all SIL OFL). */
@font-face { font-family: 'Poppins'; src: url('../fonts/poppins-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../fonts/poppins-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../fonts/poppins-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../fonts/poppins-latin-600-italic.woff2') format('woff2'); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'Allison'; src: url('../fonts/allison-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }

/* ==========================================================================
   Maila & Sufyan — invitation. Built to the Figma file "Maila - Sufyan -
   Cermoney Invitaton" (780px-wide mobile canvas). Every position below is in
   Figma pixels and scales with --u, so the page stays pixel-proportional at
   any width up to the 780px design column.
   ========================================================================== */
/* Cormorant Infant 400 (SIL OFL, see src/fonts/OFL-CormorantInfant.txt), built from
   google/fonts so its default figures are lining, as in the Figma file. */
@font-face {
  font-family: 'Cormorant Infant';
  src: url('../fonts/cormorant-infant-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
:root {
  --maroon-950: #1c0204;
  --maroon-900: #2f0509;
  --crimson: #a8182a;
  --wine: #4a0a10;
  --beige: #e7d3b8;
  --cream: #f6e6cf;
  --gold: #c9a55c;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.22, .8, .28, 1);
  --f-sans: 'Poppins', system-ui, sans-serif;
  --f-serif: 'Cormorant Infant', Georgia, serif;
  --f-script-a: 'Allison', cursive;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0; background: var(--maroon-950); color: var(--cream);
  font-family: var(--f-sans); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { display: block; max-width: none; }

.col { container-type: inline-size; max-width: 780px; margin: 0 auto; position: relative; overflow-x: clip; background: var(--maroon-900); }
.s { --u: calc(100cqw / 780); position: relative; }
.s > * { position: absolute; }

.upper { text-transform: uppercase; margin: 0; }
.script-a { font-family: var(--f-script-a); font-weight: 400; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sr-only--focusable:focus { position: static; width: auto; height: auto; min-height: 44px; margin: 8px auto; padding: 0 16px; clip: auto; display: block; }

/* Centred text line: --y is the line's vertical centre in Figma px. */
.hero__request, .hero__name, .hero__parents, .hero__blessing, .hero__amp,
.date__eyebrow, .date__heading, .count__eyebrow, .count__heading,
.closing__eyebrow, .closing__heading, .closing__text {
  left: 0; right: 0; margin: 0; text-align: center; white-space: nowrap;
  top: calc(var(--y) * var(--u)); transform: translateY(-50%); line-height: 1.15;
}

/* ---------- ornament divider: ——— ◇ ——— ---------- */
.orn {
  left: 50%; top: calc(var(--y) * var(--u)); transform: translate(-50%, -50%);
  width: calc(var(--w, 170) * var(--u)); display: flex; align-items: center; gap: calc(14 * var(--u));
}
.orn i { flex: 1; height: max(1px, calc(1.5 * var(--u))); background: currentColor; }
.orn b { flex: none; width: calc(10 * var(--u)); height: calc(10 * var(--u)); min-width: 6px; min-height: 6px; border: max(1px, calc(1.5 * var(--u))) solid currentColor; transform: rotate(45deg); }
.orn--star { gap: calc(21 * var(--u)); }
.orn--star i { height: max(1px, calc(1 * var(--u))); }
.orn--star b {
  border: 0; background: currentColor; width: calc(18 * var(--u)); height: calc(26 * var(--u)); transform: none;
  clip-path: polygon(50% 0, 60% 42%, 100% 50%, 60% 58%, 50% 100%, 40% 58%, 0 50%, 40% 42%);
}
.orn--red { color: var(--crimson); } .orn--gold { color: #a8814a; }

/* Garland straddling the top edge of each section after the hero. */
.garland {
  left: 50%; top: calc(var(--gy, 0) * var(--u)); width: calc(766 * var(--u)); height: auto;
  transform: translate(-50%, -50%); z-index: 6; pointer-events: none;
}

/* ---------- reveal-on-scroll ---------- */
.js [data-reveal] {
  opacity: 0;
  translate: 0 calc(16 * var(--u));
  filter: blur(4px);
  transition:
    opacity 0.78s var(--ease-out),
    translate 0.85s var(--ease-out),
    filter 0.72s var(--ease-soft);
  transition-delay: calc(var(--i, 0) * 72ms);
}
.js [data-reveal].is-visible { opacity: 1; translate: 0 0; filter: blur(0); }

/* ======================= 01 · HERO (arch) ======================= */
.s--hero { height: calc(1631 * var(--u)); background: var(--maroon-900); overflow: hidden; }
.hero__bg { left: 0; top: calc(-2 * var(--u)); width: 100%; height: auto; }
.s--hero > *:not(.hero__bg) { z-index: 2; }
.hero__bismillah { left: 50%; top: calc(411 * var(--u)); width: calc(372 * var(--u)); height: auto; transform: translate(-50%, -50%); }
.hero__orn { --y: 503.5; --w: 260; color: #f0dcc4; }
.hero__request, .hero__parents, .hero__blessing { color: #f0dcc4; letter-spacing: .088em; text-shadow: 0 2px 4px rgba(0,0,0,.35); }
.hero__request { --y: 582.5; font-size: calc(24 * var(--u)); line-height: 1.42; }
.hero__name { color: #ecdcc8; line-height: 1; text-shadow: 0 3px 4px rgba(0,0,0,.45); }
.hero__name--a { --y: 723; font-size: calc(121 * var(--u)); }
.hero__name--b { --y: 1004; font-size: calc(101 * var(--u)); }
.hero__parents { font-size: calc(19 * var(--u)); }
.hero__parents em { font-style: italic; font-weight: 600; }
.hero__parents--a { --y: 799; } .hero__parents--b { --y: 1078.5; }
.hero__amp {
  --y: 908; font-size: calc(119 * var(--u)); line-height: 1;
  background: linear-gradient(180deg, #e2c38a, #b8904f 55%, #8a6330);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__blessing { --y: 1188; font-size: calc(24 * var(--u)); line-height: 1.42; }
.hero__scroll {
  left: 50%; top: calc(1266 * var(--u)); transform: translateX(-50%);
  display: grid; justify-items: center; gap: calc(48 * var(--u));
  color: #c9a066; text-decoration: none; font-weight: 600; font-size: calc(20 * var(--u)); letter-spacing: .06em; line-height: 1.2;
}
.hero__scroll i { display: block; width: max(1px, calc(1.2 * var(--u))); height: calc(82 * var(--u)); background: rgba(240,220,196,.7); }

/* ======================= 02 · DATE ======================= */
.s--date { height: calc(813 * var(--u)); background: var(--beige); }
.date__eyebrow { --y: 109.5; font-size: calc(21 * var(--u)); letter-spacing: .077em; color: var(--crimson); }
.date__heading { --y: 172; font-size: calc(121 * var(--u)); line-height: 1; color: #4a0a10; font-weight: 400; }
.date__orn { --y: 242; }

.frame { left: calc(59 * var(--u)); top: calc(287 * var(--u)); width: calc(661.5 * var(--u)); aspect-ratio: 1586 / 992; }
.frame__img { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.frame__window { position: absolute; z-index: 1; left: 10.34%; top: 18.55%; right: 10.21%; bottom: 10.48%; background: #f1e4d0; }
/* Frame content is positioned in frame-relative Figma px (frame top-left = 0,0). */
.frame__content { position: absolute; inset: 0; z-index: 1; text-align: center; }
.frame__content > * { position: absolute; left: 0; right: 0; margin: 0; top: calc(var(--y) * var(--u)); transform: translateY(-50%); line-height: 1.15; white-space: nowrap; }
.frame__invited { --y: 105; font-size: calc(17 * var(--u)); letter-spacing: .067em; color: var(--crimson); }
.frame__date { --y: 158.8; font-family: var(--f-serif); font-size: calc(55.3 * var(--u)); line-height: 1; color: #3c0810; }
.frame__time { --y: 210.5; font-size: calc(18 * var(--u)); letter-spacing: .06em; color: #3c0810; }
.frame__time b { font-weight: 400; font-size: .6em; vertical-align: .2em; padding: 0 .12em; }
.frame__hint {
  position: absolute; z-index: 4; margin: 0; pointer-events: none; left: 0; right: 0; top: 55%; text-align: center; transform: translateY(-50%);
  color: #f6e6cf; font-size: calc(17 * var(--u)); letter-spacing: .28em;
  text-shadow: 0 2px 10px rgba(0,0,0,.45);
  animation: hint-pulse 2.4s ease-in-out infinite;
  transition: opacity .45s ease;
}
.is-scratching .frame__hint, .is-revealed .frame__hint { opacity: 0; animation: none; }
.frame__window canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; touch-action: none; cursor: grab; transition: opacity .9s var(--ease-out); }
.frame__window canvas[hidden] { display: none; }
.is-revealed canvas { opacity: 0; }

/* ======================= 03 · COUNTDOWN ======================= */
.s--count { height: calc(551 * var(--u)); background: linear-gradient(to bottom right, #2b0409, #4a0810); }
.count__deco { inset: 0; overflow: hidden; pointer-events: none; }
.count__deco::before, .count__deco::after { content: ''; position: absolute; border: 1px solid rgba(201,165,92,.14); width: calc(260 * var(--u)); height: calc(260 * var(--u)); transform: rotate(45deg); }
.count__deco::before { left: calc(-180 * var(--u)); top: calc(-16 * var(--u)); }
.count__deco::after { left: calc(586 * var(--u)); top: calc(128 * var(--u)); }
.count__eyebrow { --y: 117.5; font-size: calc(20 * var(--u)); letter-spacing: .105em; line-height: 1.17; color: #f0dcc4; }
.count__heading { --y: 173.7; font-size: calc(90 * var(--u)); line-height: 1; color: #f0dcc4; }
.count__orn { --y: 252; }
.count__grid { left: calc(16.5 * var(--u)); width: calc(764 * var(--u)); top: calc(314 * var(--u)); display: grid; grid-template-columns: repeat(4, 1fr); }
.unit { position: relative; display: grid; justify-items: center; gap: calc(14 * var(--u)); }
.unit + .unit::before, .unit + .unit::after { content: ''; position: absolute; left: 0; width: calc(9 * var(--u)); height: calc(9 * var(--u)); min-width: 5px; min-height: 5px; border: 1px solid #a8814a; border-radius: 50%; transform: translateX(-50%); }
.unit + .unit::before { top: calc(38 * var(--u)); } .unit + .unit::after { top: calc(54 * var(--u)); }
.unit__n {
  font-family: var(--f-serif); font-size: calc(92 * var(--u)); line-height: .9; color: #f6e6cf;
}
.unit__n.is-tick { animation: digit-swap .55s var(--ease-out); }
.unit__l { font-size: calc(18 * var(--u)); color: #a8814a; letter-spacing: .06em; margin-top: calc(-2 * var(--u)); }
.unit:nth-child(2)::before, .unit:nth-child(2)::after { left: calc(2.5 * var(--u)); }
.unit:nth-child(3)::before, .unit:nth-child(3)::after { left: calc(-5 * var(--u)); }
.unit:nth-child(4)::before, .unit:nth-child(4)::after { left: calc(-4.5 * var(--u)); }

/* ======================= 04 · VENUE ======================= */
.s--venue { height: calc(521 * var(--u)); background: #fff; }
.venue__card {
  left: calc(83 * var(--u)); top: calc(83 * var(--u)); width: calc(613 * var(--u)); height: calc(340 * var(--u));
  background: radial-gradient(ellipse 42% 32% at 50% 0%, rgba(80,11,17,.9), rgba(80,11,17,0)) #3a070d;
  border: 1px solid #6b1a1f;
}
.venue__card::before { content: ''; position: absolute; inset: calc(10 * var(--u)); border: 1px solid rgba(168,129,74,.28); pointer-events: none; }
.venue__card > * { position: absolute; left: 0; right: 0; margin: 0; text-align: center; top: calc(var(--y) * var(--u)); transform: translateY(-50%); line-height: 1.15; white-space: nowrap; }
.venue__eyebrow { --y: 54; font-size: calc(20 * var(--u)); letter-spacing: .11em; color: #c9a066; }
.venue__card .venue__orn { --y: 94; left: 50%; right: auto; transform: translate(-50%, -50%); }
.venue__title { --y: 163; font-size: calc(69.3 * var(--u)); line-height: 1; color: #f6e6cf; }
.venue__addr { --y: 211; font-size: calc(19 * var(--u)); letter-spacing: .03em; color: #c9a066; }
.venue__card .btn { --y: 280; left: 50%; right: auto; transform: translate(-50%, -50%); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: calc(196 * var(--u)); height: calc(45 * var(--u)); min-height: 32px;
  border: 1px solid #f0dcc4; color: #f0dcc4; text-decoration: none; text-transform: uppercase;
  letter-spacing: .06em; font-size: calc(13 * var(--u)); white-space: nowrap; overflow: hidden;
  transition: background .35s var(--ease-soft), color .35s var(--ease-soft);
}
.btn:hover, .btn:focus-visible { background: #f6e6cf; color: var(--maroon-900); outline: none; }

/* ======================= 05 · WITH ALL OUR HEARTS ======================= */
.s--closing { height: calc(388 * var(--u)); background: linear-gradient(90deg, #270307, #33060a 12.8%, #3e080d 25.6%, #4f0c12 50%, #3e080d 74.4%, #33060a 87.2%, #270307); }
.closing__ring {
  position: absolute; left: 50%; top: calc(-24 * var(--u)); width: calc(434 * var(--u)); height: calc(434 * var(--u));
  border: 1px solid rgba(201,165,92,.16); border-radius: 50%; transform: translateX(-50%);
}
.closing__clip { inset: 0; overflow: hidden; pointer-events: none; }
.closing__eyebrow { --y: 94; font-size: calc(21 * var(--u)); letter-spacing: .078em; color: #a8814a; }
.closing__heading { --y: 148; font-size: calc(89 * var(--u)); line-height: 1; color: #f0dcc4; }
.closing__orn { --y: 225.5; }
.closing__text { --y: 283.5; font-size: calc(17 * var(--u)); letter-spacing: .096em; line-height: 1.3; color: #a8814a; }

/* ======================= 06 · FINALE ======================= */
.s--finale { height: calc(425 * var(--u)); background: linear-gradient(90deg, #ffedcb, #faf3e8 30%, #faf3e8 70%, #ffedcb); }
.finale__card {
  left: calc(37 * var(--u)); top: calc(69 * var(--u)); width: calc(706 * var(--u)); bottom: 0;
  border: 1px solid rgba(110,60,50,.28); border-bottom: 0;
  border-radius: calc(165 * var(--u)) calc(165 * var(--u)) 0 0;
}
.finale__card::before { content: ''; position: absolute; inset: calc(12 * var(--u)) calc(12 * var(--u)) 0; border: 1px solid rgba(110,60,50,.5); border-bottom: 0; border-radius: calc(153 * var(--u)) calc(153 * var(--u)) 0 0; pointer-events: none; }
.finale__card > * { position: absolute; left: 0; right: 0; margin: 0; text-align: center; top: calc(var(--y) * var(--u)); transform: translateY(-50%); white-space: nowrap; }
.finale__line { --y: 106; font-size: calc(63 * var(--u)); line-height: 1; color: #4a0a10; }
.finale__names { --y: 198.5; font-size: calc(106 * var(--u)); line-height: 1; color: var(--crimson); }
.finale__names b { font-weight: 400; color: #4a0a10; font-size: 1.05em; vertical-align: .04em; padding: 0 .08em; }
.finale__date { --y: 290; font-size: calc(19 * var(--u)); letter-spacing: .016em; color: #a8814a; }

/* ---------- keyframes ---------- */
@keyframes hint-pulse { 0%, 100% { opacity: .55; letter-spacing: .28em; } 50% { opacity: 1; letter-spacing: .34em; } }
@keyframes digit-swap { 0% { opacity: .35; translate: 0 .22em; filter: blur(3px); } 100% { opacity: 1; translate: 0 0; filter: none; } }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; translate: 0 0; filter: none; transition: none; }
  .frame__window canvas, .btn { transition: none; }
  .frame__hint, .curtain__art, .curtain__label, .curtain__mote { animation: none; }
  .unit__n.is-tick { animation: none; }
}

/* ======================= 01 · CURTAIN (stage → arch reveal) =======================
   Artwork is the Figma stage (780×1631, same canvas as the hero) with the prompt
   painted out so it can be live text. It is cover-fitted within the 780px column
   and split down its centre into two halves that fold away to the sides,
   uncovering the hero behind it. Motion follows the client's reveal video. */
.curtain { display: none; }
.js .curtain {
  display: block; position: fixed; inset: 0; z-index: 100; overflow: hidden;
  /* Stage canvas, cover-fitted to the viewport. */
  --sw: max(min(100vw, 780px), calc(100vh * 780 / 1631));
  --sh: calc(var(--sw) * 1631 / 780);
}
html.is-curtained, html.is-curtained body { overflow: hidden; overscroll-behavior: none; }

.curtain__half { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; will-change: transform; pointer-events: none; }
/* 1px overlap so no hairline of the hero shows through the seam while closed. */
.curtain__half--l { clip-path: inset(0 calc(50% - 1px) 0 0); transform-origin: 0% 50%; }
.curtain__half--r { clip-path: inset(0 0 0 calc(50% - 1px)); transform-origin: 100% 50%; }
.curtain__half--l::after, .curtain__half--r::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: var(--shade, 0);
  background: linear-gradient(90deg, rgba(10,0,2,.85), rgba(10,0,2,.15) 50%, rgba(10,0,2,.85));
}
.curtain__art {
  position: absolute; left: 50%; top: 50%; width: var(--sw); height: var(--sh);
  translate: -50% -50%; max-width: none; background: #2a0407;
  animation: stage-drift 9s ease-in-out infinite alternate;
}
.curtain.is-opening .curtain__art { animation-play-state: paused; }

.curtain__seam {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; translate: -50% 0; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,214,150,0) 0%, rgba(255,214,150,.9) 30%, rgba(255,230,180,1) 50%, rgba(255,214,150,.9) 70%, rgba(255,214,150,0) 100%);
  box-shadow: 0 0 14px 3px rgba(255,170,90,.55), 0 0 40px 10px rgba(255,120,60,.25);
}

/* Whole screen is the tap target, as in the video. */
.curtain__tap {
  position: absolute; inset: 0; z-index: 3; margin: 0; padding: 0; border: 0;
  background: none; color: inherit; font: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.curtain__tap:focus { outline: none; }

/* Same geometry as .curtain__art, so the prompt sits in the stage's dark centre panel. */
.curtain__frame {
  position: absolute; left: 50%; top: 50%; width: var(--sw); height: var(--sh);
  translate: -50% -50%; container-type: size; pointer-events: none;
  --cu: calc(100cqw / 780); /* one Figma px of the stage */
}
/* Prompt, placed at its Figma coordinates (centre x 470.5; rules at y 795 / 958.5). */
.curtain__prompt { position: absolute; inset: 0; color: #ead7c2; }
.curtain__prompt > * { position: absolute; left: calc(470.5 * var(--cu)); translate: -50% -50%; }
.curtain__rule:first-child { top: calc(795 * var(--cu)); }
.curtain__rule:last-child { top: calc(958.5 * var(--cu)); }
.curtain__label {
  top: calc(863 * var(--cu)); white-space: nowrap; line-height: 1;
  font-family: var(--f-script-a); font-size: calc(119.5 * var(--cu));
  animation: label-glow 2.8s ease-in-out infinite;
}
.curtain__rule { display: flex; align-items: center; gap: calc(18.5 * var(--cu)); width: calc(258 * var(--cu)); }
.curtain__rule i { flex: 1; height: max(1px, calc(1 * var(--cu))); background: currentColor; opacity: .75; }
.curtain__rule b {
  flex: none; width: calc(22 * var(--cu)); height: calc(24 * var(--cu)); background: currentColor;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

.curtain__dust { position: absolute; inset: 0; }
.curtain__mote {
  position: absolute; width: .55cqw; height: .55cqw; min-width: 2px; min-height: 2px; border-radius: 50%;
  background: #ffcf8a; box-shadow: 0 0 .9cqw .2cqw rgba(255,170,80,.8);
  opacity: 0; animation: mote-float var(--d, 7s) ease-in-out var(--delay, 0s) infinite;
}

.curtain__ripple {
  position: absolute; z-index: 4; translate: -50% -50%; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(255,160,90,.9);
  box-shadow: 0 0 10px rgba(255,130,60,.7), inset 0 0 10px rgba(255,130,60,.5);
}

.curtain__skip {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 6; min-width: 44px; min-height: 44px; padding: 0 22px;
  background: rgba(20,2,5,.45); color: rgba(255,240,220,.88);
  border: 1px solid rgba(255,240,220,.38); border-radius: 22px;
  font: 500 12px var(--f-sans); letter-spacing: .2em; text-transform: uppercase; cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background .25s ease, color .25s ease;
}
.curtain__skip:hover, .curtain__skip:focus-visible { background: rgba(255,240,220,.12); }
.curtain__skip[hidden] { display: none; }

/* Hero text after the curtain: slower, softer blur-in, one line after another (as in the video). */
.js .s--hero [data-reveal][data-hold] {
  filter: blur(10px); translate: 0 calc(10 * var(--u));
  transition-duration: 1.1s, 1.1s, 1.1s;
  transition-delay: calc(var(--i, 0) * 230ms);
}
.js .s--hero [data-reveal][data-hold].is-visible { filter: blur(0); translate: 0 0; }

@keyframes stage-drift { from { scale: 1; } to { scale: 1.035; } }
@keyframes label-glow {
  0%, 100% { text-shadow: 0 0 0 rgba(255,170,100,0); }
  50% { text-shadow: 0 0 calc(10 * var(--cu)) rgba(255,180,110,.45), 0 0 calc(26 * var(--cu)) rgba(255,130,60,.25); }
}
@keyframes mote-float {
  0% { opacity: 0; transform: translate(0, 0); }
  20% { opacity: .9; }
  80% { opacity: .7; }
  100% { opacity: 0; transform: translate(var(--dx, 0), -9cqw); }
}
@media (prefers-reduced-motion: reduce) {
  .js .s--hero [data-reveal][data-hold] { filter: none; translate: 0 0; transition: none; }
}

/* ======================= Rose-petal shower (after the date is scratched) ======================= */
.petals { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; perspective: 600px; }
.petal { position: absolute; left: 0; top: 0; will-change: transform; filter: drop-shadow(0 3px 3px rgba(40,0,6,.35)); }
.petal > svg { display: block; width: 100%; height: 100%; transform-style: preserve-3d; backface-visibility: visible; }

/* ======================= Music toggle ======================= */
.music {
  position: fixed; z-index: 80; bottom: max(18px, env(safe-area-inset-bottom));
  right: max(16px, calc((100vw - 780px) / 2 + 16px));
  width: 46px; height: 46px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(47,5,9,.78); border: 1px solid rgba(201,165,92,.75); color: #e2c38a;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); backdrop-filter: blur(6px);
  transition: transform .25s var(--ease-soft), background .25s ease;
}
.music[hidden] { display: none; }
.music:hover, .music:focus-visible { background: rgba(74,10,16,.92); transform: scale(1.06); outline: none; }
.music:focus-visible { box-shadow: 0 0 0 2px #e2c38a; }
.music__bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; }
.music__bars i { width: 3px; height: 4px; border-radius: 1px; background: currentColor; transition: height .3s ease; }
.music.is-playing .music__bars i { animation: music-bar 1s ease-in-out infinite; }
.music.is-playing .music__bars i:nth-child(2) { animation-delay: -.3s; }
.music.is-playing .music__bars i:nth-child(3) { animation-delay: -.6s; }
.music.is-playing .music__bars i:nth-child(4) { animation-delay: -.15s; }
/* Paused: a slash across the bars. */
.music:not(.is-playing)::after { content: ''; position: absolute; width: 26px; height: 1.5px; background: currentColor; transform: rotate(-45deg); }
@keyframes music-bar { 0%, 100% { height: 4px; } 50% { height: 16px; } }
@media (prefers-reduced-motion: reduce) { .music.is-playing .music__bars i { animation: none; height: 12px; } }

