:root {
  --ink: #1a1740;
  --primary: #221f5e;
  --primary-2: #423a9e;
  --primary-deep: #100e2c;
  --accent: #cdb18e;
  --accent-2: #e6c99a;
  --accent-warm: #e08a5c;
  --cream: #fffdf8;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Vazirmatn", sans-serif;
  background: var(--primary-deep);
  color: var(--cream);
}

/* ========================================================= */
/* STAGE                                                      */
/* ========================================================= */
.intro-stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* ---------- animated mesh gradient background ---------- */
.intro-bg {
  position: absolute;
  inset: -10%;
  z-index: 0;
  background:
    radial-gradient(ellipse 640px 560px at var(--mx1, 20%) var(--my1, 25%), rgba(224, 138, 92, 0.32), transparent 60%),
    radial-gradient(ellipse 620px 560px at var(--mx2, 82%) var(--my2, 75%), rgba(66, 58, 158, 0.5), transparent 60%),
    radial-gradient(ellipse 560px 520px at var(--mx3, 55%) var(--my3, 92%), rgba(205, 177, 142, 0.24), transparent 60%),
    linear-gradient(150deg, var(--primary-deep) 0%, var(--primary) 55%, var(--primary-deep) 100%);
  animation: meshDrift 16s ease-in-out infinite alternate;
}
@keyframes meshDrift {
  0% {
    --mx1: 14%;
    --my1: 20%;
    --mx2: 86%;
    --my2: 78%;
    --mx3: 50%;
    --my3: 96%;
  }
  50% {
    --mx1: 30%;
    --my1: 34%;
    --mx2: 70%;
    --my2: 62%;
    --mx3: 62%;
    --my3: 80%;
  }
  100% {
    --mx1: 20%;
    --my1: 14%;
    --mx2: 80%;
    --my2: 86%;
    --mx3: 42%;
    --my3: 92%;
  }
}

/* ---------- grain texture ---------- */
.intro-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- particle dust ---------- */
.intro-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.intro-particle {
  position: absolute;
  border-radius: 50%;
  background: var(--accent-2);
  opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(-110vh) scale(1);
    opacity: 0;
  }
}

/* ---------- floating wireframe shapes (parallax) ---------- */
.intro-shapes {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  perspective: 900px;
}
.intro-shape {
  position: absolute;
  opacity: 0.5;
  will-change: transform;
  transition: transform 0.25s linear;
}
.intro-shape svg {
  width: 100%;
  height: 100%;
  stroke: var(--accent-2);
  fill: none;
}
.is-1 {
  top: 12%;
  right: 10%;
  width: 130px;
  height: 130px;
  animation: shapeSpin 22s linear infinite, shapeBob 7s ease-in-out infinite;
}
.is-2 {
  bottom: 14%;
  right: 20%;
  width: 80px;
  height: 80px;
  animation: shapeSpin 30s linear infinite reverse, shapeBob 9s ease-in-out infinite 1s;
}
.is-3 {
  top: 22%;
  left: 8%;
  width: 100px;
  height: 100px;
  animation: shapeSpin 26s linear infinite, shapeBob 8s ease-in-out infinite 2s;
}
.is-4 {
  bottom: 10%;
  left: 14%;
  width: 60px;
  height: 60px;
  animation: shapeSpin 18s linear infinite reverse, shapeBob 6s ease-in-out infinite 0.5s;
}
.is-5 {
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  opacity: 0.3;
  animation: shapeSpin 20s linear infinite, shapeBob 10s ease-in-out infinite 1.5s;
}
@keyframes shapeSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@keyframes shapeBob {
  0%,
  100% {
    margin-top: 0;
  }
  50% {
    margin-top: -18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .intro-shape,
  .intro-bg,
  .intro-particle {
    animation: none !important;
  }
}

/* ========================================================= */
/* PRELOADER                                                  */
/* ========================================================= */
.intro-loader {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--primary-deep);
  transition: opacity 0.8s var(--ease), visibility 0.8s var(--ease);
}
.intro-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.intro-loader-ring {
  position: relative;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.intro-loader-ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.intro-loader-ring circle {
  fill: none;
  stroke-width: 2.4;
}
.intro-loader-track {
  stroke: rgba(255, 253, 248, 0.12);
}
.intro-loader-bar {
  stroke: url(#introGrad);
  stroke-linecap: round;
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  transition: stroke-dashoffset 0.2s linear;
}
.intro-loader-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
  animation: loaderPulse 1.6s ease-in-out infinite;
}
@keyframes loaderPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}
.intro-loader-pct {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: rgba(255, 253, 248, 0.55);
}

