@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600&family=Lato:wght@300;400;700;900&family=Roboto+Mono:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #f7fafc;
  --panel: #ffffff;
  --text: #2d3748;
  --muted: rgba(45, 55, 72, 0.72);
  --border: rgba(45, 55, 72, 0.12);
  --nav: #392f74;
  --navText: #ffffff;
  --teal: #00c0b5;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --max: 1150px;
  --container-pad-x: 18px;

  /* Footer scale (tweak these to resize footer) */
  --footer-font-size: 0.875rem;
  --footer-padding-y: 16px;
  --footer-padding-x: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* Prevent the vertical scrollbar from overlaying header/footer (supported browsers reserve a gutter). */
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.page-sticky {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.page-sticky main {
  flex: 1;
}

body.page-sticky.notfound-page main {
  display: flex;
  align-items: center;
  justify-content: center;
}

body.notfound-page .page-title {
  padding-top: 0;
}

body.page-sticky .container {
  padding-bottom: 0;
}

body.page-sticky .footer {
  margin-top: 0;
}

.container {
  --container-max: var(--max);
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px var(--container-pad-x) 60px;
}

.container.container-wide {
  --container-max: 1320px;
  max-width: 1320px;
}

.container.container-people {
  --container-max: 1500px;
  max-width: 1500px;
}

.muted { color: var(--muted); }

.nav {
  background: var(--nav);
  color: var(--navText);
}
.nav-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.5rem var(--container-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { width: 250px; height: auto; display: block; }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(45, 55, 72, 0.55);
  color: var(--navText);
  cursor: pointer;
}

.nav-toggle:hover { background: rgba(45, 55, 72, 0.68); }

.nav-toggle-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 16px;
}
.nav-links a {
  color: var(--navText);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 5px;
  font-weight: 400;
}
.nav-links a:hover { background: rgba(255,255,255,0.12); }
.nav-links a.active { border-bottom: 2px solid rgba(255,255,255,0.85); border-radius: 5px; }

.doc-btn {
  margin-left: 6px;
  background: rgba(45, 55, 72, 0.55);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 5px;
  font-weight: 500;
}

@media (max-width: 760px) {
  .brand-logo { width: 190px; }

  .nav-inner {
    position: relative;
    gap: 12px;
  }

  .nav-toggle { display: inline-flex; }

  .nav-links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    background: var(--nav);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
    z-index: 50;
  }

  .nav.nav-open .nav-links { display: flex; }

  .nav-links a {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .nav-links a.active {
    border-bottom: 0;
    background: rgba(255, 255, 255, 0.14);
  }

  .doc-btn {
    margin-left: 0;
    justify-content: center;
  }
}


.landing {
  padding: 34px 0 10px;
}

