/* The kumkum envelope: the site arrives as a sealed invitation.
   Geometry is drawn in a 600-unit square; --W is the envelope's width in px.

   Envelope palette: override these in one :root block to swap the colourway
   (for example peacock: paper #2f6b6e, flap #29605f, ink and line #fbf0e6, seal #c99232, seal-ink #3d0f0c).
     --env-paper     the envelope's outside (the pocket)
     --env-flap      the flap's outside, a shade deeper than the paper
     --env-ink       the names printed on the envelope
     --env-date      the small date label on the envelope
     --env-line      the hairlines on the envelope
     --env-seal      the seal disc
     --env-seal-ink  the monogram and fine ring on the seal
     --env-lining    the inside of the flap, seen when it opens (the same ivory as the flap, with a faint sindoor guilloché)
   Current colourway: ivory paper (chosen). */
:root {
  --env-paper: #f4e6dc;
  --env-flap: #efdccf;
  --env-ink: #a63a2e;
  --env-date: #8a5d17;
  --env-line: #a63a2e;
  --env-seal: #a63a2e;
  --env-seal-ink: #fbf0e6;
  --env-lining: #efdccf;
}

/* the page width must not change when the scrollbar returns, so the hand-off stays pixel-exact */
html { scrollbar-gutter: stable; }
html.env-closed, html.env-closed body { overflow: hidden; overscroll-behavior: none; }
html.env-seen .env, html:not(.js) .env { display: none; }
/* hold the hero's names until the card lands on them (the arch itself is left to settle underneath) */
html.env-hold .hero .rise:not(.arch) { animation-play-state: paused; }
/* the frame the overlay is removed, the hero is already in its final state, so nothing changes */
html.env-landed .hero .rise { animation: none; opacity: 1; transform: none; }
html.env-bar-up .bar { z-index: 400; }

.env { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; touch-action: none;
  -webkit-tap-highlight-color: transparent; cursor: pointer; }
.env-ground { position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(60% 65% at 50% 45%, #6b1d16 0%, #4a120e 45%, #2a0907 100%); }
.env-ground .hero-tex { opacity: .4; }

.env-stage { position: relative; display: grid; justify-items: center; gap: calc(var(--Hb) * .14);
  --W: min(680px, 70vw, calc(56svh * 1.5)); --Hb: calc(var(--W) / 1.5); margin-top: calc(var(--Hb) * .12); }
@media (max-width: 600px) { .env-stage { --W: 92vw; --Hb: calc(var(--W) / 1.4); } }
.env-box { position: relative; width: var(--W); height: var(--Hb); }

/* ---------- the card inside: the hero in miniature, on its own kumkum ground ---------- */
.env-card { position: absolute; z-index: 2; transform-origin: 0 0; left: 30%; top: 5%; width: 40%; height: 90%; }
.ec-ground { position: absolute; inset: 0; background: #3a0d0a; }
.ec-window { position: absolute; outline: 1px solid rgba(201, 146, 50, .45); outline-offset: 3px; pointer-events: none; }
.ec-mini { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; pointer-events: none; }
.ec-mini .hero { min-height: 0; }
.ec-mini .ec-fly { transform-origin: 0 0; }
.ec-frame { position: absolute; inset: 0; border: 1px solid rgba(201, 146, 50, .6); border-radius: 4px;
  outline: 1px solid rgba(201, 146, 50, .4); outline-offset: 5px; pointer-events: none; }
.ec-families { position: absolute; left: 8%; right: 8%; top: 0; font-size: 11px; line-height: 1.35;
  color: #efd6ca; letter-spacing: .03em; text-align: center; text-wrap: balance; }

/* ---------- the envelope ---------- */
.ep-paper { fill: var(--env-paper); }
.ep-flap { fill: var(--env-flap); }
.ep-line { stroke: var(--env-line); }
.env-lining { position: absolute; inset: 0; clip-path: url(#env-arch-up);
  background: url("assets/mandala-sindoor.svg") 50% 30% / calc(var(--W) * .9) no-repeat, var(--env-lining); }
.env-lining::after { content: ""; position: absolute; inset: 0; background: var(--env-lining); opacity: .86; }
.env-clips { position: absolute; }
.env-in .ep-line { stroke: var(--env-line); }
.ep-seal { fill: var(--env-seal); }
.ep-seal-ring { stroke: var(--env-seal-ink); opacity: .6; }

.env-pocket { position: absolute; inset: 0; z-index: 4; }
.env-pocket > svg, .env-face > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.env-front { position: absolute; left: 0; right: 0; top: 68%; display: grid; justify-items: center; gap: calc(var(--W) * .026); text-align: center; }
.env-title { font-family: var(--display); font-weight: 400; font-size: calc(var(--Hb) * .085); line-height: 1.05; color: var(--env-ink);
  font-variation-settings: "opsz" 36; letter-spacing: .06em; }
.env-date { font-size: 12.5px; line-height: 1.2; letter-spacing: .24em; text-transform: uppercase; color: var(--env-date); }

.env-flap { position: absolute; left: 0; top: -46%; width: 100%; height: 46%; z-index: 5; transform-origin: 50% 100%;
  transform-style: preserve-3d; transform: perspective(1400px) rotateX(-180deg); }
.env.flap-behind .env-flap { z-index: 1; }
.env-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.env-out { transform: rotateX(180deg); }

/* the kalava: one red-and-haldi thread, tied across the envelope under the seal */
.env-thread { position: absolute; left: -2.5%; width: 105%; top: 44%; height: max(4px, calc(var(--Hb) * .016)); margin-top: max(-2px, calc(var(--Hb) * -.008)); z-index: 6; pointer-events: none; }
.env-thread > svg { display: block; width: 100%; height: 100%; }
.env-seal { position: absolute; left: 50%; top: 44%; width: calc(var(--Hb) * .22); aspect-ratio: 1; margin: calc(var(--Hb) * -.11) 0 0 calc(var(--Hb) * -.11); z-index: 7;
  padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; color: inherit; }
.env-seal > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.env-seal:focus { outline: none; }
.env-seal:focus-visible { outline: 2px solid var(--cream); outline-offset: 6px; }
.env-mono { font-family: var(--display); font-weight: 400; font-size: 27px; letter-spacing: .04em; fill: var(--env-seal-ink); font-variation-settings: "opsz" 24; }
.env-mono-amp { font-size: 16px; }
/* an occasional accent: a fine haldi ring breathes around the seal */
.env-seal::after { content: ""; position: absolute; inset: -12%; border-radius: 50%; border: 1px solid rgba(233, 194, 122, .55); opacity: 0; pointer-events: none; }

.env-hint { font-size: 12.5px; line-height: 1.4; letter-spacing: .18em; text-transform: uppercase; color: var(--haldi); text-align: center; }
.env-hint-k { display: none; }
@media (hover: hover) and (pointer: fine) { .env-hint-t { display: none; } .env-hint-k { display: inline; } }

@media (prefers-reduced-motion: no-preference) {
  .env-seal::after { animation: env-halo 4.8s cubic-bezier(.37, 0, .63, 1) 1.2s infinite; }
  @keyframes env-halo { 0%, 55%, 100% { opacity: 0; transform: scale(.94); } 70% { opacity: 1; } 90% { opacity: 0; transform: scale(1.12); } }
  .env-stage { animation: env-in .9s var(--ease) both; }
  @keyframes env-in { from { opacity: 0; transform: translateY(14px); } }
}
.env.is-opening { cursor: default; }
.env.is-opening .env-seal::after { animation: none; }


