/* Events page: "Phantom of the Opera" as a scroll-driven experience.
   assets/js/events.js sets --p (0 → 1) on each [data-scene] as it scrolls through. */

body.phantom {
  --velvet: #6b0d16;
  --wine: #2a0507;
  --night: #0b0506;
  --gold: #d9b56a;
  --gold-light: #f1dca4;
  --ivory: #f5ead2;
  --opera: "Cormorant Garamond", "Vollkorn", Georgia, serif;
}

.ph { background: var(--night); color: var(--ivory); font-family: var(--opera); }
.ph .kicker { font-family: var(--opera); font-weight: 600; letter-spacing: .42em; text-transform: uppercase; font-size: clamp(.8rem, 1.6vw, 1.05rem); color: var(--gold); }
.ph .gold { color: var(--gold); }
.ph em { font-style: italic; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--gold); }
.ornament::before, .ornament::after { content: ""; height: 1px; width: min(26vw, 220px); background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { transform: scaleX(-1); }
.ornament span { font-size: 22px; line-height: 1; }

/* Scenes that pin to the screen while you scroll through them */
.scene { position: relative; }
.ph .scene { padding: 0; }
.scene.pinned { height: var(--len, 250vh); }
.scene.pinned .stage { position: sticky; top: var(--header-h); height: calc(100svh - var(--header-h)); overflow: hidden; }
.scene .stage { display: grid; place-items: center; }

/* ---------- Act I: the curtain ---------- */
.scene-curtain { --len: 260vh; }
.scene-curtain .stage {
  --open: clamp(0, calc((var(--p, 0) - .06) / .5), 1);
  background:
    radial-gradient(ellipse 55% 60% at 50% 38%, rgba(255, 214, 150, calc(.08 + var(--open) * .16)), transparent 70%),
    radial-gradient(ellipse at 50% 120%, var(--wine), var(--night) 70%);
}
.title-card { position: relative; z-index: 1; text-align: center; padding: 0 var(--gutter); max-width: 980px; }
.title-card .kicker { opacity: clamp(0, calc((var(--p, 0) - .25) / .15), 1); }
.title-card .ornament { margin: 1.4rem auto; transform: scaleX(clamp(0, calc((var(--p, 0) - .3) / .25), 1)); }
.ph-title {
  font-family: var(--opera); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; line-height: .95;
  color: var(--ivory); text-shadow: 0 0 40px rgba(241, 220, 164, .25), 0 4px 30px rgba(0, 0, 0, .6);
  opacity: clamp(0, calc((var(--p, 0) - .28) / .25), 1);
  transform: scale(calc(.9 + clamp(0, calc((var(--p, 0) - .28) / .3), 1) * .1));
}
.ph-title .t1 { display: block; font-size: clamp(3.6rem, 13vw, 9.5rem); }
.ph-title .t2 { display: block; font-size: clamp(2rem, 7.2vw, 5.4rem); }
.ph-sub { margin-top: 1.4rem; font-style: italic; font-size: clamp(1.25rem, 2.6vw, 2rem); line-height: 1.35; color: var(--gold-light); opacity: clamp(0, calc((var(--p, 0) - .55) / .2), 1); }
.ph-cue { margin-top: 2.4rem; font-family: var(--label); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); opacity: clamp(0, calc((var(--p, 0) - .75) / .15), 1); }

