/* ============================================================
   INTRO: "The Pour". A black frame; the stacked logo fills with
   liquid (LABS, then TEA); the steam wisps rise; the black then
   contracts into the header island while the logo flies home.
   Frame 1 is painted from the <head> class alone (no JS needed).
   ============================================================ */

.intro-root { display: none; }
html.intro-active .intro-root,
.intro-root.is-running { display: block; }

/* Failsafe: if JS never takes over, the overlay hides itself at 7s. */
html.intro-active .intro-root { animation: intro-failsafe 0s 7s forwards; }
@keyframes intro-failsafe { to { visibility: hidden; pointer-events: none; } }

.intro {
  position: fixed;
  inset: 0;
  z-index: var(--z-intro, 200);
  contain: strict;
}

.intro__bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, #10222a 0%, #0a171d 45%, #050608 100%);
  clip-path: inset(0 round 0);
}
/* Solid island colour, faded in during the curtain so the black lands
   on exactly the island's obsidian (no colour pop at removal). */
.intro__bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--island, #0d1b21);
  opacity: 0;
}

/* The logo is centred with left/top so `transform` stays free for the FLIP. */
.intro__logo {
  --h: min(52svh, 420px);
  position: absolute;
  height: var(--h);
  width: calc(var(--h) * 512 / 698);
  left: calc(50% - var(--h) * 256 / 698);
  top: calc(50% - var(--h) / 2);
  transform-origin: 0 0;
  will-change: transform;
  overflow: visible;
}
@media (max-width: 599px) {
  .intro__logo { --h: min(42svh, 300px); }
}

/* Empty glass: the seven letters drawn in hairlines. */
.intro__glass {
  fill: none;
  stroke: #F4F5F7;
  stroke-opacity: .28;
  stroke-width: 1.25;
  opacity: 0;
  transform-box: view-box;
  transform-origin: 518px 670px;
}
/* vector-effect is not inherited into <use> clones, so set it on the
   sprite paths themselves (harmless where they are not stroked). */
[id^="lg-tea-"] { vector-effect: non-scaling-stroke; }

/* Liquid: local y = 0 is the surface; JS raises it from 872 to 486. */
.intro__liq { transform: translateY(872px); }
.intro__liq, .intro__crest, .intro__wave { transform-box: view-box; transform-origin: 0 0; }
.intro__body,
.intro__crest--front { fill: var(--steam, #F4F5F7); }
.intro__crest--back { fill: var(--liquid, #2e6b7c); opacity: .9; }

.intro__bubbles { fill: var(--liquid, #2e6b7c); fill-opacity: .55; }
.intro__bubbles circle { opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.intro.is-filling .intro__bubbles circle {
  animation: intro-bubble var(--bd, 1100ms) var(--ease, ease-out) var(--bdl, 0ms) infinite;
}
.intro__bubbles circle:nth-child(1) { --bd: 1000ms; --bdl: 0ms;   --by: -70px;  --bx: 5px; }
.intro__bubbles circle:nth-child(2) { --bd: 1250ms; --bdl: 180ms; --by: -95px;  --bx: -6px; }
.intro__bubbles circle:nth-child(3) { --bd: 1400ms; --bdl: 360ms; --by: -110px; --bx: 4px; }
.intro__bubbles circle:nth-child(4) { --bd: 900ms;  --bdl: 540ms; --by: -60px;  --bx: -4px; }
.intro__bubbles circle:nth-child(5) { --bd: 1150ms; --bdl: 720ms; --by: -85px;  --bx: 6px; }
@keyframes intro-bubble {
  0%   { opacity: 0; transform: translate(0, 0) scale(.6); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(1); }
}

/* Steam: revealed by a rising mask edge plus a small lift per wisp. */
.intro__steam-rect { transform-box: view-box; transform-origin: 0 0; }
.intro__wisps { fill: var(--tea-gold, #C9AE78); }
.intro__wisps > g { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; }

/* The header logo stays hidden while the intro logo is still on screen. */
html.intro-active .brand__logo,
.intro-root.is-running ~ * .brand__logo { opacity: 0; }

/* Landing: the header wisps lean once and settle. `rotate` is used (not
   `transform`) so it composes with any transform the nav applies to .lg-w. */
@property --lg-settle { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
#logo-full .lg-w { fill: var(--tea-gold, #C9AE78); transform-box: fill-box; transform-origin: 50% 100%; rotate: var(--lg-settle, 0deg); }
.motion-ok .brand__logo.is-landed { animation: lg-settle 600ms var(--ease, ease-out) both; }
@keyframes lg-settle { 40% { --lg-settle: 1.5deg; } 100% { --lg-settle: 0deg; } }

@media (prefers-reduced-motion: reduce) {
  .intro-root { display: none !important; }
  .brand__logo { opacity: 1 !important; }
}
@media print { .intro-root { display: none !important; } }
