/* ==========================================================================
   MAHDI PORTFOLIO — style.css
   Redesign: Dark Premium · Modern AI · Glassmorphism
   - فقط ظاهر (UI) تغییر کرده؛ ساختار HTML، محتوا و JS دست نخورده
   - Accent: #3B82F6 → #06B6D4  |  فونت: Manrope + Vazirmatn
   - Background: نقطه‌های خیلی ریز و محو + چند Glow آبی/فیروزه‌ای (Grid حذف شده)
   ========================================================================== */


/* ==========================================================================
   1) RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Headingها: وزن 700 تا 800 */
h1 { font-weight: 800; }
h2, h3 { font-weight: 700; }

/* فقط انگلیسی: کمی فشرده‌تر (روی فارسی letter-spacing نباید عوض بشه) */
[lang="en"] h1,
[lang="en"] h2 {
  letter-spacing: -0.02em;
}

::selection {
  background: rgba(var(--accent-rgb), 0.28);
  color: #ffffff;
}

/* فوکوس کیبورد: واضح ولی ظریف */
:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.7);
  outline-offset: 3px;
  border-radius: 6px;
}


/* ==========================================================================
   2) CSS VARIABLES
   پیش‌فرض: تم تاریک | تم روشن پایین‌تر override می‌کنه
   ========================================================================== */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* پس‌زمینه‌ها */
  --bg-primary: #05080F;
  --bg-secondary: #0A101C;
  --bg-card-rgb: 14, 22, 38;

  /* متن‌ها (Contrast بالا) */
  --text-primary: #F5F7FA;
  --text-secondary: #94A3B8;
  --text-muted: #7C8AA5;

  /* Accent: Blue → Cyan */
  --accent-start: #3B82F6;
  --accent-end: #06B6D4;
  --accent: #38BDF8;                 /* رنگ متن/لینک‌های accent روی پس‌زمینه تیره */
  --accent-rgb: 56, 189, 248;
  --blue-rgb: 59, 130, 246;
  --cyan-rgb: 6, 182, 212;
  --accent-gradient: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  --tag-text: #7DD3FC;

  /* شیشه و کارت */
  --border-color: rgba(148, 175, 255, 0.10);
  --border-strong: rgba(var(--accent-rgb), 0.30);
  --glass-bg: rgba(5, 8, 15, 0.62);
  --card-bg: rgba(var(--bg-card-rgb), 0.55);
  --card-highlight: rgba(255, 255, 255, 0.05);
  --shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.75);

  /* Background: نقطه‌ها و Glowها */
  --dot-color: rgba(148, 175, 255, 0.20);
  --glow-blue: rgba(59, 130, 246, 0.17);
  --glow-cyan: rgba(6, 182, 212, 0.12);

  /* شعاع‌ها و حرکت */
  --radius-lg: 20px;
  --radius-md: 12px;
  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);

  /* فونت‌ها */
  --font-en: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-fa: 'Vazirmatn', 'Manrope', system-ui, sans-serif;
  --font-primary: var(--font-en);
}

[data-theme="light"] {
  color-scheme: light;

  --bg-primary: #F5F8FC;
  --bg-secondary: #EAF0F9;
  --bg-card-rgb: 255, 255, 255;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;

  --accent-start: #2563EB;
  --accent-end: #0891B2;
  --accent: #0369A1;
  --accent-rgb: 3, 105, 161;
  --tag-text: #0369A1;

  --border-color: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(37, 99, 235, 0.35);
  --glass-bg: rgba(255, 255, 255, 0.72);
  --card-bg: rgba(var(--bg-card-rgb), 0.72);
  --card-highlight: rgba(255, 255, 255, 0.9);
  --shadow: 0 20px 40px -24px rgba(30, 64, 175, 0.25);

  --dot-color: rgba(37, 99, 235, 0.16);
  --glow-blue: rgba(59, 130, 246, 0.12);
  --glow-cyan: rgba(6, 182, 212, 0.10);
}

/* وقتی زبان فارسی باشه، فونت پیش‌فرض عوض میشه (توسط language.js ست میشه) */
[lang="fa"] {
  --font-primary: var(--font-fa);
}


/* ==========================================================================
   3) BACKGROUND — نقطه‌های محو + Glowهای آبی/فیروزه‌ای (بدون Grid)
   ========================================================================== */

/* --- لایه ۱: نقطه‌های خیلی ریز، به سمت لبه‌ها محو میشن --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1.5px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 20%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 20%, transparent 100%);
}

/* --- لایه ۲: چند Soft Glow برای هاله نور و عمق --- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(640px circle at 8% 6%, var(--glow-blue), transparent 65%),
    radial-gradient(560px circle at 94% 22%, var(--glow-cyan), transparent 65%),
    radial-gradient(720px circle at 50% 108%, var(--glow-blue), transparent 65%),
    radial-gradient(460px circle at -4% 62%, var(--glow-cyan), transparent 65%);
}

/* --- لایه ۳: ذرات شناور و نور موس (توسط background.js ساخته میشن؛ فقط تم تاریک) --- */
#particles {
  display: none;
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

[data-theme="dark"] #particles {
  display: block;
}


/* ==========================================================================
   4) LAYOUT
   ========================================================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 88px 0;
}


/* ==========================================================================
   5) NAVBAR
   ========================================================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border-color);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  direction: ltr; /* چیدمان نوبار با تغییر زبان ثابت بمونه: لوگو چپ، تب‌ها وسط، دکمه‌ها راست */
  padding: 14px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.navbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.navbar-logo span {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  mix-blend-mode: screen;
}

[data-theme="light"] .brand-mark {
  filter: invert(1);
  mix-blend-mode: multiply;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* فارسی: ترتیب تب‌ها راست‌به‌چپ (خانه اول از راست)، بدون اینکه جای لوگو و دکمه‌ها عوض بشه */
[dir="rtl"] .navbar-links {
  direction: rtl;
}

.navbar-links a {
  position: relative;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 6px 0;
  transition: color 0.25s var(--ease);
}

/* خط زیر لینک: با hover و لینک فعال ظاهر میشه */
.navbar-links a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: transform 0.3s var(--ease);
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--text-primary);
}

