/* ------------------------------------------------------------------
   ferjad.github.io — clean academic layout
   ------------------------------------------------------------------ */

:root {
  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --text: #1b1f24;
  --text-muted: #5b6470;
  --text-faint: #8a939e;
  --rule: #e6e8eb;
  --accent: #0b57d0;
  --accent-hover: #063f9e;
  --badge-bg: #eef2f7;
  --badge-text: #3b4550;
  --note: #8a5a00;
  --note-bg: #fff6e0;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --max: 800px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --bg-subtle: #161a20;
    --text: #e6e9ee;
    --text-muted: #a3adb8;
    --text-faint: #6f7a86;
    --rule: #262c34;
    --accent: #7cacf8;
    --accent-hover: #a8c7fa;
    --badge-bg: #1f2630;
    --badge-text: #c3ccd6;
    --note: #f0c36a;
    --note-bg: #2a2410;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 2px;
}
a:hover,
a:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.25rem;
}

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

strong { font-weight: 600; }

.muted { color: var(--text-muted); font-size: 0.9375rem; }

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  z-index: 10;
}
.skip:focus { left: 0.5rem; }

/* Header / nav ----------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.nav a { color: var(--text-muted); }
.nav a:hover { color: var(--text); text-decoration: none; }

/* Layout ----------------------------------------------------------- */

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

section { margin-bottom: 3.5rem; }
section:last-child { margin-bottom: 0; }

/* Hero ------------------------------------------------------------- */

.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
}
.portrait {
  flex: 0 0 auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--rule);
}
.hero-text h1 {
  font-size: 2.25rem;
  margin-bottom: 0.25rem;
}
.role {
  color: var(--text-muted);
  font-size: 1.0625rem;
  margin-bottom: 0.875rem;
}
.contact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  font-size: 0.9375rem;
  font-weight: 500;
}
.contact li + li::before {
  content: "·";
  color: var(--text-faint);
  padding: 0 0.6rem;
}

.bio p { font-size: 1.0625rem; }
.bio { max-width: 68ch; }

/* Experience timeline ---------------------------------------------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline > li {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1.5rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}
.timeline > li:last-child { border-bottom: 0; }
.when {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
  white-space: nowrap;
}
.what .title {
  font-weight: 600;
  font-size: 1.0625rem;
}
.what .where {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 0.4rem;
}
.what p { margin: 0.25rem 0 0; }
.what p + p { margin-top: 0.5rem; }
.bullets {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}
.bullets li { margin-bottom: 0.45rem; }
.bullets li:last-child { margin-bottom: 0; }
.span-years {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  margin-right: 0.35rem;
}
.earlier .what p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Publications ----------------------------------------------------- */

#publications .muted { margin-bottom: 1.5rem; }

.year-group { margin-bottom: 1.75rem; }
.year-group:last-child { margin-bottom: 0; }
.year {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pub {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.pub:last-child { border-bottom: 0; }
.pub-title {
  font-weight: 600;
  line-height: 1.4;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }
.pub-authors {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-top: 0.15rem;
}
.pub-authors strong { color: var(--text); }
.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.8125rem;
}
.venue {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-weight: 500;
}
.note {
  display: inline-block;
  background: var(--note-bg);
  color: var(--note);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-weight: 500;
}
.links { display: inline-flex; gap: 0.75rem; margin-left: 0.25rem; }
.links a { font-weight: 500; }

/* Footer ----------------------------------------------------------- */

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--text-faint);
  font-size: 0.8125rem;
}

/* Responsive ------------------------------------------------------- */

@media (max-width: 640px) {
  .container { padding-top: 2rem; }
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .portrait { width: 128px; height: 128px; }
  .hero-text h1 { font-size: 1.85rem; }
  .timeline > li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

@media print {
  .site-header, .skip { display: none; }
  body { font-size: 11pt; }
  a { color: inherit; }
}
