/* =====================================================================
   NoVi session intro — the real logo, drawn in gold, then a curtain lift.
   Markup: src/components/motion/Intro.tsx (rendered once, on the home page).
   Timeline (s): monogram outlines 0–0.95 · foil fill 0.55–1.15 · rule 0.6–1.05 ·
   NOVi mask sweep 0.8–1.45 · DESIGNS & FINISHING + tagline settle 1.1–1.6 ·
   sheen 1.25–1.75 · meter 0–1.6 · logo lifts 1.5–1.8 · curtain 1.62–2.22.
   Transform / opacity / stroke-dashoffset / clip-path only. Inert under reduced motion.
   ===================================================================== */
@property --novi-intro-p { syntax: "<integer>"; inherits: false; initial-value: 0; }

.novi-intro {
  display: none;
  --intro-bg: radial-gradient(120% 90% at 50% 45%, #141210 0%, #0a0a0a 62%, #070707 100%);
  --intro-f1: #e2c192;
  --intro-f2: #c39a68;
  --intro-f3: #8e6a45;
  --intro-stroke: #e2c192;
  --intro-word: url(#novi-intro-foil);
  --intro-tag: #c39a68;
  --intro-track: rgba(255, 255, 255, 0.12);
  --intro-hair: #e2c192;
  --intro-shine: 0.45;
}
html[data-theme="light"] .novi-intro {
  --intro-bg: radial-gradient(120% 90% at 50% 45%, #fbf9f5 0%, #f6f3ee 60%, #efeae2 100%);
  --intro-f1: #b08652;
  --intro-f2: #8f6a3e;
  --intro-f3: #6e5130;
  --intro-stroke: #8f6a3e;
  --intro-word: #121212;
  --intro-tag: rgba(18, 18, 18, 0.72);
  --intro-track: rgba(14, 14, 14, 0.12);
  --intro-hair: #8f6a3e;
  --intro-shine: 0.35;
}

/* `hidden` on the element keeps it out of the way if this file never loads */
html[data-novi-intro] .novi-intro {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 100010;
  background: var(--intro-bg);
  pointer-events: none; contain: strict;
  /* the exit is pure CSS with `forwards`: if the script never runs again the
     overlay still leaves, so the page can never stay hidden */
  animation: novi-intro-out 0.6s cubic-bezier(0.76, 0, 0.24, 1) 1.62s forwards;
}
/* a gold hairline rides the lower edge of the lifting curtain */
html[data-novi-intro] .novi-intro::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--intro-hair) 30%, var(--intro-hair) 70%, transparent);
  opacity: 0; animation: novi-intro-fade 0.2s linear 1.6s forwards;
}

.novi-intro__stage {
  position: relative; display: grid; justify-items: center; gap: clamp(22px, 4vh, 40px);
  direction: ltr; unicode-bidi: isolate;
  animation: novi-intro-settle 1.5s cubic-bezier(0.2, 0.7, 0.2, 1) both,
             novi-intro-lift 0.32s cubic-bezier(0.5, 0, 0.75, 0) 1.5s forwards;
}
.novi-intro__logo { display: block; width: clamp(240px, 44vw, 580px); height: auto; overflow: visible; }

/* stops take their colours from the theme */
.novi-intro .is-f1 { stop-color: var(--intro-f1); }
.novi-intro .is-f2 { stop-color: var(--intro-f2); }
.novi-intro .is-f3 { stop-color: var(--intro-f3); }

