/* =========================================
   تنظیمات پایه، متغیرهای رنگ و تایپوگرافی
   ========================================= */
:root {
  --bg-page: #fcfcfb;
  --bg-surface: #ffffff;
  --bg-alt: #f5f5f3;
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --border-color: #e4e4e7;
  --accent: #0f3d5e;
  --accent-hover: #1a5682;
  --accent-soft: #eef4f8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius-sm: 6px;
  --radius-md: 12px;
  --container-width: 1080px;
}

[data-theme="dark"] {
  --bg-page: #111113;
  --bg-surface: #18181b;
  --bg-alt: #1f1f23;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-color: #27272a;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: rgba(96, 165, 250, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* =========================================
   هدر و منوی ناوبری
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: color-mix(in srgb, var(--bg-page) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  flex-shrink: 0;
}

.brand-name {
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.main-nav a {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.main-nav a:hover {
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.42rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
}

.icon-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.kbd {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
}

[data-theme="light"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }

.mobile-menu-btn {
  display: none;
  font-size: 1.1rem;
}

/* =========================================
   نوار زنده آخرین توییت‌ها زیر هدر (X Ticker)
   ========================================= */
.x-ticker-bar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 0;
  font-size: 0.86rem;
}

.x-ticker-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.x-ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.x-ticker-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  overflow: hidden;
}

.x-ticker-text {
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.25s ease, color 0.2s ease;
}

.x-ticker-text:hover {
  color: var(--accent);
}

.x-ticker-date {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.x-ticker-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.ticker-nav-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.ticker-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================================
   بخش معرفی اصلی (Hero)
   ========================================= */
.hero-section {
  padding: 3.25rem 0 4rem;
  border-bottom: 1px solid var(--border-color);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 3.5rem;
  align-items: center;
}

.hero-kicker {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.65rem;
}

.hero-title {
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.06rem;
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 2rem;
}

.roles-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2.25rem;
}

.role-item {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.8rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.role-badge {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.role-info {
  display: flex;
  flex-direction: column;
}

.role-info strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.role-info span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}

[data-theme="dark"] .btn-primary {
  color: #09090b;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-outline {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--text-primary);
}

.portrait-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  box-shadow: var(--shadow-md);
}

.portrait-card img {
  width: 100%;
  aspect-ratio: 4 / 4.6;
  object-fit: cover;
  object-position: top center;
  border-radius: 8px;
  display: block;
  background-color: #f3f4f6;
}

.portrait-card figcaption {
  margin-top: 0.9rem;
  padding: 0 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.portrait-card figcaption strong {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.portrait-card figcaption span {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* =========================================
   بخش‌ها و تیترها
   ========================================= */
.section {
  padding: 4.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.section-alt {
  background-color: var(--bg-alt);
}

.philosophy-box {
  max-width: 820px;
}

.section-index {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

.philosophy-quote {
  font-size: 1.32rem;
  font-weight: 500;
  line-height: 1.95;
  color: var(--text-primary);
  border-right: 3px solid var(--accent);
  padding-right: 1.4rem;
  margin-bottom: 1.4rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2.25rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.text-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.text-link:hover {
  color: var(--accent-hover);
}

/* =========================================
   رسانه‌ها، مصاحبه‌ها و نشست‌ها
   ========================================= */
.media-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

[data-theme="dark"] .filter-btn.active {
  color: #09090b;
}

.media-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.65rem;
}

.media-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.media-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.media-cover-banner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 155px;
  padding: 1.15rem 1.35rem;
  color: #ffffff;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.banner-nsr {
  background: linear-gradient(135deg, #0f3d5e 0%, #1e3a8a 100%);
}

.banner-zoomit {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 60%, #1e1b4b 100%);
}

.banner-video {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.banner-irc {
  background: linear-gradient(135deg, #064e3b 0%, #0f3d5e 100%);
}

.banner-easybimeh {
  background: linear-gradient(135deg, #1d4ed8 0%, #0f3d5e 100%);
}

.media-cover-banner::after {
  content: "";
  position: absolute;
  left: -25px;
  bottom: -25px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.banner-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  z-index: 1;
}

.banner-publisher {
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.banner-play-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: #dc2626;
  color: #ffffff;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
}

.banner-headline {
  font-size: 0.94rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  z-index: 1;
  line-height: 1.5;
}

.media-body {
  padding: 1.45rem 1.55rem 1.55rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.media-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.media-source {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

.media-badge {
  font-size: 0.74rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-weight: 600;
}

.video-badge {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

[data-theme="dark"] .video-badge {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.text-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.media-body h3 {
  font-size: 1.06rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  line-height: 1.55;
}

.media-body h3 a:hover {
  color: var(--accent);
}

.media-body p {
  font-size: 0.89rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.75;
}

.media-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.15rem;
}

.media-tags span {
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid var(--border-color);
  padding: 0.12rem 0.55rem;
  border-radius: 4px;
}

.media-footer {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* =========================================
   تألیفات، حوزه‌ها، اسلایدها و رزومه
   ========================================= */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
}

.article-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.55;
  margin-bottom: 0.65rem;
}

.article-excerpt {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.domains-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.domain-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.domain-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.domain-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.slides-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.slide-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.slide-cover {
  background: linear-gradient(135deg, var(--accent) 0%, #1e293b 100%);
  color: #ffffff;
  padding: 1.5rem;
  min-height: 110px;
  display: flex;
  align-items: flex-end;
  font-size: 0.85rem;
  font-weight: 600;
}

.slide-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.slide-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.slide-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.slide-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.badge-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-alt);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.resume-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.5rem;
  align-items: start;
}

.highlights-list {
  margin-top: 1.25rem;
  padding-right: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.highlights-list strong {
  color: var(--text-primary);
}

.contact-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}

.contact-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.contact-note {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.95rem;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.contact-row:hover {
  background: var(--accent-soft);
}

.contact-label {
  color: var(--text-secondary);
}

.contact-val {
  font-weight: 600;
  color: var(--accent);
}

.site-footer {
  padding: 3rem 0;
  background: var(--bg-surface);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
}

.footer-brand {
  display: flex;
  flex-direction: column;
}

.footer-brand strong {
  font-size: 1rem;
}

.footer-brand span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-social {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.footer-bottom {
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.search-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.search-modal.active {
  display: flex;
}

.search-modal-content {
  width: 92%;
  max-width: 580px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
}

.search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.search-input-wrap button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.search-results {
  padding: 1rem;
  max-height: 320px;
  overflow-y: auto;
}

.search-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.search-result-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

.search-result-item p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

@media (max-width: 980px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 68px;
    right: 0;
    left: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 1rem 1.5rem;
    align-items: flex-start;
  }

  .main-nav.open {
    display: flex;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .hero-grid,
  .resume-grid {
    grid-template-columns: 1fr;
  }

  .hero-media {
    max-width: 360px;
  }

  .domains-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .kbd {
    display: none;
  }

  .x-ticker-date,
  .x-ticker-badge span {
    display: none;
  }

  .hero-title {
    font-size: 1.85rem;
  }

  .domains-grid,
  .slides-grid,
  .media-list {
    grid-template-columns: 1fr;
  }
}