/* =========================================================
   CorePro — Global Custom Styles
   Cyber-Neon Glow + Glassmorphism + Theme Variables
   ========================================================= */

/* ---------- CSS Variables (Light / Dark) ---------- */
:root {
  --bg-body: #f4f6fb;
  --bg-surface: #ffffff;
  --bg-surface-alt: #eef1f8;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: rgba(15, 23, 42, 0.08);

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.35);
  --glass-nav-bg: rgba(255, 255, 255, 0.9);

  --neon-primary: #1e90ff;      /* light blue */
  --neon-secondary: #0000cd;    /* dark blue */
  --neon-tertiary: #ffd700;     /* gold */
  --neon-quaternary: #ff4500;     /* orange */

  --scrollbar-track: #e2e8f0;
  --scrollbar-thumb: #94a3b8;
}

html.dark {
  --bg-body: #05070d;
  --bg-surface: #0d1220;
  --bg-surface-alt: #10182b;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);

  --glass-bg: rgba(13, 18, 32, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-nav-bg: rgba(13, 18, 32, 0.55);

  --neon-primary: #1e90ff;      /* light blue */
  --neon-secondary: #0000cd;    /* dark blue */
  --neon-tertiary: #ffd700;     /* gold */
  --neon-quaternary: #ff4500;     /* orange */

  --scrollbar-track: #0d1220;
  --scrollbar-thumb: #334155;
}

/* ---------- Base / Smooth Scroll ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  background-color: var(--bg-body);
  transition: background-color 0.35s ease, color 0.35s ease;
}

/* ---------- Bilingual Font Stack ---------- */
/* Vazirmatn is used for both Persian and English so typography stays
   consistent when switching languages; it has full Latin glyph coverage. */
body {
  font-family: 'Vazirmatn', 'IRANSans', 'Tahoma', ui-sans-serif, system-ui, sans-serif;
}

/* Slightly larger line-height reads better for Persian script */
html[lang="fa"] body {
  line-height: 1.85;
}

/* ---------- Bilingual Visibility Guard ----------
   Belt-and-suspenders alongside the .hidden class toggled by script.js:
   prevents a flash of the wrong language before JS runs on repeat visits. */
html[lang="en"] .lang-fa {
  display: none;
}
html[lang="fa"] .lang-en {
  display: none;
}

/* ---------- Language Switcher Pill ---------- */
.lang-option {
  color: var(--text-secondary);
  cursor: pointer;
}
.lang-option-active {
  background-image: linear-gradient(90deg, var(--neon-primary), var(--neon-secondary));
  color: #fff;
}

/* ---------- Code Snippets: always render LTR regardless of page direction ----------
   PHP/code tokens are Latin-script and structurally left-to-right; isolating them
   from the surrounding RTL paragraph context keeps punctuation, operators, and
   variable names in the correct visual order inside Persian sentences. */
code, pre, kbd, samp {
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.glass-nav {
  background: var(--glass-nav-bg);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* ---------- Cyber-Neon Glow Utilities ---------- */
.neon-text {
  color: var(--neon-primary);
  text-shadow:
    0 0 6px color-mix(in srgb, var(--neon-primary) 70%, transparent),
    0 0 18px color-mix(in srgb, var(--neon-primary) 45%, transparent);
}

.neon-gradient-text {
  background-image: linear-gradient(90deg, var(--neon-tertiary), var(--neon-quaternary));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-flow 6s ease-in-out infinite;
}

.neon-border {
  border: 3px solid color-mix(in srgb, var(--neon-secondary) 60%, transparent);
  box-shadow:
    0 0 8px color-mix(in srgb, var(--neon-secondary) 45%, transparent),
    inset 0 0 8px color-mix(in srgb, var(--neon-secondary) 15%, transparent);
}

.neon-glow-btn {
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.2s ease, filter 0.3s ease;
  box-shadow: 0 0 10px color-mix(in srgb, var(--neon-tertiary) 55%, transparent);
}
.neon-glow-btn:hover {
  box-shadow:
    0 0 18px color-mix(in srgb, var(--neon-tertiary) 75%, transparent),
    0 0 34px color-mix(in srgb, var(--neon-quaternary) 45%, transparent);
  transform: translateY(-2px);
  filter: brightness(1.08);
}
.neon-glow-btn:active {
  transform: translateY(0);
}

.neon-card {
  transition: box-shadow 0.35s ease, transform 0.35s ease, border-color 0.35s ease;
  border: 3px solid var(--border-color);
}
.neon-card:hover {
  border-color: color-mix(in srgb, var(--neon-secondary) 100%, transparent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--neon-secondary) 75%, transparent);
  transform: translateY(-4px);
}

/* ---------- Glow Blobs (ambient background decoration) ---------- */
.glow-blob {
  position: absolute;
  border-radius: 9999px;
  filter: blur(90px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Timeline Positioning (RTL/LTR safe) -----------
   Written as plain CSS (instead of stacking Tailwind's logical
   `start-*` with physical `left-*`/`translate-x-*` utilities) so
   there is a single, unambiguous rule per breakpoint — avoiding
   the "over-constrained left/right" browser behavior that broke
   centering in one text direction whichever way the utilities
   were combined. `inset-inline-start` alone flips correctly with
   `dir`, and at 50% logical/physical position is identical, so
   centering works the same in both RTL and LTR. */
.timeline-track {
  position: absolute;
  inset-inline-start: 1.5rem;
  top: 0;
  bottom: 0;
  width: 1px;
}
.timeline-node {
  position: absolute;
  inset-inline-start: 1.5rem;
  transform: translateX(-50%);
  z-index: 10;
}
@media (min-width: 640px) {
  .timeline-track,
  .timeline-node {
    inset-inline-start: 50%;
    transform: translateX(-50%);
  }
}

/* `inset-inline-start` maps to `right` in RTL, so the reference edge used for
   the centering offset flips too. `translateX(-50%)` only re-centers a box
   correctly when it's positioned from its LEFT edge — in RTL (positioned
   from the RIGHT edge) the same box needs `translateX(50%)` (opposite sign)
   to land on the same true center point. Higher specificity than the rules
   above ensures this wins at every breakpoint. */
[dir="rtl"] .timeline-track,
[dir="rtl"] .timeline-node {
  transform: translateX(50%);
}

/* ---------- Animations ---------- */
@keyframes gradient-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 8px color-mix(in srgb, var(--neon-primary) 45%, transparent);
  }
  50% {
    box-shadow: 0 0 26px color-mix(in srgb, var(--neon-primary) 75%, transparent);
  }
}
.animate-pulse-glow {
  animation: pulse-glow 2.6s ease-in-out infinite;
}

@keyframes float-y {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-14px); }
}
.animate-float {
  animation: float-y 5s ease-in-out infinite;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up {
  animation: fade-in-up 0.7s ease forwards;
}

/* ---------- Mobile Menu Transition ---------- */
#mobile-menu {
  transition: max-height 0.35s ease, opacity 0.3s ease;
}

/* ---------- Theme Toggle Icon Swap ---------- */
[data-theme-icon] {
  transition: opacity 0.25s ease, transform 0.4s ease;
}
