/* ==========================================================================
   mohammadi.cv — shared editorial design system
   Typography: Source Serif 4 (display) · Inter (body) · JetBrains Mono (meta)
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --paper: #fafaf7;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #444444;
  --ink-3: #6e6e6e;
  --rule: #e3e1dc;
  --accent: #1e3a5f;
  --accent-hover: #2d5080;
  --paper-deep: #f2f1ec;
  --hero-ink: #16222f;
  --hero-ink-2: #1b2a3a;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --step--1: 0.875rem;
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.4rem + 1vw, 2.1rem);
  --step-3: clamp(2.2rem, 1.8rem + 2vw, 3.25rem);
  --step-4: clamp(2.6rem, 1.9rem + 3.5vw, 4.25rem);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;

  --container: 1080px;
  --measure: 72ch;
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

ul,
ol {
  padding-left: 1.25em;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* ---------- Layout shells ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.prose {
  max-width: var(--measure);
  overflow-wrap: anywhere;
}

.about-grid > *,
.split-2 > *,
.contact-grid > *,
.hero-grid > * {
  min-width: 0;
}

.section {
  padding: var(--space-7) 0;
  border-top: 1px solid var(--rule);
}

.section-alt {
  background: var(--surface);
}

.hero-ink + .section {
  border-top: 0;
}

@media (max-width: 720px) {
  .section {
    padding: var(--space-6) 0;
  }
}

.section:first-of-type {
  border-top: none;
}

/* ---------- Section kicker ---------- */
.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: var(--space-3);
}

.kicker .kicker-num {
  color: var(--accent);
  margin-right: 0.75em;
}

.section-head {
  margin-bottom: var(--space-5);
}

.section-head h2 {
  margin-bottom: var(--space-2);
}

.section-head h2::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  background: var(--accent);
  margin-top: var(--space-3);
}

.section-lede {
  color: var(--ink-2);
  max-width: var(--measure);
}

/* ---------- Site header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: var(--space-4);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.wordmark:hover {
  color: var(--accent);
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  row-gap: 4px;
  gap: var(--space-4);
  padding: 0;
  margin: 0;
}

.site-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-2);
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* mobile disclosure nav */
.nav-toggle {
  display: none;
}

@media (max-width: 720px) {
  .site-header .container {
    flex-wrap: wrap;
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }

  .nav-toggle {
    display: block;
    margin-left: auto;
  }

  .nav-toggle summary {
    list-style: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-2);
    padding: 0.5rem 0.25rem;
  }

  .nav-toggle summary::-webkit-details-marker {
    display: none;
  }

  .nav-toggle .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: var(--space-3) var(--space-4) var(--space-4);
  }

  .nav-toggle .site-nav ul {
    flex-direction: column;
    gap: var(--space-2);
  }

  .nav-toggle .site-nav a {
    display: block;
    padding: 0.6rem 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--rule);
  }

  .site-nav:not(.nav-toggle .site-nav) {
    display: none;
  }
}

/* ---------- Ink hero (homepage only) ---------- */
.hero-ink {
  background-color: var(--hero-ink);
  background-image:
    radial-gradient(52rem 30rem at 78% -12%, rgba(45, 80, 128, 0.38), transparent 62%),
    linear-gradient(180deg, var(--hero-ink-2) 0%, var(--hero-ink) 100%);
  padding: var(--space-7) 0 var(--space-6);
}

.hero-ink .hero-name {
  color: #fff;
}

.hero-ink .hero-role {
  color: rgba(255, 255, 255, 0.87);
}

.hero-ink .hero-intro {
  color: rgba(255, 255, 255, 0.78);
}

.hero-ink .hero-intro a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.38);
}

.hero-ink .hero-intro a:hover {
  text-decoration-color: #fff;
}

.hero-ink .social-row a {
  color: rgba(255, 255, 255, 0.82);
}

.hero-ink .social-row a:hover {
  color: #fff;
}

.hero-ink .hero-portrait {
  margin: 0;
}

.hero-ink .portrait-frame {
  display: block;
  position: relative;
  margin-right: 14px;
}

.hero-ink .portrait-frame::before {
  content: "";
  position: absolute;
  inset: 14px -14px -14px 14px;
  border: 1px solid rgba(114, 152, 197, 0.45);
  pointer-events: none;
}

