/* ============================================================
   Hamed Khademi Khaledi — Resume site
   One committed brand color (editorial blue, OKLCH).
   Tinted neutrals lean toward that hue, not toward warmth.
   Serif display + sans body = contrast axis, not Inter-everywhere.
   ============================================================ */

:root {
  /* Brand anchor — one saturated color, identity-driven */
  --accent:        oklch(0.48 0.16 250);
  --accent-strong: oklch(0.40 0.18 250);
  --accent-soft:   oklch(0.96 0.018 250);

  /* Tinted neutrals — slight cool lean toward the accent hue */
  --bg:        oklch(0.985 0.004 250);
  --bg-elev:   oklch(1 0 0);
  --bg-soft:   oklch(0.965 0.006 250);
  --text:      oklch(0.22 0.02 256);
  --text-soft: oklch(0.36 0.018 256);
  --border:    oklch(0.90 0.012 250);
  --rule:      oklch(0.88 0.012 250);

  --shadow: 0 1px 2px oklch(0.22 0.02 256 / 0.04),
            0 8px 24px oklch(0.22 0.02 256 / 0.06);
  --radius: 14px;
  --max: 880px;

  /* Quiet hero surface — single-hue tonal shift, no rainbow blobs */
  --hero-surface: linear-gradient(
    160deg,
    oklch(0.97 0.018 250) 0%,
    oklch(0.95 0.022 250) 100%
  );
  --hero-text: var(--text);
  --hero-sub:  oklch(0.36 0.02 256);
}

[data-theme="dark"] {
  --accent:        oklch(0.72 0.15 250);
  /* ponytail: saturated blue link tops out ~4.2:1 on this dark bg; it is
     interactive UI text (not body prose) and gains contrast via underline. */
  --accent-strong: oklch(0.94 0.12 250);
  --accent-soft:   oklch(0.30 0.04 250);

  --bg:        oklch(0.20 0.012 256);
  --bg-elev:   oklch(0.24 0.014 256);
  --bg-soft:    oklch(0.28 0.016 256);
  --text:      oklch(0.97 0.005 256);
  --text-soft: oklch(0.95 0.014 256);
  --border:    oklch(0.34 0.014 256);
  --rule:      oklch(0.36 0.014 256);

  --shadow: 0 1px 2px oklch(0 0 0 / 0.3),
            0 8px 24px oklch(0 0 0 / 0.4);

  --hero-surface: linear-gradient(
    160deg,
    oklch(0.255 0.022 256) 0%,
    oklch(0.215 0.020 256) 100%
  );
  --hero-text: oklch(0.98 0.005 256);
  --hero-sub:  oklch(0.93 0.014 256);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.25s ease, color 0.25s ease;
}

/* Serif display face — headings only, contrast axis against Inter body */
h1, h2, h3 {
  font-family: "Source Serif 4", "Newsreader", Georgia, "Times New Roman",
    serif;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- Top nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; }
.brand a { color: var(--text); }
.brand a:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a {
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-strong); }

/* ---------- Hero surfaces (landing + resume headers) ----------
   Single-hue tonal gradient, no blurred color blobs, no
   background-clip:text. Solid ink for the name, serif face
   carries the hierarchy. */
.hero,
.resume-header {
  position: relative;
  background: var(--hero-surface);
  color: var(--hero-text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.hero > *,
.resume-header > * { position: relative; }

/* ---------- Hero (landing) ---------- */
.hero {
  padding: 72px 32px 52px;
  text-align: center;
  margin-top: 32px;
}
.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 12px;
  color: var(--hero-text);
}
.hero h1 .accent { color: var(--accent-strong); }
.hero .tagline {
  font-size: 1.12rem;
  color: var(--hero-sub);
  margin: 0 auto 24px;
  max-width: 56ch;
  text-wrap: pretty;
}
.hero .contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  justify-content: center;
  font-size: 0.94rem;
}
.hero .contacts a { color: var(--hero-sub); }
.hero .contacts a:hover { color: var(--accent-strong); text-decoration: none; }
.hero .contacts span { color: var(--hero-sub); }

