:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #1f2328;
  --muted: #5b636e;
  --line: #e3e6ea;
  --nav: #1b2a4a;
  --nav-text: #e8ecf4;
  --accent: #2e3192; /* LUMS blue */
  --accent-soft: #eceefb;
  --max: 820px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1a1e26;
    --text: #e6e8eb;
    --muted: #9aa3ae;
    --line: #2a303b;
    --nav: #0c1220;
    --nav-text: #e8ecf4;
    --accent: #8f93ff;
    --accent-soft: #23264a;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

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

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav);
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand {
  color: var(--nav-text);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}
.brand:hover { text-decoration: none; opacity: 0.9; }
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 4px;
}
.nav ul a {
  display: block;
  color: var(--nav-text);
  opacity: 0.75;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
}
.nav ul a:hover { opacity: 1; text-decoration: none; background: rgba(255,255,255,0.08); }
.nav ul a[aria-current="page"] { opacity: 1; background: rgba(255,255,255,0.12); }

/* ---------- Layout ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 16px 72px;
}

h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: 2.3rem;
  line-height: 1.2;
  margin: 0 0 6px;
}
h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: 1.45rem;
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
h3 { font-size: 1.05rem; margin: 0; font-weight: 600; }

.subtitle { color: var(--muted); font-size: 1.1rem; margin: 0 0 24px; }
.lead p { margin: 0 0 14px; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 36px;
  align-items: start;
}
.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  margin-top: 8px;
}
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .portrait { width: 160px; margin-top: 0; }
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.95rem;
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- Education card ---------- */
.edu {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.crest {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  background: #fff; /* crest is drawn for a white ground */
  display: grid;
  place-items: center;
  padding: 8px;
}
.crest img { width: 100%; height: auto; display: block; }
.edu p { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Entries ---------- */
.entry { margin: 0 0 28px; }
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  flex-wrap: wrap;
}
.when { color: var(--muted); font-size: 0.92rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.role { color: var(--muted); margin: 0 0 6px; font-size: 0.97rem; }
.entry ul { margin: 6px 0 0; padding-left: 20px; }
.entry li { margin: 4px 0; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.tags li {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.92rem;
}

.plain { padding-left: 20px; margin: 0; }
.plain li { margin: 6px 0; }
.plain .when { margin-left: 6px; }

/* ---------- CV embed ---------- */
.pdf {
  width: 100%;
  height: 80vh;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 24px 16px;
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  main { padding-top: 32px; }
  h1 { font-size: 1.9rem; }
  .nav-inner { justify-content: center; padding-top: 8px; padding-bottom: 8px; }
  .when { white-space: normal; }
}