.navbar-links a:hover::after,
.navbar-links a.active::after {
  transform: scaleX(1);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn:hover {
  background-color: rgba(var(--accent-rgb), 0.08);
  border-color: var(--border-color);
  color: var(--accent);
}

#lang-toggle {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}


/* ==========================================================================
   6) FOOTER
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border-color);
  background: linear-gradient(to bottom, transparent, rgba(var(--bg-card-rgb), 0.35));
  padding: 44px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}

.footer-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.1);
}

.footer-links svg {
  width: 20px;
  height: 20px;
}


/* ==========================================================================
   7) BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
              border-color 0.3s var(--ease), background-color 0.3s var(--ease),
              color 0.3s var(--ease), filter 0.3s var(--ease);
}

/* دکمه اصلی: متن تیره روی گرادینت برای Contrast بالا */
.btn-primary {
  background: var(--accent-gradient);
  color: #031018;
  border: none;
  box-shadow:
    0 10px 26px -10px rgba(var(--blue-rgb), 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow:
    0 16px 34px -10px rgba(var(--blue-rgb), 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.btn-outline {
  border: 1px solid var(--border-strong);
  background-color: rgba(var(--accent-rgb), 0.04);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-outline:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb), 0.6);
  background-color: rgba(var(--accent-rgb), 0.10);
  color: var(--accent);
}


/* ==========================================================================
   8) CARDS (پایه مشترک) — شیشه‌ای، تیره، نیمه‌شفاف
   ========================================================================== */
.project-card,
.path-card,
.goal-card,
.timeline-card {
  position: relative;
  overflow: hidden;
  background-color: var(--card-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: inset 0 1px 0 var(--card-highlight), var(--shadow);
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

/* خط نور نازک لبه بالای کارت */
.project-card::before,
.path-card::before,
.goal-card::before,
.timeline-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.55), transparent);
  opacity: 0.35;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
}

/* Hover ظریف: کمی بالا میاد، بردر آبی، هاله نور کم (--cx/--cy از background.js میاد؛ بدونش هم درست کار می‌کنه) */
.project-card:hover,
.path-card:hover,
.timeline-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow:
    inset 0 1px 0 var(--card-highlight),
    0 28px 50px -24px rgba(0, 0, 0, 0.8),
    0 0 40px -18px rgba(var(--blue-rgb), 0.45);
  background-image: radial-gradient(340px circle at var(--cx, 50%) var(--cy, 0%), rgba(var(--accent-rgb), 0.07), transparent 70%);
}

.project-card:hover::before,
.path-card:hover::before,
.goal-card:hover::before,
.timeline-card:hover::before {
  opacity: 1;
}

[data-theme="light"] .project-card:hover,
[data-theme="light"] .path-card:hover,
[data-theme="light"] .timeline-card:hover {
  box-shadow:
    inset 0 1px 0 var(--card-highlight),
    0 24px 44px -24px rgba(30, 64, 175, 0.3);
}


/* ==========================================================================
   9) HOME PAGE — Hero, Skills, Projects, CTA
   ========================================================================== */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  padding-top: 110px;
}

/* دو هاله نور نرم اطراف Hero (نه یک لکه زیر متن) */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(520px circle at 16% 32%, rgba(var(--blue-rgb), 0.11), transparent 70%),
    radial-gradient(460px circle at 84% 62%, rgba(var(--cyan-rgb), 0.09), transparent 70%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
}

.hero-eyebrow {
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
}

[lang="en"] .hero-title {
  letter-spacing: -0.03em;
}

.hero-title-2 {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(var(--blue-rgb), 0.28));
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

/* "Hi, I'm" به شکل یک Pill شیشه‌ای با نقطه نورانی */
.hero-greeting {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  margin-bottom: 20px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background-color: rgba(var(--bg-card-rgb), 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.hero-greeting::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-end);
  box-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.9);
  animation: softPulse 2.8s ease-in-out infinite;
}

@keyframes softPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.hero-name {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 14px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(var(--blue-rgb), 0.28));
}

[lang="en"] .hero-name {
  letter-spacing: -0.03em;
}

.hero-role {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 22px;
  min-height: 2.2em;
}

.hero-role .cursor {
  animation: blink 0.8s infinite;
  color: var(--accent-end);
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-intro {
  max-width: 560px;
  margin: 0 0 32px;
  color: var(--text-secondary);
  font-size: 1.08rem;
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

/* عنوان بخش‌ها: خط گرادینت کوتاه زیرش */
.section-title {
  text-align: center;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800;
  margin-bottom: 48px;
}

.section-title::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin: 14px auto 0;
  border-radius: 3px;
  background: var(--accent-gradient);
  opacity: 0.9;
}

/* بخش Skills: نوار شیشه‌ای خیلی ملایم */
.glass-band,
.skills-preview {
  background: linear-gradient(to bottom, rgba(var(--bg-card-rgb), 0.28), rgba(var(--bg-card-rgb), 0.10));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.skill-chip {
  padding: 10px 20px;
  border-radius: 999px;
  background-color: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 0 var(--card-highlight);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), color 0.3s var(--ease);
}

.skill-chip:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  color: var(--accent);
  box-shadow:
    inset 0 1px 0 var(--card-highlight),
    0 0 24px -8px rgba(var(--accent-rgb), 0.5);
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.project-card h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.project-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 18px;
  line-height: 1.75;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tech-tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 8px;
  background-color: rgba(var(--blue-rgb), 0.10);
  border: 1px solid rgba(var(--blue-rgb), 0.25);
  color: var(--tag-text);
}

.project-links {
  display: flex;
  gap: 18px;
  font-size: 0.9rem;
  font-weight: 700;
}

.project-links a {
  color: var(--accent);
  transition: opacity 0.25s var(--ease);
}

