/* ==========================================================================
   Bercher theme for bercher.net (child theme of Quark)
   ========================================================================== */

:root {
  --b-accent: #2952CC;
  --b-ink: #111827;
  --b-ink-2: #374151;
  --b-muted: #4B5563;
  --b-line: #E3E6EB;
  --b-line-2: #D5DAE1;
  --b-bg: #F5F6F8;
  --b-surface: #FFFFFF;
  --b-tint: #EEF1F5;
  --b-hover: #F3F5F8;
  --b-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --b-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ---------- Base ---------- */
body {
  font-family: var(--b-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--b-ink);
  background: var(--b-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--b-accent); }
a:hover, a:focus { color: var(--b-accent); text-decoration: underline; }
h1, h2, h3, h4 {
  font-family: var(--b-serif);
  color: var(--b-ink);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.b-wrap {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 40px;
  padding-right: 40px;
}

/* ---------- Header ---------- */
#header.site-header {
  position: relative;
  z-index: 30;
  height: auto;
  background: var(--b-surface);
  border-bottom: 1px solid var(--b-line);
  font-size: 15px;
  font-weight: 500;
  color: var(--b-ink);
}
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 10px;
  padding-bottom: 10px;
}
#header .site-brand,
.mobile-logo .site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  color: var(--b-ink);
  text-decoration: none;
}
.site-brand__mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: var(--b-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--b-serif);
  font-size: 16px;
  font-weight: 700;
}
.site-brand__name {
  font-family: var(--b-serif);
  font-size: 20px;
  font-weight: 600;
}

/* ---------- Main menu with dropdowns ---------- */
#header .site-nav > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}
#header .site-nav > ul > li { position: relative; margin: 0; }
#header .site-nav a:before { content: none !important; }
#header .site-nav > ul > li > a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  color: var(--b-ink-2);
  text-decoration: none;
}
#header .site-nav > ul > li > a:not(:only-child)::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg);
}
#header .site-nav > ul > li > a:hover,
#header .site-nav > ul > li:hover > a { color: var(--b-accent) !important; }
#header .site-nav > ul > li > a.active { color: var(--b-accent) !important; background: var(--b-tint); }

/* dropdown panel */
#header .site-nav ul ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 40;
  min-width: 240px;
  margin: 0;
  padding: 10px;
  list-style: none;
  background: var(--b-surface);
  border: 1px solid var(--b-line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.14);
  visibility: visible;
  opacity: 1;
  transform: none;
  white-space: nowrap;
}
#header .site-nav > ul > li:hover > ul,
#header .site-nav > ul > li:focus-within > ul { display: block; }
#header .site-nav > ul > li:nth-child(n+5) > ul { left: auto; right: 0; }
/* bigger sections get two columns */
#header .site-nav > ul > li > ul:has(> li:nth-child(9)),
#header .site-nav > ul > li > ul:has(ul > li:nth-child(4)) {
  width: 540px;
  columns: 2;
  column-gap: 8px;
  white-space: normal;
}
#header .site-nav > ul > li > ul > li { break-inside: avoid; }
/* deeper levels: listed inline, indented */
#header .site-nav ul ul ul {
  display: block;
  position: static;
  left: auto;
  top: auto;
  min-width: 0;
  width: auto;
  columns: auto;
  margin: 0;
  padding: 0 0 4px 14px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: none;
}
#header .site-nav ul ul li { display: block; margin: 0; }
#header .site-nav ul ul a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--b-ink) !important;
  text-decoration: none;
}
#header .site-nav ul ul ul a,
#header .site-nav ul ul li.nav-indent > a {
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--b-muted) !important;
}
#header .site-nav ul ul li.nav-indent > a { padding-left: 24px; }
#header .site-nav ul ul a:hover,
#header .site-nav ul ul a.active { background: var(--b-hover); color: var(--b-accent) !important; }

