/*
 * NADI — vector emblem (static) and the one-time entry screen.
 * Built by assets/js/emblem.js. Timeline of the intro (≈3.4 s):
 *   0.0–1.0 s  emblem turns to face the viewer (needles and leaves on separate Z layers)
 *   0.7–2.7 s  needles inserted one by one, centre outwards: enter, pierce, lift, settle
 *   2.4–2.9 s  wordmark appears; the intro then fades out and needles stay still
 */

.emblem {
  position: relative;
  aspect-ratio: 876 / 540;
}

.emblem__stage,
.emblem__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.emblem__layer {
  overflow: visible;
}

.emblem__vein {
  fill: none;
  stroke: #d9b95f;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.emblem__glow {
  fill: #f3dc8b;
  opacity: 0;
  filter: blur(14px);
}

/* ---------- Page cover while the intro is being built (set by the <head> snippet) ---------- */

.intro-pending body {
  overflow: hidden;
}

.intro-pending body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--brand-cream, #f6f2e9);
  /* Safety net: never leave the page covered if the script fails to run. */
  animation: intro-cover-release 0.3s 4s forwards;
}

@keyframes intro-cover-release {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.intro-playing body {
  overflow: hidden;
}

/* ---------- Entry screen ---------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.2rem;
  padding: 1rem;
  background: radial-gradient(circle at 50% 42%, #fffdf6 0%, var(--brand-cream, #f6f2e9) 60%, #ebe4d3 100%);
  cursor: pointer;
  transition: opacity 0.6s ease, visibility 0.6s;
}

.intro--out {
  opacity: 0;
  visibility: hidden;
}

.intro__emblem {
  width: min(460px, 82vw);
  perspective: 900px;
}

.intro .emblem__stage {
  transform-style: preserve-3d;
  animation: emblem-turn-in 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.intro .emblem__layer--needles {
  transform: translateZ(-50px);
}

.intro .emblem__layer--leaves {
  transform: translateZ(35px);
}

@keyframes emblem-turn-in {
  from {
    opacity: 0;
    transform: rotateX(52deg) rotateY(-34deg) scale(0.82);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.intro .emblem__needle {
  animation: needle-insert 0.9s cubic-bezier(0.3, 0.6, 0.3, 1) both;
  animation-delay: calc(0.7s + var(--i) * 0.28s);
}

@keyframes needle-insert {
  0% {
    opacity: 0;
    transform: translate(calc(var(--dx) * -8), calc(var(--dy) * -8));
  }
  15% {
    opacity: 1;
  }
  55% {
    transform: translate(var(--dx), var(--dy));
  }
  70% {
    transform: translate(calc(var(--dx) * -0.35), calc(var(--dy) * -0.35));
  }
  85% {
    transform: translate(calc(var(--dx) * 0.6), calc(var(--dy) * 0.6));
  }
  100% {
    opacity: 1;
    transform: translate(0, 0);
  }
}

.intro .emblem__glow {
  animation: emblem-glow 1.8s ease-out 1.1s both;
}

@keyframes emblem-glow {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 0.75;
  }
  40% {
    opacity: 0.1;
  }
  80% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}

.intro__word,
.intro__sub {
  margin: 0;
  color: var(--brand-green-800, #133a27);
  text-align: center;
  animation: intro-fade-up 0.6s ease-out both;
}

.intro__word {
  margin-top: 1.2rem;
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2.6rem, 2rem + 3vw, 4rem);
  letter-spacing: 0.28em;
  padding-left: 0.28em;
  line-height: 1;
  animation-delay: 2.4s;
}

.intro__sub {
  font-size: clamp(0.8rem, 0.75rem + 0.3vw, 1rem);
  letter-spacing: 0.04em;
  animation-delay: 2.6s;
}

.intro__skip {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(19, 58, 39, 0.45);
}

@keyframes intro-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