.project-links a:hover {
  opacity: 0.8;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.view-all-wrapper {
  text-align: center;
  margin-top: 40px;
}

/* CTA: کارت شیشه‌ای بزرگ با هاله نور آبی/فیروزه‌ای */
.cta-section {
  position: relative;
  overflow: hidden;
  text-align: center;
  width: min(1152px, calc(100% - 48px));
  margin: 0 auto 40px;
  padding: 64px 24px;
  border-radius: 28px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background:
    linear-gradient(135deg, rgba(var(--blue-rgb), 0.12), rgba(var(--cyan-rgb), 0.06)),
    var(--card-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    inset 0 1px 0 var(--card-highlight),
    0 30px 60px -30px rgba(0, 0, 0, 0.7),
    0 0 70px -30px rgba(var(--blue-rgb), 0.5);
}

.cta-section::before {
  content: "";
  position: absolute;
  top: -120px;
  left: 50%;
  width: 420px;
  height: 240px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(var(--cyan-rgb), 0.16), transparent);
  pointer-events: none;
}

.cta-inner {
  position: relative;
}

.cta-inner h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800;
  margin-bottom: 12px;
}

.cta-inner p {
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* آیکون‌های SVG داخل دکمه‌ها */
.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* نمایش/مخفی‌کردن آیکون درست بر اساس تم فعلی */
#icon-sun { display: block; }
#icon-moon { display: none; }

[data-theme="light"] #icon-sun { display: none; }
[data-theme="light"] #icon-moon { display: block; }


/* ==========================================================================
   10) ABOUT PAGE — Intro, Learning Path, Goal, Timeline
   ========================================================================== */
.about-hero {
  padding-top: 140px;
}

.about-hero-inner {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 56px;
  align-items: center;
}

/* قاب عکس: 4:5، حاشیه گرادینت آبی→فیروزه‌ای، هاله نور نرم */
.about-photo {
  width: 300px;
  aspect-ratio: 4 / 5;
  padding: 8px;
  border-radius: 24px;
  border: 1px solid transparent;
  /* لایه اول: داخل قاب | لایه دوم: گرادینت فقط روی حاشیه دیده میشه */
  background:
    linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
    linear-gradient(135deg, rgba(var(--blue-rgb), 0.75), rgba(var(--cyan-rgb), 0.28) 55%, rgba(var(--blue-rgb), 0.15)) border-box;
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, 0.7),
    0 0 60px -20px rgba(var(--blue-rgb), 0.5);
  overflow: hidden;
}

[data-theme="light"] .about-photo {
  box-shadow:
    0 30px 60px -20px rgba(30, 64, 175, 0.28),
    0 0 50px -24px rgba(var(--blue-rgb), 0.4);
}

.about-photo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  object-fit: cover;
}

.about-photo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-rgb), 0.08);
  font-size: 5rem;
  font-weight: 800;
  color: var(--accent);
}

.about-title {
  font-size: clamp(2.1rem, 4.5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 24px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.about-text p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.9;
  margin-bottom: 14px;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.path-number {
  display: inline-block;
  font-weight: 800;
  font-size: 1.5rem;
  margin-bottom: 10px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.path-card h3,
.timeline-card h3 {
  margin-bottom: 8px;
}

.path-card p,
.goal-card p,
.timeline-card p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
}

/* کارت هدف: کمی پررنگ‌تر با تِین آبی/فیروزه‌ای (Hover حرکتی نداره) */
.goal-card {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 32px;
  border-color: rgba(var(--accent-rgb), 0.16);
  background-image: linear-gradient(135deg, rgba(var(--blue-rgb), 0.09), rgba(var(--cyan-rgb), 0.05));
}

.goal-card:hover {
  border-color: var(--border-strong);
}

.goal-card h2 {
  margin-bottom: 12px;
}

/* Timeline عمودی: خط محو + کارت‌های یک‌درمیان چپ/راست */
.timeline {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(var(--accent-rgb), 0.4) 12%, rgba(var(--accent-rgb), 0.4) 88%, transparent);
  transform: translateX(-50%);
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  align-items: center;
  margin-bottom: 32px;
}

.timeline-card {
  grid-column: 1;
  grid-row: 1;
}

.timeline-item:nth-child(even) .timeline-card {
  grid-column: 3;
}

.timeline-dot {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow:
    0 0 0 5px rgba(var(--accent-rgb), 0.14),
    0 0 18px rgba(var(--accent-rgb), 0.5);
  position: relative;
}

.timeline-date {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
/* What I Build: ۵ کارت، ردیف اول ۳ تا، ردیف دوم ۲ تای وسط‌چین */
.build-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
}

.build-grid .path-card {
  grid-column: span 2;
}

.build-grid .path-card:nth-child(4) {
  grid-column: 2 / span 2;
}

.build-grid .path-card:nth-child(5) {
  grid-column: 4 / span 2;
}

/* My Approach: Problem → AI → Product → Real-world Use */
.flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.flow-arrow {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

[dir="rtl"] .flow-arrow {
  transform: scaleX(-1); /* فلش در فارسی برعکس بشه */
}
/* AI System Card (Hero) */
.system-card {
  position: relative;
  direction: ltr; /* دیاگرام در هر دو زبان یکسان بمونه */
  overflow: hidden;
  padding: 26px 28px 30px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    inset 0 1px 0 var(--card-highlight),
    var(--shadow),
    0 0 70px -30px rgba(var(--blue-rgb), 0.55);
  animation: floatY 7s ease-in-out infinite;
}

.system-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(320px circle at 50% 0%, rgba(var(--cyan-rgb), 0.12), transparent 70%);
}

.system-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.system-head span:first-child {
  color: var(--accent);
}

.system-logo {
  position: relative;
  display: block;
  width: 92px;
  height: 92px;
  margin: 26px auto;
  border-radius: 24px;
  object-fit: cover;
  box-shadow:
    0 0 40px -6px rgba(var(--blue-rgb), 0.65),
    0 0 0 1px rgba(var(--accent-rgb), 0.25);
}

.system-flow {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
}

.system-inputs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.system-inputs li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

.system-inputs li::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.45), rgba(var(--accent-rgb), 0.15));
}

.system-merge {
  align-self: stretch;
  width: 1px;
  margin-block: 10px;
  background: rgba(var(--accent-rgb), 0.35);
}