/* ---------- Mobile menu (Quark's overlay, restyled) ---------- */
.mobile-menu .button_container { top: 22px; right: 20px; }
.mobile-menu .button_container span { background: var(--b-ink); height: 3px; }
.overlay { background: var(--b-ink); }
.mobile-logo .site-brand { padding: 16px 20px; color: #fff; }
.overlay .treemenu li { background: rgba(255, 255, 255, 0.06); }
.overlay .treemenu li a { color: #fff; }

/* ---------- Section bar (pages of the current section) ---------- */
.section-bar {
  background: var(--b-surface);
  border-bottom: 1px solid var(--b-line);
}
.section-bar__inner {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  scrollbar-width: thin;
}
.section-bar a {
  padding: 12px 9px;
  color: var(--b-muted);
  text-decoration: none;
}
.section-bar a:hover { color: var(--b-accent); text-decoration: none; }
.section-bar a.active { color: var(--b-accent); box-shadow: inset 0 -2px 0 var(--b-accent); }
.section-bar .section-bar__title {
  padding-left: 0;
  padding-right: 12px;
  font-family: var(--b-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--b-ink);
}
.section-bar a.is-sub::before { content: '› '; color: var(--b-line-2); }

/* ---------- Page body ---------- */
#start { background: var(--b-bg); }
#body-wrapper { padding: 0; }
#body-wrapper > .container {
  max-width: 1200px;
  padding: 40px 40px 72px;
}
.page-body { max-width: 900px; }
.page-body > h1:first-of-type,
.page-body > h2:first-of-type {
  margin: 0 0 20px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.page-body h2 { margin: 40px 0 12px; font-size: 28px; }
.page-body h3 { margin: 28px 0 10px; font-size: 22px; }
.page-body h4 { margin: 24px 0 8px; font-size: 18px; }
.page-body p,
.page-body li { color: var(--b-ink-2); }
.page-body ul,
.page-body ol { margin-left: 1.3em; list-style-position: outside; }
.page-body img { max-width: 100%; height: auto; border-radius: 10px; }
.page-body blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  border: 0;
  background: var(--b-surface);
  border-radius: 12px;
  color: var(--b-ink-2);
}
.page-body table { background: var(--b-surface); border-radius: 12px; overflow: hidden; }
.page-body hr { border: 0; border-top: 1px solid var(--b-line); margin: 32px 0; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--b-muted);
}
.breadcrumbs a { color: var(--b-muted); }
.breadcrumbs [aria-current] { color: var(--b-ink); }

/* ---------- Footer ---------- */
#footer.site-footer {
  padding: 0;
  text-align: left;
  font-size: 14px;
  color: var(--b-muted);
  background: var(--b-surface);
  border-top: 1px solid var(--b-line);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.site-footer__links { display: flex; gap: 20px; }
.site-footer__links a { padding: 10px 0; color: var(--b-muted); }

