/* =========================================================================
   beetle — research site design system
   Restraint first: clean type, generous whitespace, one indigo accent.
   ========================================================================= */

:root {
  --accent:        #6d5ae0;
  --accent-dark:   #5a49c9;
  --accent-soft:   #efeaff;
  --ink:           #211f45;   /* headings */
  --body:          #44416a;   /* body text */
  --muted:         #6b6788;
  --line:          #e9e5f7;
  --surface:       #ffffff;
  --surface-2:     #faf9ff;
  --surface-3:     #f4f2fd;
  --bg:            #ffffff;

  --head-font: "Space Grotesk", "Quicksand", system-ui, sans-serif;
  --body-font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono-font: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --maxw: 1080px;
  --radius: 18px;
  --shadow: 0 6px 28px rgba(33, 31, 69, 0.07);
  --shadow-lg: 0 20px 48px rgba(33, 31, 69, 0.14);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--body-font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  font-family: var(--head-font);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-dark); }
strong { color: var(--ink); font-weight: 700; }
code { font-family: var(--mono-font); }
img { max-width: 100%; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 820px; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 20px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--head-font); }
.brand img { width: 34px; height: 34px; }
.brand span { font-weight: 700; font-size: 21px; color: var(--ink); letter-spacing: -0.02em; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a {
  font-family: var(--head-font); font-weight: 500; font-size: 15px;
  color: var(--body); padding: 8px 13px; border-radius: 9px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.active { color: var(--accent); }
.nav a.nav-gh {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--ink); color: #fff; margin-left: 6px;
}
.nav a.nav-gh:hover { background: #322f5e; color: #fff; }
.nav-toggle { display: none; background: none; border: 0; font-size: 26px; color: var(--ink); cursor: pointer; margin-left: auto; }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; inset: 64px 0 auto 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px; box-shadow: var(--shadow);
    transform: translateY(-120%); transition: transform 0.25s ease;
  }
  .nav.open { transform: translateY(0); }
  .nav a { padding: 12px 10px; border-radius: 10px; font-size: 16px; }
  .nav a.nav-gh { margin: 8px 0 0; justify-content: center; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--head-font); font-weight: 600; font-size: 15px;
  padding: 11px 24px; border-radius: 50px;
  text-decoration: none; cursor: pointer; border: 1.5px solid transparent;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--surface-3); color: var(--ink); }
.btn-ghost:hover { background: #e9e5f7; color: var(--ink); }
.btn-sm { padding: 8px 18px; font-size: 14px; }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 500px at 50% -120px, rgba(109, 90, 224, 0.14), transparent 70%),
    linear-gradient(180deg, #fbfaff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
  padding: 92px 0 72px;
  text-align: center;
}
.hero .eyebrow {
  display: inline-block; font-family: var(--head-font); font-weight: 600;
  font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 6px 16px; border-radius: 50px; margin-bottom: 26px;
}
.hero h1 {
  font-size: clamp(32px, 5.2vw, 54px); line-height: 1.07;
  max-width: 16ch; margin: 0 auto 22px; letter-spacing: -0.025em;
}
.hero .lede {
  font-size: clamp(17px, 2.2vw, 21px); color: var(--body);
  max-width: 60ch; margin: 0 auto 32px; line-height: 1.55;
}
.hero .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.hero-mark { width: 92px; height: 92px; margin: 0 auto 24px; display: block; filter: drop-shadow(0 12px 26px rgba(109,90,224,0.28)); }

/* ---------------------------------------------------------------- stats */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 18px; max-width: 760px; margin: 52px auto 0;
}
.stat {
  text-align: center; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 12px;
}
.stat .num {
  font-family: var(--head-font); font-weight: 700; font-size: clamp(30px, 5vw, 42px);
  color: var(--accent); line-height: 1; letter-spacing: -0.02em;
}
.stat .lbl { font-size: 13.5px; color: var(--muted); margin-top: 8px; font-weight: 600; }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; gap: 12px; } }

