/* ============================================================
   MOHSEN SADAGHJO — PERSONAL WEBSITE
   style.css  |  Production-ready, bilingual (LTR / RTL)
   ============================================================ */

/* ── 1. CUSTOM PROPERTIES ──────────────────────────────────── */
:root {
  /* Palette */
  --navy:      #1a2744;
  --navy-mid:  #243056;
  --navy-light:#2e3d6b;
  --gold:      #c9a84c;
  --gold-light:#d9bb70;
  --white:     #ffffff;
  --off-white: #f8f7f4;
  --gray-50:   #f4f4f6;
  --gray-100:  #e8e8ec;
  --gray-300:  #c5c5d0;
  --gray-500:  #7a7a90;
  --gray-700:  #3d3d50;
  --gray-900:  #1a1a2e;
  --text:      #2c2c3e;
  --text-muted:#6b6b80;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 12px 32px rgba(0,0,0,.12);

  /* Spacing & Layout */
  --container-max: 1200px;
  --section-py: 5rem;
  --header-h: 68px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Transitions */
  --ease: cubic-bezier(.25,.46,.45,.94);
  --dur: .25s;

  /* Typography */
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-fa:    'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
}

/* ── 2. RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--white);
  line-height: 1.7;
  overflow-x: hidden;
}

/* Persian / RTL override */
html[lang="fa"] body {
  font-family: var(--font-fa);
  direction: rtl;
  text-align: right;
}

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

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

ul { list-style: none; }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── 3. TYPOGRAPHY ─────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--navy);
  line-height: 1.25;
}
html[lang="fa"] h1,
html[lang="fa"] h2,
html[lang="fa"] h3,
html[lang="fa"] h4 {
  font-family: var(--font-fa);
  font-weight: 700;
}

p + p { margin-top: .75em; }

/* ── 4. UTILITIES ──────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: var(--section-py) 0;
}
.section-alt {
  background: var(--off-white);
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--navy);
}
.section-rule {
  width: 48px;
  height: 3px;
  background: var(--gold);
  margin: .75rem auto 0;
  border-radius: 2px;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  border: 2px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.btn-primary:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(201,168,76,.35);
}
.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,.6);
}
.btn-outline:hover {
  background: rgba(255,255,255,.12);
  border-color: var(--white);
  text-decoration: none;
}

/* Badges */
.pub-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .2rem .65rem;
  border-radius: 999px;
  margin-top: .5rem;
}
.badge-published { background: #dcfce7; color: #166534; }
.badge-review    { background: #fef9c3; color: #854d0e; }

/* Tags */
.tag-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.tag {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  color: var(--gray-700);
  font-size: .82rem;
  padding: .3rem .75rem;
  border-radius: 999px;
  transition: background var(--dur);
}
.tag:hover { background: var(--navy); color: var(--white); }

/* ── 5. HEADER ─────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  height: var(--header-h);
  background: rgba(26, 39, 68, .97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  transition: box-shadow var(--dur);
}
.site-header.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,.35); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1rem;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--gold);
  color: var(--navy);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.logo-name {
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .01em;
}
html[lang="fa"] .logo-name { font-family: var(--font-fa); font-size: .98rem; }

/* Nav */
.main-nav .nav-list {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.main-nav .nav-list a {
  color: rgba(255,255,255,.8);
  font-size: .875rem;
  font-weight: 500;
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  transition: color var(--dur), background var(--dur);
  white-space: nowrap;
}
.main-nav .nav-list a:hover {
  color: var(--gold);
  background: rgba(255,255,255,.06);
  text-decoration: none;
}

/* Header actions */
.header-actions { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }

/* Language toggle */
.lang-toggle {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--white);
  padding: .35rem .9rem;
  border-radius: 999px;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
  white-space: nowrap;
}
.lang-toggle:hover { background: rgba(255,255,255,.18); }
.lang-toggle .lang-fa { display: none; }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  border-radius: var(--radius-sm);
}
.nav-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--white);
  border-radius: 1px;
  transition: transform var(--dur), opacity var(--dur);
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: var(--navy);
  z-index: 950;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s var(--ease), visibility .3s;
}
.mobile-nav-overlay.open {
  opacity: 1;
  visibility: visible;
}
.mobile-nav-list { text-align: center; }
.mobile-nav-list li + li { margin-top: .5rem; }
.mobile-nav-list a {
  color: var(--white);
  font-size: 1.3rem;
  font-weight: 600;
  padding: .5rem 1.5rem;
  display: block;
  border-radius: var(--radius-sm);
  transition: color var(--dur);
}
.mobile-nav-list a:hover { color: var(--gold); text-decoration: none; }
.mobile-nav-close {
  position: absolute;
  top: 1.2rem; right: 1.5rem;
  background: none; border: none;
  color: var(--white);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: .25rem;
}
html[lang="fa"] .mobile-nav-close { right: auto; left: 1.5rem; }

