/*
   Opening sequence + hero reveal
   Initial (hidden) states live here; the timing lives in InvitationIntro.js.
   */

.intro {
  position: fixed; inset: 0; z-index: 200;
  overflow: hidden; color: var(--on-dark);
  touch-action: manipulation;
  --corner: clamp(54px, 15vw, 92px);
}
.intro.is-opening { pointer-events: none; }

/* the two halves of the maroon background are the temple doors */
.intro__panel {
  position: absolute; top: 0; bottom: 0; width: calc(50% + 1px); z-index: 1;
  background-color: var(--wine);
  background-image:
    var(--lattice),
    radial-gradient(ellipse 85% 70% at 50% 40%, var(--maroon-hi) 0%, var(--maroon) 46%, var(--wine) 100%);
  background-size: 72px 72px, 200% 100%;
  will-change: transform;
}
.intro__panel--l { left: 0; background-position: 0 0, left top; box-shadow: 1px 0 0 rgba(197, 161, 91, 0.32), 22px 0 44px -16px rgba(0, 0, 0, 0.55); }
.intro__panel--r { right: 0; background-position: 0 0, right top; box-shadow: -1px 0 0 rgba(197, 161, 91, 0.32), -22px 0 44px -16px rgba(0, 0, 0, 0.55); }

.intro__aura {
  position: absolute; z-index: 2; left: 50%; top: 44%; width: min(130vw, 980px); aspect-ratio: 1;
  translate: -50% -50%;
  background: radial-gradient(circle, rgba(242, 196, 107, 0.2) 0%, rgba(242, 196, 107, 0.07) 38%, transparent 64%);
  opacity: 0; pointer-events: none;
}
.intro__dust { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; opacity: 0; pointer-events: none; }

/* golden frame */
.intro__frame { position: absolute; z-index: 4; inset: calc(var(--demo-h) + 10px) max(12px, var(--safe-r)) calc(12px + var(--safe-b)) max(12px, var(--safe-l)); pointer-events: none; }
.fl { position: absolute; background: linear-gradient(90deg, transparent, var(--gold) 6%, var(--gold) 94%, transparent); }
.fl--t, .fl--b { left: var(--corner); right: var(--corner); height: 1px; transform: scaleX(0); }
.fl--l, .fl--r { top: var(--corner); bottom: var(--corner); width: 1px; transform: scaleY(0); background: linear-gradient(180deg, transparent, var(--gold) 6%, var(--gold) 94%, transparent); }
.fl--t { top: calc(var(--corner) * 0.022); } .fl--b { bottom: calc(var(--corner) * 0.022); }
.fl--l { left: calc(var(--corner) * 0.022); } .fl--r { right: calc(var(--corner) * 0.022); }
.fl--in { opacity: 0.55; }
.fl--in.fl--t { top: calc(var(--corner) * 0.133); } .fl--in.fl--b { bottom: calc(var(--corner) * 0.133); }
.fl--in.fl--l { left: calc(var(--corner) * 0.133); } .fl--in.fl--r { right: calc(var(--corner) * 0.133); }
.fl--in.fl--t, .fl--in.fl--b { left: calc(var(--corner) * 0.98); right: calc(var(--corner) * 0.98); }
.fl--in.fl--l, .fl--in.fl--r { top: calc(var(--corner) * 0.98); bottom: calc(var(--corner) * 0.98); }
.fc { position: absolute; width: var(--corner); height: var(--corner); }
.fc svg { display: block; width: 100%; height: 100%; }
.fc--tl { top: 0; left: 0; } .fc--tr { top: 0; right: 0; transform: scaleX(-1); }
.fc--bl { bottom: 0; left: 0; transform: scaleY(-1); } .fc--br { bottom: 0; right: 0; transform: scale(-1, -1); }
.intro .fc .rt-draw { stroke-dasharray: 1 2; stroke-dashoffset: 1; }
.intro .fc .rt-fade { opacity: 0; }

