/* ===== Icons not in Bootstrap Icons (SVG luminance-mask workaround) ===== */
/* White circle + black letters → mask reveals currentColor as circle, letters cut out */
i.bi.bi-orcid {
  display: inline-block;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M256 128c0 70.7-57.3 128-128 128S0 198.7 0 128 57.3 0 128 0s128 57.3 128 128z' fill='%23fff'/%3E%3Cpath d='M86.3 186.2H70.9V79.1h15.4v107.1zM108.9 79.1h41.6c39.6 0 57 28.3 57 53.6 0 27.5-21.5 53.6-56.8 53.6h-41.8V79.1zm15.4 93.3h24.5c34.9 0 42.9-26.5 42.9-39.7C191.7 111.2 178 93 148 93h-23.7v79.4zM88.7 56.8c0 5.5-4.5 10.1-10.1 10.1s-10.1-4.6-10.1-10.1c0-5.6 4.5-10.1 10.1-10.1s10.1 4.5 10.1 10.1z' fill='%23000'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M256 128c0 70.7-57.3 128-128 128S0 198.7 0 128 57.3 0 128 0s128 57.3 128 128z' fill='%23fff'/%3E%3Cpath d='M86.3 186.2H70.9V79.1h15.4v107.1zM108.9 79.1h41.6c39.6 0 57 28.3 57 53.6 0 27.5-21.5 53.6-56.8 53.6h-41.8V79.1zm15.4 93.3h24.5c34.9 0 42.9-26.5 42.9-39.7C191.7 111.2 178 93 148 93h-23.7v79.4zM88.7 56.8c0 5.5-4.5 10.1-10.1 10.1s-10.1-4.6-10.1-10.1c0-5.6 4.5-10.1 10.1-10.1s10.1 4.5 10.1 10.1z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 1em;
  mask-size: 1em;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-mode: luminance;
  mask-mode: luminance;
  background-color: currentColor;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

i.bi.bi-orcid::before {
  content: none !important;
}

/* ===== ResearchGate icon (not in Bootstrap Icons — SVG luminance-mask workaround) ===== */
i.bi.bi-researchgate {
  display: inline-block;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23fff' d='M0 32C0 14.3 14.3 0 32 0h384c17.7 0 32 14.3 32 32V480c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32V32z'/%3E%3Cpath fill='%23000' d='M288.8 148c-5.3 0-10.3 1.4-14.7 4.1-20.4 12.5-21.1 54-21.1 54s21.9-3.3 35.2-14.3c12.1-10 14.5-24.8 14.5-32.5 0-6.7-5.4-11.3-13.9-11.3zM224 32C100.3 32 0 132.3 0 256s100.3 224 224 224 224-100.3 224-224S347.7 32 224 32zm-48 272h-32V176h70.7c43.7 0 64.6 22 64.6 55.2 0 26.4-13.3 44.4-35.5 51.4L288 416h-35.2l-36.7-125.4H176V304zm32-152h-32v83.4h29.5c23.6 0 38.2-11.5 38.2-33.5 0-20.5-11.7-49.9-35.7-49.9z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23fff' d='M0 32C0 14.3 14.3 0 32 0h384c17.7 0 32 14.3 32 32V480c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32V32z'/%3E%3Cpath fill='%23000' d='M288.8 148c-5.3 0-10.3 1.4-14.7 4.1-20.4 12.5-21.1 54-21.1 54s21.9-3.3 35.2-14.3c12.1-10 14.5-24.8 14.5-32.5 0-6.7-5.4-11.3-13.9-11.3zM224 32C100.3 32 0 132.3 0 256s100.3 224 224 224 224-100.3 224-224S347.7 32 224 32zm-48 272h-32V176h70.7c43.7 0 64.6 22 64.6 55.2 0 26.4-13.3 44.4-35.5 51.4L288 416h-35.2l-36.7-125.4H176V304zm32-152h-32v83.4h29.5c23.6 0 38.2-11.5 38.2-33.5 0-20.5-11.7-49.9-35.7-49.9z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 1em;
  mask-size: 1em;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-mode: luminance;
  mask-mode: luminance;
  background-color: currentColor;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

i.bi.bi-researchgate::before {
  content: none !important;
}

/* =========================================================================
   Site styles. Colours come from --c-* tokens defined in _theme/light.scss
   and _theme/dark.scss, so everything below works in both modes.
   ========================================================================= */

/* ===== Base typography ===== */
body {
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .title, .navbar-brand, .listing-title {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  letter-spacing: -0.01em;
}

h1.title { font-size: 2.4rem; font-weight: 500; }

main a:not(.pill):not(.nav-link):not(.entry-title) {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--c-accent) 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.15s ease;
}
main a:not(.pill):hover { text-decoration-color: currentColor; }
main .quarto-listing a,
main .quarto-listing a:hover { text-decoration: none !important; color: inherit; }

::selection { background: var(--c-tint); }

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

/* Section headings: serif with a short teal rule above */
main h2 {
  font-size: 1.55rem;
  margin-top: 2.6rem;
  padding-top: 0.9rem;
  border-bottom: none;
  position: relative;
}
main h2::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 2.25rem; height: 2px;
  background: var(--c-mark);
}

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

/* ===== Navbar: quiet, paper-coloured, hairline below ===== */
.navbar {
  border-bottom: 1px solid var(--c-rule);
  box-shadow: none;
}
.navbar-brand, .navbar-title {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--c-heading) !important;
}
.navbar .nav-link {
  font-size: 0.95rem;
  color: var(--c-muted) !important;
  padding-left: 0.85rem !important;
  padding-right: 0.85rem !important;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: var(--c-accent) !important;
}
.navbar .nav-link.active { box-shadow: inset 0 -2px 0 var(--c-accent); }

