/* Houssam-Eddine Zahaf — personal academic site */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5d6570;
  --border: #e4e6e9;
  --accent: #1f5f8b;
  --accent-soft: #e8f1f7;
  --journal: #1f5f8b;
  --conf: #2f7d4f;
  --wksp: #8a5a14;
  --other: #6b5b95;
  --radius: 10px;
  --maxw: 960px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1b1f23;
    --text: #e6e8ea;
    --muted: #9aa3ad;
    --border: #2c3238;
    --accent: #6cb4e4;
    --accent-soft: #1d2d3a;
    --journal: #6cb4e4;
    --conf: #6fcf97;
    --wksp: #e0b56a;
    --other: #b8a6e6;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

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

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

/* ---------- Header / navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }

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

.site-nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 500;
}
.site-nav a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

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

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 20px 64px;
}

h1, h2, h3, h4 { line-height: 1.3; font-weight: 600; }
h1 { font-size: 2rem; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 {
  font-size: 1.3rem;
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
h3 { font-size: 1.08rem; margin: 28px 0 8px; }
h4 { font-size: 1rem; margin: 20px 0 6px; }

.lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 24px; }

section:first-of-type h2:first-child { margin-top: 0; }

/* ---------- Home hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: start;
}

.hero .photo {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 50%;
  transform: scaleX(-1);
  border: 4px solid var(--surface);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
}

.hero .role { color: var(--muted); margin: 0 0 18px; }
.hero .role strong { color: var(--text); font-weight: 600; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.links a {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- Cards & grids ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card h3 { margin-top: 0; }
.card p { margin: 0.4em 0; }
.card p:last-child { margin-bottom: 0; }

.tech { color: var(--muted); font-size: 0.9rem; }
.tech strong { color: var(--text); font-weight: 600; }

/* ---------- Lists ---------- */

ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean > li { padding: 10px 0; border-bottom: 1px solid var(--border); }
ul.clean > li:last-child { border-bottom: 0; }

.meta { color: var(--muted); font-size: 0.9rem; }

.people li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Contact ---------- */

.contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  font-size: 0.95rem;
}
.contact address { font-style: normal; }

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

.pub-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 8px;
}

.chip {
  font: inherit;
  font-size: 0.88rem;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) {
  .chip[aria-pressed="true"] { color: #0e1215; }
}

.pub-search {
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  min-width: 0;
  flex: 1 1 200px;
  max-width: 320px;
}

.pub-year {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 36px 0 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.pub {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: 0; }

.badge {
  display: inline-block;
  align-self: start;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 0;
  border-radius: 6px;
  border: 1px solid currentColor;
  margin-top: 3px;
}
.badge.journal { color: var(--journal); }
.badge.conference { color: var(--conf); }
.badge.workshop { color: var(--wksp); }
.badge.thesis,
.badge.chapter { color: var(--other); }

.pub-title { font-weight: 600; display: block; }
.pub-authors { display: block; color: var(--muted); font-size: 0.93rem; }
.pub-authors .me { color: var(--text); font-weight: 600; }
.pub-venue { display: block; font-size: 0.93rem; font-style: italic; }
.pub-links { display: flex; gap: 10px; margin-top: 4px; font-size: 0.85rem; flex-wrap: wrap; }
.pub-links a { font-weight: 500; }

.pub-summary { color: var(--muted); font-size: 0.92rem; margin: 0 0 8px; }

/* ---------- Teaching (collapsible) ---------- */

details.course {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 10px;
}
details.course > summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
details.course > summary::-webkit-details-marker { display: none; }
details.course > summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details.course[open] > summary::after { content: "−"; }
details.course .body { padding: 0 18px 14px; }
details.course h4 { margin: 10px 0 4px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
details.course ul { margin: 0; padding-left: 20px; }
details.course li { margin: 2px 0; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody th { white-space: nowrap; }

.figure { margin: 20px 0; text-align: center; }
.figure img { border-radius: var(--radius); background: #fff; padding: 8px; border: 1px solid var(--border); }

.notice {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 10px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  main { padding: 28px 16px 48px; }
  .site-header .inner { padding: 10px 16px; }
  .site-nav ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .site-nav { width: 100%; }
  .hero { grid-template-columns: 1fr; gap: 20px; text-align: center; }
  .hero .photo { margin: 0 auto; width: 160px; height: 160px; }
  .links { justify-content: center; }
  h1 { font-size: 1.6rem; }
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .badge { justify-self: start; padding: 2px 8px; }
}