/* ---------- Homepage ---------- */
.home-hero__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 40px 48px;
  padding-top: 56px;
  padding-bottom: 56px;
}
.home-hero__text { flex: 999 1 520px; min-width: 0; }
.home-hero__photo { flex: 1 1 260px; display: flex; justify-content: center; }
.home-hero__photo img {
  display: block;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 24px;
  background: #E8ECF2;
}
.chip {
  display: inline-block;
  margin: 0 0 20px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--b-surface);
  border: 1px solid var(--b-line);
  font-size: 14px;
  font-weight: 500;
  color: var(--b-ink-2);
}
.home-hero__name {
  margin: 0;
  font-size: 64px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.home-hero__lede {
  margin: 20px 0 0;
  max-width: 640px;
  font-size: 22px;
  line-height: 1.45;
  color: var(--b-ink);
}
.home-hero__intro {
  margin-top: 12px;
  max-width: 640px;
  font-size: 17px;
  color: var(--b-muted);
}
.home-hero__intro p { margin: 0 0 8px; color: var(--b-muted); }
.btn-row { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 12px; }
.pill-btn {
  padding: 11px 19px;
  border-radius: 10px;
  border: 1px solid var(--b-line-2);
  background: var(--b-surface);
  color: var(--b-ink);
  font-weight: 600;
  text-decoration: none;
}
.pill-btn:hover, .pill-btn:focus { border-color: var(--b-accent); color: var(--b-accent); text-decoration: none; }
.pill-btn--primary { background: var(--b-accent); border-color: var(--b-accent); color: #fff; }
.pill-btn--primary:hover, .pill-btn--primary:focus { color: #fff; filter: brightness(1.1); }

.home-band { padding: 64px 0; }
.home-band--first { padding-top: 0; }
.home-band--white {
  background: var(--b-surface);
  border-top: 1px solid var(--b-line);
  border-bottom: 1px solid var(--b-line);
}
.home-eyebrow {
  margin: 0 0 16px;
  font-family: var(--b-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--b-muted);
}
.home-h2 { margin: 0 0 12px; font-size: 36px; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 20px;
}
.section-head .home-h2 { margin: 0; }
.more { padding: 10px 0; font-weight: 600; text-decoration: none; }
.card-row { display: flex; flex-wrap: wrap; gap: 16px; }
.card {
  flex: 1 1 300px;
  padding: 24px;
  background: var(--b-surface);
  border: 1px solid var(--b-line);
  border-radius: 16px;
}
.card__icon { display: block; color: var(--b-accent); }
.card__title {
  margin: 14px 0 6px;
  font-family: var(--b-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--b-ink);
}
.card__text { margin: 0; font-size: 15px; color: var(--b-muted); }
.card--link { display: block; color: var(--b-ink); text-decoration: none; }
.card--link:hover, .card--link:focus { border-color: var(--b-accent); text-decoration: none; }
.card__more { display: inline-block; margin-top: 12px; font-size: 15px; font-weight: 600; color: var(--b-accent); }
.highlight-row + .highlight-row { margin-top: 32px; }
.highlight-row__label {
  margin: 0 0 12px;
  font-family: var(--b-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  color: var(--b-ink-2);
}
.research-lead { margin: 0 0 32px; max-width: 820px; font-size: 17px; color: var(--b-muted); }
.line-card {
  flex: 1 1 400px;
  padding: 28px;
  background: #F9FAFB;
  border: 1px solid var(--b-line);
  border-radius: 16px;
}
.line-card__label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--b-accent);
}
.line-card__title { margin: 0 0 10px; font-size: 25px; }
.line-card__text { margin: 0; color: var(--b-ink-2); }
.tag-row { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tag-row .more { margin-left: auto; }
.tag {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--b-tint);
  font-size: 14px;
  font-weight: 500;
  color: var(--b-ink-2);
}
.news-card {
  flex: 1 1 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  background: var(--b-surface);
  border: 1px solid var(--b-line);
  border-radius: 16px;
  color: var(--b-ink);
  text-decoration: none;
}
.news-card:hover, .news-card:focus { border-color: var(--b-accent); text-decoration: none; }
.news-card__date {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--b-muted);
}
.news-card__title {
  font-family: var(--b-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--b-ink);
}
.news-card__source { font-size: 15px; color: var(--b-muted); }
.paper-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--b-surface);
  border: 1px solid var(--b-line);
  border-radius: 16px;
}
.paper-list li { margin: 0; padding: 20px 24px; }
.paper-list li + li { border-top: 1px solid var(--b-line); }
.venue-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--b-accent);
  color: var(--b-accent);
  font-size: 13px;
  font-weight: 600;
}
.paper-list__title {
  display: block;
  margin: 10px 0 4px;
  font-family: var(--b-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--b-ink);
}
a.paper-list__title:hover { color: var(--b-accent); }
.paper-list__authors { margin: 0; font-size: 15px; color: var(--b-muted); }