/* 1. monogram: outlines draw, then the foil floods in */
.novi-intro__mark path {
  fill: url(#novi-intro-foil); fill-opacity: 0;
  stroke: var(--intro-stroke); stroke-width: 0.32; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation:
    novi-intro-draw 0.8s cubic-bezier(0.65, 0, 0.35, 1) var(--d, 0s) forwards,
    novi-intro-flood 0.6s cubic-bezier(0.4, 0, 0.2, 1) calc(var(--d, 0s) + 0.55s) forwards;
}

/* 2. the vertical rule grows from the centre */
.novi-intro__rule {
  fill: url(#novi-intro-foil);
  transform-box: fill-box; transform-origin: 50% 50%; transform: scaleY(0);
  animation: novi-intro-grow 0.45s cubic-bezier(0.65, 0, 0.35, 1) 0.6s forwards;
}

/* 3. NOVi: a mask sweeps left to right while each letter rises into place */
.novi-intro__word {
  clip-path: inset(0 100% 0 0);
  animation: novi-intro-sweep 0.62s cubic-bezier(0.7, 0, 0.2, 1) 0.8s forwards;
}
.novi-intro__word path {
  fill: var(--intro-word);
  transform-box: fill-box; transform-origin: 50% 100%; transform: translate3d(0, 18%, 0); opacity: 0;
  animation: novi-intro-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0.8s) forwards;
}

/* 4. DESIGNS & FINISHING and the tagline settle from wide tracking */
.novi-intro__line, .novi-intro__tag {
  transform-box: fill-box; transform-origin: 0 50%; opacity: 0; transform: scaleX(1.14);
  animation: novi-intro-track 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) 1.1s forwards;
}
.novi-intro__line { fill: var(--intro-word); }
.novi-intro__tag {
  fill: var(--intro-tag);
  font-family: var(--ff-head, "Montserrat"), "Montserrat", "Helvetica Neue", Arial, sans-serif;
  font-size: 3.1px; font-weight: 600; letter-spacing: 0;
  animation-delay: 1.18s;
}

/* 5. a light sheen crosses the whole lockup */
.novi-intro__shine {
  opacity: var(--intro-shine);
  transform: translate3d(0, 0, 0);
  animation: novi-intro-shine 0.55s cubic-bezier(0.45, 0, 0.55, 1) 1.22s forwards;
}

/* progress hairline + counter */
.novi-intro__meter { position: relative; display: flex; align-items: center; gap: 12px; width: clamp(150px, 16vw, 220px); }
.novi-intro__bar { position: relative; flex: 1; height: 1px; background: var(--intro-track); overflow: hidden; }
.novi-intro__bar::after {
  content: ""; position: absolute; inset: 0; background: var(--intro-hair); transform: scaleX(0); transform-origin: 0 50%;
  animation: novi-intro-bar 1.5s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
.novi-intro__count {
  min-width: 3ch; font: 500 11px/1 var(--ff-head, "Montserrat"), "Montserrat", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.16em; color: var(--intro-hair);
  font-variant-numeric: tabular-nums; text-align: end;
  counter-reset: novi-intro var(--novi-intro-p);
  animation: novi-intro-count 1.5s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
.novi-intro__count::after { content: counter(novi-intro, decimal-leading-zero); }

@keyframes novi-intro-draw { to { stroke-dashoffset: 0; } }
@keyframes novi-intro-flood { to { fill-opacity: 1; stroke-opacity: 0; } }
@keyframes novi-intro-grow { to { transform: scaleY(1); } }
@keyframes novi-intro-sweep { to { clip-path: inset(0 0 0 0); } }
@keyframes novi-intro-rise { to { transform: none; opacity: 1; } }
@keyframes novi-intro-track { to { transform: none; opacity: 1; } }
@keyframes novi-intro-shine { to { transform: translate3d(180px, 0, 0); } }
@keyframes novi-intro-fade { to { opacity: 1; } }
@keyframes novi-intro-bar { to { transform: scaleX(1); } }
@keyframes novi-intro-count { to { --novi-intro-p: 100; } }
@keyframes novi-intro-settle { from { transform: scale(0.96); } to { transform: none; } }
@keyframes novi-intro-lift { to { opacity: 0; transform: translate3d(0, -32px, 0); } }
@keyframes novi-intro-out { to { transform: translate3d(0, -100%, 0); visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  html[data-novi-intro] .novi-intro { display: none !important; }
}
