/* =========================================================================
   ORA — opening sequence
   A gold hairline draws the flacon, the liquid rises, the wordmark lifts out
   of a mask, then the screen parts along its centre line like a box opening.

   Everything animates transform and opacity only. The markup is injected by
   intro.js on the first page of a session, so none of this exists in the
   DOM on later pages.
   ========================================================================= */

html.intro-active { overflow: hidden; }

.intro {
  position: fixed;
  inset: 0;
  z-index: var(--z-intro);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* --- the two halves that part at the end -------------------------------- */
/* Each half runs 1px past the centre line so the join can never open a
   hairline gap on a fractional-pixel viewport. */

.intro__half {
  position: absolute;
  inset-inline: 0;
  height: calc(50% + 1px);
  background: var(--c-bg);
  transition: transform 1000ms var(--ease) 420ms;
}

.intro__half--top    { top: 0; }
.intro__half--bottom { bottom: 0; }

/* The slit of light that shows while the halves separate. */
.intro__half::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent, rgb(232 185 126 / 70%) 50%, transparent);
  opacity: 0;
  transition: opacity 240ms var(--ease) 380ms;
}

.intro__half--top::after    { bottom: 0; }
.intro__half--bottom::after { top: 0; }

.intro.is-leaving .intro__half--top    { transform: translateY(-101%); }
.intro.is-leaving .intro__half--bottom { transform: translateY(101%); }
.intro.is-leaving .intro__half::after  { opacity: 1; }

/* --- ambient glow --------------------------------------------------------- */

.intro__glow {
  position: absolute;
  /* Physical left, not inset-inline-start: this is centring, and in RTL the
     logical property would anchor the box to the right edge instead. */
  left: 50%;
  top: 46%;
  width: min(120vmin, 980px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgb(212 165 116 / 13%) 0%, rgb(212 165 116 / 4%) 38%, transparent 66%);
  opacity: 0;
  animation: intro-glow 1700ms var(--ease) 100ms forwards;
  pointer-events: none;
}

.intro.is-leaving .intro__glow {
  animation: none;
  opacity: 0;
  transition: opacity 500ms var(--ease);
}

@keyframes intro-glow {
  from { opacity: 0; scale: 0.7; }
  to   { opacity: 1; scale: 1; }
}

/* --- stage ---------------------------------------------------------------- */

.intro__stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: var(--s-6);
  transition: opacity 480ms var(--ease), transform 640ms var(--ease);
}

.intro.is-leaving .intro__stage {
  opacity: 0;
  transform: translateY(-14px) scale(0.985);
}

/* --- the flacon ------------------------------------------------------------ */

.intro__bottle {
  position: relative;
  width: clamp(96px, 26vw, 136px);
}

.intro__svg { display: block; width: 100%; height: auto; overflow: visible; }

.intro__draw {
  fill: none;
  stroke: var(--c-gold-2);
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: intro-draw 1000ms var(--ease) var(--at, 0ms) forwards;
}

.intro__draw--soft { stroke: rgb(232 185 126 / 45%); }

@keyframes intro-draw { to { stroke-dashoffset: 0; } }

/* Liquid: a tall rect parked below the pane and lifted into it. The surface
   highlight rides on its top edge, so it rises with the fill. */
.intro__liquid {
  transform: translateY(100px);
  animation: intro-fill 1250ms var(--ease) 950ms forwards;
}

@keyframes intro-fill { to { transform: translateY(30px); } }

.intro__pane-fade {
  opacity: 0;
  animation: intro-fade 700ms var(--ease) 900ms forwards;
}

@keyframes intro-fade { to { opacity: 1; } }

/* One pass of light across the glass, after the liquid has settled. */
.intro__glint {
  transform: translateX(-10px) skewX(-18deg);
  opacity: 0;
  animation: intro-glint 1000ms var(--ease) 1900ms forwards;
}

@keyframes intro-glint {
  0%   { opacity: 0; transform: translateX(-10px) skewX(-18deg); }
  18%  { opacity: 1; }
  82%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(210px) skewX(-18deg); }
}

/* Vapour leaving the cap. Soft radial discs: no filter, no blur cost. */
.intro__mist i {
  position: absolute;
  top: -6%;
  left: 50%;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(232 185 126 / 17%), transparent 70%);
  opacity: 0;
  translate: var(--x, 0) 0;
  animation: intro-mist 2000ms var(--ease) var(--at, 0ms) forwards;
  pointer-events: none;
}

@keyframes intro-mist {
  0%   { opacity: 0;   transform: translateY(14px) scale(0.35); }
  28%  { opacity: 1; }
  100% { opacity: 0;   transform: translateY(-84px) scale(1.7); }
}

/* --- wordmark -------------------------------------------------------------- */
/* Matches the header brand: Vazirmatn above, tracked Cormorant below. */

.intro__mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-block-start: var(--s-6);
  line-height: 1;
}

.intro__line {
  display: block;
  overflow: hidden;
  padding-block: 0.12em;
}

.intro__line > span {
  display: block;
  transform: translateY(120%);
  animation: intro-rise 1000ms var(--ease) var(--at, 0ms) forwards;
}

@keyframes intro-rise { to { transform: translateY(0); } }

.intro__fa {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  font-weight: 500;
  line-height: 1.5;
  color: var(--c-ink);
}

.intro__lat {
  font-family: var(--f-lat);
  font-size: clamp(0.8125rem, 0.7rem + 0.5vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.6em;
  /* Tracking trails each glyph; pull the mark back onto the centre line. */
  text-indent: 0.6em;
  color: var(--c-gold-2);
}

.intro__rule {
  display: block;
  width: min(180px, 44vw);
  height: 1px;
  margin-block: var(--s-5) var(--s-4);
  background: linear-gradient(90deg,
    transparent, rgb(212 165 116 / 75%) 50%, transparent);
  transform: scaleX(0);
  animation: intro-rule 1100ms var(--ease) 1500ms forwards;
}

@keyframes intro-rule { to { transform: scaleX(1); } }

.intro__tag {
  margin: 0;
  font-size: var(--t-xs);
  color: var(--c-ink-3);
  opacity: 0;
  translate: 0 8px;
  animation: intro-tag 900ms var(--ease) 1750ms forwards;
}

@keyframes intro-tag { to { opacity: 1; translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
  html.intro-active { overflow: auto; }
}