/* ---------------------------------------------------------------- sections */
.section { padding: 76px 0; }
.section.alt { background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 680px; margin: 0 0 40px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head .eyebrow {
  display: inline-block; font-family: var(--head-font); font-weight: 600;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px;
}
.section-head h2 { font-size: clamp(26px, 3.6vw, 36px); margin-bottom: 14px; }
.section-head p { font-size: 18px; color: var(--body); margin: 0; }
.page-head { padding: 64px 0 20px; }
.page-head h1 { font-size: clamp(30px, 4.6vw, 46px); margin-bottom: 14px; }
.page-head p { font-size: 19px; color: var(--body); max-width: 70ch; margin: 0; }

/* page lead paragraph */
.lead { font-size: 19px; line-height: 1.7; color: var(--body); }

/* ---------------------------------------------------------------- generic cards */
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 920px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 24px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card h3 { font-size: 19px; margin-bottom: 8px; }
.card h4 { font-size: 17px; margin-bottom: 6px; }
.card p { font-size: 15px; color: var(--body); margin: 0 0 14px; }
.card p:last-child { margin-bottom: 0; }
.card-ic {
  width: 48px; height: 48px; border-radius: 13px; margin-bottom: 16px;
  background: linear-gradient(155deg, #8a7bf0, #6d5ae0);
  color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.card .more {
  margin-top: auto; font-family: var(--head-font); font-weight: 600; font-size: 14.5px;
  color: var(--accent); display: inline-flex; align-items: center; gap: 6px;
}
.card .more i { transition: transform 0.18s; }
a.card:hover, .card.link:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d9d0f6; }
a.card { color: inherit; transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s; }
a.card:hover .more i { transform: translateX(4px); }

/* destination cards (home → next steps) */
.dest-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 860px) { .dest-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- figures */
figure { margin: 0; }
.fig {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.fig img { width: 100%; height: auto; border-radius: 10px; display: block; }
.fig figcaption { font-size: 13.5px; line-height: 1.55; color: var(--muted); margin-top: 12px; }
.fig figcaption b { color: var(--ink); }

/* ---------------------------------------------------------------- code */
.code {
  background: #1a1836; border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 30px rgba(33, 31, 69, 0.16); margin: 0 0 18px;
}
.code-head {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 16px; background: #211f45; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.code-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.code-head .dot.r { background: #ff6b6b; } .code-head .dot.y { background: #ffd166; } .code-head .dot.g { background: #5ecfa6; }
.code-head .t { margin-left: 8px; font-family: var(--mono-font); font-size: 12px; color: #9c99bd; }
.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; }
.code code { font-family: var(--mono-font); font-size: 13.5px; line-height: 1.7; color: #eae7ff; white-space: pre; }
.c-prompt { color: #6d5ae0; user-select: none; }
.c-comment { color: #7d79a8; }
.c-str { color: #9be3c4; }
.c-kw { color: #c9bbff; }

/* inline code pill */
.ic { font-family: var(--mono-font); font-size: 0.86em; background: var(--accent-soft); color: var(--accent-dark); padding: 1px 6px; border-radius: 6px; }

/* ---------------------------------------------------------------- spec grid / chips */
.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.spec {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.spec .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #9c99bd; font-weight: 700; }
.spec .v { font-family: var(--mono-font); font-size: 13.5px; color: var(--ink); margin-top: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips span { font-size: 12.5px; background: var(--accent-soft); color: var(--accent-dark); border-radius: 6px; padding: 4px 10px; font-weight: 600; }
.chips span.sub { background: #e3f6ee; color: #2f9d6d; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { font-size: 12.5px; color: var(--body); background: var(--surface-2); border: 1px solid var(--line); border-radius: 50px; padding: 5px 13px; }

/* ---------------------------------------------------------------- curriculum legend */
.curr-legend { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 920px) { .curr-legend { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .curr-legend { grid-template-columns: 1fr; } }
.curr {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px; background: var(--surface);
  box-shadow: var(--shadow);
}
.curr .tag {
  display: inline-block; font-family: var(--mono-font); font-weight: 600; font-size: 12px;
  color: #fff; background: var(--accent); border-radius: 6px; padding: 2px 9px; margin-bottom: 9px;
}
.curr h5 { font-size: 15px; margin: 0 0 5px; }
.curr p { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 0; }
.curr .pct { font-weight: 700; color: var(--accent); }

/* ---------------------------------------------------------------- data scale bars */
.scale-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 14px; color: #fff; margin-bottom: 12px; }
.scale-row .n { font-family: var(--head-font); font-size: 26px; font-weight: 700; min-width: 86px; }
.scale-row .d { font-size: 13.5px; opacity: 0.96; }
.scale-a { background: linear-gradient(155deg, #7fb2ff, #5b8def); }
.scale-b { background: linear-gradient(155deg, #8a7bf0, #6d5ae0); }
.scale-c { background: linear-gradient(155deg, #5ecfa6, #2f9d6d); }

/* ---------------------------------------------------------------- paper / abstract */
.paper-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 36px; box-shadow: var(--shadow-lg);
}
.venue {
  display: inline-block; font-family: var(--head-font); font-weight: 700; font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); border-radius: 50px; padding: 5px 16px; margin-bottom: 16px;
}
.paper-title { font-size: 28px; line-height: 1.22; margin-bottom: 18px; }
.authors { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 6px; }
.authors a { font-size: 15.5px; font-weight: 700; color: var(--ink); border-bottom: 2px solid transparent; }
.authors a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.authors sup { color: var(--accent); font-size: 0.7em; }
.affil { font-size: 13.5px; color: var(--muted); margin: 4px 0 22px; }
.abstract {
  font-size: 16px; line-height: 1.75; color: var(--body);
  border-left: 3px solid var(--accent); padding-left: 20px; margin: 0 0 24px;
}
.abstract .lbl {
  display: block; font-family: var(--head-font); color: var(--ink);
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; margin-bottom: 8px;
}
.paper-btns { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data {
  border-collapse: collapse; width: 100%; min-width: 460px; font-size: 14px; background: #fff;
}
table.data caption { caption-side: bottom; font-size: 13px; color: var(--muted); text-align: left; padding: 12px 2px 0; line-height: 1.55; }
table.data th, table.data td { padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; font-family: var(--mono-font); }
table.data thead th { color: var(--ink); font-family: var(--head-font); border-bottom: 2px solid #d9d3ef; }
table.data .grp th { text-align: center; font-style: italic; color: var(--accent); background: var(--surface-2); }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------- key findings */
.findings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 860px) { .findings { grid-template-columns: 1fr; } }
.finding { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.finding .fi { font-size: 24px; color: var(--accent); margin-bottom: 12px; }
.finding h4 { font-size: 17px; margin-bottom: 8px; }
.finding p { font-size: 14.5px; color: var(--body); margin: 0; }

/* ---------------------------------------------------------------- link cards */
.link-cards { display: flex; gap: 16px; flex-wrap: wrap; }
.link-card {
  display: flex; align-items: center; gap: 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 22px;
  min-width: 230px; flex: 1 1 230px; box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.link-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d9d0f6; }
.link-card i { font-size: 26px; color: var(--accent); }
.link-card .t { font-family: var(--head-font); font-weight: 700; font-size: 16px; color: var(--ink); }
.link-card .s { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- notebooks */
.nb-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.nb-badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--head-font); font-weight: 600; font-size: 12.5px; padding: 7px 13px; border-radius: 50px; }
.nb-badge.colab { background: #f9ab00; color: #211f45; }
.nb-badge.colab:hover { background: #f79500; color: #211f45; }
.nb-badge.gh { background: #211f45; color: #fff; }
.nb-badge.gh:hover { background: #322f5e; color: #fff; }

/* ---------------------------------------------------------------- authors grid */
.people { display: flex; flex-wrap: wrap; gap: 14px; }
.person {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 22px;
  text-align: center; min-width: 200px; flex: 1 1 200px; box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.person:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d9d0f6; }
.person .name { font-family: var(--head-font); font-weight: 700; font-size: 16px; color: var(--ink); }
.person .aff { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------- HF catalogue (models page) */
.hf-search-wrap { position: relative; max-width: 560px; margin: 0 auto 10px; }
.hf-search {
  width: 100%; padding: 13px 18px 13px 46px; border: 1.5px solid #e0d9f5; border-radius: 50px;
  font-family: var(--body-font); font-size: 15px; color: var(--ink); background: #fff; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.hf-search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(109,90,224,0.12); }
.hf-search-wrap .bi-search { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 16px; }
.hf-search-hint { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 26px; }
.hf-noresult { text-align: center; color: var(--muted); padding: 20px; display: none; }

.hf-org { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 26px 26px 20px; margin-bottom: 22px; box-shadow: var(--shadow); }
.hf-org-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hf-org-title { display: flex; align-items: center; gap: 14px; }
.hf-org-icon { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(160deg, #ffd166, #ffb703); color: #211f45; display: flex; align-items: center; justify-content: center; font-size: 24px; flex: 0 0 auto; }
.hf-org-title h3 { margin: 0; font-family: var(--mono-font); font-size: 19px; }
.hf-org-title h3 a { color: var(--ink); }
.hf-org-title h3 a:hover { color: var(--accent); }
.hf-org-title p { margin: 3px 0 0; font-size: 13.5px; color: var(--muted); }
.hf-org-btn { flex: 0 0 auto; background: var(--accent); color: #fff; font-family: var(--head-font); font-weight: 600; font-size: 13.5px; padding: 9px 18px; border-radius: 50px; display: inline-flex; align-items: center; gap: 7px; transition: background 0.2s; }
.hf-org-btn:hover { background: var(--accent-dark); color: #fff; }
.hf-org-count { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: #9c99bd; font-weight: 700; margin: 14px 0 4px; }
.hf-group { margin-top: 16px; }
.hf-group h4 { font-size: 14.5px; font-family: var(--head-font); font-weight: 700; color: var(--ink); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.hf-group h4 i { color: var(--accent); }
.hf-group h4 .hf-n { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 50px; padding: 2px 9px; }
.hf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hf-chip { font-family: var(--mono-font); font-size: 12.5px; color: #4a4570; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s; }
.hf-chip:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); }

/* ---------------------------------------------------------------- misc */
.prose > * + * { margin-top: 1em; }
.prose h3 { margin-top: 1.6em; }
.divider { height: 1px; background: var(--line); border: 0; margin: 48px 0; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack-lg > * + * { margin-top: 22px; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  background: #1a1836; color: rgba(255,255,255,0.72);
  padding: 48px 0 32px; margin-top: 0; text-align: center;
}
.site-footer img { width: 46px; height: 46px; margin-bottom: 14px; }
.site-footer .f-tag { color: rgba(255,255,255,0.86); font-size: 15px; margin-bottom: 18px; }
.site-footer .f-nav { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.site-footer .f-nav a { color: rgba(255,255,255,0.72); font-family: var(--head-font); font-weight: 500; font-size: 14.5px; }
.site-footer .f-nav a:hover { color: #fff; }
.site-footer .f-copy { font-size: 13px; color: rgba(255,255,255,0.5); line-height: 1.7; }
.site-footer .f-copy a { color: rgba(255,255,255,0.72); }
.site-footer .f-copy a:hover { color: #fff; }