.system-output {
  padding-left: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent);
  white-space: nowrap;
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
/* ==========================================================================
   11) دسترسی‌پذیری: کاهش حرکت
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* حذف بک‌گراند مشکی لوگوی N (تم تاریک) */
.system-logo,
.brand-mark {
  mix-blend-mode: screen;
}

/* تم روشن: رنگ‌ها معکوس میشن تا مشکی سفید بشه و با multiply محو بشه */
[data-theme="light"] .system-logo,
[data-theme="light"] .brand-mark {
  filter: invert(1);
  mix-blend-mode: multiply;
}
/* ==========================================================================
   PROJECTS — لیست، جزئیات، Carousel، Code Showcase
   ========================================================================== */
.page-head { padding-top: 140px; text-align: center; }
.page-head h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: 12px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-head p { color: var(--text-secondary); max-width: 560px; margin: 0 auto 24px; }

/* کارت پروژه با کاور */
.pcard { display: flex; flex-direction: column; padding: 0; overflow: hidden; color: inherit; }
.pcard-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.25), rgba(123, 97, 255, 0.25));
  border-bottom: 1px solid var(--border-color);
}
.pcard-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; font-weight: 800;
  color: var(--accent); opacity: 0.5;
}
.pcard-cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.pcard:hover .pcard-cover img { transform: scale(1.04); }
.pcard-body { padding: 24px 28px 28px; display: flex; flex-direction: column; flex: 1; }
.pcard-body h3 { font-size: 1.6rem; font-weight: 800; }
.pcard-link { margin-top: auto; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.pcard-link::after { content: " →"; }
[dir="rtl"] .pcard-link::after { content: " ←"; }

/* صفحه جزئیات */
.pd-hero { padding-top: 140px; padding-bottom: 20px; }
.pd-back { display: inline-block; color: var(--text-secondary); font-weight: 600; margin-bottom: 20px; transition: color 0.2s ease; }
.pd-back:hover { color: var(--accent); }
.pd-back::before { content: "← "; }
[dir="rtl"] .pd-back::before { content: "→ "; }
.pd-title {
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 14px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pd-caption { color: var(--text-secondary); font-size: 1.15rem; max-width: 720px; line-height: 1.8; margin-bottom: 24px; }
.pd-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 36px; }

.pd-cover {
  aspect-ratio: 16 / 9;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
    linear-gradient(135deg, rgba(79, 140, 255, 0.55), rgba(123, 97, 255, 0.55)) border-box;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.pd-cover img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
/* انیمیشن کاور (iframe): دقیقاً به اندازه‌ی کادر، بدون border و سایز پیش‌فرض ۳۰۰×۱۵۰ مرورگر */
.pd-cover iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 14px; background: #0a0f1d; }

.pd-section { padding: 36px 0; }
.pd-h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; }
.pd-text { color: var(--text-secondary); line-height: 1.9; white-space: pre-line; max-width: 820px; }
.pd-two { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.pd-features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.pd-feature { display: flex; gap: 12px; align-items: flex-start; padding: 20px; }
.pd-check { color: var(--accent); font-weight: 800; }
.pd-arch { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }

/* Gallery Carousel (Swipe شبیه اینستاگرام) — جهت همیشه LTR تا رفتار اسکرول در فارسی به‌هم نریزه */
.carousel {
  position: relative;
  direction: ltr;
  max-width: 900px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: rgba(var(--bg-card-rgb), 0.6);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}
.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.18), rgba(123, 97, 255, 0.18));
}
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.g-count {
  position: absolute; top: 12px; right: 12px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; color: #fff;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
}
.g-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 1.4rem; line-height: 1; color: #fff;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  transition: background 0.2s ease;
}
.g-btn:hover { background: rgba(0, 0, 0, 0.7); }
.g-prev { left: 12px; }
.g-next { right: 12px; }
.g-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.g-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.4); transition: all 0.25s ease; }
.g-dot.active { background: #fff; width: 18px; border-radius: 4px; }

/* ==========================================================================
   Lightbox گالری — نمایش تمام‌صفحه عکس
   ========================================================================== */
.carousel-slide { position: relative; cursor: zoom-in; }
.carousel-slide::after {
  content: "";
  position: absolute; top: 12px; left: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45) center / 14px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cpolyline points='9 21 3 21 3 15'/%3E%3Cline x1='21' y1='3' x2='14' y2='10'/%3E%3Cline x1='3' y1='21' x2='10' y2='14'/%3E%3C/svg%3E");
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0.85;
  pointer-events: none;
}

body.lb-open { overflow: hidden; }

.lightbox {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  direction: ltr;
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}
.lightbox.open { opacity: 1; visibility: visible; }

.lb-backdrop {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(var(--blue-rgb), 0.16), transparent 60%),
    rgba(3, 6, 12, 0.88);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.lb-stage {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px;
}

.lb-img {
  max-width: min(1200px, 92vw);
  max-height: 82vh;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.85),
    0 0 60px rgba(var(--cyan-rgb), 0.18);
  transform: scale(0.94);
  transition: transform 0.45s var(--ease), opacity 0.3s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox.open .lb-img { transform: scale(1); }
.lb-img.loading { opacity: 0; }

.lb-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 16px;
}