/* ---------- BibBase publication lists ---------- */
#bibbase { font-family: var(--b-sans); font-size: 15px; line-height: 1.55; color: var(--b-muted); }
.bibbase_msg { font-size: 12px; color: var(--b-muted); }
.bibbase_group_whole { margin: 0 0 8px; }
.bibbase_group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 32px 0 14px;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 1px solid var(--b-line);
  background: none !important;
  font-family: var(--b-serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--b-ink);
  cursor: pointer;
}
.bibbase_group_head_icon { font-size: 16px; color: var(--b-muted); }
.bibbase_group_count { font-family: var(--b-sans); font-size: 14px; font-weight: 500; color: var(--b-muted); }
#bibbase .bibbase_paper {
  margin: 0 !important;
  padding: 18px 22px !important;
  background: var(--b-surface);
  border: 1px solid var(--b-line);
  border-radius: 14px;
  color: var(--b-muted);
}
#bibbase .bibbase_paper + .bibbase_paper { margin-top: 12px !important; }
.bibbase_paper_titleauthoryear { display: block; }
.bibbase_paper_title,
.bibbase_paper_title a {
  display: block;
  font-family: var(--b-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--b-ink);
  text-decoration: none;
}
.bibbase_paper_title a:hover { color: var(--b-accent); text-decoration: none; }
.bibbase_paper_author { display: block; margin: 4px 0; font-size: 15px; color: var(--b-ink-2); }
/* award notes (bib "note" field): always shown */
.bibbase_paper .note:not(:empty) { display: block; margin-top: 8px; font-size: 14px; color: var(--b-accent); }
.bibbase_paper .note b,
.bibbase_paper .note i { font-weight: 600; font-style: normal; }
/* "Favorite paper/title, because …": only inside the matching page wrapper */
.bibbase_note .favorite-paper,
.bibbase_note .nerdy-title { display: none; }
.favorite-paper .bibbase_note .favorite-paper,
.nerdy-title .bibbase_note .nerdy-title {
  display: block;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--b-tint);
  font-size: 14px;
  color: var(--b-ink-2);
}
/* links row as pills */
br.bibbase_paper_content { display: none; }
span.bibbase_paper_content {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 0;
}
span.bibbase_paper_content > a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  border: 1px solid var(--b-line-2);
  border-radius: 999px;
  background: var(--b-surface);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  text-transform: capitalize;
  color: var(--b-ink) !important;
  text-decoration: none !important;
}
span.bibbase_paper_content > a.doi { text-transform: uppercase; }
span.bibbase_paper_content > a:hover { border-color: var(--b-accent); color: var(--b-accent) !important; }
span.bibbase_paper_content .bibbase_icon { display: none; }
span.bibbase_paper_content .fa { font-size: 11px; }
span.bibbase_paper_content .bibbase_stats_paper { margin-left: 4px; font-size: 12px; color: var(--b-muted) !important; }
#bibbase .well {
  margin: 12px 0 0;
  padding: 12px 14px;
  background: var(--b-bg);
  border: 1px solid var(--b-line);
  border-radius: 10px;
  box-shadow: none;
  font-size: 13px;
}

/* ---------- Small screens ---------- */
@media (max-width: 840px) {
  .site-header__inner { padding-right: 72px; }
}
@media (max-width: 640px) {
  .b-wrap { padding-left: 20px; padding-right: 20px; }
  #body-wrapper > .container { padding: 28px 20px 56px; }
  .home-hero__inner { padding-top: 36px; padding-bottom: 40px; }
  .home-hero__name { font-size: 44px; }
  .home-hero__lede { font-size: 19px; }
  .home-band { padding: 44px 0; }
  .home-band--first { padding-top: 0; }
  .home-h2 { font-size: 30px; }
  .page-body > h1:first-of-type,
  .page-body > h2:first-of-type { font-size: 32px; }
}
