/* ============================================================
   Chalghooz AI · v2 — one continuous journey into the machine
   Palette: Persian night — abyss indigo, فیروزه turquoise,
   زعفران saffron. Type: Vazirmatn / Space Grotesk / JetBrains Mono.
   ============================================================ */

/* ---------- fonts (self-hosted, shared with root site) ---------- */
@font-face { font-family: "Vazirmatn"; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/vazirmatn-arabic-400.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Vazirmatn"; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/vazirmatn-latin-400.woff2") format("woff2");
  unicode-range: U+0000-024F; }
@font-face { font-family: "Vazirmatn"; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/vazirmatn-arabic-500.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Vazirmatn"; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/vazirmatn-latin-500.woff2") format("woff2");
  unicode-range: U+0000-024F; }
@font-face { font-family: "Vazirmatn"; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/vazirmatn-arabic-700.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Vazirmatn"; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/vazirmatn-latin-700.woff2") format("woff2");
  unicode-range: U+0000-024F; }
@font-face { font-family: "Vazirmatn"; font-weight: 900; font-display: swap;
  src: url("/assets/fonts/vazirmatn-arabic-900.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Vazirmatn"; font-weight: 900; font-display: swap;
  src: url("/assets/fonts/vazirmatn-latin-900.woff2") format("woff2");
  unicode-range: U+0000-024F; }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/space-grotesk-700.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-500.woff2") format("woff2"); }

/* ---------- tokens ---------- */
:root {
  --ink: #05080F;
  --ink-2: #0A101D;
  --turquoise: #37E5C9;
  --turquoise-dim: rgba(55, 229, 201, 0.14);
  --saffron: #F5B841;
  --mist: #9FB0C6;
  --paper: #F2F6FA;
  --line: rgba(159, 176, 198, 0.14);
  --glass-bg: rgba(10, 16, 29, 0.55);
  --glass-line: rgba(159, 176, 198, 0.16);
  --font-fa: "Vazirmatn", system-ui, sans-serif;
  --font-latin: "Space Grotesk", "Vazirmatn", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { background: var(--ink); }
body {
  font-family: var(--font-fa);
  color: var(--mist);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--turquoise-dim); color: var(--paper); }

button { font-family: inherit; cursor: pointer; }
:is(a, button, textarea):focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 3px;
  border-radius: 4px;
}

.mono { font-family: var(--font-mono); }

/* ---------- persistent scene ---------- */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 90% at 50% 45%, transparent 55%, rgba(3, 5, 10, 0.55) 100%);
}

/* everything readable floats above the scene */
.topnav, .hero, .station, .chat-station { position: relative; z-index: 2; }

/* ---------- top nav ---------- */
.topnav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, rgba(5, 8, 15, 0.75), transparent);
}
.topnav__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-latin);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--paper);
}
.topnav__brand img { width: 26px; height: 26px; border-radius: 8px; }
.brand-ai { color: var(--turquoise); }

.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--mist);
  font-family: var(--font-fa);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}
.lang-switch button.is-active { background: var(--turquoise-dim); color: var(--turquoise); }
.lang-switch button:hover:not(.is-active) { color: var(--paper); }

/* ---------- shared station copy ---------- */
.eyebrow {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--turquoise);
  margin-bottom: 14px;
}
.station__marker {
  font-size: 12px;
  color: var(--saffron);
  letter-spacing: 0.25em;
  margin-bottom: 22px;
  opacity: 0.9;
}

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 96px 20px 80px;
}
.hero__headline {
  font-weight: 900;
  font-size: clamp(42px, 9.5vw, 96px);
  line-height: 1.18;
  color: var(--paper);
  display: flex;
  flex-direction: column;
  letter-spacing: -0.01em;
}
.hero__headline .accent {
  color: var(--turquoise);
  text-shadow: 0 0 48px rgba(55, 229, 201, 0.35);
}
.hero__sub {
  max-width: 480px;
  margin: 22px auto 34px;
  font-size: clamp(15px, 2.4vw, 17.5px);
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 15px 34px;
  font-size: 16.5px;
  font-weight: 700;
  color: #04322B;
  background: linear-gradient(135deg, #4FF0D6, var(--turquoise) 55%, #23BFA6);
  box-shadow: 0 8px 40px rgba(55, 229, 201, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 12px 52px rgba(55, 229, 201, 0.45), inset 0 1px 0 rgba(255,255,255,0.35); }
.cta:active { transform: translateY(0); }
.cta svg { transform: scaleX(var(--flip, 1)); }
[dir="rtl"] .cta { --flip: -1; }

.scrollcue {
  position: absolute;
  bottom: 26px;
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--mist);
  opacity: 0.75;
}
.scrollcue__line {
  width: 1px;
  height: 42px;
  background: linear-gradient(to bottom, var(--turquoise), transparent);
  animation: cue 2.2s ease-in-out infinite;
}
@keyframes cue {
  0%, 100% { transform: scaleY(0.4); transform-origin: top; opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ---------- journey stations ---------- */
.station { height: 190svh; }
.station__pin {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  place-items: center;
  padding: 90px 20px 40px;
  overflow: hidden;
}
.station__copy { max-width: 560px; text-align: center; }
.station__copy--wide { max-width: 1020px; width: 100%; }
.station__headline {
  font-weight: 900;
  font-size: clamp(32px, 6.5vw, 60px);
  line-height: 1.25;
  color: var(--paper);
  margin-bottom: 18px;
}
.station__body { font-size: clamp(15px, 2.3vw, 17.5px); max-width: 460px; margin-inline: auto; }

/* features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2vw, 22px);
}
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.feature {
  padding: clamp(22px, 3vw, 34px) clamp(18px, 2.4vw, 28px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.feature__icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--turquoise);
  background: var(--turquoise-dim);
  border: 1px solid rgba(55, 229, 201, 0.25);
}
.feature h3 { color: var(--paper); font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.feature p { font-size: 14.5px; }

/* dive */
.dive__word {
  font-weight: 900;
  font-size: clamp(46px, 11vw, 120px);
  color: var(--paper);
  text-align: center;
  text-shadow: 0 0 60px rgba(245, 184, 65, 0.35);
}

/* ---------- chat station ---------- */
.chat-station {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 100px 14px 34px;
}
.chat-shell {
  width: min(760px, 100%);
  height: min(78svh, 860px);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border-color: rgba(55, 229, 201, 0.2);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(55, 229, 201, 0.05),
    0 0 120px rgba(55, 229, 201, 0.07);
}

.chatbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 15, 0.35);
}
.chatbar__brand { display: flex; align-items: center; gap: 10px; }
.brand-avatar { position: relative; width: 34px; height: 34px; }
.brand-avatar img { width: 100%; height: 100%; border-radius: 11px; }
.brand-avatar .dot {
  position: absolute;
  bottom: -1px;
  inset-inline-end: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--turquoise);
  border: 2px solid var(--ink-2);
}
.brand-word { font-family: var(--font-latin); font-weight: 700; font-size: 15.5px; color: var(--paper); }
.chatbar__quota { font-size: 11.5px; color: var(--mist); letter-spacing: 0.02em; }
.chatbar__quota.is-low { color: var(--saffron); }
.chatbar__quota.is-empty { color: #ff7d7d; }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(159, 176, 198, 0.25) transparent;
}