.lb-count,
.lb-caption {
  padding: 7px 14px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lb-caption {
  position: absolute; left: 50%; z-index: 2;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: 80vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.lb-close,
.lb-nav {
  display: flex; align-items: center; justify-content: center;
  color: #fff; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.25s ease, transform 0.25s var(--ease), border-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.lb-close { width: 42px; height: 42px; }
.lb-close svg { width: 18px; height: 18px; }
.lb-close:hover { background: rgba(var(--blue-rgb), 0.55); border-color: rgba(var(--accent-rgb), 0.7); transform: rotate(90deg); }

.lb-nav {
  position: absolute; top: 50%; z-index: 2;
  width: 48px; height: 48px;
  font-size: 1.8rem; line-height: 1;
  transform: translateY(-50%);
}
.lb-nav:hover { background: rgba(var(--blue-rgb), 0.55); border-color: rgba(var(--accent-rgb), 0.7); transform: translateY(-50%) scale(1.1); }
.lb-prev { left: 24px; }
.lb-next { right: 24px; }

.lightbox.single .lb-nav { display: none; }

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lb-img, .lb-close, .lb-nav { transition: none; }
}
/* Code Showcase (همیشه LTR) */
.code-box {
  max-width: 820px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(var(--bg-card-rgb), 0.9);
  direction: ltr;
  text-align: left;
}
.code-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
}
.code-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.code-copy:hover { color: var(--accent); background-color: rgba(var(--accent-rgb), 0.1); }
.code-copy svg { width: 16px; height: 16px; }
.code-copy .icon-check { display: none; color: #22c55e; }
.code-copy.copied .icon-copy { display: none; }
.code-copy.copied .icon-check { display: block; }
.code-pre {
  position: relative; margin: 0; padding: 16px; overflow-x: auto;
  font-family: "Consolas", "Menlo", monospace;
  font-size: 0.85rem; line-height: 1.7;
  color: var(--text-primary);
}
.code-pre.collapsed::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(var(--bg-card-rgb), 1));
}
.code-more { margin: 12px 16px 16px; }
/* ==========================================================================
   PROJECT DETAILS — همه محتوا داخل یک کادر شیشه‌ای واحد
   ========================================================================== */
.pd-glass {
  margin-top: 100px;
  margin-bottom: 60px;
  padding: 8px 32px 48px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(var(--bg-card-rgb), 0.18);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .pd-glass {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.35);
}

/* چون همه سکشن‌ها حالا داخل یک container هستن، container تو در تو باعث فاصله اضافه نشه */
.pd-glass .container { padding: 0; max-width: none; }

/* هدر و بخش‌ها چسبیده به لبه کادر نباشن */
.pd-glass .pd-hero { padding-top: 32px; }
.pd-glass .pd-section:last-child,
.pd-glass .code-box { margin-bottom: 0; }
/* ==========================================================================
   SKILLS PAGE — مسیر هویتی، Core Expertise سلسله‌مراتبی، Skills Breakdown
   ========================================================================== */

/* مسیر هویتی: AI Developer → AI Engineer → AI Product Builder */
.identity-path {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.identity-step {
  padding: 8px 18px;
  border-radius: 30px;
  background: rgba(var(--bg-card-rgb), 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.identity-arrow {
  color: var(--accent);
  font-weight: 700;
}

/* Core Expertise — سلسله‌مراتب بصری: یک کارت اصلی بزرگ + دو کارت فرعی */
.expertise-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.expertise-card {
  background: rgba(var(--bg-card-rgb), 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 28px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.expertise-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--accent-rgb), 0.4);
}

.expertise-primary {
  grid-column: 1 / -1;
  padding: 40px;
  border-color: rgba(var(--accent-rgb), 0.3);
  box-shadow: 0 20px 40px -15px rgba(var(--accent-rgb), 0.15);
}

.expertise-primary h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin-bottom: 12px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.expertise-secondary h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.expertise-desc {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 18px;
}

.expertise-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Skills Breakdown */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.skill-category-card h3 {
  margin-bottom: 16px;
}

.skill-category-card .project-tech {
  margin-bottom: 20px;
}

.skill-used-in {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-used-in a {
  color: var(--accent);
  font-weight: 600;
}

.skill-used-in a:hover {
  text-decoration: underline;
}
/* ==========================================================================
   SKILLS PAGE — Technology Stack, Capability Map, How I Build,
   Skills in Action, Services, Collaboration, Currently Exploring
   ========================================================================== */

.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }

/* Capability Map: زنجیره عمودی ساده */
.capability-map { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 320px; margin: 0 auto; }
.cap-node {
  width: 100%; text-align: center;
  padding: 14px 24px; border-radius: 14px;
  background: rgba(var(--bg-card-rgb), 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  font-weight: 700;
}
.cap-arrow { color: var(--accent); font-size: 1.2rem; line-height: 1; }

/* Skills in Action */
.action-list { display: flex; flex-direction: column; gap: 12px; max-width: 640px; margin: 0 auto; }
.action-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border-radius: 14px;
  background: rgba(var(--bg-card-rgb), 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.action-item:hover { border-color: rgba(var(--accent-rgb), 0.4); transform: translateY(-2px); }
.action-arrow { color: var(--accent); font-weight: 700; }
.action-project { font-weight: 600; }

/* Services */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.service-card p { color: var(--text-secondary); line-height: 1.8; margin: 10px 0 16px; font-size: 0.95rem; }
.service-card .pcard-link { display: inline-block; margin-top: 14px; }

/* Collaboration */
.collab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.collab-grid .path-card p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 8px; }
/* ==========================================================================
   IDEAS — لیست عمودی مینیمال + صفحه جزئیات Editorial
   ========================================================================== */

/* لیست: Divider ظریف بین آیتم‌ها، بدون کارت/سایه */
.ideas-list { max-width: 780px; margin: 0 auto; }

.idea-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: rgba(var(--bg-card-rgb), 0.35);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.idea-row + .idea-row { margin-top: 14px; }
.idea-row:hover {
  border-color: rgba(var(--accent-rgb), 0.35);
  transform: translateY(-2px);
}

.idea-thumb {
  position: relative;
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.18), rgba(123, 97, 255, 0.18));
}
.idea-thumb-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.6rem; color: var(--accent); opacity: 0.6;
}
.idea-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
}
.idea-row:hover .idea-thumb img { transform: scale(1.05); }

