/* ==========================================================================
   REAL Shahnameh — Cinematic Intro
   Builds on style.css + home.css (gold/violet/jade tokens). Dark, gold,
   atmospheric — like opening a book of kings on a high mountain at dusk.
   ========================================================================== */

.intro-body {
  background: #04050b;
  color: #f3eedd;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--font-stack, "Inter", system-ui, -apple-system, sans-serif);
}

.intro-stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 18px env(safe-area-inset-bottom);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(244, 197, 107, .14), transparent 65%),
    radial-gradient(120% 80% at 50% 110%, rgba(140, 109, 255, .18), transparent 65%),
    linear-gradient(180deg, #06070f 0%, #04050b 100%);
}

/* ---------- atmosphere: stars, embers ---------- */
.intro-sky {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.intro-sky .star {
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: #fff;
  opacity: .55;
  animation: twinkle 4s ease-in-out infinite;
}
.intro-sky .star.s1 { top: 8%;  left: 12%; animation-delay: 0s; }
.intro-sky .star.s2 { top: 14%; left: 78%; animation-delay: .6s; }
.intro-sky .star.s3 { top: 22%; left: 36%; animation-delay: 1.2s; }
.intro-sky .star.s4 { top: 6%;  left: 60%; animation-delay: 2.0s; }
.intro-sky .star.s5 { top: 28%; left: 88%; animation-delay: 1.6s; width: 3px; height: 3px; }
.intro-sky .star.s6 { top: 18%; left: 24%; animation-delay: 2.6s; }
.intro-sky .star.s7 { top: 32%; left: 6%;  animation-delay: 3.0s; }
.intro-sky .star.s8 { top: 42%; left: 70%; animation-delay: .9s; }
.intro-sky .star.s9 { top: 50%; left: 14%; animation-delay: 1.9s; }
.intro-sky .ember {
  position: absolute;
  bottom: -10px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, #f4c56b, transparent 70%);
  opacity: .7;
  animation: rise 12s linear infinite;
  filter: blur(.5px);
}
.intro-sky .ember.e1 { left: 20%; animation-delay: 0s;  }
.intro-sky .ember.e2 { left: 55%; animation-delay: 4s;  width: 3px; height: 3px;  }
.intro-sky .ember.e3 { left: 82%; animation-delay: 8s;  }

@keyframes twinkle {
  0%, 100% { opacity: .25; transform: scale(1); }
  50%      { opacity: .9;  transform: scale(1.4); }
}
@keyframes rise {
  0%   { transform: translateY(0)     translateX(0);  opacity: 0; }
  10%  {                                              opacity: .7; }
  90%  {                                              opacity: .25; }
  100% { transform: translateY(-110vh) translateX(20px); opacity: 0; }
}

/* ---------- top bar ---------- */
.intro-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 2px 14px;
}
.intro-skip {
  background: transparent;
  border: 1px solid rgba(244, 197, 107, .25);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--gold, #f4c56b);
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  cursor: pointer;
}
.intro-skip:hover { background: rgba(244, 197, 107, .08); }
.intro-step {
  font: 11px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 1.6px;
  color: var(--muted, #6c7287);
}

/* ---------- panels ---------- */
.intro-panel {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; flex-direction: column;
  padding: 8px 2px 12px;
  opacity: 0;
  transform: translateY(12px);
  animation: panel-in .55s ease-out forwards;
}
.intro-panel[hidden] { display: none !important; }
.intro-panel.exit-left  { animation: panel-out-left  .35s ease-in forwards; }
.intro-panel.exit-right { animation: panel-out-right .35s ease-in forwards; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes panel-out-left {
  to { opacity: 0; transform: translateX(-30px); }
}
@keyframes panel-out-right {
  to { opacity: 0; transform: translateX(30px); }
}

.panel-glow {
  position: absolute;
  inset: -10% -20% auto -20%;
  height: 60%;
  pointer-events: none;
  filter: blur(60px);
  opacity: .6;
  z-index: -1;
  animation: drift 16s ease-in-out infinite;
}
.panel-glow.gold   { background: radial-gradient(closest-side, rgba(244, 197, 107, .55), transparent 70%); }
.panel-glow.violet { background: radial-gradient(closest-side, rgba(140, 109, 255, .55), transparent 70%); }
.panel-glow.split  {
  background:
    radial-gradient(closest-side at 25% 50%, rgba(244, 197, 107, .45), transparent 70%),
    radial-gradient(closest-side at 75% 50%, rgba(140, 109, 255, .45), transparent 70%);
}
.panel-glow.large {
  inset: 5% -20% 5% -20%;
  height: auto;
  filter: blur(80px);
  opacity: .7;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(0, 8%); }
}

.panel-kicker {
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--gold, #f4c56b);
  margin-bottom: 14px;
}
.panel-h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff 0%, var(--gold, #f4c56b) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(244, 197, 107, .15);
}
.panel-h1-fa {
  margin: 6px 0 0;
  font-size: clamp(20px, 5vw, 26px);
  color: var(--gold, #f4c56b);
  opacity: .85;
}
.panel-body {
  margin-top: 18px;
  font-size: 15px; line-height: 1.65;
  color: #d8d2c0;
  flex: 1;
}
.panel-body p { margin: 0 0 12px; }
.panel-body .lead { font-size: 16px; color: #fff; font-weight: 600; }
.panel-body .quote {
  margin: 18px 0 6px;
  padding: 12px 14px;
  font-style: italic;
  font-size: 14px;
  color: var(--gold, #f4c56b);
  background: rgba(244, 197, 107, .06);
  border-left: 2px solid var(--gold, #f4c56b);
  border-radius: 0 12px 12px 0;
}
.panel-body .centered { text-align: center; color: #fff; font-style: italic; margin-top: 18px; }

/* ---------- opening verse panel ---------- */
.intro-panel[data-panel="bism"] { justify-content: center; align-items: center; text-align: center; }
.intro-panel[data-panel="bism"] .verse {
  margin: auto;
  max-width: 540px;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.verse-fa {
  margin: 0;
  font-size: clamp(22px, 6vw, 28px);
  line-height: 2;
  color: var(--gold, #f4c56b);
  letter-spacing: 1px;
  text-shadow: 0 0 30px rgba(244, 197, 107, .35);
}
.verse-en {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #d8d2c0;
  font-style: italic;
}
.verse-author {
  margin-top: 12px;
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted, #6c7287);
}

/* ---------- Ferdowsi panel — parchment / warm glow ---------- */
.panel-glow.parchment {
  background:
    radial-gradient(closest-side at 50% 30%, rgba(255, 196, 110, .55), transparent 70%),
    radial-gradient(closest-side at 30% 80%, rgba(180, 90, 40, .35), transparent 70%);
  filter: blur(70px);
  opacity: .8;
}
.ferdowsi-panel { padding-top: 4px; }
.ferdowsi-portrait {
  position: relative;
  margin: 8px auto 16px;
  width: min(78%, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 4px;
  background:
    conic-gradient(from 200deg,
      var(--gold, #f4c56b),
      #ffe5b3 25%,
      var(--gold, #f4c56b) 50%,
      #c89043 75%,
      var(--gold, #f4c56b) 100%);
  box-shadow:
    0 12px 50px rgba(244, 197, 107, .35),
    inset 0 0 24px rgba(244, 197, 107, .2);
  animation: ferdowsi-breathe 6s ease-in-out infinite;
}
.ferdowsi-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  background: #1a0c00;
  filter: saturate(1.05) contrast(1.05);
}
.ferdowsi-portrait img.img-fail { display: none; }
.ferdowsi-portrait:has(img.img-fail)::after {
  content: "✒";
  position: absolute; inset: 4px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 64px; color: var(--gold, #f4c56b);
  background: radial-gradient(circle at 50% 40%, #2a1a05, #0a0500);
}
.parchment-vignette {
  position: absolute; inset: 4px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 -40px 60px rgba(0, 0, 0, .55), inset 0 20px 40px rgba(255, 196, 110, .12);
}
@keyframes ferdowsi-breathe {
  0%, 100% { box-shadow: 0 12px 50px rgba(244, 197, 107, .30), inset 0 0 24px rgba(244, 197, 107, .15); }
  50%      { box-shadow: 0 12px 70px rgba(244, 197, 107, .55), inset 0 0 28px rgba(244, 197, 107, .28); }
}
.ferdowsi-verse {
  margin: 0 0 18px;
  padding: 16px 18px;
  font-size: clamp(18px, 5vw, 22px);
  line-height: 2;
  text-align: center;
  color: var(--gold, #f4c56b);
  background:
    radial-gradient(80% 80% at 50% 50%, rgba(244, 197, 107, .12), transparent 75%),
    linear-gradient(180deg, rgba(244, 197, 107, .06), rgba(244, 197, 107, 0));
  border: 1px solid rgba(244, 197, 107, .35);
  border-radius: 14px;
  text-shadow: 0 0 24px rgba(244, 197, 107, .35);
}

/* ---------- fact list (Shahnameh panel) ---------- */
.fact-list {
  list-style: none; margin: 18px 0 0; padding: 0;
  display: grid; gap: 10px;
}
.fact-list li {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(244, 197, 107, .05);
  border: 1px solid rgba(244, 197, 107, .2);
  border-radius: 14px;
}
.fact-num {
  font-size: 18px; font-weight: 800;
  color: var(--gold, #f4c56b);
  letter-spacing: -.5px;
}

/* ---------- duality (light vs dark) ---------- */
.duality {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 18px 0;
}
.dual-card {
  padding: 16px 14px;
  border-radius: 16px;
  text-align: center;
}
.dual-card.light {
  background: linear-gradient(180deg, rgba(244, 197, 107, .14), rgba(244, 197, 107, .02));
  border: 1px solid rgba(244, 197, 107, .35);
}
.dual-card.dark {
  background: linear-gradient(180deg, rgba(140, 109, 255, .14), rgba(140, 109, 255, .02));
  border: 1px solid rgba(140, 109, 255, .35);
}
.dual-icon {
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
}
.dual-card.light .dual-icon { color: var(--gold, #f4c56b); text-shadow: 0 0 16px rgba(244, 197, 107, .6); }
.dual-card.dark  .dual-icon { color: #cdbcff; text-shadow: 0 0 16px rgba(140, 109, 255, .6); }
.dual-card h3 {
  margin: 0 0 6px;
  font-size: 14px; font-weight: 800;
  letter-spacing: .5px;
}
.dual-card.light h3 { color: var(--gold, #f4c56b); }
.dual-card.dark  h3 { color: #cdbcff; }
.dual-card p { margin: 0; font-size: 12px; line-height: 1.6; color: #d8d2c0; }

/* ---------- timeline panel ---------- */
.timeline-list {
  list-style: none; margin: 24px 0 0; padding: 0;
  display: grid; gap: 14px;
}
.t-event {
  display: grid;
  grid-template-columns: 70px 18px 1fr;
  gap: 6px;
  align-items: stretch;
}
.t-year {
  font-size: 13px; font-weight: 800;
  color: var(--gold, #f4c56b);
  letter-spacing: -.3px;
  text-align: right;
  padding-top: 10px;
}
.t-year small { display: block; font-size: 9px; opacity: .7; margin-top: 2px; }
.t-line {
  position: relative;
  width: 18px;
}
.t-line::before {
  content: ""; position: absolute;
  left: 7px; top: 6px;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--gold, #f4c56b), rgba(140, 109, 255, .55));
  border-radius: 2px;
}
.t-line::after {
  content: ""; position: absolute;
  left: 2px; top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold, #f4c56b), rgba(244, 197, 107, .2) 70%);
  box-shadow: 0 0 16px rgba(244, 197, 107, .55);
}
.t-event:last-child .t-line::before { background: linear-gradient(180deg, rgba(140, 109, 255, .55), transparent); }
.t-event.boss .t-line::after {
  background: radial-gradient(circle, #ff6c6c, rgba(255, 108, 108, .2) 70%);
  box-shadow: 0 0 18px rgba(255, 108, 108, .55);
}
.t-body {
  padding: 8px 12px 12px;
  background: rgba(244, 197, 107, .04);
  border: 1px solid rgba(244, 197, 107, .2);
  border-radius: 14px;
}
.t-body h4 {
  margin: 0 0 4px;
  font-size: 14px; font-weight: 800; color: #fff;
}
.t-body p { margin: 0; font-size: 12px; color: #d8d2c0; line-height: 1.55; }
.t-event.boss .t-body { border-color: rgba(255, 108, 108, .35); background: rgba(255, 108, 108, .05); }

/* ---------- CTA panel ---------- */
.cta-panel { justify-content: center; align-items: center; text-align: center; }
.cta-crest {
  width: 140px; height: 140px;
  border-radius: 50%;
  padding: 4px;
  background: conic-gradient(from 220deg, var(--gold, #f4c56b), #cdbcff, var(--jade, #4ad8a6), var(--gold, #f4c56b));
  margin: 0 auto 18px;
  animation: spin 18s linear infinite;
}
.cta-crest img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #0a0e1d;
}
.cta-crest img.img-fail { display: grid; place-items: center; font-size: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }

.cta-kicker {
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--gold, #f4c56b);
  margin-bottom: 8px;
}
.cta-title {
  margin: 0;
  font-size: clamp(24px, 6vw, 28px);
  font-weight: 900;
  background: linear-gradient(180deg, #fff, var(--gold, #f4c56b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cta-fa {
  margin: 6px 0 16px;
  font-size: 16px;
  color: var(--gold, #f4c56b);
}
.cta-copy {
  max-width: 460px;
  margin: 0 auto 22px;
  font-size: 14px; line-height: 1.65;
  color: #d8d2c0;
}
.intro-cta {
  display: inline-block;
  min-width: 220px;
  padding: 14px 28px;
  font-size: 14px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  text-decoration: none;
  background: linear-gradient(180deg, var(--gold, #f4c56b), #c89043);
  color: #1a0c00;
  border-radius: 999px;
  box-shadow:
    0 8px 30px rgba(244, 197, 107, .35),
    inset 0 1px 0 rgba(255, 255, 255, .35);
  animation: cta-pulse 2.4s ease-in-out infinite;
}
@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 8px 30px rgba(244, 197, 107, .35), inset 0 1px 0 rgba(255, 255, 255, .35); }
  50%      { box-shadow: 0 8px 40px rgba(244, 197, 107, .60), inset 0 1px 0 rgba(255, 255, 255, .35); }
}
.cta-foot {
  margin: 18px 0 0;
  font-size: 11px; color: var(--muted, #6c7287);
}

/* ---------- footer controls ---------- */
.intro-foot {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 80px 1fr 110px;
  gap: 10px;
  align-items: center;
  padding: 10px 0 18px;
}
.intro-foot .ghost-btn,
.intro-foot .primary-btn {
  height: 42px;
  font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase;
}
.intro-foot .ghost-btn[hidden] { visibility: hidden; }
.intro-dots {
  display: flex; gap: 6px; justify-content: center;
}
.intro-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(244, 197, 107, .25);
  transition: width .25s ease, background .25s ease;
}
.intro-dot.active { width: 18px; border-radius: 999px; background: var(--gold, #f4c56b); }
.intro-dot.done   { background: rgba(244, 197, 107, .55); }

/* ---------- RTL-aware tweaks ---------- */
html[dir="rtl"] .panel-body .quote { border-left: none; border-right: 2px solid var(--gold, #f4c56b); border-radius: 12px 0 0 12px; }
html[dir="rtl"] .t-event { grid-template-columns: 1fr 18px 70px; }
html[dir="rtl"] .t-year { text-align: left; }

/* In FA mode the .panel-h1 (now driven by data-i18n) already shows the Persian
   title, so the parallel .panel-h1-fa / .cta-fa subtitle would duplicate it.
   The opening verse and the in-body ferdowsi-verse stay visible — they are
   real verse content, not translation duplicates. */
html[lang="fa"] .panel-h1-fa,
html[lang="fa"] .cta-fa { display: none; }

/* ---------- mobile compactness ---------- */
@media (max-width: 360px) {
  .panel-h1 { font-size: 26px; }
  .duality { grid-template-columns: 1fr; }
  .cta-crest { width: 110px; height: 110px; }
}