.hero-ink .portrait-frame img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.hero-ink .hero-portrait figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: var(--space-5);
}

.hero-ink .hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-7);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-ink .hero-stats .stat-value {
  font-family: var(--serif);
  font-size: var(--step-2);
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
}

.hero-ink .hero-stats .stat-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-top: var(--space-1);
}

.hero-ink .hero-stats-caption {
  flex-basis: 100%;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

.hero-ink .hero-stats-caption a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 820px) {
  .hero-ink {
    padding: var(--space-6) 0 var(--space-5);
  }

  .hero-ink .hero-stats {
    gap: var(--space-4) var(--space-6);
    margin-top: var(--space-5);
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: var(--space-7) 0 var(--space-6);
}

@media (max-width: 720px) {
  .hero {
    padding: var(--space-6) 0 var(--space-5);
  }
}

.hero-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--space-7);
  align-items: center;
}

.hero-name {
  font-size: var(--step-4);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: var(--space-3);
}

.hero-role {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--step-1);
  color: var(--ink-2);
  margin-bottom: var(--space-4);
  line-height: 1.45;
}

.hero-intro {
  color: var(--ink-2);
  max-width: 52ch;
  margin-bottom: var(--space-5);
}

.hero-portrait img {
  width: 100%;
  border: 1px solid var(--rule);
}

.hero-portrait figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  margin-top: var(--space-2);
}

@media (max-width: 820px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .hero-portrait {
    max-width: 340px;
  }
}

/* ---------- Social row ---------- */
.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.social-row a {
  font-size: 0.9rem;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.social-row a:hover {
  color: var(--accent);
}

.social-row i {
  font-size: 1rem;
}

/* ---------- Two doors ---------- */
.doors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.door {
  display: block;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  background: var(--surface);
  padding: var(--space-5);
  color: var(--ink);
  transition: border-color 0.15s ease;
}

.door:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.door:hover .link-arrow::after {
  transform: translateX(4px);
}

.door .kicker {
  margin-bottom: var(--space-2);
}

.door h3 {
  margin-bottom: var(--space-2);
}

.door p {
  color: var(--ink-2);
  font-size: 0.95rem;
}

.door .link-arrow {
  margin-top: var(--space-3);
}

@media (max-width: 720px) {
  .doors {
    grid-template-columns: 1fr;
  }
}

/* ---------- Arrow link ---------- */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--accent);
}

.link-arrow::after {
  content: "→";
  transition: transform 0.15s ease;
}

.link-arrow:hover::after {
  transform: translateX(3px);
}

/* ---------- Publication card ---------- */
.pub-card {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--rule);
}

.pub-card:last-child {
  border-bottom: none;
}

.pub-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.pub-type {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1rem 0.5rem;
}

.cite-chip {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
}

.pub-title {
  font-size: var(--step-1);
  margin-bottom: var(--space-1);
}

.pub-title a {
  color: var(--ink);
}

.pub-title a:hover {
  color: var(--accent);
}

.pub-authors {
  font-size: 0.92rem;
  color: var(--ink-2);
  margin-bottom: 0.15rem;
}

.pub-authors strong {
  color: var(--ink);
}

.pub-venue {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--ink-3);
  margin-bottom: var(--space-2);
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.pub-links a {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---------- Timeline (experience / education / news) ---------- */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline > li {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-5);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--rule);
}

.timeline > li:last-child {
  border-bottom: none;
}

.timeline .tl-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-3);
  padding-top: 0.35rem;
  white-space: nowrap;
}

.timeline .tl-body h3 {
  font-size: 1.15rem;
  margin-bottom: 0.15rem;
}

.timeline .tl-org {
  font-size: 0.9rem;
  color: var(--ink-2);
  margin-bottom: var(--space-2);
}

.timeline .tl-body ul {
  color: var(--ink-2);
  font-size: 0.95rem;
  padding-left: 1.1em;
}

.timeline .tl-body li + li {
  margin-top: 0.3em;
}

@media (max-width: 640px) {
  .timeline > li {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .timeline .tl-date {
    padding-top: 0;
  }
}

/* ---------- Chips (skills) ---------- */
.chip-group {
  margin-bottom: var(--space-4);
}

.chip-group .kicker {
  margin-bottom: var(--space-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
}

.chip {
  font-size: 0.85rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.25rem 0.7rem;
  white-space: nowrap;
}

/* ---------- News list ---------- */
.news-list {
  list-style: none;
  padding: 0;
}

.news-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--rule);
}