.idea-info { flex: 1; min-width: 0; }
.idea-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  transition: color 0.2s ease;
}
.idea-row:hover .idea-info h3 { color: var(--accent); }
/* ---------- فیلتر مقالات: نوار مرتب (نوع = بخش‌بخش، موضوع = لیست کشویی) ---------- */
.idea-filters {
  max-width: 780px;
  margin: 0 auto 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.idea-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* نوع: کنترل بخش‌بخش */
.idea-seg {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(var(--bg-card-rgb), 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.idea-seg-btn {
  padding: 7px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.idea-seg-btn:hover { color: var(--text-primary); }
.idea-seg-btn.active {
  background: var(--accent-gradient);
  color: #031018;
  box-shadow: 0 6px 18px -8px rgba(var(--blue-rgb), 0.7);
}
.idea-seg-btn:focus-visible,
.idea-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* موضوع: لیست کشویی (روی موبایل پیکر خود گوشی باز میشه) */
.idea-select-wrap { position: relative; display: inline-flex; min-width: 210px; }
.idea-select {
  width: 100%;
  height: 42px;
  padding-block: 0;
  padding-inline: 18px 40px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(var(--bg-card-rgb), 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  text-align: start;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.idea-select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea-select:hover { border-color: rgba(var(--accent-rgb), 0.45); }
.idea-select-wrap.active .idea-select {
  border-color: rgba(var(--accent-rgb), 0.6);
  background: rgba(var(--accent-rgb), 0.12);
}
.idea-select-ico {
  position: absolute;
  top: 50%;
  inset-inline-end: 16px;
  display: inline-flex;
  color: var(--text-muted);
  transform: translateY(-50%);
  pointer-events: none;
}
.idea-select-ico svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
.idea-select-wrap.open .idea-select-ico svg { transform: rotate(180deg); }
.idea-select-wrap.open .idea-select { border-color: rgba(var(--accent-rgb), 0.6); }

/* منوی بازشونده‌ی موضوع: پنل شیشه‌ای با گزینه‌های مرتب */
.idea-filters { position: relative; z-index: 20; }
.idea-select-wrap { z-index: 20; }
.idea-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(320px, 92vw);
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--border-strong, var(--border-color));
  background: rgba(var(--bg-card-rgb), 0.94);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.65);
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.4) transparent;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}
.idea-select-wrap.open .idea-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
html[data-theme="light"] .idea-menu {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 50px -20px rgba(42, 18, 56, 0.28);
}
.idea-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.idea-opt-check { flex: none; display: inline-flex; width: 16px; height: 16px; color: var(--accent); }
.idea-opt-check svg { width: 16px; height: 16px; }
.idea-opt-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea-opt-count {
  flex: none;
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}
.idea-opt:hover:not(:disabled),
.idea-opt:focus-visible {
  background: rgba(var(--accent-rgb), 0.13);
  color: var(--text-primary);
  outline: none;
}
.idea-opt[aria-selected="true"] { color: var(--accent); background: rgba(var(--accent-rgb), 0.10); }
.idea-opt[aria-selected="true"] .idea-opt-count { background: var(--accent-gradient); color: #031018; }
.idea-opt:disabled { opacity: 0.38; cursor: not-allowed; }
.idea-opt--all { margin-bottom: 8px; }
.idea-opt--all::after {
  content: "";
  position: absolute;
  inset-inline: 12px;
  bottom: -5px;
  height: 1px;
  background: var(--border-color);
}

/* ردیف نتیجه: کم‌رنگ و کوچک */
.idea-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.idea-clear {
  padding: 2px 4px;
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.idea-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border-color);
  border-radius: 16px;
}
.idea-empty .idea-clear { margin-top: 10px; }

/* کارت‌ها با ورود ملایم (فقط backwards تا hover خراب نشه) */
.idea-row { animation: idea-in 0.45s ease backwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes idea-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- تگ‌ها، تاریخ و زمان مطالعه ---------- */
.idea-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.idea-tag {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  background: rgba(var(--accent-rgb), 0.10);
  color: var(--tag-text);
  font-size: 0.72rem;
  font-weight: 700;
}
.idea-tag--type { background: rgba(var(--accent-rgb), 0.22); border-color: rgba(var(--accent-rgb), 0.42); }

.idea-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
}
.idea-metaline { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.idea-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.idea-meta-ico { display: inline-flex; color: var(--accent); }
.idea-meta-ico svg { width: 15px; height: 15px; }
.idea-foot .idea-cta { margin-top: 0; }

/* صفحه‌ی مقاله: چیپ‌های تاریخ / زمان مطالعه / تگ */
.idea-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 22px; }
.idea-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(var(--bg-card-rgb), 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
}
.idea-chip svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.idea-chips .idea-tag { padding: 5px 12px; font-size: 0.78rem; }

@media (prefers-reduced-motion: reduce) {
  .idea-row { animation: none; }
}
.idea-info p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.idea-arrow {
  flex: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: transform 0.2s ease, color 0.2s ease;
}
.idea-row:hover .idea-arrow { color: var(--accent); transform: translateX(4px); }
[dir="rtl"] .idea-row:hover .idea-arrow { transform: translateX(-4px); }

/* صفحه جزئیات: عرض محدود برای خوانایی بهتر */
.idea-article-head,
.idea-body { max-width: 720px; }
.idea-title { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.idea-cover { margin-top: 24px; }

/* Share: دکمه + منوی شیشه‌ای */
/* دکمه Share: گوشه‌ی بالای کارت، هم‌ردیف لینک برگشت (فارسی: چپ، انگلیسی: راست) */
.idea-article { position: relative; }
.idea-share {
  position: absolute;
  top: 19px;
  inset-inline-end: 32px;
  z-index: 5;
}
.idea-share-btn { padding: 7px 14px; font-size: 0.82rem; }
.idea-share-btn svg { width: 16px; height: 16px; }

.idea-share-menu {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  max-width: calc(100vw - 72px);
  padding: 8px;
  background: rgba(var(--bg-card-rgb), 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top;
  transition: opacity 0.2s ease, transform 0.25s var(--ease), visibility 0.25s;
}

.idea-share.open .idea-share-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.idea-share-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: start;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.idea-share-item svg { width: 18px; height: 18px; flex: none; }

.idea-share-item:hover,
.idea-share-item:focus-visible {
  background-color: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  outline: none;
}

.idea-share-item.copied { color: #22c55e; }

.idea-h2 { font-size: 1.2rem; font-weight: 700; margin: 32px 0 12px; }
.idea-body > .idea-h2:first-child { margin-top: 0; }
.idea-p { color: var(--text-secondary); line-height: 2; font-size: 1.02rem; margin-bottom: 4px; }

/* درخت قابلیت‌ها: تیتر اصلی + تنه‌ی آبی محو + شاخه‌ها (فیلد level در data/ideas.js) */
.idea-h2--root {
  position: relative;
  font-size: 1.65rem;
  line-height: 1.4;
  margin: 48px 0 0;
  padding-bottom: 6px;
  padding-inline-start: 26px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* گره‌ی درخشان کنار تیتر اصلی */
.idea-h2--root::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: calc(50% - 3px);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.14),
              0 0 20px rgba(var(--accent-rgb), 0.6);
}

.idea-tree {
  position: relative;
  margin-inline-start: 4px;
  padding-inline-start: 30px;
  padding-bottom: 4px;
}

/* تنه‌ی آبی محو: از گره شروع میشه و به پایین کم‌رنگ میشه */
.idea-tree::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: -24px;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom,
              rgba(var(--accent-rgb), 0.6),
              rgba(var(--accent-rgb), 0.18) 65%,
              transparent);
}

.idea-branch { position: relative; padding-bottom: 6px; }

.idea-h2--sub {
  position: relative;
  font-size: 1.12rem;
  line-height: 1.5;
  margin: 26px 0 10px;
}

.idea-tree > .idea-branch:first-child .idea-h2--sub { margin-top: 14px; }

/* خط افقی از تنه تا تیتر شاخه */
.idea-h2--sub::before {
  content: "";
  position: absolute;
  inset-inline-start: -30px;
  top: 0.75em;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: rgba(var(--accent-rgb), 0.5);
}

/* گره‌ی کوچک سر شاخه */
.idea-h2--sub::after {
  content: "";
  position: absolute;
  inset-inline-start: -14px;
  top: 0.75em;
  width: 8px;
  height: 8px;
  box-sizing: border-box;
  border-radius: 50%;
  transform: translateY(-3px);
  background: var(--bg-primary);
  border: 2px solid var(--accent);
}
/* صفحه جزئیات Idea داخل همون کادر شیشه‌ای مشترک با Project Details */
.idea-article .pd-hero,
.idea-article .pd-section { padding-left: 0; padding-right: 0; }
/* لینک برگشت + دکمه Share بالاتر بیان */
.idea-article .pd-hero { padding-top: 16px; }
/* ==========================================================================
   CONTACT PAGE — لیست مینیمال راه‌های ارتباطی
   ========================================================================== */
.contact-head { text-align: center; }

.contact-list {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 20px;
  color: inherit;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}
.contact-row:first-child { border-top: 1px solid var(--border-color); }
.contact-row:hover { background-color: rgba(var(--bg-card-rgb), 0.4); }

.contact-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.contact-row:hover .contact-icon {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.35);
}
.contact-icon svg { width: 20px; height: 20px; }

.contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.contact-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}
.contact-value {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.contact-arrow {
  flex: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform 0.2s ease, color 0.2s ease;
}
.contact-row:hover .contact-arrow {
  color: var(--accent);
  transform: translateX(4px);
}
[dir="rtl"] .contact-row:hover .contact-arrow { transform: translateX(-4px); }
/* ==========================================================================
   404 PAGE — Signal Lost
   ========================================================================== */
.nf-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 140px 24px 80px;
  overflow: hidden;
}

