
/* ---------- Design tokens ---------- */
:root {
  --color-text: #1B1F24;
  --color-text-muted: #3D4652;
  --color-text-subtle: #5B6673;
  --color-accent: #1F4E79;
  --color-accent-dark: #163A5C;
  --color-border: #E3E6EA;
  --color-border-strong: #C9D2DC;
  --color-row: #F5F7F9;
  --color-photo-bg: #E9EEF4;
  --color-bg: #FFFFFF;

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

  --max-width: 1120px;
  --content-width: 880px;
  --radius: 6px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

main { flex: 1 0 auto; }

/* Home page: centre the profile vertically */
.home main { display: flex; align-items: center; }
.home .profile { width: 100%; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); text-decoration: underline; }
a:focus-visible, .nav-toggle:focus-visible + .nav-toggle-label {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 32px; }
.content   { max-width: var(--content-width); margin: 0 auto; padding: 56px 32px 72px; }

/* ---------- Header & navigation ---------- */
.site-header { border-bottom: 1px solid var(--color-border); }

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.site-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}
.site-name:hover { color: var(--color-text); text-decoration: none; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  font-weight: 500;
}
.site-nav a { color: var(--color-text-muted); padding-bottom: 4px; }
.site-nav a:hover { color: var(--color-accent); text-decoration: none; }
.site-nav a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
}

/* Mobile menu (CSS only: a hidden checkbox toggles the menu) */
.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nav-toggle-label { display: none; }

@media (max-width: 760px) {
  .nav-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    cursor: pointer;
  }
  .nav-toggle-label .hamburger,
  .nav-toggle-label .hamburger::before,
  .nav-toggle-label .hamburger::after {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    position: relative;
    content: "";
  }
  .nav-toggle-label .hamburger::before { position: absolute; top: -6px; }
  .nav-toggle-label .hamburger::after  { position: absolute; top: 6px; }

  .site-nav { display: none; width: 100%; }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav li a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
  }
  .site-nav a[aria-current="page"] { border-bottom: 1px solid var(--color-border); font-weight: 600; }
}

/* ---------- Home: profile ---------- */
.profile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 64px;
  padding-top: 72px;
  padding-bottom: 72px;
}

.profile-photo {
  flex: 0 0 300px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-photo-bg);
  border: 6px solid var(--color-bg);
  box-shadow: 0 0 0 1px #D5DCE4, 0 12px 32px rgba(27, 31, 36, 0.10);
}

.profile-text { flex: 1 1 420px; min-width: 0; }

.profile-text h1 { margin: 0 0 14px; font-size: 52px; font-weight: 700; line-height: 1.1; }
.profile-title { margin: 0 0 14px; font-size: 22px; font-weight: 500; color: var(--color-accent); }
.profile-affiliation { margin: 0; font-size: 17px; line-height: 1.5; color: var(--color-text-muted); }
.profile-intro { margin: 22px 0 0; max-width: 560px; color: var(--color-text-muted); font-style: italic;}

/* Social links */
.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
  transition: border-color 0.15s, background-color 0.15s;
}
.social-link:hover { border-color: var(--color-accent); background: var(--color-row); }
.social-link img { width: 22px; height: 22px; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  background: var(--color-accent);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
}
.button:hover { background: var(--color-accent-dark); color: #FFFFFF; text-decoration: none; }

@media (max-width: 760px) {
  .profile { flex-direction: column; text-align: center; gap: 24px; padding-top: 40px; padding-bottom: 48px; }
  .profile-photo { flex-basis: auto; width: 200px; height: 200px; }
  .profile-text { flex-basis: auto; }
  .profile-text h1 { font-size: 36px; }
  .profile-title { font-size: 18px; }
  .profile-intro { margin-left: auto; margin-right: auto; }
  .links { justify-content: center; }
}

/* ---------- Sub-pages ---------- */
.page-title { margin: 0 0 8px; font-size: 40px; font-weight: 700; }
.page-intro { margin: 0 0 40px; font-size: 15px; color: var(--color-text-subtle); }

.section { margin-bottom: 44px; }
.section-title {
  margin: 0 0 12px;
  padding-bottom: 8px;
  font-size: 24px;
  font-weight: 600;
  color: var(--color-accent);
  border-bottom: 1px solid var(--color-border);
}

/* Publications */
.publication { padding: 14px 0; border-bottom: 1px solid #F0F2F5; }
.publication-title   { margin: 0 0 4px; font-size: 17px; font-weight: 600; line-height: 1.4; }
.publication-authors { margin: 0 0 4px; font-size: 15px; color: var(--color-text-muted); }
.publication-venue   { margin: 0 0 10px; font-size: 15px; font-style: italic; color: var(--color-text-subtle); }
.publication-links { display: flex; flex-wrap: wrap; gap: 8px; }
.publication-links a {
  padding: 4px 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
}
.publication-links a:hover { border-color: var(--color-accent); text-decoration: none; }

/* Tables (theses & teaching) */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
  padding: 10px 12px;
  border-bottom: 2px solid var(--color-border);
}
.table td { padding: 12px; vertical-align: top; border-bottom: 1px solid var(--color-border); }
.table .col-year { width: 90px; white-space: nowrap; }

/* Teaching: the "content covered" row under each course */
.table .course-main td { border-bottom: none; padding-bottom: 4px; }
.table .course-main .course-name { font-weight: 600; }
.table .course-content td { padding-top: 0; color: var(--color-text-muted); }
.course-content ul { margin: 4px 0 0; padding-left: 20px; }
.course-content p  { margin: 4px 0 0; }
.content-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
}

/* Teaching table becomes stacked cards on phones */
@media (max-width: 640px) {
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tbody { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
  .table-stack .course-main td { padding: 2px 0; }
  .table-stack .course-main td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--color-text-subtle);
  }
  .table-stack .course-content td { padding: 8px 0 0; border-bottom: none; }
}

/* Academic roles */
.roles-list { margin: 0; padding-left: 22px; }
.roles-list li { margin-bottom: 10px; }

/* Legal pages */
.legal h2 { margin: 36px 0 8px; font-size: 22px; }
.legal p, .legal address { margin: 0 0 12px; font-style: normal; color: var(--color-text-muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--color-border); font-size: 13px; color: var(--color-text-subtle); }
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 20px;
}
.site-footer a { color: var(--color-text-subtle); }
.site-footer a:hover { color: var(--color-accent); }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }

@media (max-width: 760px) {
  .container { padding-left: 20px; padding-right: 20px; }
  .content { padding: 36px 20px 56px; }
  .page-title { font-size: 32px; }
  .site-footer .container { flex-direction: column; align-items: center; text-align: center; }
  .footer-links { justify-content: center; }
}
