/* ============================================================
   Zulfiqar Ahmad Khan — academic website
   Light/dark themes via CSS variables. Oxford blue accent.
   ============================================================ */
:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --text: #1c2430;
  --muted: #5b6573;
  --faint: #8a93a0;
  --border: #e3e7ec;
  --accent: #002147;          /* Oxford blue */
  --accent-soft: #e7edf5;
  --link: #1a4a85;
  --me: #0b1220;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --serif: "Source Serif 4", Charter, "Bitstream Charter", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #131a23; --surface-2: #1a2330; --text: #e4e8ee; --muted: #a3adba;
    --faint: #7b8593; --border: #26303d; --accent: #9cc3f5; --accent-soft: #1b2a40; --link: #9cc3f5; --me: #ffffff;
        --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #131a23; --surface-2: #1a2330; --text: #e4e8ee; --muted: #a3adba;
  --faint: #7b8593; --border: #26303d; --accent: #9cc3f5; --accent-soft: #1b2a40; --link: #9cc3f5; --me: #ffffff;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 var(--serif);
  transition: background .2s ease, color .2s ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--sans); color: var(--accent); line-height: 1.25; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { font: 600 17px var(--sans); color: var(--accent); white-space: nowrap; margin-right: auto; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a {
  font: 500 15px var(--sans); color: var(--muted); padding: 7px 12px; border-radius: 8px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ---------- Layout ---------- */
main { padding: 36px 0 64px; }
section { margin: 0 0 40px; }
.section-title {
  font: 700 14px var(--sans); letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1.5px solid var(--accent);
}
.page-title { font-size: 30px; margin: 0 0 6px; }
.page-sub { color: var(--muted); margin: 0 0 28px; font-size: 16px; }

/* ---------- Hero (About) ---------- */
.hero { display: grid; grid-template-columns: 170px 1fr; gap: 32px; align-items: center; margin-bottom: 36px; }
.avatar {
  width: 170px; height: 170px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border), var(--shadow);
  background: var(--accent-soft); display: grid; place-items: center;
  font: 700 54px var(--sans); color: var(--accent);
}
.hero h1 { font-size: 36px; margin: 0 0 6px; }
.hero .role { margin: 0; font-size: 18px; }
.hero .org { margin: 2px 0 14px; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 500 14px var(--sans);
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.links svg { width: 16px; height: 16px; flex: none; }

.bio p { margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { font: 500 13.5px var(--sans); padding: 4px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* ---------- Metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.metric {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 10px 12px; text-align: center; box-shadow: var(--shadow);
}
.metric .v { font: 700 26px var(--sans); color: var(--accent); font-variant-numeric: tabular-nums; }
.metric .l { font: 500 12.5px var(--sans); color: var(--muted); margin-top: 2px; }


/* ---------- Timeline entries ---------- */
.entries { display: grid; gap: 14px; }
.entry { display: grid; grid-template-columns: 170px 1fr; gap: 16px; }
.entry .date { font: 500 14px var(--sans); color: var(--muted); padding-top: 2px; }
.entry .title { font-weight: 600; }
.entry .org { color: var(--muted); }
.entry .detail { font-size: 15px; color: var(--muted); font-style: italic; }
.entry ul { margin: 6px 0 0; padding-left: 18px; font-size: 15.5px; }
.entry li { margin: 2px 0; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; }
.kv dt { font: 500 14px var(--sans); color: var(--muted); padding-top: 2px; }
.kv dd { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  background: var(--accent); color: var(--bg); font: 600 15px var(--sans); border: 0; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.cv-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cv-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 30px; }

/* ---------- Publications ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  font: 500 14px var(--sans); padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.tab .c { color: var(--faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.tab[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.tab[aria-pressed="true"] .c { color: inherit; opacity: .75; }
.search, .sort {
  font: 14px var(--sans); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.search { flex: 1; min-width: 180px; }
.year { font: 700 15px var(--sans); color: var(--accent); margin: 26px 0 10px; }
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pub {
  display: grid; grid-template-columns: 48px 1fr; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.pub .num { font: 600 13px var(--sans); color: var(--faint); padding-top: 3px; }
.pub .t { font-weight: 600; line-height: 1.4; }
.pub .t a { color: var(--text); }
.pub .t a:hover { color: var(--link); }
.pub .a { font-size: 15px; color: var(--muted); margin-top: 3px; }
.pub .a b { color: var(--me); font-weight: 700; }
.pub .v { font-size: 15px; font-style: italic; margin-top: 1px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.badge {
  font: 600 12px var(--sans); padding: 3px 9px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.status { background: transparent; border: 1px solid var(--border); white-space: normal; }
.pub > div { min-width: 0; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; font-family: var(--sans); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding: 22px 0 34px; font: 13.5px var(--sans); color: var(--faint); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; gap: 8px; }
  .brand { width: 100%; margin: 0; }
  .nav { order: 2; }
  .theme-toggle { margin-left: auto; order: 3; }
  .hero { grid-template-columns: 1fr; text-align: center; gap: 18px; }
  .avatar { margin: 0 auto; width: 130px; height: 130px; font-size: 42px; }
  .links { justify-content: center; }
  .chips { justify-content: center; }
  .hero h1 { font-size: 28px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .entry, .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .search, .sort { flex: 1 1 100%; }
  .pub { grid-template-columns: 1fr; }
  .pub .num { padding: 0; }
}
@media print {
  .topbar, footer, .theme-toggle, .toolbar { display: none; }
}
