/* ==========================================================================
   ZURVAN — design tokens
   ========================================================================== */

:root {
  /* color */
  --ink: #0b0c0e;           /* base background — near-black, cool */
  --stone: #17191c;         /* footer / solid surface */
  --parchment: #efe7d8;     /* primary text — warm off-white */
  --muted: #a39d90;         /* secondary text */
  --muted-2: #6f6a60;       /* tertiary / captions */
  --amber: #cd9c4f;         /* accent — brass, sunset, instrument wood */
  --amber-soft: rgba(205, 156, 79, 0.35);
  --teal: #3c6864;          /* secondary accent — canal water, dusk shadow */

  /* type */
  --font-fa: 'Vazirmatn', system-ui, sans-serif;
  --font-display-en: 'Fraunces', Georgia, serif;
  --font-body-en: 'Inter', system-ui, sans-serif;

  /* rhythm */
  --gutter: clamp(1.5rem, 5vw, 4.5rem);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[lang="fa"] {
  --font-heading: var(--font-fa);
  --font-body: var(--font-fa);
}
html[lang="en"] {
  --font-heading: var(--font-display-en);
  --font-body: var(--font-body-en);
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

img { display: block; max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.section-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.section-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Language toggle
   ========================================================================== */

.lang-toggle {
  position: fixed;
  top: var(--gutter);
  inset-inline-end: var(--gutter);
  z-index: 50;
  background: rgba(11, 12, 14, 0.55);
  border: 1px solid rgba(239, 231, 216, 0.25);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 0.55em 1.1em;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.lang-toggle:hover {
  border-color: var(--amber-soft);
  background: rgba(11, 12, 14, 0.75);
}

/* ==========================================================================
   01 — Opening
   ========================================================================== */

.opening {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.opening__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at center, rgba(11,12,14,0.35) 0%, rgba(11,12,14,0.72) 62%, rgba(11,12,14,0.9) 100%),
    linear-gradient(180deg, rgba(11,12,14,0.55) 0%, rgba(11,12,14,0.35) 40%, rgba(11,12,14,0.7) 100%);
}

.opening__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 var(--gutter);
  max-width: 42rem;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 1.4s var(--ease) 0.2s forwards;
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.wordmark {
  font-family: var(--font-display-en);
  font-weight: 450;
  font-size: clamp(2.75rem, 9vw, 5.5rem);
  letter-spacing: 0.14em;
  color: var(--parchment);
}

.rule {
  width: 3.5rem;
  height: 1px;
  margin: 1.6rem auto;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
}

.tagline {
  font-family: var(--font-heading);
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  color: var(--parchment);
  letter-spacing: 0.02em;
}

.definition {
  margin-top: 1.1rem;
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  color: var(--muted);
  line-height: 1.9;
}

.scroll-cue {
  position: absolute;
  bottom: 2.75rem;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  opacity: 0;
  animation: fadeIn 1s var(--ease) 1.3s forwards;
}
.scroll-cue__line {
  width: 1px;
  height: 2.2rem;
  background: linear-gradient(180deg, var(--amber), transparent);
  animation: cueMove 2.2s var(--ease) infinite;
}
@keyframes fadeIn { to { opacity: 1; } }
@keyframes cueMove {
  0% { transform: scaleY(0.3); opacity: 0.3; transform-origin: top; }
  50% { transform: scaleY(1); opacity: 1; transform-origin: top; }
  100% { transform: scaleY(0.3); opacity: 0.3; transform-origin: bottom; }
}

/* ==========================================================================
   03 — Final City Reveal + Interactive Map
   ========================================================================== */

.city {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.city__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(11, 12, 14, 0.55);
  transition: background 1.8s var(--ease);
}
.city.is-visible .city__scrim {
  background: rgba(11, 12, 14, 0.22);
}

.city__intro {
  position: relative;
  z-index: 2;
  max-width: 40rem;
  padding: 0 var(--gutter);
  text-align: center;
}

.city__eyebrow {
  font-family: var(--font-heading);
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  letter-spacing: 0.14em;
  color: var(--amber);
  text-shadow: 0 2px 16px rgba(11, 12, 14, 0.7);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.1s var(--ease) 0.1s, transform 1.1s var(--ease) 0.1s;
}
.city.is-visible .city__eyebrow {
  opacity: 1;
  transform: translateY(0);
}

.city__sentence {
  margin-top: 1.1rem;
  font-family: var(--font-heading);
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  line-height: 1.85;
  color: var(--parchment);
  text-shadow: 0 2px 20px rgba(11, 12, 14, 0.75), 0 1px 3px rgba(11, 12, 14, 0.9);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.3s var(--ease) 0.4s, transform 1.3s var(--ease) 0.4s;
}
.city.is-visible .city__sentence {
  opacity: 1;
  transform: translateY(0);
}

/* the interactive map — five discoverable points, no button chrome */
.city__map {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.map-point {
  position: absolute;
  top: var(--py, 50%);
  left: var(--px, 50%);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  margin: -0.8rem -1rem;
  text-decoration: none;
  color: var(--parchment);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s var(--ease);
  /* dot-then-label order must stay fixed regardless of page language —
     this positions elements relative to the image, not the script */
  direction: ltr;
}
.city.is-ready .map-point {
  opacity: 1;
  pointer-events: auto;
}

.map-point__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(205, 156, 79, 0.5);
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}

.map-point__label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  opacity: 0.88;
  text-shadow: 0 1px 10px rgba(11, 12, 14, 0.85);
  border-bottom: 1px solid transparent;
  transition: opacity 0.35s var(--ease), border-color 0.35s var(--ease);
}

.map-point:hover .map-point__dot,
.map-point:focus-visible .map-point__dot {
  transform: scale(1.5);
  box-shadow: 0 0 0 8px rgba(205, 156, 79, 0.15), 0 0 16px 2px rgba(205, 156, 79, 0.5);
}
.map-point:hover .map-point__label,
.map-point:focus-visible .map-point__label {
  opacity: 1;
  border-color: var(--amber-soft);
}

@media (max-width: 767px) {
  .map-point { padding: 0.6rem 0.7rem; margin: -0.6rem -0.7rem; }
  .map-point__label { font-size: 0.78rem; }
}

/* ==========================================================================
   02 — Five Gates  (the signature: a pinned city, a traveling spotlight)
   ========================================================================== */

.gates {
  position: relative;
  /* one full viewport of pinned scroll per gate */
  height: 500vh;
}

.gates__stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}

.gates__vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(
    circle at var(--spot-x, 50%) var(--spot-y, 50%),
    rgba(11,12,14, var(--spot-clear, 0.18)) 0,
    rgba(11,12,14, 0.55) var(--spot-mid, 22%),
    rgba(11,12,14, 0.93) var(--spot-far, 60%)
  );
  will-change: background;
}

