/* Project page: Adapting a billion-parameter vision model with few labels */
:root {
  color-scheme: light;
  --bg: #fbfaf6;
  --surface: #ffffff;
  --sunken: #f3f1ea;
  --ink: #1d2320;
  --ink-2: #3d4642;
  --muted: #5f6763;
  --line: #e2ded3;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --note: #fff7e3;
  --note-line: #d9b45a;
  /* chart roles (validated: scripts/validate_palette.py, all-pairs, light surface) */
  --c-qlora: #2a78d6;
  --c-dora: #eb6834;
  --c-frozen: #1baf7a;
  --c-scratch: #8a8983;
  --grid: #ebe8df;
  --axis: #c3c2b7;
  --ring: #ffffff;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111513; --surface: #181d1a; --sunken: #0d100f;
    --ink: #e8ece9; --ink-2: #c5ccc8; --muted: #9aa39e; --line: #2d3531;
    --accent: #7ab8e6; --accent-ink: #0c1411; --note: #2a2412; --note-line: #8a7236;
    --c-qlora: #3987e5; --c-dora: #d95926; --c-frozen: #199e70; --c-scratch: #8a8983;
    --grid: #262c29; --axis: #3d4541; --ring: #181d1a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111513; --surface: #181d1a; --sunken: #0d100f;
  --ink: #e8ece9; --ink-2: #c5ccc8; --muted: #9aa39e; --line: #2d3531;
  --accent: #7ab8e6; --accent-ink: #0c1411; --note: #2a2412; --note-line: #8a7236;
  --c-qlora: #3987e5; --c-dora: #d95926; --c-frozen: #199e70; --c-scratch: #8a8983;
  --grid: #262c29; --axis: #3d4541; --ring: #181d1a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.62 var(--sans); }
a { color: var(--accent); text-underline-offset: 2px; }
img { display: block; max-width: 100%; height: auto; }
code { font: .86em var(--mono); background: var(--sunken); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; line-height: 1.45; margin: 0; }
pre code { background: none; padding: 0; font-size: 13.5px; overflow-wrap: normal; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -.005em; }
h2 { font-size: 34px; margin: 0 0 10px; }
h3 { font-size: 22px; margin: 40px 0 8px; }
p { margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 10px max(16px, calc((100vw - 1100px) / 2));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font: 600 17px var(--serif); color: var(--ink); text-decoration: none; white-space: nowrap; }
.top nav { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; font-size: 15px; flex: 1; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.top nav a:hover, .top nav a[aria-current="true"] { color: var(--ink); }
.theme-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; line-height: 1; flex: none; }
.theme-toggle:hover { border-color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
section { padding: 64px 0 8px; }
section + section { border-top: 1px solid var(--line); margin-top: 48px; }
.section-lead { font-size: 19px; color: var(--ink-2); max-width: 820px; }
.prose { max-width: 820px; }

/* hero */
.hero { padding-top: 56px; }
.eyebrow { font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.hero h1 { font-size: clamp(34px, 5.2vw, 56px); margin: 0 0 14px; max-width: 900px; }
.paper-title { font-style: italic; color: var(--ink-2); max-width: 860px; font-size: 18px; }
.authors { color: var(--muted); font-size: 15.5px; margin-bottom: 22px; }
.lead { font-size: 19.5px; max-width: 860px; color: var(--ink-2); }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 8px; }
.button { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; font-size: 15px; font-weight: 600; text-decoration: none; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.button.ghost { background: transparent; color: var(--accent); }
.button:hover { filter: brightness(1.06); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 34px 0 4px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.tile .value { font-size: 36px; font-weight: 650; line-height: 1.1; color: var(--ink); }
.tile .label { font-size: 14.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.tile .key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* cards */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 22px 0; }
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.card h4 { margin: 0 0 6px; font: 600 17px var(--sans); }
.card p { font-size: 15.5px; color: var(--ink-2); margin: 0 0 8px; }
.card .tag { display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.card .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.card ul { margin: 6px 0 0; padding-left: 18px; font-size: 15px; color: var(--ink-2); }
.card .stat { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px; }
@media (max-width: 860px) { .cards, .cards.two { grid-template-columns: minmax(0, 1fr); } }

.questions { counter-reset: q; list-style: none; padding: 0; margin: 18px 0; max-width: 820px; }
.questions li { counter-increment: q; position: relative; padding: 2px 0 10px 44px; }
.questions li::before { content: counter(q); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%; background: var(--sunken); border: 1px solid var(--line); text-align: center; font: 600 15px/28px var(--sans); color: var(--ink-2); }

.note { background: var(--note); border: 1px solid var(--note-line); border-radius: 10px; padding: 14px 16px; font-size: 15.5px; color: var(--ink-2); }

/* figures and charts */
figure { margin: 26px 0; }
.chart-frame { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px 12px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 6px; }
.chart-title { font: 600 17px var(--sans); margin: 0; }
.chart-sub { font-size: 14.5px; color: var(--muted); margin: 2px 0 10px; }
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); }
figcaption { font-size: 15px; color: var(--muted); margin-top: 10px; max-width: 860px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--ink-2); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.legend i.sq { border-radius: 2px; }
.legend i.dia { width: 9px; height: 9px; border-radius: 1px; transform: rotate(45deg); margin: 0 2px; }
.legend i.open { background: transparent !important; border: 2px solid var(--muted); }
.legend i.line { width: 18px; height: 2px; border-radius: 2px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 10px; font-size: 14.5px; color: var(--ink-2); }
.controls select, .seg button { font: 14.5px var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; cursor: pointer; padding: 6px 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

details.table-view { margin-top: 8px; font-size: 14.5px; }
details.table-view summary { cursor: pointer; color: var(--muted); width: fit-content; }
details.table-view summary:hover { color: var(--ink); }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; margin: 10px 0; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.group td { font-weight: 600; color: var(--muted); background: var(--sunken); font-size: 13.5px; letter-spacing: .02em; }
.bar-cell { width: 34%; min-width: 120px; }
.inline-bar { height: 10px; border-radius: 0 4px 4px 0; background: var(--muted); opacity: .55; min-width: 2px; }

/* the 1:98 figure */
.ratio { display: grid; grid-template-columns: auto 1fr; gap: 18px 30px; align-items: center; margin: 26px 0 6px; }
.ratio .one, .ratio .many { display: flex; flex-direction: column; gap: 8px; }
.ratio .grid { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; max-width: 520px; }
.ratio .cell { aspect-ratio: 1; border-radius: 3px; background: var(--axis); }
.ratio .cell.train { background: var(--accent); width: 30px; }
.ratio .cap { font-size: 14.5px; color: var(--muted); }
.ratio .big { font: 650 30px var(--sans); color: var(--ink); line-height: 1.1; }

/* adapter placement */
.block { display: grid; gap: 10px; max-width: 560px; margin: 10px 0; }
.block .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.block .row .name { width: 120px; font-size: 14px; color: var(--muted); }
.chip { font: 13.5px var(--mono); padding: 5px 10px; border-radius: 7px; border: 1.5px dashed var(--line); color: var(--muted); background: var(--surface); }
.chip.on { border-style: solid; border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }

/* tooltip */
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.14); border-radius: 9px; padding: 9px 11px; font-size: 13.5px; line-height: 1.45; max-width: 300px; opacity: 0; transition: opacity .08s; }
.tip.show { opacity: 1; }
.tip .t-head { font-weight: 600; margin-bottom: 4px; color: var(--ink-2); }
.tip .t-row { display: flex; align-items: center; gap: 8px; }
.tip .t-row b { font-variant-numeric: tabular-nums; }
.tip .t-key { width: 14px; height: 3px; border-radius: 2px; flex: none; }
.tip .t-muted { color: var(--muted); }

/* citation */
.cite { position: relative; margin: 12px 0 18px; }
.copy { position: absolute; top: 8px; right: 8px; font: 13px var(--sans); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 7px; padding: 4px 9px; cursor: pointer; }

footer { max-width: 1100px; margin: 64px auto 0; padding: 22px 16px 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14.5px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  h2 { font-size: 28px; }
  .lead, .section-lead { font-size: 17.5px; }
  .ratio { grid-template-columns: minmax(0, 1fr); }
  .tile .value { font-size: 30px; }
  .chart-frame { padding: 14px 10px 10px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (forced-colors: active) { .chip.on { border-style: double; } }