/* stage */
.intro__stage {
  position: relative; z-index: 5; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: clamp(0.3rem, 1.5dvh, 0.9rem);
  padding: calc(var(--demo-h) + 26px) max(26px, var(--safe-r)) calc(46px + var(--safe-b)) max(26px, var(--safe-l));
}
.intro__invocation { font-size: clamp(0.95rem, 2.4dvh, 1.15rem); color: var(--champ); opacity: 0; line-height: 1.5; }

.intro__arch { position: relative; height: clamp(205px, 41dvh, 470px); aspect-ratio: 300 / 460; --diya: clamp(48px, 8.4dvh, 88px); }
.intro__arch > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.intro .rt-draw { stroke-dasharray: 1 2; stroke-dashoffset: 1; }
.intro .rt-fade, .intro .arch__opening { opacity: 0; }
.intro__diya { position: absolute; bottom: 0; width: var(--diya); opacity: 0; }
.intro__diya--l { right: calc(100% + 10px); } .intro__diya--r { left: calc(100% + 10px); }
.intro__diya svg { display: block; width: 100%; height: auto; overflow: visible; }
.intro .flame, .intro .glow { opacity: 0; }
.intro .flame { scale: 0.15; }
.intro.is-burning .flame { animation: flicker 1.9s ease-in-out infinite; }
.intro.is-burning .diya--r .flame, .intro.is-burning .intro__diya--r .flame { animation-delay: -0.8s; }
.intro.is-burning .glow { animation: breathe 3.6s ease-in-out infinite; }

.intro__title { opacity: 0; display: grid; gap: 0.1rem; }
.intro__title-te { font-size: clamp(1.02rem, 2.8dvh, 1.3rem); color: var(--champ); line-height: 1.5; }
.intro__title-en { font: 700 clamp(0.62rem, 1.7dvh, 0.74rem)/1.4 var(--font-body); letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold); padding-left: 0.4em; }

.intro__names {
  display: flex; align-items: baseline; justify-content: center; gap: 0.28em; flex-wrap: nowrap; white-space: nowrap;
  font: italic 500 clamp(2.5rem, min(11.2vw, 9dvh), 5.6rem)/1.08 var(--font-display);
  color: var(--ivory);
}
.intro__names .amp { font-style: normal; font-weight: 400; font-size: 0.62em; color: var(--gold); opacity: 0; transform: translateY(-0.12em); }
.intro__date { font: 400 clamp(0.74rem, 1.9dvh, 0.86rem)/1.4 var(--font-body); letter-spacing: 0.26em; text-transform: uppercase; color: var(--on-dark-soft); opacity: 0; }

.intro__actions { display: grid; justify-items: center; gap: 0.3rem; margin-top: clamp(0.3rem, 1.4dvh, 0.9rem); opacity: 0; }
.intro__open {
  position: relative; min-height: 42px; padding: 0 clamp(1.1rem, 4vw, 1.6rem);
  background: var(--gold); color: var(--wine); border: 0; border-radius: 2px; cursor: pointer;
  font: 700 0.66rem/1 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase; overflow: visible;
  transition: background-color 0.35s, transform 0.4s var(--ease-out);
  touch-action: manipulation;
}
.intro__open span { position: relative; z-index: 1; }
.intro__open:hover { background: var(--champ); transform: translateY(-2px); }
.intro__open::after {
  content: ""; position: absolute; inset: -1px; border: 1px solid var(--gold); border-radius: 2px; pointer-events: none;
  animation: ring 3s ease-out infinite;
}
@keyframes ring { 0% { transform: scale(1); opacity: 0.8; } 70%, 100% { transform: scale(1.22, 1.55); opacity: 0; } }
.intro__open:focus-visible { outline: 2px solid var(--champ); outline-offset: 4px; }