.gates__points {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.point {
  position: absolute;
  top: var(--py, 50%);
  left: var(--px, 50%);
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.35;
  box-shadow: 0 0 0 0 rgba(205, 156, 79, 0.5);
  transition: opacity 0.5s var(--ease), box-shadow 0.5s var(--ease), transform 0.5s var(--ease);
}
.point.is-active {
  opacity: 1;
  transform: scale(1.4);
  box-shadow: 0 0 0 10px rgba(205, 156, 79, 0.12), 0 0 24px 4px rgba(205, 156, 79, 0.45);
}

.gates__text {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.gate {
  position: absolute;
  top: 50%;
  transform: translateY(calc(-50% + 10px));
  max-width: min(24rem, 82vw);
  padding: 0 var(--gutter);
  opacity: 0;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.gate.is-active {
  opacity: 1;
  transform: translateY(-50%);
}

/* text always sits on the physical side opposite the active point —
   computed from real coordinates in main.js, not a fixed alternation,
   and independent of language direction (this is about the image,
   not the text's script) */
.gate[data-side="left"]  { left: 0; right: auto; text-align: left; }
.gate[data-side="right"] { right: 0; left: auto; text-align: right; }

.gate__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2.2rem, 5.4vw, 3.8rem);
  color: var(--parchment);
  line-height: 1.05;
}
html[lang="en"] .gate__title { font-weight: 500; }

.gate__subtitle {
  margin-top: 0.9rem;
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--muted);
}

.gate__description {
  margin-top: 0.85rem;
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 1.3vw, 0.92rem);
  line-height: 1.8;
  color: var(--muted-2);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  position: relative;
  z-index: 4;
  background: var(--stone);
  padding: 4.5rem var(--gutter) 3rem;
  text-align: center;
}

.site-footer__brand {
  font-family: var(--font-display-en);
  font-weight: 450;
  font-size: 1.3rem;
  letter-spacing: 0.14em;
  color: var(--parchment);
}

.site-footer__tagline {
  margin-top: 0.6rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--muted);
}

.site-footer__legal {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--muted-2);
}

.site-footer__meta {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted-2);
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}
.site-footer__meta a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-footer__meta a:hover { color: var(--amber); }

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 767px) {
  /* keep the final sentence in the upper area so it doesn't collide
     with map points/labels lower on the image */
  .city { align-items: flex-start; padding-top: 12vh; }
  .city__sentence { font-size: 0.98rem; line-height: 1.75; }

  /* mobile always centers, regardless of the point's position */
  .gate {
    max-width: 88vw;
    left: 0;
    right: 0;
    text-align: center;
    margin: 0 auto;
  }
  .gate__description {
    /* keep the description from taking too much vertical space on small screens */
    max-width: 30rem;
    margin-inline: auto;
    margin-top: 0.6rem;
    font-size: 0.78rem;
    line-height: 1.7;
  }
  .gate__title { font-size: clamp(2rem, 9vw, 2.6rem); }
  .gate__subtitle { font-size: 0.95rem; margin-top: 0.6rem; }
}