.landing-inner {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

.landing-title {
  font-family: Lato, Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  font-weight: 700;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  margin: 22px 0 18px;
  color: var(--text);
}

.landing-body {
  text-align: justify;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.landing-body p { margin: 0 0 18px; }

.landing-body strong { color: var(--text); font-weight: 700; }

.prose {
  max-width: 100%;
  margin: 0 auto;
  text-align: justify;
}
.prose p { line-height: 1.75; color: var(--muted); font-size: 1.05rem; }
.prose h2, .prose h3 { text-align: left; color: var(--text); }
.prose a { color: #1a56db; }
.prose code { background: rgba(45,55,72,0.08); padding: 2px 6px; border-radius: 8px; color: var(--text); }

.btn-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: #2d3748;
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  box-shadow: var(--shadow);
}
.btn:hover { filter: brightness(1.03); }
.btn.teal { background: var(--teal); color: #ffffff; }

.panel {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 12px;
}
@media (min-width: 850px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.mini-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: rgba(45,55,72,0.02);
  text-decoration: none;
}
.mini-card:hover { background: rgba(45,55,72,0.04); }
.mini-title { font-weight: 800; margin-bottom: 6px; color: var(--text); }

.page-title {
  padding: 18px 0 6px;
}
.page-title h1 { margin: 0; font-size: 2rem; }
.page-title p { margin: 8px 0 0; }

/* Publications: reduce the paper list typography */
body.publications-page .pub-title-link {
  font-size: 1.45rem;
}

body.publications-page .pub-item-authors,
body.publications-page .pub-item-venue {
  font-size: 0.98rem;
}

body.publications-page .pub-item-type {
  font-size: 0.95rem;
}

body.publications-page .pub-action {
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  body.publications-page .pub-title-link {
    font-size: 1.25rem;
  }
}

.cards {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
  margin-top: 16px;
}
@media (min-width: 900px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}

.card {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--panel);
  text-decoration: none;
}
.card img { width: 100%; height: 260px; object-fit: contain; background: #fff; border-bottom: 1px solid var(--border); }
.card-body { padding: 14px 14px 16px; }
.card-body h3 { margin: 0 0 6px; color: var(--text); font-weight: 700; }
.card-body p { margin: 0; color: var(--muted); line-height: 1.6; }
.card-cta { margin-top: 12px; display: inline-block; font-weight: 700; color: #2d3748; }

.image-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  justify-content: center;
  margin: 14px 0;
}
.image-panel img { width: 40%; max-width: 850px; height: auto; }

/* Opt-in full-width images inside an image panel */
.image-panel img.image-full {
  width: 100%;
  max-width: none;
}

/* Allow image panels to include captions (used in long-form pages) */
.image-panel.image-panel-stack {
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.image-panel figcaption {
  width: 90%;
  max-width: 90%;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
  text-align: left;
}

.image-panel figcaption strong {
  color: var(--text);
}

.prevnext {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.prevnext-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  text-decoration: none;
  min-width: 220px;
}
.prevnext-link strong { color: var(--text); }

.prevnext-arrow {
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
}

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

/* When prev/next appears at the very top of a page, make it lighter so it reads
   like navigation (and doesn't interrupt the page title). */
main.container > .prevnext:first-child,
main.container.container-wide > .prevnext:first-child,
main.container.container-people > .prevnext:first-child {
  margin-top: 0;
  margin-bottom: 14px;
  padding-top: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(45, 55, 72, 0.12);

  /* Subtle bar so the full-bleed width is visible. */
  background: rgba(255, 255, 255, 0.55);

  /* Full-bleed to viewport edges, while keeping content aligned
     to the container's max width + padding. */
  width: 100vw;
  width: 100dvw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  transform: none;
  box-sizing: border-box;
  padding-left: max(
    var(--container-pad-x),
    calc((100vw - var(--container-max)) / 2 + var(--container-pad-x))
  );
  padding-right: max(
    var(--container-pad-x),
    calc((100vw - var(--container-max)) / 2 + var(--container-pad-x))
  );
}

main.container > .prevnext:first-child .prevnext-link,
main.container.container-wide > .prevnext:first-child .prevnext-link,
main.container.container-people > .prevnext:first-child .prevnext-link {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 6px 0;
  min-width: 0;
}

main.container > .prevnext:first-child .prevnext-link strong,
main.container.container-wide > .prevnext:first-child .prevnext-link strong,
main.container.container-people > .prevnext:first-child .prevnext-link strong {
  color: rgba(45, 55, 72, 0.82);
  font-weight: 600;
}

main.container > .prevnext:first-child .prevnext-link .prevnext-label,
main.container.container-wide > .prevnext:first-child .prevnext-link .prevnext-label,
main.container.container-people > .prevnext:first-child .prevnext-link .prevnext-label {
  color: rgba(45, 55, 72, 0.82);
  font-weight: 600;
}

main.container > .prevnext:first-child .prevnext-link:hover,
main.container.container-wide > .prevnext:first-child .prevnext-link:hover,
main.container.container-people > .prevnext:first-child .prevnext-link:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  /* Components prev/next: compact on mobile */
  .prevnext { gap: 10px; margin-top: 14px; }

  .prevnext-link {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 999px;
  }

  .prevnext-label { display: none; }
  .prevnext-arrow { font-size: 18px; }

  main.container > .prevnext:first-child,
  main.container.container-wide > .prevnext:first-child,
  main.container.container-people > .prevnext:first-child {
    padding-bottom: 8px;
  }
}

/* Publications (KU-like list layout) */
.pub-section {
  margin-top: 10px;
}

/* Widen the pinned panel so its inner content aligns with the unboxed rows below.
   (The panel has horizontal padding; this extends the panel into the container padding.) */
body.publications-page .pub-pinned.panel {
  margin-left: calc(var(--container-pad-x) * -1);
  margin-right: calc(var(--container-pad-x) * -1);
}

.pub-pinned {
  border-left: 4px solid var(--teal);
}

.pub-pinned-body {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.pub-pinned-lead {
  color: var(--muted);
  margin-bottom: 10px;
}

.pub-list {
  margin-top: 12px;
}

.pub-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid rgba(45, 55, 72, 0.14);
}

.pub-main {
  flex: 1;
  min-width: 0;
}

.pub-item-title {
  margin: 0 0 8px;
}

.pub-title-link {
  color: #1a56db;
  text-decoration: none;
  font-family: Lato, Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.2;
}

.pub-title-link:hover {
  text-decoration: underline;
}

.pub-item-authors {
  color: rgba(45, 55, 72, 0.78);
  font-size: 1.05rem;
  line-height: 1.55;
}

.pub-item-venue {
  margin-top: 4px;
  color: rgba(45, 55, 72, 0.72);
  font-size: 1.05rem;
  line-height: 1.55;
}

.pub-item-type {
  margin-top: 6px;
  color: rgba(45, 55, 72, 0.62);
  font-style: italic;
}

.pub-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.pub-action {
  color: rgba(45, 55, 72, 0.82);
  text-decoration: none;
  font-weight: 500;
}

.pub-action:hover {
  text-decoration: underline;
}

.pub-metrics {
  flex: 0 0 150px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.pub-metrics-inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

@media (max-width: 720px) {
  .pub-pinned-body {
    flex-direction: column;
    align-items: stretch;
  }
  .pub-row {
    flex-direction: column;
  }
  .pub-metrics {
    justify-content: flex-start;
  }
  .pub-title-link {
    font-size: 1.45rem;
  }
}

.section { margin-top: 20px; }
.section-title { margin: 0 0 10px; }

body.people-page .section-title {
  text-align: center;
  margin-bottom: 14px;
}

body.people-page .section {
  margin-top: 46px;
}

body.people-page .section:first-of-type {
  margin-top: 26px;
}

/* Optional: center the cards themselves (including the last row) */
body.people-page.people-center-cards .people-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 310px));
  justify-content: center;
  gap: 18px;
}

.person-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  width: 310px;
  height: 400px;
  display: flex;
  flex-direction: column;
}
.person-photo {
  width: 100%;
  height: 224px;
  object-fit: contain;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.person-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.person-name { font-weight: 700; margin-bottom: 6px; }
.person-email { display: inline-block; margin-top: 10px; color: #1a56db; text-decoration: none; word-break: break-word; font-size: 0.8rem; line-height: 1.35; }
.person-email:hover { text-decoration: underline; }

.person-email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.person-email span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.person-email-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: rgba(45, 55, 72, 0.72);
}


.table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.data-table { border-collapse: collapse; min-width: 1200px; width: 100%; font-size: 12px; }
.data-table th, .data-table td { border-bottom: 1px solid rgba(45,55,72,0.08); padding: 8px 10px; text-align: left; white-space: nowrap; }
.data-table th { position: sticky; top: 0; background: #f7fafc; }

/* Compact tables (avoid forcing horizontal scrolling) */
.table-wrap.table-wrap-compact {
  overflow: visible;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto 6px;
}

.data-table.data-table-compact {
  min-width: 0;
  width: auto;
  font-size: 13px;
  table-layout: auto;
}
.data-table.data-table-compact th,
.data-table.data-table-compact td {
  white-space: normal;
}

/* Full-width table caption (place this as a sibling after the table wrapper) */
.table-caption {
  width: 100%;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
  text-align: left;
}

.table-caption strong {
  color: var(--text);
}

/* Synthetic population schema: 4 compact tables side-by-side */
.schema-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  margin: 12px 0 10px;
}

/* Don't force horizontal scrolling for these small tables */
.schema-grid .table-wrap {
  overflow: hidden;
}

.schema-grid .data-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
  font-size: 12px;
}

