/* What's on Docker's Model Shelf? — every model in Docker Hub's ai namespace.
 *
 * Shares the paper, type and sidebar of the other AI apps. One hue: the
 * accent marks the model in hand; everything else is ink and grey. Scores AA
 * only estimated are drawn hollow, so the page reads in grayscale.
 */
:root {
  --paper: #f5f3ec;
  --card: #fbfaf6;
  --ink: #1c1b18;
  --ink-2: #4f4c45;
  --ink-3: #847f74;
  --rule: #dad5c9;
  --rule-soft: #e8e4d9;
  --accent: #a64f2a;
  --bar: #2f6f9a;
  --wash: rgba(28, 27, 24, 0.045);
  --sel: rgba(166, 79, 42, 0.09);

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --side-w: 336px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: calc(var(--appnav-h, 0px) + 24px); }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 0.86em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  max-width: 1720px;
  margin: 0 auto;
}
.side {
  position: sticky;
  top: var(--appnav-h, 0px);
  height: calc(100vh - var(--appnav-h, 0px));
  height: calc(100dvh - var(--appnav-h, 0px));
  border-right: 1px solid var(--rule-soft);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.side-inner { padding: 1.3rem 1.2rem 1.6rem 1.35rem; }

.kicker, .side-h {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.wordmark {
  margin-top: 0.3rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2.5rem;
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.wordmark em { font-style: italic; color: var(--accent); }
.lede { margin-top: 0.7rem; font-size: 0.86rem; line-height: 1.55; color: var(--ink-2); }
.lede strong { color: var(--ink); font-weight: 600; }

.seg { display: flex; margin-top: 1rem; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg[hidden] { display: none; }
.seg-sub { margin-top: 0.4rem; }
.seg button { flex: 1; font-size: 0.72rem; font-weight: 500; padding: 0.3rem 0.45rem; border: 0; background: var(--card); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover { background: var(--wash); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.search { display: grid; gap: 0.25rem; margin-top: 1rem; }
.search input {
  width: 100%;
  font-size: 0.82rem;
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--card);
}

.filters { margin-top: 0.9rem; display: grid; gap: 0.3rem; }
.filters .side-h + .chips { margin-bottom: 0.45rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.chip {
  font-size: 0.7rem;
  padding: 0.12rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { background: var(--wash); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .n { font-family: var(--mono); font-size: 0.62rem; opacity: 0.65; margin-left: 0.2rem; }
.check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--ink-2); cursor: pointer; }
.count { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); }

.readout { margin-top: 1.1rem; padding-top: 0.8rem; border-top: 1px solid var(--rule-soft); }
.r-name { margin-top: 0.25rem; font-family: var(--mono); font-size: 0.95rem; font-weight: 600; word-break: break-word; }
.r-sub { font-size: 0.74rem; color: var(--ink-3); }
.r-desc { margin-top: 0.4rem; font-size: 0.8rem; color: var(--ink-2); line-height: 1.45; }
.r-grid { margin-top: 0.55rem; display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.8rem; font-size: 0.76rem; }
.r-grid dt { color: var(--ink-3); }
.r-grid dd { font-family: var(--mono); font-size: 0.72rem; text-align: right; }
.r-h { margin-top: 0.7rem; }
.r-vars { margin-top: 0.25rem; display: grid; gap: 0; font-size: 0.72rem; }
.r-var { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) auto; gap: 0.5rem; padding: 0.22rem 0; border-top: 1px solid var(--rule-soft); align-items: baseline; }
.r-var .t { font-family: var(--mono); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.r-var .s { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-var .v { font-family: var(--mono); font-weight: 600; text-align: right; white-space: nowrap; }
.r-cmd {
  margin-top: 0.7rem;
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 5px;
  padding: 0.4rem 0.55rem;
  overflow-x: auto;
  white-space: nowrap;
}
.r-links { margin-top: 0.45rem; font-size: 0.74rem; }
.r-empty { margin-top: 0.3rem; font-size: 0.78rem; color: var(--ink-3); }
.side-foot { margin-top: 1.2rem; font-size: 0.74rem; color: var(--ink-3); }

.est-mark {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 0.2rem;
  margin-left: 0.2rem;
  vertical-align: 1px;
}

/* ---------- the table ---------- */

.main { min-width: 0; }
/* The table scrolls inside its own full-height pane, so its header can stick
 * while it scrolls sideways too. */
.table-wrap {
  height: calc(100vh - var(--appnav-h, 0px));
  height: calc(100dvh - var(--appnav-h, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.table-wrap[hidden] { display: none; }
.models { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.models th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: 0;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.models th button {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  text-align: inherit;
  padding: 0.75rem 0.5rem 0.45rem;
  cursor: pointer;
}
.models th button:hover { color: var(--ink); }
.models th.num, .models td.num { text-align: right; }
.models th[aria-sort] button { color: var(--ink); }
.models th[aria-sort="descending"] button::after { content: " ↓"; }
.models th[aria-sort="ascending"] button::after { content: " ↑"; }
.models td { padding: 0.36rem 0.5rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; white-space: nowrap; }
.models tbody tr { cursor: pointer; }
.models tbody tr:hover { background: var(--wash); }
.models tbody tr[aria-selected="true"] { background: var(--sel); }
.models tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.models td:first-child { padding-left: 1.2rem; }
.models th:first-child button { padding-left: 1.2rem; }
.m-name { font-family: var(--mono); font-weight: 600; font-size: 0.8rem; }
.m-desc { display: block; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; font-size: 0.7rem; color: var(--ink-3); }
.m-kind { font-size: 0.74rem; color: var(--ink-2); }
.m-fmt { font-family: var(--mono); font-size: 0.64rem; color: var(--ink-2); }
.m-fmt span + span::before { content: " · "; color: var(--rule); }
.mono { font-family: var(--mono); font-size: 0.74rem; }
.dim { color: var(--ink-3); }

/* a value with its bar behind it */
.barcell { display: grid; grid-template-columns: 3.6rem 56px; gap: 0.5rem; align-items: center; justify-content: end; }
.barcell .val { font-family: var(--mono); font-size: 0.74rem; text-align: right; }
.barcell .track { height: 6px; border-radius: 0 3px 3px 0; background: var(--rule-soft); position: relative; overflow: hidden; }
.barcell .fill { position: absolute; inset: 0 auto 0 0; background: var(--ink-2); border-radius: 0 3px 3px 0; }
.barcell.score .fill { background: var(--bar); }
.barcell.score.est .fill { background: none; border: 1px solid var(--bar); border-left: 0; }
.barcell .val small { color: var(--ink-3); font-size: 0.6rem; }
.none { color: var(--rule); font-family: var(--mono); }

/* ---------- the map ---------- */

.chart { padding: 1rem 1.2rem 1rem 0.6rem; height: calc(100vh - var(--appnav-h, 0px)); height: calc(100dvh - var(--appnav-h, 0px)); min-height: 460px; }
.chart[hidden] { display: none; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ax-line { stroke: var(--rule); }
.ax-grid { stroke: var(--rule-soft); }
.ax-t { font-family: var(--mono); font-size: 10px; fill: var(--ink-3); }
.ax-title { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--ink-2); }
.dot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; cursor: pointer; }
.dot.est { fill: var(--paper); stroke: var(--ink-2); stroke-width: 1.4; }
.dot.on { fill: var(--accent); stroke: var(--paper); }
.dot.est.on { fill: var(--paper); stroke: var(--accent); stroke-width: 2.2; }
.dot-hit { fill: transparent; cursor: pointer; }
.lbl { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.lbl.on { fill: var(--accent); font-weight: 600; }
.chart-note { font-family: var(--sans); font-size: 11px; fill: var(--ink-3); }

/* ---------- prose ---------- */

.reading, .sources {
  max-width: 1720px;
  margin: 0 auto;
  padding: 2.6rem 2rem 0 calc(var(--side-w) + 2rem);
}
.sec-h { font-family: var(--serif); font-weight: 400; font-size: 2.1rem; line-height: 1; }
.sec-h em { font-style: italic; color: var(--accent); }
.reading p, .reading li, .sources li { max-width: 74ch; font-size: 0.92rem; color: var(--ink-2); }
.reading p { margin-top: 0.75rem; }
.reading strong { color: var(--ink); font-weight: 600; }
.reading ul, .sources ul { margin-top: 0.8rem; padding-left: 1.1rem; display: grid; gap: 0.5rem; }
.sources li { font-size: 0.84rem; }
.colophon {
  max-width: 1720px;
  margin: 2.4rem auto 0;
  padding: 1.2rem 2rem 3rem calc(var(--side-w) + 2rem);
  font-size: 0.76rem;
  color: var(--ink-3);
  border-top: 1px solid var(--rule-soft);
}

.tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  max-width: 280px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-size: 0.76rem;
  line-height: 1.4;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}
.tip b { font-family: var(--mono); font-weight: 600; }
.tip .tip-g { display: grid; grid-template-columns: auto 1fr; gap: 0 0.7rem; margin-top: 0.3rem; font-family: var(--mono); font-size: 0.68rem; color: #dcd8cd; }
.tip .tip-g span:nth-child(odd) { color: #a9a497; }

/* ---------- narrow screens ---------- */

@media (max-width: 1099px) {
  :root { --side-w: 300px; }
  .wordmark { font-size: 2.2rem; }
}
@media (max-width: 860px) {
  .layout { display: block; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .side-inner { padding: 1.1rem 1rem 1.2rem; }
  .table-wrap { height: 80vh; }
  .models td:first-child, .models th:first-child button { padding-left: 1rem; }
  .chart { height: 72vh; padding: 0.8rem 1rem 0.8rem 0.2rem; }
  .reading, .sources, .colophon { padding-left: 1rem; padding-right: 1rem; }
}
.m-desc b { font-weight: 500; color: var(--ink-2); }

/* the pulls bar, on a log scale */
.logbar { grid-template-columns: 3.6rem 96px; }
.logbar .track { height: 8px; overflow: visible; }
.logbar .fill { background: var(--ink-2); }
.logbar.t1 .fill { background: var(--ink-3); opacity: 0.45; }
.logbar.t2 .fill { background: var(--ink-3); }
.logbar.t3 .fill { background: var(--ink); }
.logbar.t1 .val { color: var(--ink-3); }
.logbar .tick { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--ink-3); opacity: 0.55; }
.m-sub { display: block; font-size: 0.64rem; color: var(--ink-3); }
