/* mohammadjranjbar.github.io — hand-rolled, no framework.
   Palette: firuzeh (Persian tile turquoise) + saffron highlight. */

:root {
  --bg: #fbfaf6;
  --text: #23211c;
  --muted: #6e675a;
  --accent: #0c7080;
  --accent2: #c08a2d;
  --underline: rgba(12, 112, 128, 0.32);
  --rule: #e8e4da;
  --wash: #f3f0e8;
  --accent-wash: rgba(12, 112, 128, 0.10);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13171a;
    --text: #dcd8ce;
    --muted: #9a958a;
    --accent: #4fc3d1;
    --accent2: #d9a94e;
    --underline: rgba(79, 195, 209, 0.4);
    --rule: #2b3036;
    --wash: #1b2024;
    --accent-wash: rgba(79, 195, 209, 0.13);
  }
}
:root[data-theme="light"] {
  --bg: #fbfaf6;
  --text: #23211c;
  --muted: #6e675a;
  --accent: #0c7080;
  --accent2: #c08a2d;
  --underline: rgba(12, 112, 128, 0.32);
  --rule: #e8e4da;
  --wash: #f3f0e8;
  --accent-wash: rgba(12, 112, 128, 0.10);
}
:root[data-theme="dark"] {
  --bg: #13171a;
  --text: #dcd8ce;
  --muted: #9a958a;
  --accent: #4fc3d1;
  --accent2: #d9a94e;
  --underline: rgba(79, 195, 209, 0.4);
  --rule: #2b3036;
  --wash: #1b2024;
  --accent-wash: rgba(79, 195, 209, 0.13);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-underline-offset: 2px;
}
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 1px; }