.empty { text-align: center; padding: 26px 8px 10px; }
.empty__img { width: 74px; height: 74px; border-radius: 22px; margin-bottom: 16px;
  box-shadow: 0 0 44px rgba(55, 229, 201, 0.25); }
.empty__title { color: var(--paper); font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.empty__sub { font-size: 14px; margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  border: 1px solid var(--glass-line);
  background: rgba(159, 176, 198, 0.07);
  color: var(--mist);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chip:hover { color: var(--turquoise); border-color: rgba(55, 229, 201, 0.4); background: var(--turquoise-dim); }

.messages { display: flex; flex-direction: column; gap: 12px; }
.msg {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user {
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(55, 229, 201, 0.16), rgba(55, 229, 201, 0.09));
  border: 1px solid rgba(55, 229, 201, 0.22);
  color: var(--paper);
  border-end-start-radius: 4px;
}
[dir="ltr"] .msg.user { align-self: flex-end; }
.msg.ai {
  align-self: flex-end;
  background: rgba(159, 176, 198, 0.08);
  border: 1px solid var(--line);
  color: var(--paper);
  border-end-end-radius: 4px;
}
[dir="ltr"] .msg.ai { align-self: flex-start; }
.msg.system {
  align-self: center;
  text-align: center;
  font-size: 13px;
  color: var(--saffron);
  background: rgba(245, 184, 65, 0.08);
  border: 1px solid rgba(245, 184, 65, 0.2);
}
.msg.system.danger { color: #ff9d9d; background: rgba(255, 125, 125, 0.07); border-color: rgba(255, 125, 125, 0.2); }

.typing { display: inline-flex; gap: 5px; padding: 3px 2px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--turquoise); opacity: 0.35;
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.composer { padding: 14px 16px 16px; border-top: 1px solid var(--line); background: rgba(5, 8, 15, 0.35); }
.composer__field {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-md);
  background: rgba(159, 176, 198, 0.06);
  padding: 9px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer__field:focus-within {
  border-color: rgba(55, 229, 201, 0.45);
  box-shadow: 0 0 0 3px rgba(55, 229, 201, 0.1);
}
.composer__input {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  color: var(--paper);
  font-family: var(--font-fa);
  font-size: 15px;
  line-height: 1.7;
  max-height: 140px;
}
.composer__input:focus { outline: none; }
.composer__input::placeholder { color: rgba(159, 176, 198, 0.55); }
.composer__send {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #04322B;
  background: linear-gradient(135deg, #4FF0D6, var(--turquoise));
  transition: transform 0.15s, opacity 0.2s;
}
.composer__send svg { transform: scaleX(var(--flip, 1)); }
[dir="rtl"] .composer__send { --flip: -1; }
.composer__send:hover { transform: translateY(-1px); }
.composer__send:disabled { opacity: 0.4; cursor: default; transform: none; }

.footnote { font-size: 12px; opacity: 0.65; text-align: center; }
.footnote__link { color: var(--turquoise); }

/* ---------- reveal defaults (scene.js animates these when 3D is on) ---------- */
html.has3d [data-reveal] { opacity: 0; }

/* ---------- no-3D / reduced-motion fallback ----------
   The journey collapses into an elegant static page: stations lose their
   scroll runway, every text is visible, gradients stand in for WebGL. */
html.no3d #scene { display: none; }
html.no3d .station { height: auto; min-height: 100svh; }
html.no3d .station__pin { position: static; height: auto; min-height: 100svh; }
html.no3d body {
  background:
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(55, 229, 201, 0.09), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(245, 184, 65, 0.06), transparent 60%),
    var(--ink);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scrollcue__line, .typing span { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .features { grid-template-columns: 1fr; max-width: 420px; margin-inline: auto; }
  .feature { display: grid; grid-template-columns: 54px 1fr; text-align: start; gap: 4px 16px; padding: 18px; }
  .feature__icon { grid-row: span 2; margin: 0; }
  .station { height: 170svh; }
}
@media (max-width: 480px) {
  .topnav__brand { font-size: 15px; }
  .chat-shell { height: min(84svh, 860px); border-radius: 18px; }
  .msg { max-width: 90%; }
}