/* short landscape screens: arch left, copy right */
@media (max-height: 520px) and (orientation: landscape) {
  .intro__stage { display: grid; grid-template-columns: auto 1fr; grid-auto-flow: column; align-content: center; justify-items: center; column-gap: clamp(1rem, 6vw, 4rem); row-gap: 0.15rem; padding-bottom: 34px; }
  .intro__arch { grid-row: 1 / span 6; grid-column: 1; height: min(62dvh, 250px); margin-inline: calc(var(--diya) + 10px); }
  .intro__stage > *:not(.intro__arch) { grid-column: 2; }
}

/* HERO (the invitation reveal) */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; align-items: center;
  padding-block: calc(var(--demo-h) + 2.8rem) 6rem;
  background:
    linear-gradient(to bottom, transparent calc(100% - 140px), var(--maroon)),
    radial-gradient(ellipse 80% 60% at 50% 32%, var(--maroon-hi) 0%, var(--maroon) 58%, var(--maroon-lo) 100%);
  color: var(--on-dark); overflow: clip; isolation: isolate;
}
.hero__bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero__lattice { position: absolute; inset: 0; background-image: var(--lattice); background-size: 72px 72px; opacity: 0.8; -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 20%, transparent 78%); mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 20%, transparent 78%); }
.hero__glow { position: absolute; left: 50%; top: 42%; width: min(150vw, 1200px); aspect-ratio: 1; translate: -50% -50%; background: radial-gradient(circle, rgba(242, 196, 107, 0.2), rgba(242, 196, 107, 0.05) 42%, transparent 66%); opacity: 0; transition: opacity 2.4s 0.3s var(--ease-out); }
.hero.is-revealed .hero__glow { opacity: 1; }
.hero__mandala { position: absolute; left: 50%; top: 40%; width: min(150vw, 980px); translate: -50% -50%; opacity: 0.16; }
.hero__mandala svg { display: block; width: 100%; height: auto; transform-origin: 50% 50%; animation: wheel-spin 80s linear infinite; animation-play-state: paused; will-change: transform; }
.hero.is-spinning .hero__mandala svg { animation-play-state: running; } /* only turns while the hero is on screen */
@keyframes wheel-spin { to { transform: rotate(360deg); } }
.hero__petals { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }

.hero__grid { position: relative; z-index: 1; display: grid; gap: clamp(2rem, 5vw, 3.5rem); justify-items: center; text-align: center; }
.hero__head, .hero__body { display: grid; justify-items: center; gap: 0.9rem; max-width: 36rem; }
.hero__body { max-width: 44rem; width: 100%; }
.hero__rest { position: relative; z-index: 1; display: grid; justify-items: center; text-align: center; margin-top: clamp(2rem, 5vw, 3.5rem); }

html.js .hero [data-hero] { opacity: 0; transform: translate3d(0, 26px, 0); }
html.js .hero.is-revealed [data-hero] {
  opacity: 1; transform: none;
  transition: opacity 1.2s var(--ease-out), transform 1.3s var(--ease-out);
  transition-delay: var(--hd, 0.5s);
}
.hero__invocation { --hd: 0.7s; font-size: 1.15rem; color: var(--champ); }
.hero__head .eyebrow { --hd: 0.9s; }
.hero__names {
  display: grid; justify-items: center; gap: 0;
  font: italic 500 clamp(3.7rem, 17vw, 8.4rem)/0.98 var(--font-display);
  color: var(--ivory); text-wrap: balance;
}
.hero__names:focus { outline: none; }
.hero__names .n { display: block; padding-inline: 0.06em; }
.hero__names .amp { --hd: 1.5s; display: block; font-style: normal; font-weight: 400; font-size: 0.42em; line-height: 1.1; color: var(--gold); margin-block: 0.06em; }
.hero.is-revealed .hero__names .n:first-child .split__unit { --split-delay: 750ms; }
.hero.is-revealed .hero__names .n:last-child .split__unit { --split-delay: 1250ms; }
.hero__divider { --hd: 1.9s; width: min(280px, 68vw); }
.hero__divider svg { display: block; width: 100%; height: auto; overflow: visible; }