.schema-grid .data-table th,
.schema-grid .data-table td {
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schema-grid .data-table th:nth-child(1),
.schema-grid .data-table td:nth-child(1) {
  width: 3.2rem;
  font-variant-numeric: tabular-nums;
}

.schema-grid .data-table th:nth-child(3),
.schema-grid .data-table td:nth-child(3) {
  width: 5.2rem;
}

@media (max-width: 980px) {
  .schema-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .schema-grid { grid-template-columns: 1fr; }
}

.footer {
  margin-top: 40px;
  background: #2d3748;
  color: #fff;
  font-size: var(--footer-font-size);
}
.footer .muted { color: rgba(255,255,255,0.82); }
.footer-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--footer-padding-y) var(--footer-padding-x);
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(1, 1fr);
}
@media (min-width: 900px) {
  .footer-inner { grid-template-columns: 4fr 2fr 3fr 6fr; }
}

.footer-col a { color: rgba(255,255,255,0.92); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 500; }
.footer-links { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.footer-links a { margin-top: 0; }
.footer-link { line-height: 1.2; }
.footer-link-text { display: inline-block; line-height: 1; }
.footer-icon { width: 16px; height: 16px; display: block; flex: 0 0 auto; }
.footer-license { line-height: 1.55; font-size: 0.875rem; }
.footer-col a:hover { text-decoration: underline; }
.footer-title { font-weight: 700; margin-bottom: 6px; }
.footer-logo { width: 200px; height: auto; display: block; margin-bottom: 8px; }