/* --- Graphic: ● ─── ● ─── ● ─── × --- */
.nf-graphic {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 40px;
  opacity: 0.5;
}

.nf-node {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: nfPulse 2.6s ease-in-out infinite;
}
.nf-node:nth-child(3) { animation-delay: 0.4s; }
.nf-node:nth-child(5) { animation-delay: 0.8s; }

.nf-line {
  width: 46px;
  height: 1px;
  background: var(--border-color);
}

.nf-x {
  margin-inline-start: 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
}

@keyframes nfPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.6); box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6); }
}

/* --- 404 Typography --- */
.nf-code {
  font-size: clamp(5rem, 16vw, 10rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-secondary);
  opacity: 0;
  animation: nfFadeUp 0.7s ease forwards;
}

.nf-zero {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 22px rgba(var(--accent-rgb), 0.25));
}

.nf-signal {
  margin-top: 20px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--text-primary);
  opacity: 0;
  animation: nfFadeUp 0.7s ease 0.15s forwards;
}

.nf-desc {
  margin-top: 16px;
  max-width: 420px;
  color: var(--text-secondary);
  line-height: 1.8;
  opacity: 0;
  animation: nfFadeUp 0.7s ease 0.3s forwards;
}

.nf-cta {
  margin-top: 36px;
  opacity: 0;
  animation: nfFadeUp 0.7s ease 0.45s forwards;
}

.nf-arrow { display: inline-block; }

@keyframes nfFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .nf-code, .nf-signal, .nf-desc, .nf-cta { animation: none; opacity: 1; }
  .nf-node { animation: none; opacity: 0.7; }
}
/* ==========================================================================
   MOBILE HAMBURGER MENU
   ========================================================================== */

/* دکمه همبرگری فقط تو موبایل دیده میشه (پیش‌فرض دسکتاپ مخفی) */
.menu-toggle { display: none; }

.menu-toggle svg {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  position: absolute;
}

.menu-toggle .icon-burger { opacity: 1; transform: rotate(0deg); }
.menu-toggle .icon-close { opacity: 0; transform: rotate(-90deg); position: absolute; }

.menu-toggle.active .icon-burger { opacity: 0; transform: rotate(90deg); }
.menu-toggle.active .icon-close { opacity: 1; transform: rotate(0deg); }

.menu-toggle:active { transform: scale(0.9); }