/* ===== Footer ===== */
.nav-footer {
  border-top: 1px solid var(--c-rule);
  font-size: 0.85rem;
  color: var(--c-muted);
  margin-top: 4rem;
}
.nav-footer .nav-link { color: var(--c-muted); }
.nav-footer .nav-link:hover { color: var(--c-accent); }

/* ===== Home: hero ===== */
.hero {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 2.25rem;
  align-items: center;
  margin: 1rem 0 2.5rem;
}
.hero img.portrait {
  width: 11rem;
  height: 11rem;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--c-rule);
}
.hero h1 {
  font-size: 2.6rem;
  line-height: 1.1;
  margin: 0 0 0.35rem;
  font-weight: 600;
}
.hero .role {
  color: var(--c-muted);
  font-size: 1.02rem;
  margin-bottom: 0.9rem;
}
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; text-align: left; gap: 1.25rem; }
  .hero img.portrait { width: 7.5rem; height: 7.5rem; }
  .hero h1 { font-size: 2.1rem; }
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-size: 0.92rem;
}
main .link-row a {
  color: var(--c-accent);
  text-decoration: none !important;
  white-space: nowrap;
}
main .link-row a:hover { color: var(--c-accent-strong); }
.link-row i.bi { margin-right: 0.3em; font-size: 0.95em; }

.lede {
  font-size: 1.12rem;
  line-height: 1.7;
}

/* "More →" links under home sections */
.more {
  font-size: 0.92rem;
  margin-top: 0.6rem;
}

/* ===== News list ===== */
.news ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.news li {
  position: relative;
  padding: 0.5rem 0 0.5rem 7.25rem;
  border-bottom: 1px solid var(--c-rule);
}
.news li:last-child { border-bottom: none; }
.news .date {
  position: absolute;
  left: 0;
  top: 0.55rem;
  font-variant-numeric: tabular-nums;
  color: var(--c-muted);
  font-size: 0.9rem;
}
@media (max-width: 520px) {
  .news li { padding-left: 0; }
  .news .date { position: static; display: block; }
}

/* ===== Research / talk entries ===== */
.entry {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--c-rule);
}
.entry:last-child { border-bottom: none; }
.entry p { margin: 0; }
.entry .venue { margin-top: 0.3rem; }
.entry .entry-title {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-size: 1.22rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--c-heading);
  margin: 0;
}
main .entry a.entry-title { text-decoration: none !important; color: var(--c-ink); }
main .entry a.entry-title:hover { color: var(--c-accent); }
.entry .authors {
  font-size: 0.92rem;
  color: var(--c-muted);
  margin-top: 0.25rem;
}
.entry .authors .me { color: var(--c-ink); font-weight: 600; }
.entry .venue {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-mark);
  margin-right: 0.5rem;
}
.entry .summary {
  font-size: 0.95rem;
  margin: 0.45rem 0 0;
}