.hero__date { --hd: 2.1s; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: min(100%, 34rem); margin: 0.4rem auto 0; } /* equal side columns keep the day on the exact centre line, under the names */
.hero__month { justify-self: end; margin-right: -0.3em; padding-right: clamp(0.8rem, 3vw, 1.4rem); }
.hero__year { justify-self: start; padding-left: clamp(0.8rem, 3vw, 1.4rem); }
.hero__month, .hero__year { font: 700 0.84rem/1 var(--font-body); letter-spacing: 0.3em; text-transform: uppercase; color: #F3E8C6; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35); }
/* lining figures: Cormorant's default old-style "12" is x-height only, so it sat low and looked small and dim next to the caps */
.hero__day {
  font: 600 clamp(3rem, 11vw, 4.3rem)/1 var(--font-display); font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1;
  padding: 0.035em clamp(0.9rem, 3.2vw, 1.5rem) 0.085em; /* tiny lift: figures optically centre on the caps */
  color: #E3C27A; /* fallback where background-clip:text is missing */
  background: linear-gradient(180deg, #FBF0C8 0%, #EAC97D 48%, #CFA34C 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  border-inline: 1px solid transparent;
  border-image: linear-gradient(180deg, transparent 0%, rgba(232, 202, 130, 0.95) 24%, rgba(232, 202, 130, 0.95) 76%, transparent 100%) 1;
}
.hero__when { --hd: 2.25s; font: 400 0.84rem/1.5 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-dark-soft); }
.hero__message { --hd: 2.4s; margin-top: 0.7rem; font: 400 clamp(1.18rem, 3.4vw, 1.4rem)/1.65 var(--font-display); color: var(--on-dark); text-wrap: pretty; }
.hero__blessing { --hd: 2.55s; font: italic 400 clamp(1.3rem, 3.8vw, 1.65rem)/1.55 var(--font-display); max-width: 30rem; text-wrap: balance; color: var(--champ); }
.hero__actions { --hd: 2.7s; display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; margin-top: 0.7rem; }

.hero__art { --hd: 1.1s; position: relative; width: min(440px, 80vw); }
.hero__art svg.mandap { position: relative; display: block; width: 100%; height: auto; }
.hero__art::before { content: ""; position: absolute; left: 4%; right: 4%; bottom: -3%; height: 14%; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.42), transparent 70%); pointer-events: none; } /* soft ground shadow – a plain gradient instead of a 40px drop-shadow filter, which was re-rendered every scroll frame */

.hero__cue { --hd: 3s; position: absolute; z-index: 1; left: 50%; bottom: 1.6rem; translate: -50% 0; display: grid; justify-items: center; gap: 0.35rem; min-width: 48px; min-height: 48px; color: var(--champ); text-decoration: none; font: 700 0.62rem/1 var(--font-body); letter-spacing: 0.3em; text-transform: uppercase; }
.hero__cue .icon { animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: translateY(0); opacity: 0.6; } 50% { transform: translateY(5px); opacity: 1; } }

@media (min-width: 980px) {
  .hero { padding-block: calc(var(--demo-h) + 3rem) 5rem; }
  /* names on the left, the mandap on the right of them (same row, centred on each other); the date and message run centred underneath */
  .hero__grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); column-gap: clamp(2rem, 5vw, 5rem); align-items: center; }
  .hero__head { grid-column: 1; grid-row: 1; }
  .hero__art { grid-column: 2; grid-row: 1; width: min(520px, 100%); }
  .hero__rest { margin-top: clamp(1.6rem, 3vw, 2.4rem); }
  .hero__names { font-size: clamp(5rem, 8.4vw, 8.6rem); }
}
@media (prefers-reduced-motion: reduce) {
  .hero__cue .icon, .intro__open::after, .intro.is-burning .flame, .intro.is-burning .glow, .hero__mandala svg { animation: none; }
  html.js .hero [data-hero] { opacity: 1; transform: none; }
}