/* ---------- nav ---------- */
nav { border-bottom: 1px solid var(--rule); }
.nav-inner {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.nav-name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
}
.nav-name svg { color: var(--accent); flex-shrink: 0; }
.nav-links { display: flex; gap: 1.35rem; align-items: baseline; }
.nav-links a {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 0.15rem;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--text); border-bottom: 2px solid var(--accent); }
.theme-toggle {
  font: inherit;
  font-size: 0.85rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 0.15rem;
  line-height: 1;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.6rem 1.25rem 2rem;
}

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}
h1 {
  margin: 0;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.name-fa {
  margin-top: 0.35rem;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  color: var(--accent);
  font-size: 1.2rem;
}
.contact { margin-top: 0.8rem; font-size: 0.85rem; color: var(--muted); }
.portrait {
  width: 116px; height: 116px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 0.4rem;
}

/* ---------- the voice: signature waveform ---------- */
.voice {
  margin: 1.1rem 0 1.4rem;
  padding: 1rem 1.1rem;
  background: var(--wash);
  border-radius: 4px;
}
.wave-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.wave-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
#wave { display: block; width: 100%; height: 56px; }
.voice-caption {
  margin: 0.6rem 0 0;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.voice-caption .fa-line { font-family: Charter, "Bitstream Charter", Georgia, serif; }
.voice-caption .state { color: var(--accent2); font-size: 0.82rem; white-space: nowrap; }
.voice-en { margin: 0.2rem 0 0; font-size: 0.82rem; color: var(--muted); font-style: italic; }

/* ---------- "currently" ---------- */
.now {
  margin-top: 1.9rem;
  padding: 1.05rem 1.2rem;
  background: var(--wash);
  border-radius: 4px;
}
.now-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.now p {
  margin: 0.35rem 0 0;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.5;
}

.intro { margin-top: 1.5rem; }
.intro p { margin: 0 0 0.9rem; font-size: 0.97rem; }

/* ---------- sections: bilingual headings ---------- */
section { margin-top: 2.6rem; }
h2 {
  margin: 0 0 1rem;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
h2 .fa {
  font-size: 1.02rem;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.85;
}
.h2-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}
.h2-row h2 { margin: 0; flex: 1; }
.see-all { font-size: 0.85rem; white-space: nowrap; }

.page-title {
  margin: 0 0 0.2rem;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.page-title .fa { font-size: 1.15rem; font-weight: 400; color: var(--muted); }
.page-sub { margin: 0.3rem 0 2rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- experience / education rows ---------- */
.job { padding: 0.85rem 0; border-bottom: 1px solid var(--rule); }
.job:first-of-type { border-top: 1px solid var(--rule); }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.job-org { font-weight: 600; font-size: 0.97rem; }
.job-role { font-weight: 400; color: var(--muted); }
.job-dates {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.job-desc { margin: 0.3rem 0 0; font-size: 0.88rem; color: var(--muted); }

/* ---------- publications ---------- */
.pub { margin-bottom: 1.15rem; }
.pub:last-child { margin-bottom: 0; }
.pub-title {
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-size: 1.02rem;
  color: var(--text);
  font-weight: 500;
  text-decoration-color: var(--rule);
}
.pub-title:hover { color: var(--accent); text-decoration-color: var(--accent); }
.pub-authors { margin-top: 0.12rem; font-size: 0.82rem; color: var(--muted); }
.pub-authors .me { color: var(--text); font-weight: 500; }
.pub-meta { margin-top: 0.12rem; font-size: 0.82rem; color: var(--muted); }
.pub-meta .venue { font-style: italic; }
.pubyear-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 1.6rem 0 0.8rem;
  font-variant-numeric: tabular-nums;
}
.pubyear-label:first-of-type { margin-top: 0; }

/* ---------- projects ---------- */
.proj { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.proj:first-of-type { border-top: 1px solid var(--rule); }
.proj-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.proj-title {
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text);
  text-decoration-color: var(--rule);
}
a.proj-title:hover { color: var(--accent); text-decoration-color: var(--accent); }
span.proj-title { text-decoration: none; }
.proj-year { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.proj-desc { margin: 0.25rem 0 0; font-size: 0.88rem; color: var(--muted); }
.earlier { margin-top: 2.2rem; }
.earlier h2 { font-size: 1.05rem; }
.earlier ul { margin: 0; padding-left: 1.1rem; }
.earlier li { margin-bottom: 0.45rem; font-size: 0.9rem; }
.earlier li .note { color: var(--muted); }

/* ---------- project detail ---------- */
.proj-detail-meta { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 1.4rem; }
.proj-body p { margin: 0 0 0.9rem; font-size: 0.97rem; }
.proj-body video, .proj-body img {
  display: block;
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--rule);
  margin: 1.4rem 0;
}
.proj-body figure { margin: 1.4rem 0; }
.proj-body figure video, .proj-body figure img { margin: 0; }
.proj-body figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 0.4rem; }
.proj-links { margin-top: 1.2rem; font-size: 0.9rem; }
.backlink { font-size: 0.85rem; }

/* ---------- voice cloning demo ---------- */
.demo-lede { margin: 0 0 0.4rem; font-size: 0.97rem; }
.sample { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.sample:first-of-type { border-top: 1px solid var(--rule); }
.sample-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.sample-fa {
  margin: 0.35rem 0 0;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-size: 1.12rem;
  line-height: 1.7;
  text-align: right;
}
.sample-en { margin: 0.1rem 0 0; font-size: 0.82rem; color: var(--muted); font-style: italic; }
.sample-controls { margin-top: 0.65rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.play-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.84rem;
  color: var(--accent);
  background: none;
  border: 1px solid var(--underline);
  border-radius: 4px;
  padding: 0.38rem 0.75rem;
  cursor: pointer;
}
.play-btn:hover { border-color: var(--accent); }
.play-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.play-btn .fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: var(--accent-wash);
  pointer-events: none;
}
.play-btn .icon { font-size: 0.7rem; width: 0.8em; }
.demo-links { margin-top: 0.9rem; font-size: 0.88rem; }
.demo-note { margin-top: 1.1rem; font-size: 0.92rem; color: var(--muted); }

/* ---------- footer ---------- */
footer {
  margin-top: 3.2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  h1 { font-size: 1.7rem; }
  .portrait { width: 84px; height: 84px; }
  .job-head, .proj-head { flex-direction: column; gap: 0.05rem; }
  .nav-links { gap: 1rem; }
  h2 .fa { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  a { transition: color 0.15s ease, text-decoration-color 0.15s ease; }
}