@media (max-width: 768px) {
  .menu-toggle { display: flex; }

  .navbar-links {
    position: fixed;
    inset-inline: 0;
    top: 68px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: rgba(var(--bg-card-rgb), 0.92);
    backdrop-filter: blur(0px) saturate(150%);
    -webkit-backdrop-filter: blur(0px) saturate(150%);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
    clip-path: inset(0 0 100% 0 round 0 0 16px 16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: clip-path 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease,
                backdrop-filter 0.4s ease,
                visibility 0.45s;
  }

  .navbar-links.open {
    clip-path: inset(0 0 0% 0 round 0 0 16px 16px);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .navbar-links a {
    position: relative;
    padding: 14px 16px 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(10px);
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  /* خط اکسنت کوچیک کنار لینک، فقط موقع hover/active نمایان میشه */
  .navbar-links a::before {
    content: "";
    position: absolute;
    inset-inline-start: 8px;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 16px;
    border-radius: 3px;
    background: var(--accent-gradient);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .navbar-links a:hover,
  .navbar-links a.active {
    background-color: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
  }

  .navbar-links a:hover::before,
  .navbar-links a.active::before {
    transform: translateY(-50%) scaleY(1);
  }

  .navbar-links a:active {
    transform: scale(0.98);
  }

  /* خط جداکننده‌ی محو بین لینک‌ها (همرنگ تم، آخرین لینک ندارد) */
  .navbar-links a:not(:last-child) {
    background-image: linear-gradient(90deg, transparent, var(--border-strong), transparent);
    background-repeat: no-repeat;
    background-size: calc(100% - 40px) 1px;
    background-position: center bottom;
  }

  /* هر لینک با تاخیر کمی بیشتر از قبلی ظاهر میشه (Stagger) */
  .navbar-links.open a {
    animation: navItemIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .navbar-links.open a:nth-child(1) { animation-delay: 0.1s; }
  .navbar-links.open a:nth-child(2) { animation-delay: 0.16s; }
  .navbar-links.open a:nth-child(3) { animation-delay: 0.22s; }
  .navbar-links.open a:nth-child(4) { animation-delay: 0.28s; }
  .navbar-links.open a:nth-child(5) { animation-delay: 0.34s; }
  .navbar-links.open a:nth-child(6) { animation-delay: 0.4s; }

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

  .navbar-links:not(.open) a {
    opacity: 0;
    transform: translateY(10px);
    animation: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .navbar-links, .navbar-links a, .navbar-links a::before {
      transition: none; animation: none; opacity: 1; transform: none;
    }
  }

  .navbar-links a:hover,
  .navbar-links a.active {
    background-color: rgba(var(--accent-rgb), 0.1);
  }

  /* وقتی منو بازه، اسکرول پشت صفحه قفل بشه */
  body.menu-open { overflow: hidden; }
}

/* ==========================================================================
   ICON BADGE — آیکون کارت‌ها (صفحات About و Skills)
   ========================================================================== */
.ico-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 14px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  box-shadow: inset 0 1px 0 rgba(var(--accent-rgb), 0.12);
  transition: transform 0.35s var(--ease), background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}

.ico-badge svg {
  width: 22px;
  height: 22px;
  display: block;
}

.ico-badge.ico-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.ico-badge.ico-lg svg {
  width: 28px;
  height: 28px;
}

.path-card:hover .ico-badge,
.expertise-card:hover .ico-badge {
  transform: translateY(-2px) scale(1.05);
  background: rgba(var(--accent-rgb), 0.16);
  border-color: rgba(var(--accent-rgb), 0.4);
}

[data-theme="light"] .ico-badge {
  color: var(--accent-start);
  background: rgba(var(--accent-rgb), 0.12);
}

/* ==========================================================================
   ICONS — صفحات Home و Contact
   ========================================================================== */
/* آیکون داخل دکمه‌ها */
.btn-ico {
  display: inline-flex;
  align-items: center;
  flex: none;
}
.btn-ico svg {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 0.3s var(--ease);
}
.btn:hover .btn-ico[data-icon="arrow-right"] svg { transform: translateX(3px); }
[dir="rtl"] .btn:hover .btn-ico[data-icon="arrow-right"] svg { transform: scaleX(-1) translateX(3px); }

/* فلش‌ها در حالت راست‌به‌چپ برعکس میشن */
[dir="rtl"] [data-icon="arrow-right"] svg { transform: scaleX(-1); }

/* چیپ‌های مهارت با آیکون */
.skill-chip.has-ico {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip-ico {
  display: inline-flex;
  color: var(--accent);
}
.chip-ico svg {
  width: 17px;
  height: 17px;
  display: block;
}

/* آیکون بالای عنوان بخش CTA و هدر صفحه تماس */
.cta-inner > .ico-badge,
.contact-head .ico-badge {
  margin-bottom: 18px;
}

/* فلش ردیف‌های تماس */
.contact-arrow {
  display: inline-flex;
  align-items: center;
}
.contact-arrow svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ==========================================================================
   CARD CTA — دکمه ورود به جزئیات (کارت‌های Projects و Ideas و Home)
   ========================================================================== */
.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--accent-gradient);
  color: #031018;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow:
    0 8px 22px -8px rgba(var(--blue-rgb), 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), filter 0.3s var(--ease);
}
.card-cta .btn-ico svg { width: 18px; height: 18px; }

.pcard:hover .card-cta,
.idea-row:hover .card-cta {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 14px 30px -8px rgba(var(--blue-rgb), 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}
.pcard:hover .card-cta .btn-ico svg,
.idea-row:hover .card-cta .btn-ico svg { transform: translateX(4px); }
[dir="rtl"] .pcard:hover .card-cta .btn-ico svg,
[dir="rtl"] .idea-row:hover .card-cta .btn-ico svg { transform: scaleX(-1) translateX(4px); }

/* کارت پروژه: دکمه پایین کارت، با فاصله از تگ‌ها */
.card-cta-row { margin-top: auto; padding-top: 22px; }

/* کارت ایده: دکمه زیر توضیح */
.idea-cta { margin-top: 14px; padding: 8px 18px; font-size: 0.86rem; }

/* کارت پروژه‌های منتخب در Home: دکمه جزئیات */
.btn.btn-sm { padding: 9px 20px; font-size: 0.88rem; }
.project-links { align-items: center; flex-wrap: wrap; }
.project-links a.btn-primary { color: #031018; }
.project-links a.btn-primary:hover { opacity: 1; text-decoration: none; }

/* کارت‌های Home: دکمه جزئیات هم‌تراز پایین کارت */
.projects-grid > .project-card:not(.pcard) { display: flex; flex-direction: column; }
.projects-grid > .project-card:not(.pcard) .project-links { margin-top: auto; padding-top: 8px; }