/* ── 6. HERO ───────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, var(--navy-light) 100%);
  display: flex;
  align-items: center;
  padding-top: calc(var(--header-h) + 3rem);
  padding-bottom: 4rem;
  overflow: hidden;
}

/* Subtle geometric background */
.hero-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(201,168,76,.07) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(201,168,76,.05) 0%, transparent 50%),
    linear-gradient(45deg, transparent 45%, rgba(255,255,255,.015) 50%, transparent 55%);
  pointer-events: none;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4rem;
  align-items: center;
}

.hero-label {
  color: var(--gold);
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .75rem;
}
html[lang="fa"] .hero-label {
  letter-spacing: 0;
  text-transform: none;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  color: var(--white);
  line-height: 1.1;
  margin-bottom: 1.25rem;
  font-weight: 700;
}
html[lang="fa"] .hero-name { font-family: var(--font-fa); }

.hero-bio {
  color: rgba(255,255,255,.75);
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 560px;
  margin-bottom: 2rem;
}

.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Avatar */
.hero-avatar { flex-shrink: 0; }
.avatar-placeholder {
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  border: 3px solid rgba(201,168,76,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 8px rgba(201,168,76,.1);
}
.avatar-initials {
  font-family: var(--font-serif);
  font-size: 4rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

/* Scroll hint */
.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.4);
  animation: bounce 2s infinite;
  display: flex;
  align-items: center;
}
.hero-scroll-hint:hover { color: var(--gold); text-decoration: none; }
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(6px); }
}

/* ── 7. ABOUT ──────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 3rem;
  align-items: start;
}

.about-text {
  font-size: 1.05rem;
  color: var(--text);
  white-space: pre-line;
}

.info-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .5rem 1.2rem;
  font-size: .93rem;
}
.info-list dt {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  padding-top: .1rem;
}
.info-list dd { color: var(--text); }
.info-list a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); }

/* ── 8. EDUCATION / TIMELINE ───────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2rem;
}
html[lang="fa"] .timeline { padding-left: 0; padding-right: 2rem; }

.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--gold), var(--gray-100));
  border-radius: 1px;
}
html[lang="fa"] .timeline::before { left: auto; right: 0; }

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -2.4rem;
  top: 1.5rem;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--gold);
}
html[lang="fa"] .timeline-marker { left: auto; right: -2.4rem; }

.tl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .75rem;
}
.tl-degree {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
}
html[lang="fa"] .tl-degree { font-family: var(--font-fa); }
.tl-institution { color: var(--text-muted); font-size: .9rem; margin-top: .2rem; }
.tl-date {
  font-size: .83rem;
  color: var(--white);
  background: var(--navy);
  padding: .3rem .75rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tl-body { font-size: .95rem; color: var(--text); }
.tl-rank {
  margin-top: .6rem;
  font-weight: 600;
  color: var(--navy);
}

/* ── 9. EXPERIENCE ─────────────────────────────────────────── */
.exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.exp-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.exp-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.exp-title {
  font-size: 1.05rem;
  margin-bottom: .25rem;
}
.exp-org { color: var(--text-muted); font-size: .88rem; }
.exp-duration {
  font-size: .82rem;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: .5rem;
}
.exp-detail { margin-top: .5rem; font-size: .9rem; color: var(--text); }
.compact-list {
  list-style: disc;
  padding-left: 1.3rem;
  margin-top: .3rem;
  color: var(--text);
}
html[lang="fa"] .compact-list { padding-left: 0; padding-right: 1.3rem; }
.compact-list li + li { margin-top: .15rem; }

/* ── 10. RESEARCH GRID ─────────────────────────────────────── */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.cluster-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--gold);
  margin-bottom: .25rem;
}
html[lang="fa"] .cluster-title { font-family: var(--font-fa); }