/* ========================================================= */
/* CONTENT                                                    */
/* ========================================================= */
.intro-content {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 24px;
  max-width: 680px;
}

.intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--accent-2);
  border: 1px solid rgba(255, 253, 248, 0.2);
  border-radius: 999px;
  padding: 7px 18px;
  margin-bottom: 30px;
  opacity: 0;
  transform: translateY(14px);
}
.intro-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-warm);
  animation: dotPulse 1.8s ease-in-out infinite;
}
@keyframes dotPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(224, 138, 92, 0.6);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(224, 138, 92, 0);
  }
}

.intro-title-wrap {
  overflow: hidden;
  margin-bottom: 22px;
}
.intro-title {
  font-family: "Fraunces", serif;
  font-weight: 500;
  font-size: clamp(2.4rem, 9vw, 5.4rem);
  line-height: 1.1;
  color: var(--cream);
  clip-path: inset(0 0 0 100%);
}
.intro-title .accent-grad {
  background: linear-gradient(100deg, var(--accent-2) 5%, var(--accent) 45%, var(--accent-warm) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.intro-tagline {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: rgba(255, 253, 248, 0.68);
  line-height: 1.9;
  max-width: 46ch;
  margin: 0 auto 40px;
  opacity: 0;
  transform: translateY(14px);
}

.intro-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 17px 38px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: "Vazirmatn", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-deep);
  background: linear-gradient(115deg, var(--accent-2), var(--accent) 55%, var(--accent-warm));
  isolation: isolate;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.94);
  box-shadow: 0 20px 50px -16px rgba(224, 138, 92, 0.55), 0 0 0 1px rgba(255, 253, 248, 0.08) inset;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.intro-cta::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -2;
  border-radius: 999px;
  background: linear-gradient(115deg, var(--accent-2), var(--accent-warm));
  filter: blur(14px);
  opacity: 0.6;
  animation: ctaGlow 2.6s ease-in-out infinite;
}
@keyframes ctaGlow {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.06);
  }
}
.intro-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.8) 46%, rgba(255, 255, 255, 0.8) 54%, transparent 70%);
  transform: translateX(-130%);
  transition: transform 0.85s var(--ease);
}
.intro-cta:hover::after {
  transform: translateX(130%);
}
.intro-cta:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 26px 60px -14px rgba(224, 138, 92, 0.65), 0 0 0 1px rgba(255, 253, 248, 0.12) inset;
}
.intro-cta svg {
  width: 18px;
  height: 18px;
  transition: transform 0.4s var(--ease);
}
.intro-cta:hover svg {
  transform: translateX(-5px);
}

.intro-hint {
  margin-top: 26px;
  font-size: 0.76rem;
  color: rgba(255, 253, 248, 0.4);
  opacity: 0;
}

/* ---------- reveal state (JS adds .is-in) ---------- */
.intro-stage.is-in .intro-badge {
  animation: introUp 0.8s var(--ease) 0.15s forwards;
}
.intro-stage.is-in .intro-title {
  animation: titleWipe 1.1s var(--ease) 0.35s forwards;
}
.intro-stage.is-in .intro-tagline {
  animation: introUp 0.8s var(--ease) 0.95s forwards;
}
.intro-stage.is-in .intro-cta {
  animation: introUpScale 0.8s var(--ease) 1.2s forwards;
}
.intro-stage.is-in .intro-hint {
  animation: introUp 0.8s var(--ease) 1.55s forwards;
}
@keyframes introUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes introUpScale {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes titleWipe {
  to {
    clip-path: inset(0 0 0 0%);
  }
}

/* ---------- exit transition ---------- */
.intro-stage.is-leaving .intro-content {
  animation: contentOut 0.5s var(--ease) forwards;
}
@keyframes contentOut {
  to {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }
}
.intro-wash {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--primary-deep);
  transform: scaleY(0);
  transform-origin: bottom;
  pointer-events: none;
}
.intro-wash.show {
  animation: washUp 0.7s var(--ease) 0.15s forwards;
}
@keyframes washUp {
  to {
    transform: scaleY(1);
  }
}

@media (max-width: 640px) {
  .intro-title {
    font-size: clamp(2.1rem, 12vw, 3.2rem);
  }
  .intro-cta {
    padding: 15px 30px;
    font-size: 0.94rem;
  }
}