.curtain { position: absolute; top: 0; bottom: 0; width: 52%; z-index: 3; overflow: hidden; box-shadow: 0 0 60px rgba(0, 0, 0, .7); }
.curtain .cloth { position: absolute; inset: 0; background: url("/assets/img/events/curtain.jpg") center top / cover; }
.curtain .cloth::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.35), transparent 30%, transparent 70%, rgba(0,0,0,.55)); }
.curtain.left { left: 0; transform-origin: left center; transform: translateX(calc(var(--open) * -56%)) scaleX(calc(1 - var(--open) * .3)); }
.curtain.right { right: 0; transform-origin: right center; transform: translateX(calc(var(--open) * 56%)) scaleX(calc(1 - var(--open) * .3)); }
.curtain.right .cloth { transform: scaleX(-1); }
.valance {
  position: absolute; top: 0; left: 0; right: 0; height: clamp(44px, 8vh, 80px); z-index: 4;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .25), transparent 40%, rgba(0, 0, 0, .45)),
    repeating-linear-gradient(90deg, #4a070d 0 14px, #8e1622 22px, #5c0910 34px, #3a0509 44px);
  border-bottom: 3px solid var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.valance::after { content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 10px; background: repeating-linear-gradient(90deg, var(--gold) 0 2px, transparent 2px 7px); opacity: .8; }
.curtain-label { position: absolute; z-index: 5; inset: 0; display: grid; place-content: center; text-align: center; gap: 1.4rem; pointer-events: none; opacity: calc(1 - var(--open) * 2.2); }
.curtain-label .kicker { font-size: clamp(.9rem, 2vw, 1.2rem); color: var(--gold-light); text-shadow: 0 2px 12px #000; }
.curtain-label .hint { font-family: var(--label); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.curtain-label .hint::after { content: ""; display: block; width: 1px; height: 46px; margin: 12px auto 0; background: linear-gradient(var(--gold), transparent); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: scaleY(.4); transform-origin: top; opacity: .4; } 50% { transform: scaleY(1); opacity: 1; } }

/* ---------- Act II: featuring ---------- */
.ph-section { padding: clamp(5rem, 12vw, 9rem) var(--gutter); }
.ph-section .center { text-align: center; }
.cast { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1rem, 3vw, 2.4rem); max-width: 1100px; margin: 3rem auto 0; }
.performer {
  text-align: center; padding: 2.6rem 1.4rem; border: 1px solid rgba(217, 181, 106, .35);
  background: radial-gradient(ellipse at 50% 0%, rgba(217, 181, 106, .12), transparent 70%);
  transform: translateY(40px); opacity: 0; transition: transform 1s cubic-bezier(.2, .8, .2, 1), opacity 1s;
}
.performer.in { transform: none; opacity: 1; }
.performer:nth-child(2) { transition-delay: .15s; }
.performer:nth-child(3) { transition-delay: .3s; }
.performer .role { font-style: italic; font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--gold); }
.performer .name { margin-top: .4rem; font-weight: 600; font-size: clamp(1.4rem, 2.6vw, 1.9rem); letter-spacing: .08em; text-transform: uppercase; }
.performer .line { width: 40px; height: 1px; background: var(--gold); margin: 1.2rem auto 0; }