/* Labelled action pills: [Paper] [Slides] [QR] */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font: 500 0.8rem/1 "Source Sans 3", "Source Sans Pro", system-ui, sans-serif;
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--c-rule);
  border-radius: 999px;
  background: transparent;
  color: var(--c-accent) !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pill:hover {
  background: var(--c-tint);
  border-color: var(--c-mark);
}
.pill .bi { font-size: 0.9em; }

/* ===== Popovers ===== */
.popover { border-color: var(--c-rule); font-family: "Source Sans 3", "Source Sans Pro", system-ui, sans-serif; }
.qr-pop { text-align: center; }
.qr-pop img { display: block; margin: 0 auto 0.4rem; background: #fff; border-radius: 4px; }
.qr-pop small { color: var(--c-muted); font-size: 0.72rem; word-break: break-all; }
.versions-pop { list-style: none; margin: 0; padding: 0; min-width: 12rem; }
.versions-pop li { padding: 0.2rem 0; }

/* ===== About: CV rows ===== */
.cv-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1.25rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--c-rule);
}
.cv-row:last-child { border-bottom: none; }
.cv-row .when {
  font-variant-numeric: tabular-nums;
  color: var(--c-muted);
  font-size: 0.9rem;
  padding-top: 0.15rem;
}
.cv-row .what { font-weight: 600; }
.cv-row .where { color: var(--c-ink); }
.cv-row .detail { color: var(--c-muted); font-size: 0.92rem; margin-top: 0.15rem; }
.cv-row p { margin: 0; }
@media (max-width: 560px) {
  .cv-row { grid-template-columns: 1fr; gap: 0.1rem; }
}

.contact-list ul { list-style: none; padding-left: 0; }
.contact-list li { margin-bottom: 0.45rem; }
.contact-list li i.bi {
  display: inline-block;
  width: 1.25em;
  margin-right: 0.35em;
  color: var(--c-mark);
  text-align: center;
}

/* ===== Listings (home "Recent writing" + blog index) ===== */
.quarto-listing .quarto-post { border-bottom: 1px solid var(--c-rule) !important; padding-bottom: 1.4rem; margin-bottom: 1.4rem; }
.quarto-listing .quarto-post .listing-title {
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--c-ink);
}
.quarto-listing .quarto-post a:hover .listing-title { color: var(--c-accent); }
.quarto-listing .quarto-post .metadata { font-size: 0.85rem; color: var(--c-muted); }
.quarto-listing .quarto-post .thumbnail img {
  border-radius: 6px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.quarto-listing .listing-categories .listing-category,
.quarto-title .quarto-categories .quarto-category,
.quarto-category {
  border: none;
  background: var(--c-tint);
  color: var(--c-mark);
  text-transform: none;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  opacity: 1;
}
.quarto-listing-category-title,
.quarto-listing-category .category { font-size: 0.9rem; }

/* ===== Title block (posts, project pages) ===== */
.quarto-title-meta-heading { color: var(--c-muted); font-size: 0.72rem; letter-spacing: 0.06em; }
#title-block-header .description { color: var(--c-muted); font-size: 1.1rem; }

/* ===== Tables ===== */
.table { --bs-table-bg: transparent; }

/* ===== Expandable version list (Talks page) ===== */
details.versions {
  margin-top: 0.8rem;
  border: 1px solid var(--c-rule);
  border-radius: 8px;
  background: var(--c-surface);
}
details.versions > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--c-accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
details.versions > summary::-webkit-details-marker { display: none; }
details.versions > summary::before {
  content: "\F285"; /* bootstrap-icons chevron-right */
  font-family: "bootstrap-icons";
  font-size: 0.8em;
  transition: transform 0.15s ease;
}
details.versions[open] > summary::before { transform: rotate(90deg); }
details.versions > summary:hover { color: var(--c-accent-strong); }
details.versions .version {
  padding: 0.8rem 0.9rem;
  border-top: 1px solid var(--c-rule);
}
details.versions .version p { margin: 0; }
.version-title {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-size: 1.08rem;
  color: var(--c-heading) !important;
  text-decoration: none !important;
}
.version-title:hover { color: var(--c-accent) !important; }
.version-meta { font-size: 0.88rem; color: var(--c-muted); margin-top: 0.2rem; }
@media (prefers-reduced-motion: reduce) {
  details.versions > summary::before { transition: none; }
}

/* ===== Poster preview (project pages) ===== */
.poster-preview {
  width: 100%;
  height: auto;
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  transition: border-color 0.15s ease;
}
a:hover .poster-preview { border-color: var(--c-accent); }