.news-list li:last-child {
  border-bottom: none;
}

.news-list .news-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-3);
  padding-top: 0.25rem;
  white-space: nowrap;
}

.news-list .news-text {
  color: var(--ink-2);
  font-size: 0.97rem;
}

.news-list .news-text strong {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 640px) {
  .news-list li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.6rem 1.2rem;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn.btn-ghost {
  color: var(--accent);
  background: transparent;
}

.btn.btn-ghost:hover {
  color: #fff;
  background: var(--accent);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--paper-deep);
  border-top: 2px solid var(--ink);
  padding: var(--space-6) 0;
  margin-top: 0;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: center;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin: 0;
}

.site-footer a {
  color: var(--ink-2);
}

.site-footer a:hover {
  color: var(--accent);
}

/* ---------- Ghost year numerals ---------- */
.year-block {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-5);
}

.year-ghost {
  font-family: var(--serif);
  font-size: var(--step-3);
  font-weight: 700;
  color: var(--rule);
  line-height: 1;
  padding-top: var(--space-4);
}

@media (max-width: 720px) {
  .year-block {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .year-ghost {
    font-size: var(--step-2);
    padding-top: var(--space-3);
  }
}

/* ---------- Detail lists ---------- */
.fact-list {
  list-style: none;
  padding: 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.fact-list li {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--rule);
}

.fact-list li:last-child {
  border-bottom: none;
}

.fact-list .fact-key {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  min-width: 120px;
  padding-top: 0.2rem;
}

@media (max-width: 480px) {
  .fact-list .fact-key {
    min-width: 84px;
  }
}

/* ---------- About grid ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 820px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Two-column split ---------- */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

.split-2 .col-kicker {
  margin-bottom: var(--space-3);
}

@media (max-width: 820px) {
  .split-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Interest grid ---------- */
.interest-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.interest-card {
  border: 1px solid var(--rule);
  background: var(--surface);
  padding: var(--space-4);
}

.interest-card h3 {
  font-size: 1.05rem;
  margin-bottom: var(--space-2);
}

.interest-card p {
  font-size: 0.9rem;
  color: var(--ink-2);
  margin: 0;
}

@media (max-width: 900px) {
  .interest-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .interest-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- More links ---------- */
.more-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3) var(--space-6);
}

.more-grid .link-arrow {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--rule);
  justify-content: space-between;
  display: flex;
  font-size: 1rem;
}

@media (max-width: 820px) {
  .more-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ---------- Gallery grid (certificates / recommendations) ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.gallery-item {
  margin: 0;
}

.gallery-item a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: var(--space-2);
  transition: border-color 0.15s ease;
}

.gallery-item a:hover {
  border-color: var(--accent);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
}

.gallery-item figcaption {
  font-size: 0.8rem;
  color: var(--ink-2);
  margin-top: var(--space-2);
  line-height: 1.4;
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 620px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Organization strip ---------- */
.org-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.org-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  color: var(--ink-2);
  font-size: 0.78rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.org-item img {
  height: 52px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.75;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.org-item:hover {
  color: var(--ink);
}

.org-item:hover img {
  filter: none;
  opacity: 1;
}

@media (max-width: 900px) {
  .org-grid {
    grid-template-columns: repeat(3, 1fr);
    row-gap: var(--space-5);
  }
}

@media (max-width: 480px) {
  .org-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Contact grid ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-6);
  align-items: start;
}

.contact-photo {
  margin: 0;
}

.contact-photo .duotone {
  background: var(--accent);
  isolation: isolate;
  border: 1px solid var(--rule);
  overflow: hidden;
}

.contact-photo .duotone img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08) brightness(1.02);
  mix-blend-mode: luminosity;
}

.contact-photo figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  margin-top: var(--space-2);
}

@media (max-width: 720px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid .contact-photo {
    max-width: 360px;
  }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero-ink .container {
    animation: rise 0.5s ease-out both;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .site-footer,
  .nav-toggle {
    display: none;
  }

  body {
    background: #fff;
  }
}