/* ---------- Act III: three nights ---------- */
.scene-nights { --len: 230vh; }
.scene-nights .stage { background: radial-gradient(ellipse at 50% 50%, #1a0709, var(--night) 70%); }
.nights-frame { position: relative; width: min(92vw, 760px); padding: clamp(2.4rem, 6vw, 4rem) clamp(1.2rem, 5vw, 3.6rem); text-align: center; }
.nights-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.nights-frame rect { fill: none; stroke: var(--gold); stroke-dasharray: 1; stroke-dashoffset: calc(1 - clamp(0, calc(var(--p, 0) / .3), 1)); }
.nights-frame rect.inner { stroke-width: 1; opacity: .6; }
.nights-title { font-weight: 600; letter-spacing: .28em; font-size: clamp(2rem, 6vw, 3.6rem); color: var(--gold); opacity: clamp(0, calc((var(--p, 0) - .15) / .15), 1); }
.night {
  --lit: clamp(0, calc((var(--p, 0) - var(--at)) / .1), 1);
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .4rem 1rem; text-align: left;
  padding: 1rem 0; border-bottom: 1px solid rgba(217, 181, 106, .2);
  opacity: calc(.12 + var(--lit) * .88); transform: translateX(calc((1 - var(--lit)) * -24px));
}
.night:last-child { border-bottom: 0; }
.night .when { font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: clamp(1.15rem, 3vw, 1.7rem); color: var(--ivory); text-shadow: 0 0 calc(var(--lit) * 24px) rgba(241, 220, 164, .55); }
.night .when sup { font-size: .55em; }
.night .status { font-family: var(--label); font-weight: 700; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.night .status.sold { color: #f3a1a8; }
.night .status.past { color: rgba(245, 234, 210, .5); }
.night .meta { grid-column: 1 / -1; font-family: var(--label); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); display: flex; gap: 14px; flex-wrap: wrap; }
.night .meta a { color: var(--gold-light); }
.night.is-past .when { text-decoration: line-through; text-decoration-color: rgba(217, 181, 106, .6); text-decoration-thickness: 1px; }
.countdown { font-variant-numeric: tabular-nums; }
.season-note { margin-top: 1.4rem; font-style: italic; font-size: 1.1rem; color: var(--gold-light); opacity: clamp(0, calc((var(--p, 0) - .8) / .1), 1); }

/* ---------- Act IV: the evening ---------- */
.evening { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 6rem); max-width: 1100px; margin: 0 auto; align-items: start; }
.evening h2, .ph h2 { font-family: var(--opera); font-weight: 600; letter-spacing: .06em; color: var(--ivory); }
.evening .lede { font-style: italic; color: var(--gold-light); font-size: clamp(1.2rem, 2vw, 1.5rem); }
.courses { position: relative; list-style: none; padding-left: 64px; }
.courses::before, .courses::after { content: ""; position: absolute; left: 22px; top: 8px; bottom: 8px; width: 2px; }
.courses::before { background: rgba(217, 181, 106, .2); }
.courses::after { background: var(--gold); transform-origin: top; transform: scaleY(clamp(0, calc((var(--p, 0) - .2) / .45), 1)); box-shadow: 0 0 12px rgba(217, 181, 106, .6); }
.course { position: relative; padding: 1.1rem 0 1.4rem; }
.course .num {
  position: absolute; left: -64px; top: .9rem; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; background: var(--night); border: 1px solid var(--gold); color: var(--gold);
  font-weight: 600; font-size: 1.1rem; z-index: 1;
}
.course h3 { font-family: var(--opera); font-weight: 600; text-transform: none; letter-spacing: .04em; font-size: clamp(1.4rem, 2.4vw, 1.8rem); color: var(--ivory); }
.course p { font-size: 1.05rem; color: rgba(245, 234, 210, .8); display: flex; align-items: center; gap: 8px; }
.glass { width: 18px; height: 24px; flex: none; }
.glass .wine-fill { fill: #8e1622; transform-origin: 50% 100%; transform: scaleY(0); transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.with-wine .glass .wine-fill { transform: scaleY(1); }
.course:nth-child(2) .wine-fill { transition-delay: .08s; }
.course:nth-child(3) .wine-fill { transition-delay: .16s; }
.course:nth-child(4) .wine-fill { transition-delay: .24s; }
.course:nth-child(5) .wine-fill { transition-delay: .32s; }
.pairing-label { transition: opacity .4s; }
.without-wine .pairing-label { opacity: .35; text-decoration: line-through; }

.ticket {
  position: sticky; top: calc(var(--header-h) + 24px); border: 1px solid var(--gold); padding: clamp(1.6rem, 4vw, 2.4rem); text-align: center;
  background: linear-gradient(160deg, rgba(107, 13, 22, .55), rgba(11, 5, 6, .9));
  box-shadow: 0 0 0 6px var(--night), 0 0 0 7px rgba(217, 181, 106, .5), 0 30px 60px rgba(0, 0, 0, .5);
}
.toggle { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--gold); border-radius: 999px; padding: 4px; margin: 1.2rem 0 1.6rem; position: relative; }
.toggle button { position: relative; z-index: 1; background: none; border: 0; color: var(--gold-light); cursor: pointer; font-family: var(--label); font-weight: 700; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 10px 16px; border-radius: 999px; transition: color .3s; }
.toggle button[aria-pressed="true"] { color: var(--night); }
.toggle .knob { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--gold); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.without-wine .toggle .knob { transform: translateX(100%); }
.price { font-size: clamp(3.4rem, 8vw, 5rem); font-weight: 600; line-height: 1; color: var(--ivory); font-variant-numeric: lining-nums; }
.price small { font-size: .3em; letter-spacing: .1em; color: var(--gold-light); }
.fine { margin-top: .8rem; font-family: var(--label); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.ticket .btn { margin-top: 1.6rem; color: var(--gold-light); border-color: var(--gold); }
.ticket .btn:hover { background: var(--gold); color: var(--night); border-color: var(--gold); }

/* ---------- Act V: good to know ---------- */
.know { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; max-width: 1100px; margin: 3rem auto 0; }
.know div { border-top: 1px solid var(--gold); padding-top: 1.2rem; }
.know h3 { font-family: var(--opera); font-weight: 600; font-size: 1.5rem; letter-spacing: .04em; text-transform: none; color: var(--gold); margin-bottom: .5rem; }
.know p { font-size: 1.1rem; line-height: 1.55; color: rgba(245, 234, 210, .85); }
.know a { color: var(--gold-light); }

/* ---------- Act VI: finale ---------- */
.scene-finale { --len: 220vh; }
.scene-finale .stage { background: var(--night); }
.finale-media {
  position: absolute; inset: 0;
  background: url("/assets/img/events/mask-rose.jpg") center 40% / cover;
  clip-path: circle(calc(8% + clamp(0, calc(var(--p, 0) / .55), 1) * 70%) at 50% 42%);
  filter: brightness(calc(.35 + clamp(0, calc(var(--p, 0) / .55), 1) * .45));
  transform: scale(calc(1.12 - clamp(0, var(--p, 0), 1) * .12));
}
.finale-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(11, 5, 6, .9) 85%); }
.finale-words { position: absolute; left: 0; right: 0; bottom: clamp(2rem, 8vh, 5rem); z-index: 2; text-align: center; padding: 0 var(--gutter); }
.finale-words .w { display: inline-block; font-style: italic; font-size: clamp(2rem, 6vw, 4.4rem); color: var(--gold-light); text-shadow: 0 4px 30px #000; opacity: clamp(0, calc((var(--p, 0) - var(--at)) / .08), 1); transform: translateY(calc((1 - clamp(0, calc((var(--p, 0) - var(--at)) / .08), 1)) * 18px)); }
.finale-words .w + .w { margin-left: .3em; }
.finale-words .actions { justify-content: center; margin-top: 1.6rem; opacity: clamp(0, calc((var(--p, 0) - .8) / .1), 1); }
.finale-words .btn { color: var(--gold-light); border-color: var(--gold); }
.finale-words .btn.solid { background: var(--velvet); border-color: var(--velvet); color: #fff; }
.finale-words .btn:hover { background: var(--gold); color: var(--night); border-color: var(--gold); }
.petals { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; opacity: clamp(0, calc((var(--p, 0) - .3) / .2), 1); }
.petals i {
  position: absolute; top: -40px; width: 14px; height: 18px; border-radius: 80% 0 80% 0;
  background: radial-gradient(circle at 30% 30%, #c0182a, #5e0710); box-shadow: inset -2px -2px 4px rgba(0,0,0,.4);
  animation: fall linear infinite;
}
@keyframes fall {
  0% { transform: translate(0, -40px) rotate(0deg); }
  100% { transform: translate(var(--drift, 60px), calc(100svh + 40px)) rotate(var(--spin, 540deg)); }
}

/* ---------- Flyer & more events ---------- */
.flyer-wrap { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; max-width: 1100px; margin: 0 auto; }
.flyer-thumb { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; position: relative; }
.flyer-thumb:focus:not(:focus-visible) { outline: none; }
.flyer-thumb:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }
.flyer-thumb img { width: 100%; height: auto; aspect-ratio: 1545 / 1999; box-shadow: 0 30px 60px rgba(0, 0, 0, .6); transition: transform .5s; }
.flyer-thumb:hover img { transform: scale(1.02) rotate(-.4deg); }
.flyer-thumb span { position: absolute; right: 12px; bottom: 12px; font-family: var(--label); font-weight: 700; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; background: var(--gold); color: var(--night); padding: 6px 10px; }
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: min(94vw, 760px); max-height: 94svh; }
dialog.lightbox::backdrop { background: rgba(0, 0, 0, .85); }
dialog.lightbox img { display: block; max-height: 90svh; height: auto; width: auto; max-width: 100%; margin: 0 auto; }
dialog.lightbox .close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gold); background: rgba(0,0,0,.6); color: var(--gold-light); font-size: 24px; cursor: pointer; }

