@font-face {
  font-family: 'Doran';
  src: url('./fonts/Doran-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Doran';
  src: url('./fonts/Doran-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: 'HK Grotesk';
  src: url('./fonts/HKGrotesk-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-body: #f8fafc;
  --text-primary: #0f172a;
  --text-muted: #475569;
  --border-light: #e2e8f0;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --hero-bg-start: #ffffff;
  --hero-bg-end: #edf6ff;
  --badge-bg: #e0f2fe;
  --badge-text: #0369a1;
  --btn-bg: #0f172a;
  --btn-text: #ffffff;
  --btn-hover-text: #0f172a;
  --skill-bg: #eef2ff;
  --skill-hover-bg: #2563eb;
  --skill-hover-text: #ffffff;
  --contact-bg: #f1f5f9;
  --footer-border: #e2e8f0;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --hover-shadow: 0 20px 30px -12px rgba(15, 23, 42, 0.15);
}

body.dark {
  --bg-body: #0f172a;
  --text-primary: #e2e8f0;
  --text-muted: #cbd5e1;
  --border-light: #334155;
  --card-bg: #1e293b;
  --card-border: #334155;
  --hero-bg-start: #0f172a;
  --hero-bg-end: #162033;
  --badge-bg: #1e3a5f;
  --badge-text: #7ab7ef;
  --btn-bg: #38bdf8;
  --btn-text: #0f172a;
  --btn-hover-text: #38bdf8;
  --skill-bg: #334155;
  --skill-hover-bg: #38bdf8;
  --skill-hover-text: #0f172a;
  --contact-bg: #1e293b;
  --footer-border: #334155;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --hover-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.42);
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  scroll-behavior: smooth;
  transition: background 0.3s ease, color 0.3s ease;
}

html[lang='fa'] body {
  font-family: 'Doran', Tahoma, Arial, sans-serif;
}

a {
  color: inherit;
}

@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(28px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 80px 0;
  border-bottom: 1px solid var(--border-light);
}

section:last-child {
  border-bottom: none;
}

h1 {
  max-width: 980px;
  font-size: clamp(2.5rem, 6vw, 3.7rem);
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, #0f4c81, #287271, #6d5dfc);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 7s ease infinite;
  letter-spacing: 0;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  position: relative;
  display: inline-block;
  color: var(--text-primary);
}

h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
}

html[dir='rtl'] h2::after {
  left: auto;
  right: 0;
}

.hero {
  min-height: 88vh;
  display: flex;
  align-items: center;
  background: linear-gradient(120deg, var(--hero-bg-start), var(--hero-bg-end));
}

.hero-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
}

.hero-text {
  flex: 1 1 520px;
}

.hero-text p {
  max-width: 780px;
  font-size: 1.22rem;
  color: var(--text-primary);
  margin: 1rem 0 1.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--badge-bg);
  color: var(--badge-text);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.profile-img {
  flex-shrink: 0;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 20px 35px -10px rgba(15, 23, 42, 0.24);
  border: 4px solid #ffffff;
  transition: transform 0.4s ease, box-shadow 0.3s ease;
}

.profile-img:hover {
  transform: scale(1.02);
  box-shadow: 0 25px 40px -12px rgba(15, 23, 42, 0.3);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.25s ease;
  border: 1px solid var(--btn-bg);
}

.btn:hover {
  background: transparent;
  color: var(--btn-hover-text);
  transform: translateY(-3px);
}

.grid-2,
.skills-grid,
.publications-grid,
.projects-grid,
.topic-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.card,
.topic-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
  border: 1px solid var(--card-border);
}

.card:hover,
.topic-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--hover-shadow);
  border-color: #cbd5e1;
}

.topic-card {
  display: block;
  text-decoration: none;
}

.topic-card strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.45rem;
}

.topic-card span {
  color: var(--text-muted);
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--skill-bg);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: 0.2s ease;
  color: var(--text-primary);
}

.skill-tag:hover,
.topic-pill:hover {
  background: var(--skill-hover-bg);
  color: var(--skill-hover-text);
  transform: scale(1.02);
}

.pub-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.pub-authors {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.pub-journal {
  font-size: 0.84rem;
  font-style: italic;
  color: var(--accent);
}

.pub-link {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  text-decoration: none;
  font-weight: 700;
  color: var(--accent-strong);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
}

.contact-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s ease;
}

.contact-links a:hover {
  color: var(--accent);
  transform: translateX(3px);
}

html[dir='rtl'] .contact-links a:hover {
  transform: translateX(-3px);
}

.location {
  margin-top: 30px;
  padding: 16px;
  background: var(--contact-bg);
  border-radius: 8px;
}

footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-primary);
  opacity: 0.72;
  border-top: 1px solid var(--footer-border);
}

.top-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 10px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

html[dir='rtl'] .top-bar {
  right: auto;
  left: 20px;
}

.theme-toggle,
.lang-toggle {
  min-width: 42px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  padding: 0 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: 0.2s ease;
}

.theme-toggle:hover,
.lang-toggle:hover {
  background: var(--accent);
  transform: scale(1.04);
}

.article-hero {
  min-height: 58vh;
  padding: 120px 0 72px;
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.88), rgba(237, 246, 255, 0.95)),
    radial-gradient(circle at 12% 18%, rgba(37, 99, 235, 0.15), transparent 30%);
}

body.dark .article-hero {
  background:
    linear-gradient(120deg, rgba(15, 23, 42, 0.94), rgba(22, 32, 51, 0.96)),
    radial-gradient(circle at 12% 18%, rgba(56, 189, 248, 0.16), transparent 30%);
}

.article-lead {
  max-width: 920px;
  margin-top: 1rem;
  font-size: 1.18rem;
  color: var(--text-muted);
}

.back-link {
  display: inline-flex;
  margin-bottom: 22px;
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
}

.article-shell {
  padding-top: 56px;
  padding-bottom: 80px;
}

.article-content {
  max-width: 980px;
}

.article-section {
  margin-bottom: 44px;
}

.article-section h2 {
  font-size: 1.55rem;
  margin-bottom: 1.25rem;
}

.article-section p {
  color: var(--text-primary);
  font-size: 1.04rem;
  margin-bottom: 1rem;
}

.article-section p:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .hero {
    min-height: 84vh;
  }

  .hero-content {
    flex-direction: column-reverse;
    text-align: center;
  }

  .hero-text p {
    font-size: 1.08rem;
  }

  section {
    padding: 50px 0;
  }

  .profile-img {
    width: 200px;
    height: 200px;
  }

  h2 {
    text-align: center;
    display: block;
  }

  h2::after,
  html[dir='rtl'] h2::after {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .top-bar,
  html[dir='rtl'] .top-bar {
    top: 12px;
    right: 12px;
    left: auto;
  }

  .article-hero {
    min-height: 50vh;
    padding: 100px 0 54px;
  }
}
