/* ==========================================================================
   Fonts
   Crimson Pro is loaded from Google Fonts in the layout.
   Inter is self-hosted: drop InterVariable.woff2 into assets/fonts/ (see the
   README there). Until then the system UI font is used.
   ========================================================================== */
@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Design tokens
   One definition per token. light-dark() picks the value from the used
   colour scheme, which follows the system unless the toggle sets data-theme.
   ========================================================================== */
:root {
  color-scheme: light dark;

  /* Fonts */
  --font-serif: "Crimson Pro", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

  /* Type scale */
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --h3: clamp(1.15rem, 1.05rem + 0.5vw, 1.35rem);
  --h2: clamp(1.55rem, 1.35rem + 1vw, 1.95rem);
  --h1: clamp(2.5rem, 2rem + 2.6vw, 3.75rem);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --radius: 12px;
  --radius-sm: 8px;

  /* Layout */
  --nav-h: 3.5rem;
  --sidebar-w: max(20vw, 14rem);
  --main-pad: 5vw;
  --main-pad: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 52rem;

  /* Colour */
  --bg: light-dark(#fcfbf9, #0d0d0c);
  --surface: light-dark(#ffffff, #161615);
  --surface-2: light-dark(#f5f4f1, #1e1e1c);
  --text: light-dark(#111111, #f2f1ed);
  --text-secondary: light-dark(#44443f, #b8b6ae);
  --text-muted: light-dark(#66655e, #9b998f);
  --border: light-dark(rgba(17, 17, 17, 0.10), rgba(255, 255, 255, 0.10));
  --border-strong: light-dark(rgba(17, 17, 17, 0.18), rgba(255, 255, 255, 0.18));

  --accent: light-dark(#1d4ed8, #5b8def);
  --accent-hover: light-dark(#1739a6, #7ba3f2);
  --accent-bg: light-dark(rgba(29, 78, 216, 0.07), rgba(91, 141, 239, 0.12));
  --on-accent: light-dark(#ffffff, #0d0d0c);

  /* Placeholders the author still has to fill in */
  --todo-bg: light-dark(#fff4d6, rgba(245, 184, 48, 0.14));
  --todo-border: light-dark(#d9a21b, #b8892a);
  --todo-text: light-dark(#6b4a00, #f0cf84);
}

/* The toggle only has to pin the scheme; every token above follows it. */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
html {
  background: var(--bg);
  scroll-padding-top: calc(var(--nav-h) + 1.25rem);
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  padding-top: var(--nav-h);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: var(--accent-bg);
  color: var(--text);
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.2;
  color: var(--text);
}

h1 {
  font-size: var(--h1);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

h2 {
  font-size: var(--h2);
}

h3 {
  font-size: var(--h3);
}

h4,
h5,
h6 {
  font-size: var(--text-lg);
}

p {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

strong {
  color: var(--text);
  font-weight: 600;
}

/* Small sentence-case label */
.kicker {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 var(--space-1);
}

/* Links: faint underline that firms up on hover */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease, text-underline-offset 0.2s ease, color 0.15s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
  text-underline-offset: 4px;
}

/* Quiet document links: "Transcript ↗" */
.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.doc-link,
.ext {
  color: var(--text-muted);
  text-decoration-color: color-mix(in srgb, var(--text-muted) 40%, transparent);
}

.doc-link:hover,
.doc-link:focus-visible {
  color: var(--accent);
}

.doc-link::after,
.ext::after {
  content: "\2197" / "";
  display: inline-block;
  margin-left: 0.2em;
  font-size: 0.85em;
  text-decoration: none;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  z-index: 2000;
}

.skip-link:focus {
  left: var(--space-3);
  top: var(--space-3);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Keyboard focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

main:focus {
  outline: none;
}

hr {
  border-color: var(--border);
  opacity: 1;
}

/* ==========================================================================
   Navbar (fixed, translucent)
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
}

.site-navbar {
  --bs-navbar-padding-y: 0;
  padding: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .site-navbar {
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
  }
}

.site-navbar>.container-fluid {
  padding-left: 0;
  padding-right: var(--main-pad);
}

.navbar-brand {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-right: var(--space-3);
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--text);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-navbar .nav-link {
  position: relative;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.6rem 0.25rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-navbar .nav-link::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  bottom: 0.3rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus-visible {
  color: var(--text);
}

.site-navbar .nav-link:hover::after,
.site-navbar .nav-link:focus-visible::after {
  transform: scaleX(1);
}

.site-navbar .nav-link[aria-current="page"] {
  color: var(--accent);
}

.site-navbar .nav-link[aria-current="page"]::after {
  transform: scaleX(1);
  height: 2px;
  background: var(--accent);
}

.nav-arrow {
  margin-left: 0.2em;
  font-size: 0.85em;
}

/* Theme toggle: shows the icon of the theme you will switch TO */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.theme-toggle:hover {
  background: var(--surface-2);
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun {
    display: inline;
  }

  :root:not([data-theme]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* Hamburger -> close */
.navbar-toggler {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  background-image: none;
  position: relative;
  width: 1.1rem;
  height: 1.1rem;
  display: inline-block;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--text);
  transition: transform 0.2s ease, top 0.2s ease, bottom 0.2s ease;
}

.navbar-toggler-icon::before {
  top: 32%;
}

.navbar-toggler-icon::after {
  bottom: 32%;
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before {
  top: calc(50% - 1px);
  transform: rotate(45deg);
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::after {
  bottom: calc(50% - 1px);
  transform: rotate(-45deg);
}

/* Mobile menu panel */
@media (max-width: 991.98px) {
  .site-navbar .navbar-collapse {
    padding: var(--space-2) 0 var(--space-3);
  }

  .site-navbar .navbar-nav {
    gap: 0;
  }

  .site-navbar .nav-link {
    padding: 0.65rem 0.25rem;
  }

  .site-navbar .nav-link::after {
    left: 0;
    right: auto;
    width: 1.5rem;
    bottom: 0.45rem;
  }
}

/* ==========================================================================
   Page shell: fixed sidebar (~20%) + main content on desktop
   ========================================================================== */
.site-shell {
  display: block;
}

/* Compact profile block (mobile / tablet): flows with the page */
.sidebar {
  border-bottom: 1px solid var(--border);
  padding: var(--space-6) var(--space-4);
}

.sidebar-inner {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  max-width: none;
}

.avatar {
  width: 100%;
  overflow: hidden;
  background: var(--surface-2);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-id p {
  margin: 0;
  line-height: 1.4;
}

.sidebar-name {
  display: none;
}

.sidebar-role {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text) !important;
}

.sidebar-affil {
  font-size: var(--text-sm);
  color: var(--text-muted) !important;
}

.sidebar-links {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
}

.sidebar-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  min-height: 2rem;
  max-width: 100%;
}

.sidebar-links a span {
  overflow-wrap: anywhere;
}

.sidebar-links a svg {
  flex: none;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.sidebar-links a:hover,
.sidebar-links a:focus-visible {
  color: var(--accent);
}

.sidebar-links a:hover svg,
.sidebar-links a:focus-visible svg {
  color: var(--accent);
}

.sidebar-links a span {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size 0.25s ease;
}

.sidebar-links a:hover span,
.sidebar-links a:focus-visible span {
  background-size: 100% 1px;
}

.main {
  padding: clamp(1.75rem, 4vw, 3rem) var(--main-pad) var(--space-6);
  min-width: 0;
}

.page {
  max-width: none;
}

.site-footer {
  padding: var(--space-5) var(--main-pad) var(--space-6);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.site-footer p {
  color: var(--text-muted);
  max-width: none;
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
}

/* Desktop: fixed sidebar below the navbar */
@media (min-width: 992px) {
  .site-navbar>.container-fluid {
    padding-left: 0;
    padding-right: var(--space-5);
  }

  /* Align nav links with the left edge of the main column */
  .site-navbar .navbar-collapse {
    padding-left: calc(var(--sidebar-w) + var(--main-pad));
    flex-grow: 1;
  }

  .site-navbar .navbar-nav {
    gap: var(--space-5);
  }

  .sidebar {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    padding: var(--space-6) var(--space-5);
    border-bottom: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .sidebar-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-5);
    max-width: none;
  }

  .avatar {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .sidebar-name {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.65rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text) !important;
    margin-bottom: var(--space-2) !important;
  }

  .sidebar-role {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
  }

  .sidebar-links {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    width: 100%;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
  }

  .sidebar-links a {
    min-height: 2.1rem;
  }

  .site-content {
    margin-left: var(--sidebar-w);
  }
}

@media (max-width: 992px) {
  .avatar {
    width: 50%;
    height: auto;
    aspect-ratio: 1;
  }

  .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
}

/* ==========================================================================
   Sections
   ========================================================================== */
.page-header {
  margin-bottom: var(--space-6);
}

.page-header .lead-in {
  margin: var(--space-3) 0 0;
  font-size: var(--text-lg);
  max-width: 70vw;
}

.section {
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.section>h2 {
  margin: 0 0 var(--space-5);
}

.section>h2+.section-note {
  margin-top: calc(-1 * var(--space-3));
}

.section-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.subsection-title {
  margin: var(--space-6) 0 var(--space-4);
  font-size: var(--h3);
}

.subsection-title.first {
  margin-top: 0;
}

/* In-page jump links */
.jump-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.jump-links a {
  color: var(--text-secondary);
  text-decoration-color: color-mix(in srgb, var(--text-secondary) 30%, transparent);
}

.jump-links a:hover,
.jump-links a:focus-visible {
  color: var(--accent);
}

/* ==========================================================================
   Home
   ========================================================================== */
.hero h1 {
  margin: 0 0 var(--space-2);
}

.hero-role {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  color: var(--text-secondary);
  margin: 0 0 var(--space-5);
}

.hero-bio {
  font-size: 1.0625rem;
  max-width: 50vw;
  margin-bottom: var(--space-4);
}

.hero .tag-row {
  margin: var(--space-5) 0 var(--space-5);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}

.hero-contact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

/* Currently */
.currently {
  margin: 0;
  display: grid;
  gap: var(--space-3);
}

.currently-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: var(--space-4);
  align-items: baseline;
}

.currently dt {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.currently dd {
  margin: 0;
  color: var(--text-secondary);
}

.currently dd strong {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
}

/* Highlights */
.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: var(--space-5) var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.highlight {
  border-top: 2px solid var(--border-strong);
  padding-top: var(--space-3);
  display: flex;
  flex-direction: column;
}

.highlight h3 {
  font-size: var(--text-lg);
  margin: 0 0 var(--space-2);
  line-height: 1.25;
}

.highlight p {
  font-size: var(--text-sm);
  margin: 0 0 var(--space-2);
}

.highlight .more {
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: var(--text-sm);
}

/* Skills */
.skills {
  margin: 0;
  display: grid;
  gap: var(--space-4);
}

.skills-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
}

.skills dt {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.skills dd {
  margin: 0;
}

/* ==========================================================================
   Tags / pills (kept from the original design)
   ========================================================================== */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-row .tag {
  margin: 0;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--text-secondary);
  margin: 0 var(--space-2) var(--space-2) 0;
  line-height: 1.5;
}

.tag em {
  font-family: var(--font-sans);
  font-style: normal;
  color: var(--text-muted);
  margin-left: 0.35em;
}

.tag-accent {
  color: var(--accent);
  background: var(--accent-bg);
}

.status-pill {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-secondary);
  line-height: 1.5;
}

.status-pill.is-published {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.1rem;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-accent {
  --bs-btn-color: var(--on-accent);
  --bs-btn-hover-color: var(--on-accent);
  --bs-btn-active-color: var(--on-accent);
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid transparent;
}

.btn-accent:hover,
.btn-accent:focus-visible {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn .btn-icon {
  margin-right: 0.45rem;
  vertical-align: -2px;
}

/* ==========================================================================
   Disclosure (<details>)
   ========================================================================== */
details.disclosure {
  margin-top: var(--space-3);
}

details.disclosure>summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent);
  user-select: none;
}

details.disclosure>summary::-webkit-details-marker {
  display: none;
}

details.disclosure>summary::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

details.disclosure[open]>summary::before {
  transform: rotate(45deg);
}

details.disclosure>summary:hover {
  color: var(--accent-hover);
}

.disclosure-body {
  margin-top: var(--space-3);
}

.disclosure-body> :last-child {
  margin-bottom: 0;
}

.disclosure-body ul {
  padding-left: 1.15rem;
  color: var(--text-secondary);
}

.disclosure-body li+li {
  margin-top: var(--space-2);
}

/* ==========================================================================
   Entries (research activities, certifications, items)
   ========================================================================== */
.entry {
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border);
}

.entry:first-of-type {
  padding-top: 0;
}

.entry:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
}

.entry-head :is(h3, h4) {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.3;
}

.entry-date {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry-meta {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.entry p {
  margin-bottom: var(--space-2);
}

.entry-fields {
  margin: var(--space-3) 0 0;
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
}

.entry-fields div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: var(--space-3);
}

.entry-fields dt {
  font-weight: 500;
  color: var(--text-muted);
}

.entry-fields dd {
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.entry-fields dd strong {
  font-weight: 500;
}

/* Placeholders for content the author still has to fill in */
.todo {
  display: inline;
  background: var(--todo-bg);
  color: var(--todo-text);
  border: 1px dashed var(--todo-border);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  font-size: 0.9em;
  font-style: normal;
  overflow-wrap: anywhere;
}

p.todo,
div.todo {
  display: block;
  padding: 0.55rem 0.8rem;
  font-size: var(--text-sm);
}

.todo-label {
  font-weight: 700;
}

/* ==========================================================================
   Publications and presentations (grouped by year)
   ========================================================================== */
.year-group {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border);
}

.year-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.year-group:last-of-type {
  padding-bottom: 0;
}

.year {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pub-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pub-item {
  padding: 0 0 var(--space-5);
}

.pub-item:last-child {
  padding-bottom: 0;
}

.pub-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: 1.3;
  color: var(--text);
  margin: 0 0 2px;
}

.pub-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-1);
  overflow-wrap: anywhere;
}

.pub-venue {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.pub-line {
  margin: var(--space-2) 0 var(--space-1);
}

.pub-role {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: var(--space-1) 0 0;
}

/* ==========================================================================
   Timeline (Education / Leadership)
   ========================================================================== */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 var(--space-5);
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-6);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-5) - 5px);
  top: 0.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 2px solid var(--bg);
}

.timeline-item.is-current::before {
  background: var(--accent);
}

.timeline-date {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.timeline-title {
  font-family: var(--font-serif);
  font-size: var(--h3);
  font-weight: 600;
  margin: var(--space-1) 0;
  line-height: 1.25;
}

.timeline-item p {
  margin-bottom: var(--space-1);
}

.timeline-item .tag-row {
  margin-top: var(--space-2);
}

.timeline-item .also {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}

/* ==========================================================================
   Self-studies, honors, languages
   ========================================================================== */
.book-groups {
  margin: 0;
  display: grid;
  gap: var(--space-3);
}

.book-group {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: var(--space-1) var(--space-4);
}

.book-group dt {
  font-weight: 500;
  color: var(--text);
}

.book-group dd {
  margin: 0;
  color: var(--text-secondary);
}

.book-group dd span {
  display: block;
}

.book-group dd em {
  color: var(--text-muted);
}

.honor h3 {
  margin: 0;
  font-size: var(--text-lg);
}

.lang-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-5);
}

.lang-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: var(--space-1) var(--space-4);
  align-items: baseline;
}

.lang-name {
  font-weight: 500;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.lang-main {
  margin: 0;
  color: var(--text);
}

.lang-main span {
  color: var(--text-secondary);
}

.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.score {
  display: inline-flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: var(--text-sm);
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-secondary);
}

.score b {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   404
   ========================================================================== */
.nf {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.nf-code {
  display: flex;
  align-items: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(6rem, 4rem + 14vw, 12rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 var(--space-5);
  user-select: none;
}

.nf-orbit {
  width: 0.78em;
  height: 0.78em;
  margin: 0 0.04em;
  color: var(--accent);
  flex: none;
}

.nf-orbit .ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: nf-spin 48s linear infinite;
}

.nf-orbit .nucleus {
  fill: currentColor;
}

.nf h1 {
  font-size: var(--h2);
  margin: 0 0 var(--space-3);
}

.nf p {
  max-width: 34rem;
}

.nf code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.nf-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

@keyframes nf-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Entrance (gentle, once)
   ========================================================================== */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.page>* {
  animation: rise 0.5s ease both;
}

.page>*:nth-child(2) {
  animation-delay: 0.06s;
}

.page>*:nth-child(3) {
  animation-delay: 0.12s;
}

.page>*:nth-child(4) {
  animation-delay: 0.18s;
}

.page>*:nth-child(5) {
  animation-delay: 0.24s;
}

.page>*:nth-child(n+6) {
  animation-delay: 0.3s;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .nf-orbit .ring {
    animation: none !important;
  }
}

/* ==========================================================================
   Narrow screens
   ========================================================================== */
@media (max-width: 575.98px) {
  .currently-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .skills-row {
    grid-template-columns: 1fr;
  }

  .book-group {
    grid-template-columns: 1fr;
  }

  .lang-row {
    grid-template-columns: 1fr;
  }

  .entry-fields div {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .year-group {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .entry-date {
    white-space: normal;
  }
}

/* ==========================================================================
   Print (kept inside the main stylesheet)
   ========================================================================== */
@media print {

  :root,
  :root[data-theme] {
    color-scheme: light;
  }

  html,
  body {
    overflow: visible;
  }

  body {
    padding-top: 0;
    font-size: 10.5pt;
  }

  .site-header,
  .skip-link,
  .jump-links,
  .hero-actions .btn,
  .nf-links {
    display: none !important;
  }

  .sidebar {
    position: static;
    width: auto;
    border: 0;
    padding: 0 0 var(--space-4);
    overflow: visible;
  }

  .sidebar-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
  }

  .sidebar-name {
    display: block;
  }

  .avatar {
    width: 3.5rem;
    height: 3.5rem;
  }

  .site-content {
    margin-left: 0;
  }

  .main {
    padding: 0;
  }

  .page>* {
    animation: none;
  }

  .section,
  .entry,
  .timeline-item,
  .pub-item,
  .highlight {
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  a[href^="http"]:not(.sidebar-links a)::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }
}