.ph-next { background: var(--light); color: var(--ink); font-family: var(--body); }
.ph-next .gathering { background: #fff; border: 1px solid var(--line-dark); padding: 1.8rem; text-align: center; }
.ph-next .gathering .script { font-size: 2rem; }
.ph-next .gathering h3 { margin: .6rem 0 .4rem; }
.ph-next .gathering p { font-size: 15px; opacity: .8; }

/* ---------- Phones ---------- */
@media (max-width: 860px) {
  .cast, .know { grid-template-columns: 1fr; }
  .evening, .flyer-wrap { grid-template-columns: 1fr; }
  .ticket { position: static; }
}
@media (max-width: 560px) {
  .curtain { width: 54%; }
  .night { grid-template-columns: 1fr; }
  .night .status { justify-self: start; }
  .courses { padding-left: 56px; }
  .course .num { left: -56px; width: 40px; height: 40px; }
  .courses::before, .courses::after { left: 19px; }
  .petals i:nth-child(n + 7) { display: none; }
}

/* ---------- Reduced motion: show every act fully, no pinning ---------- */
@media (prefers-reduced-motion: reduce) {
  .scene.pinned { height: auto; }
  .scene.pinned .stage { position: relative; top: 0; height: auto; min-height: 80svh; padding: 5rem 0; }
  .ph [data-scene] { --p: 1 !important; }
  .scene-curtain .curtain, .valance, .curtain-label, .petals { display: none; }
  .performer { transform: none; opacity: 1; transition: none; }
  .finale-media { position: absolute; }
}