/* ── 11. PUBLICATIONS ──────────────────────────────────────── */
/* Filter buttons */
.pub-filter {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 2rem;
}
.pub-filter-btn {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  color: var(--gray-700);
  padding: .45rem 1.1rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.pub-filter-btn:hover { background: var(--gray-100); }
.pub-filter-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* Publication items */
.pub-list { display: flex; flex-direction: column; gap: 1rem; }
.pub-item {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  transition: opacity .2s;
}
.pub-item.hidden { display: none; }

.pub-number {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: var(--gold);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: 0;
  margin-top: .1rem;
}

.pub-content { flex: 1; }
.pub-title { font-size: 1rem; font-weight: 600; color: var(--navy); margin-bottom: .35rem; line-height: 1.45; }
.pub-title a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); }
.pub-title a:hover { color: var(--gold); text-decoration: none; }
.pub-authors { font-size: .88rem; color: var(--text-muted); margin-bottom: .2rem; }
.pub-authors strong { color: var(--text); }
.pub-venue { font-size: .88rem; color: var(--gray-500); margin-bottom: .2rem; }
.pub-doi { font-size: .82rem; color: var(--text-muted); }
.pub-doi a { color: var(--navy); text-decoration: underline; }
.lang-note { font-style: italic; font-size: .8rem; }

/* ── 12. ACHIEVEMENTS ──────────────────────────────────────── */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.ach-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.ach-icon { font-size: 1.75rem; flex-shrink: 0; margin-top: .1rem; }
.ach-text h3 { font-size: .97rem; margin-bottom: .3rem; }
html[lang="fa"] .ach-text h3 { font-family: var(--font-fa); }
.ach-text p { font-size: .88rem; color: var(--text-muted); }

/* ── 13. CONTACT ───────────────────────────────────────────── */
.contact-container { max-width: 900px; }
.contact-intro {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.75rem 1rem;
  gap: .5rem;
  cursor: pointer;
  transition: box-shadow var(--dur), transform var(--dur), border-color var(--dur);
}
.contact-card:hover { border-color: var(--gold); text-decoration: none; }
.contact-icon { font-size: 2rem; }
.contact-label { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
html[lang="fa"] .contact-label { letter-spacing: 0; text-transform: none; }
.contact-value { font-size: .9rem; color: var(--navy); font-weight: 500; word-break: break-all; }
.contact-placeholder { color: var(--gray-300); font-style: italic; font-size: .83rem; }
.placeholder-card { border-style: dashed; opacity: .7; }

/* ── 14. FOOTER ────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.7);
  padding: 2.5rem 0;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.footer-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--white);
  font-weight: 600;
}
html[lang="fa"] .footer-name { font-family: var(--font-fa); }
.footer-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-nav a { color: rgba(255,255,255,.65); font-size: .875rem; transition: color var(--dur); }
.footer-nav a:hover { color: var(--gold); text-decoration: none; }
.footer-copy { font-size: .8rem; color: rgba(255,255,255,.45); }

/* ── 15. SCROLL-TO-TOP ─────────────────────────────────────── */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 42px; height: 42px;
  background: var(--navy);
  color: var(--gold);
  border: 2px solid var(--gold);
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur), visibility var(--dur), transform var(--dur);
  z-index: 800;
}
html[lang="fa"] .scroll-top { right: auto; left: 2rem; }
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { transform: translateY(-3px); }

/* ── 16. RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .nav-hamburger { display: flex; }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  html[lang="fa"] .hero-content { text-align: center; }
  .hero-avatar { justify-self: center; }
  .hero-bio { margin: 0 auto 2rem; }
  .hero-cta { justify-content: center; }

  .about-grid { grid-template-columns: 1fr; }
  .tl-header { flex-direction: column; gap: .5rem; }
}

@media (max-width: 640px) {
  :root { --section-py: 3.5rem; }

  .logo-name { display: none; }
  .avatar-placeholder { width: 140px; height: 140px; }
  .avatar-initials { font-size: 2.8rem; }

  .timeline { padding-left: 1.25rem; }
  html[lang="fa"] .timeline { padding-left: 0; padding-right: 1.25rem; }
  .timeline-marker { left: -1.65rem; }
  html[lang="fa"] .timeline-marker { left: auto; right: -1.65rem; }

  .pub-item { flex-direction: column; gap: .75rem; }
  .pub-number { width: auto; height: auto; padding: .2rem .6rem; }

  .scroll-top { bottom: 1.25rem; right: 1.25rem; }
  html[lang="fa"] .scroll-top { right: auto; left: 1.25rem; }
}

/* ── 17. PRINT ─────────────────────────────────────────────── */
@media print {
  .site-header, .hero-scroll-hint, .scroll-top,
  .pub-filter, .mobile-nav-overlay, .nav-hamburger { display: none !important; }
  .hero { min-height: auto; padding: 1rem 0; }
  .section { page-break-inside: avoid; }
  a[href]::after { content: " (" attr(href) ")"; font-size: .75em; color: #666; }
}