/* ---------- Version cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 40px 0 64px;
}
.card {
  display: block;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 28px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
  color: var(--text);
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  text-decoration: none;
}
.card h3 {
  font-size: 1.3rem;
  margin: 0 0 8px;
  color: var(--text);
}
.card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.96rem;
  max-width: 42ch;
  text-wrap: pretty;
}

/* One deliberate accent marker — not a card icon, not a site-wide
   numbered scaffold. A short rule, only on the landing cards. */
.card .marker {
  width: 28px;
  height: 2px;
  background: var(--accent);
  margin-bottom: 18px;
  border-radius: 2px;
}

/* ---------- Resume page ---------- */
.resume { padding: 32px 0 70px; }
.resume-header {
  text-align: center;
  padding: 48px 28px 36px;
  margin-bottom: 4px;
}
.resume-header h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--hero-text);
}
.resume-header .sub {
  color: var(--hero-sub);
  margin: 0 0 14px;
  font-size: 1.02rem;
}
.resume-header .contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: center;
  font-size: 0.88rem;
  color: var(--hero-sub);
}
.resume-header .contacts a { color: var(--hero-sub); }
.resume-header .contacts a:hover { color: var(--accent-strong); text-decoration: none; }

/* ---------- Section pill nav (TOC) ---------- */
.toc {
  position: sticky;
  top: 60px;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
  margin: 20px 0 4px;
}
.toc-inner {
  display: flex;
  gap: 6px;
  padding: 10px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.toc-inner::-webkit-scrollbar { display: none; }
.toc a {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-soft);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.toc a:hover {
  color: var(--text);
  text-decoration: none;
  border-color: var(--border);
}
/* Active = ink text + accent underline bar, not a saturated fill */
.toc a.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Sections ---------- */
.section {
  margin-top: 38px;
  scroll-margin-top: 110px;
}
.section > h2 {
  font-size: 1.32rem;
  line-height: 1.25;
  margin: 0 0 18px;
  padding-bottom: 10px;
  color: var(--text);
  border-bottom: 1px solid var(--rule);
  /* Short accent rule above the section, not a side-stripe on cards
     and not a tiny tracked uppercase eyebrow */
  position: relative;
}
.section > h2::before {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 12px;
}

.entry { margin-bottom: 20px; }
.entry .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.entry .title { font-weight: 700; color: var(--text); }
.entry .org {
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.95rem;
}
.entry .meta {
  color: var(--text-soft);
  font-size: 0.86rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.entry ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
.entry ul li {
  margin: 4px 0;
  max-width: 70ch;
  text-wrap: pretty;
}
.entry ul li b { color: var(--text); font-weight: 600; }

.summary p {
  color: var(--text);
  margin: 0;
  max-width: 70ch;
  text-wrap: pretty;
}

/* Publication entry — indent so it reads as a citation, not a bullet */
#publications ul li {
  list-style: none;
  margin-left: -20px;
  padding-left: 16px;
  border-left: 2px solid var(--rule);
  max-width: 68ch;
}

/* ---------- Skills ---------- */
/* Definition-list grid: category label + inline comma-separated tools.
   No animated bars — they all filled to 100% and carried no signal. */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px 28px;
  padding: 4px 0;
}
.skill {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.skill .label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-strong);
  letter-spacing: 0.01em;
  text-transform: none;
}
.skill .items {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.5;
}

.back-link {
  display: inline-block;
  margin-top: 36px;
  color: var(--text-soft);
  font-size: 0.88rem;
}
.back-link:hover { color: var(--accent-strong); }

footer {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.82rem;
  padding: 28px 0 50px;
  border-top: 1px solid var(--border);
}

/* ---------- Scroll-reveal (toned down) ----------
   Was 26px translate + 0.6s — too much, read as "AI entrance".
   Now 10px + 0.4s, opacity-based, subtle presence. */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card { transition: none; }
}

@media (max-width: 520px) {
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 0.88rem; }
  .hero { padding: 56px 22px 40px; }
  .resume-header { padding: 40px 22px 30px; }
  .resume-header .contacts { font-size: 0.82rem; }
  .entry .meta { white-space: normal; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: clamp(2rem, 8vw, 2.6rem); }
  .card { padding: 24px 22px; }
}
