/* =========================================================
   OPENING ANIMATION
   ========================================================= */

html.is-intro, html.is-intro body { overflow: hidden; }

.intro {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; place-items: center;
  perspective: 1700px;
  cursor: pointer;
  --ah: min(82vh, 125vw);
  --aw: calc(var(--ah) * 300 / 440);
}
.intro.is-open { pointer-events: none; }

/* ---------- arched velvet doors ---------- */
.intro__doors { position: absolute; inset: 0; transform-style: preserve-3d; }
.intro__door {
  position: absolute; top: 0; bottom: 0; width: 50.1%;
  overflow: hidden;
  background:
    repeating-linear-gradient(45deg, rgba(201, 164, 92, 0.035) 0 1px, transparent 1px 16px),
    radial-gradient(ellipse 120% 85% at var(--hx) 50%, #2c2116, #110d09 72%);
  backface-visibility: hidden;
  transition: transform 1.3s cubic-bezier(0.7, 0, 0.18, 1);
  will-change: transform;
}
.intro__door--l { left: 0; transform-origin: left center; --hx: 100%; box-shadow: inset -1px 0 0 rgba(201, 164, 92, 0.55); }
.intro__door--r { right: 0; transform-origin: right center; --hx: 0%; box-shadow: inset 1px 0 0 rgba(201, 164, 92, 0.55); }
.intro.is-open .intro__door--l { transform: rotateY(-110deg); }
.intro.is-open .intro__door--r { transform: rotateY(110deg); }

/* the arch outline is split across the two doors */
.intro__arch {
  position: absolute; top: 50%; translate: 0 -50%;
  width: var(--aw); height: var(--ah); max-width: none;
  fill: none; stroke: #c9a45c; stroke-width: 1.4;
  overflow: visible;
}
.intro__door--l .intro__arch { right: calc(var(--aw) / -2); }
.intro__door--r .intro__arch { left: calc(var(--aw) / -2); }
.intro__arch path { vector-effect: non-scaling-stroke; stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: introDraw 2.2s 0.1s cubic-bezier(0.6, 0, 0.2, 1) forwards; }
.intro__arch path.thin { opacity: 0.4; animation-delay: 0.35s; }
@keyframes introDraw { to { stroke-dashoffset: 0; } }

.intro__handle {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 4px; height: min(90px, 12vh); border-radius: 4px;
  background: linear-gradient(#8c6a2c, #ecd39a 45%, #8c6a2c);
  box-shadow: 0 0 12px rgba(236, 211, 154, 0.35);
  opacity: 0; animation: introFade 0.8s 1.2s forwards;
}
.intro__door--l .intro__handle { right: calc(var(--aw) / 2 + 18px); }
.intro__door--r .intro__handle { left: calc(var(--aw) / 2 + 18px); }
@keyframes introFade { to { opacity: 1; } }

/* light that spills through the gap */
.intro__beam {
  position: absolute; top: 0; bottom: 0; left: 50%; translate: -50% 0;
  width: 2px; opacity: 0;
  background: linear-gradient(transparent, rgba(255, 232, 175, 0.95) 30%, rgba(255, 232, 175, 0.95) 70%, transparent);
  transition: opacity 0.35s, width 1.1s cubic-bezier(0.7, 0, 0.2, 1);
}
.intro.is-out .intro__beam { opacity: 1; }
.intro.is-open .intro__beam { width: 70vw; opacity: 0; transition: width 1.2s cubic-bezier(0.7, 0, 0.2, 1), opacity 0.9s 0.25s; }

/* ---------- gold dust ---------- */
.intro__dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; transition: opacity 0.8s; }
.intro.is-open .intro__dust { opacity: 0; }

/* ---------- ring + signature ---------- */
.intro__mark {
  position: relative; z-index: 2;
  width: min(72vmin, 440px); aspect-ratio: 1;
  display: grid; place-items: center;
  transition: opacity 0.45s, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.intro.is-out .intro__mark { opacity: 0; transform: scale(1.14); }

.intro__ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.intro__ring-line {
  fill: none; stroke: url(#introGold); stroke-width: 1.6;
  stroke-dasharray: 1056; stroke-dashoffset: 1056;
  transform: rotate(-90deg); transform-box: fill-box; transform-origin: center;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.6, 0, 0.2, 1);
}
.intro__ring-line--thin { stroke-width: 0.8; opacity: 0.5; stroke-dasharray: 1131; stroke-dashoffset: -1131; transition-delay: 0.15s; }
.intro.is-ring .intro__ring-line { stroke-dashoffset: 0; }

.intro__stone, .intro__facets, .intro__flare { transform-box: fill-box; transform-origin: center; }
.intro__stone { fill: #f4f8ff; stroke: url(#introGold); stroke-width: 1; opacity: 0; transform: scale(0.2); }
.intro__facets { fill: none; stroke: rgba(130, 150, 190, 0.8); stroke-width: 0.7; opacity: 0; transform: scale(0.2); }
.intro__flare { fill: #fff8e2; opacity: 0; }
.intro.is-burst .intro__stone, .intro.is-burst .intro__facets {
  opacity: 1; transform: none;
  transition: opacity 0.3s, transform 0.6s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.intro.is-burst .intro__flare { animation: introFlare 1s ease-out forwards; }
@keyframes introFlare {
  0% { opacity: 0; transform: scale(0.2) rotate(0deg); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.9) rotate(45deg); }
}

.intro__sig { position: relative; width: 88%; margin-top: -6%; overflow: visible; }
.intro__text { font-family: "Pinyon Script", cursive; font-size: 120px; }
.intro__text--stroke {
  fill: none; stroke: #ecd39a; stroke-width: 1.1;
  stroke-dasharray: 900; stroke-dashoffset: 900;
  transition: stroke-dashoffset 1.7s cubic-bezier(0.55, 0, 0.3, 1), opacity 0.8s;
}
.intro.is-sig .intro__text--stroke { stroke-dashoffset: 0; }
.intro.is-fill .intro__text--stroke { opacity: 0; }
.intro__text--fill { fill: url(#introGold); opacity: 0; transition: opacity 0.9s; }
.intro.is-fill .intro__text--fill { opacity: 1; }

.intro__sub {
  position: absolute; top: 66%; left: 0; right: 0; margin: 0;
  text-align: center; white-space: nowrap;
  font-family: "Jost", sans-serif; font-weight: 300;
  font-size: clamp(0.55rem, 1.7vmin, 0.78rem); letter-spacing: 0.32em;
  color: #c9b48c;
}
.intro__sub span { display: inline-block; opacity: 0; transform: translateY(8px); }
.intro.is-sub .intro__sub span { opacity: 1; transform: none; transition: opacity 0.5s, transform 0.6s; transition-delay: calc(var(--i) * 22ms); }

/* repeat visits / reduced motion: already drawn */
.intro.is-instant .intro__ring-line,
.intro.is-instant .intro__text,
.intro.is-instant .intro__sub span,
.intro.is-instant .intro__arch path { transition: none !important; animation: none !important; stroke-dashoffset: 0; }
.intro.is-instant .intro__handle { animation: none; opacity: 1; }
.intro.is-calm.is-open .intro__door { transform: none; filter: none; opacity: 0; transition: opacity 0.6s; }
.intro.is-calm .intro__dust, .intro.is-calm .intro__beam { display: none; }

/* skip */
.intro__skip {
  position: absolute; bottom: 26px; inset-inline-end: 26px; z-index: 3;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(201, 164, 92, 0.35);
  background: rgba(18, 15, 11, 0.5);
  color: #c9b48c; font: 300 0.75rem "Jost", sans-serif; letter-spacing: 0.14em; text-transform: uppercase;
  opacity: 0; animation: introFade 0.6s 0.9s forwards;
  transition: border-color 0.3s, color 0.3s;
}
.intro__skip:hover { border-color: #c9a45c; color: #ecd39a; }
.intro.is-out .intro__skip { opacity: 0; animation: none; transition: opacity 0.3s; }

/* ---------- the page arrives as the doors open ---------- */
html.is-intro .hero .reveal { opacity: 0 !important; transform: translateY(28px) !important; }
.hero__arch { transition: scale 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s, opacity 1.2s 0.15s; }
html.is-intro .hero__arch { scale: 0.86; opacity: 0; }
.header { transition: background 0.5s, backdrop-filter 0.5s, border-color 0.5s, translate 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.35s; }
html.is-intro .header { translate: 0 -100%; }
html.is-intro .wa-float { scale: 0; }
.wa-float { transition: transform 0.4s var(--ease), scale 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) 1s; }
