:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.05);
  --accent: #2a78d6;
  --brand: #0b0b0b;       /* primary buttons, selected tab */
  --on-brand: #f9f9f7;
  --critical: #d03b3b;
  --idle: #e9e8e2;

  /* Categorical slots, in the validated order. Colour follows the component, never its rank. */
  --c-routed: #2a78d6;
  --c-shared: #eb6834;
  --c-attn_linear: #1baf7a;
  --c-attn_full: #eda100;
  --c-latent: #e87ba4;
  --c-dense: #008300;
  --c-embed: #4a3aa7;
  --c-vision: #e34948;
  --c-other: #a3a29b;
  --c-unclassified: #d6d5ce;

  /* Models in the hardware chart: two neutral inks, so they don't borrow a component's hue. */
  --m-0: #52514e;
  --m-1: #a3a29b;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #080808;
    --surface: #121211;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.12);
    --wash: rgba(255, 255, 255, 0.06);
    --accent: #3987e5;
    --brand: #ffffff;
    --on-brand: #080808;
    --idle: #2c2c2a;
    --c-routed: #3987e5;
    --c-shared: #d95926;
    --c-attn_linear: #199e70;
    --c-attn_full: #c98500;
    --c-latent: #d55181;
    --c-dense: #008300;
    --c-embed: #9085e9;
    --c-vision: #e66767;
    --c-other: #6b6a65;
    --c-unclassified: #45443f;
    --m-0: #c3c2b7;
    --m-1: #6b6a65;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #080808;
  --surface: #121211;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.12);
  --wash: rgba(255, 255, 255, 0.06);
  --accent: #3987e5;
  --brand: #ffffff;
  --on-brand: #080808;
  --idle: #2c2c2a;
  --c-routed: #3987e5;
  --c-shared: #d95926;
  --c-attn_linear: #199e70;
  --c-attn_full: #c98500;
  --c-latent: #d55181;
  --c-dense: #008300;
  --c-embed: #9085e9;
  --c-vision: #e66767;
  --c-other: #6b6a65;
  --c-unclassified: #45443f;
  --m-0: #c3c2b7;
  --m-1: #6b6a65;
}

/* Brand theme (dark based). The five brand colors are the ones supplied; text shades, dimmed lines and washes are
   derived from them and checked for contrast (text >= 4.5:1). Chart colors are the dark set, validated against
   this surface. */
:root[data-theme="brand"] {
  color-scheme: dark;
  --page: #00010d;              /* supplied */
  --surface: #090b17;           /* supplied */
  --brand: #d99116;             /* supplied */
  --on-brand: #141414;          /* supplied */
  --border: #d99116;            /* supplied line color: card, input, header and footer borders */
  --text-primary: #f4f4f8;      /* 17.9:1 on surface */
  --text-secondary: #b8bbd0;    /* 10.3:1 */
  --text-muted: #8c90aa;        /* 6.2:1 */
  --grid: rgba(217, 145, 22, 0.24);   /* table lines and chart gridlines: the line color, dimmed */
  --axis: rgba(217, 145, 22, 0.45);
  --wash: rgba(217, 145, 22, 0.12);   /* hover and selected highlights */
  --accent: #d99116;            /* focus outlines, spinner */
  --critical: #ff6b6b;          /* errors: 7.1:1 (the usual red is too dark on navy) */
  --idle: #23263d;
  --c-routed: #3987e5;
  --c-shared: #d95926;
  --c-attn_linear: #199e70;
  --c-attn_full: #c98500;
  --c-latent: #d55181;
  --c-dense: #008300;
  --c-embed: #9085e9;
  --c-vision: #e66767;
  --c-other: #676b85;
  --c-unclassified: #3a3d56;
  --m-0: #b8bbd0;
  --m-1: #676b85;
}

* { box-sizing: border-box; }

body {
  display: flex; flex-direction: column; min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.page { flex: 1 0 auto; width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 16px 48px; }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; font-weight: 650; }
.page-heading { margin-bottom: 18px; overflow-wrap: anywhere; }
h2 { font-size: 17px; margin: 0 0 4px; font-weight: 600; }
.sub { margin: 0 0 16px; color: var(--text-secondary); max-width: 80ch; font-size: 14px; }
code { font-size: 0.92em; }


button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ghost { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; }
.ghost:hover { background: var(--wash); }
.icon { padding: 7px; display: inline-flex; color: var(--text-secondary); }
.primary { background: var(--brand); color: var(--on-brand); border: 0; border-radius: 8px; padding: 9px 18px; font-weight: 600; }
.primary:hover { opacity: 0.88; }

.pick { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 260px; min-width: 0; }
.field label { font-size: 13px; color: var(--text-secondary); }
.pick input {
  width: 100%; font: inherit; color: var(--text-primary); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}

/* Search suggestions under each model box */
.combo { position: relative; }
.combo-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}
.combo-head { padding: 4px 8px 6px; font-size: 12px; color: var(--text-muted); }
.combo-empty { padding: 6px 8px 8px; font-size: 13px; color: var(--text-secondary); }
.combo-opt {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.combo-opt[aria-selected="true"], .combo-opt:hover { background: var(--wash); }
.combo-opt .name { min-width: 0; overflow-wrap: anywhere; }
.combo-opt .org { color: var(--text-muted); }
.combo-opt .meta-r { flex: none; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.summary { margin: 14px 0 0; color: var(--text-secondary); font-size: 14px; max-width: 90ch; }
.summary:empty { display: none; }
.opt { color: var(--text-muted); }
/* The analyzer's two modes: one model, or two side by side. */
#tool[data-mode="analyze"] .compare-only, #tool[data-mode="compare"] .analyze-only { display: none; }
.vs { color: var(--text-muted); padding-bottom: 9px; }
@media (max-width: 600px) {
  .vs { display: none; }
  .compare .ratio { display: none; }
}

.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 8px; font-size: 13px; color: var(--text-muted); }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; font-size: 13px; color: var(--text-secondary);
  /* Names come from trending, so a long one is cut short; the full ids are in the tooltip. */
  max-width: min(100%, 26em); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { background: var(--wash); }

.status { min-height: 24px; margin: 8px 0 16px; color: var(--text-secondary); font-size: 14px; }
.status.error { color: var(--critical); }
.status.warn { color: var(--text-primary); }
.status.warn::before {
  content: "!"; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  margin-right: 8px; border: 1.5px solid #fab219; border-radius: 50%; color: #fab219; font-size: 11px; font-weight: 700;
  vertical-align: -3px;
}
.status.busy::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%;
  border: 2px solid var(--axis); border-top-color: var(--accent); vertical-align: -1px; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation: none; } }

#out { transition: opacity 0.2s; }
#out.stale { opacity: 0.45; pointer-events: none; }

/* The base line is an inset shadow, not a border, so the selected tab's underline can cover it without spilling
   out of the bar (which, with sideways scrolling allowed, gave the bar a 1px vertical scrollbar). Only sideways
   scrolling, for narrow screens. */
.tabs {
  display: flex; gap: 4px; margin-bottom: 16px; box-shadow: inset 0 -1px 0 var(--border);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.tabs button {
  border: 0; background: transparent; padding: 10px 14px; font-size: 14px; white-space: nowrap;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
}
.tabs button:hover { color: var(--text-primary); }
.tabs button[aria-selected="true"] { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--brand); }
.tabs button:focus-visible { outline-offset: -2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }


/* Comparison table (two models) */
.compare { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.compare thead th:nth-child(1) { width: 22%; }
.compare thead th:nth-child(2), .compare thead th:nth-child(3) { width: 30%; }
/* One model: the label column keeps the comparison's width and the value takes the rest. */
.compare.single thead th:nth-child(2) { width: auto; }
.compare td, .compare th { overflow-wrap: anywhere; }
.compare th, .compare td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.compare thead th { font-weight: 600; font-size: 13px; color: var(--text-secondary); }
.compare td.v { font-weight: 600; }
.compare td.ratio { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare .note { display: block; font-weight: 400; font-size: 12px; color: var(--text-muted); }
.info {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 6px;
  position: relative; padding: 0; border: 1px solid var(--axis); border-radius: 50%; background: transparent; color: var(--text-muted);
  font: 600 10px/1 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; vertical-align: 1px;
}
.info:hover, .info:focus-visible { color: var(--text-primary); border-color: var(--text-secondary); }
.info::before { content: ""; position: absolute; inset: -6px; } /* larger hit target */
.more { margin-top: 14px; }
.more > summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.more .table-scroll { margin-top: 10px; }
.tip { max-width: 380px; }
.tip .pieces { margin: 4px 0 6px; padding-left: 16px; font-size: 12px; line-height: 1.5; }
.tip code { font-size: 11px; }

/* At-home fit table. Status colour always comes with an icon and a label. */
.home { width: 100%; border-collapse: collapse; font-size: 14px; }
.home th, .home td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.home thead th { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.home thead .model-head { color: var(--text-primary); border-bottom: 0; padding-bottom: 0; }
.home tbody th { font-weight: 600; white-space: nowrap; }
.home .note { display: block; font-weight: 400; font-size: 12px; color: var(--text-muted); }
.fit { display: flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.home td .note { margin-top: 2px; }
.st-good { color: #0ca30c; }
.st-warning { color: #fab219; }
.st-critical { color: #d03b3b; }
.model-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--axis); }
.model-link:hover { border-bottom-color: var(--text-primary); }
.meta { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* Charts */
.chart { width: 100%; }
svg { display: block; overflow: visible; }
svg text { fill: var(--text-secondary); font-size: 12px; font-family: inherit; }
svg .row-label { fill: var(--text-primary); font-weight: 600; font-size: 13px; }
svg .value-label { fill: var(--text-primary); font-size: 12px; font-variant-numeric: tabular-nums; }
svg .tick { fill: var(--text-muted); font-variant-numeric: tabular-nums; }
svg .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
svg .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
svg .hit { cursor: default; }
svg .hit:focus { outline: none; }
svg .hit:focus-visible > *:first-child, svg rect.hit:focus-visible { stroke: var(--text-primary); stroke-width: 2; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.pair.single { grid-template-columns: 1fr; }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; } }
.pane-title { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.pane-sub { font-size: 13px; color: var(--text-secondary); margin: 0 0 10px; }

.layer-block { margin-bottom: 18px; }
.layer-block:last-child { margin-bottom: 0; }

#reroute { margin-bottom: 14px; font-size: 13px; }
.route-cell { transition: fill 0.25s; }
@media (prefers-reduced-motion: reduce) { .route-cell { transition: none; } }

.tables { margin-top: 20px; font-size: 13px; }
/* Let each table scroll inside its own column instead of widening the page on small screens. */
.tables > div { min-width: 0; }
.data { border-collapse: collapse; margin-top: 10px; width: 100%; font-variant-numeric: tabular-nums; }
.data th, .data td { padding: 6px 10px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; }
.data th:first-child, .data td:first-child { text-align: left; }
.data thead th { color: var(--text-secondary); font-weight: 600; }
.data .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.table-scroll { overflow-x: auto; }

.tip {
  position: fixed; top: 0; left: 0; z-index: 10; pointer-events: none; max-width: 300px;
  background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; line-height: 1.45; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}
.tip b { font-weight: 600; }
.tip .muted { color: var(--text-secondary); }
.tip .key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }


/* What couldn't be worked out for a model, above the tabs */
.notice { margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--border); border-left: 3px solid #fab219;
  border-radius: 8px; background: var(--surface); font-size: 14px; color: var(--text-secondary); }
.notice p { margin: 0; }
.notice p + p { margin-top: 6px; }
.notice b { color: var(--text-primary); font-weight: 600; }

/* Site header: name and slogan, main navigation, theme toggle */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; text-decoration: none; color: inherit; margin-right: auto; }
.brand-name { font-size: 18px; font-weight: 650; line-height: 1.25; }
.brand-slogan { font-size: 13px; color: var(--text-secondary); }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  padding: 7px 12px; border-radius: 8px; font-size: 14px; text-decoration: none; color: var(--text-secondary);
}
.site-nav a:hover { background: var(--wash); color: var(--text-primary); }
.site-nav a[aria-current="page"] { color: var(--text-primary); font-weight: 600; background: var(--wash); }
.site-nav a:focus-visible, .brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* "Can my GPU handle this model?" at the top of the Hardware tab */
.gc-form { display: flex; flex-wrap: wrap; gap: 12px 16px; margin: 4px 0 14px; }
.gc-form .field { flex: 0 1 auto; }
.gc-form select {
  font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; max-width: 100%;
}
.gc-form select:disabled { opacity: 0.5; }
.gc-result { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.gc-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--grid); border-radius: 10px; min-width: 0; }
.gc-model { font-weight: 600; overflow-wrap: anywhere; }
.gc-status { font-size: 18px; font-weight: 600; gap: 8px; }
.gc-card .note { font-size: 13px; color: var(--text-secondary); }
.gc-link { margin: 14px 0 0; font-size: 14px; }

/* Hardware picker */
.hw-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 8px 0 18px; }
.hw-form .field { flex: 0 1 auto; }  /* sized to their options, unlike the search form's wide fields */
.hw-form label { font-size: 13px; color: var(--text-secondary); }
.hw-form select {
  font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; max-width: 100%;
}
.hw-form select:disabled { opacity: 0.5; }
.hw-form .check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-primary); padding-bottom: 8px; }
.js .hw-submit { display: none; }  /* with JavaScript, every change reloads the table */
.hw-table td { vertical-align: top; }
.hw-table tr.no-fit th a, .hw-table tr.no-fit td { color: var(--text-muted); }
.hw-table .meta-line { display: block; font-size: 12px; color: var(--text-muted); }
.hw-table .meta-line.warn { color: var(--text-secondary); font-style: italic; }
@media (max-width: 600px) {
  .hw-form .field { flex: 1 1 40%; }
  .hw-form .field select { width: 100%; }
  .hw-form .check { flex-basis: 100%; padding-bottom: 0; }
}

/* Home page */
.hero { padding: 28px 0 20px; }
.hero-title { font-size: clamp(28px, 4.4vw, 42px); line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.01em; }
.hero-sub { font-size: 17px; color: var(--text-secondary); margin: 0 0 20px; max-width: 62ch; }
.hero-search { display: flex; gap: 10px; max-width: 760px; }
.hero-search input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-primary);
}
.hero-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hero-search .primary { padding: 12px 22px; font-size: 15px; border-radius: 10px; }
.hero-gpu { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; font-size: 15px; }
.hero-gpu label { font-weight: 600; }
.hero-gpu select {
  font: inherit; color: var(--text-primary); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; max-width: 100%;
}
.hero-gpu-link { color: var(--text-primary); font-weight: 600; text-decoration-color: var(--brand); text-underline-offset: 3px; }
.features { list-style: none; margin: 8px 0 20px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--text-primary); text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease;
}
.feature svg { color: var(--brand); }
.feature:hover { background: var(--wash); transform: translateY(-2px); }
.feature:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.feature-title { font-size: 17px; font-weight: 650; }
.feature-desc { font-size: 14px; color: var(--text-secondary); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 14px; }
.home-new, .home-guides { margin: 20px 0; }  /* the trending cards drop their own margin in the grid above */
.nm-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.nm-card[hidden] { display: none; }  /* the page an item is on wins over the card layout */
.nm-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--grid); border-radius: 10px; min-width: 0; }
.nm-name { font-weight: 650; color: var(--text-primary); text-decoration: none; overflow-wrap: anywhere; }
.nm-name:hover { text-decoration: underline; text-decoration-color: var(--brand); }
.nm-name .org { color: var(--text-muted); font-weight: 400; }
.nm-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--wash); color: var(--text-secondary); }
.nm-runs { font-size: 13px; font-weight: 600; text-decoration: none; }
a.nm-runs:hover { text-decoration: underline; }
.nm-card .meta-line { font-size: 12px; color: var(--text-muted); }
.home-guide-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.guide-card {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px 16px; border: 1px solid var(--grid);
  border-radius: 10px; color: var(--text-primary); text-decoration: none;
}
.guide-card:hover { background: var(--wash); }
.guide-card .guide-item-title { font-weight: 650; }
.guide-card .guide-item-desc { font-size: 14px; color: var(--text-secondary); }
@media (max-width: 760px) {
  .features { grid-template-columns: 1fr; }
  .hero-search { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .feature { transition: none; } .feature:hover { transform: none; } }

/* Guides */
.guide-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.guide-item a {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--text-primary);
}
.guide-item a:hover { background: var(--wash); }
.guide-item a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.guide-item-title { font-size: 18px; font-weight: 650; }
.guide-item-desc { color: var(--text-secondary); }
.guide-item .meta-line { font-size: 12px; color: var(--text-muted); }
.prose { max-width: 760px; font-size: 16px; line-height: 1.65; }
.prose .post-meta { font-size: 13px; color: var(--text-muted); margin: 0 0 6px; }
.prose h2 { font-size: 22px; margin: 32px 0 8px; }
.prose h3 { font-size: 18px; margin: 24px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose li { margin: 4px 0; }
.prose a:not(.model-link) { color: var(--text-primary); text-decoration-color: var(--brand); text-underline-offset: 3px; }
.prose code { font-size: 0.9em; background: var(--wash); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--wash); border: 1px solid var(--grid); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 0 0 14px; padding: 4px 14px; border-left: 3px solid var(--brand); color: var(--text-secondary); }
.guide-block { margin: 18px 0 22px; font-size: 14px; line-height: 1.5; }
.guide-block .table-scroll { border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; background: var(--surface); }
.guide-table .meta-line { display: block; font-size: 12px; color: var(--text-muted); }
.guide-note { font-size: 13px; color: var(--text-secondary); margin: 8px 0 0 !important; }

/* "Get this model": download button and a command with a copy button */
.get-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-weight: 600;
  font-size: 14px; text-decoration: none; background: var(--brand); color: var(--on-brand);
}
.get-btn:hover { filter: brightness(1.08); }
.get-btn:focus-visible, .copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cmd {
  display: flex; align-items: center; gap: 8px; margin-top: 6px; max-width: 100%; padding: 4px 4px 4px 10px;
  border: 1px solid var(--grid); border-radius: 8px; background: var(--wash);
}
.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 12.5px; color: var(--text-primary); }
.copy-btn {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); border-radius: 6px;
  padding: 3px 10px; font-size: 12px;
}
.copy-btn:hover { background: var(--wash); }
.cir-answer .cmd { max-width: 640px; margin-top: 12px; }

/* "Can I run <model> on <device>?" pages */
.cir-answer .cir-short { margin: 0 0 6px; }
.cir-answer .cir-short .fit { font-size: 26px; gap: 10px; }
.cir-answer .cir-sentence { margin: 0 0 12px; font-size: 16px; max-width: 70ch; }
.cir-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.cir-actions .cir-action {  /* more specific than .button-link, which is inline-block */
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 8px; font-size: 14px;
  font-weight: 600; white-space: normal; text-align: left; transition: transform 0.12s ease, background 0.12s ease;
}
.cir-action.ghost { color: var(--text-primary); }
.cir-action:hover { transform: translateY(-1px); }
.cir-action:hover .cir-arrow { transform: translateX(2px); }
.cir-arrow { transition: transform 0.12s ease; flex: none; }
.cir-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .cir-action, .cir-arrow { transition: none; } .cir-action:hover { transform: none; } }
@media (max-width: 600px) { .cir-actions .cir-action { flex: 1 1 100%; justify-content: center; } }
.cir-list a[aria-current="page"] { border-color: var(--brand); }
.cir-list .fit { font-size: 13px; font-weight: 500; }
.cir-table td { vertical-align: middle; }
.gc-full { margin-top: 4px; font-size: 13px; }

/* Hardware hub: every device as a link, grouped */
.hw-hub-group h2 { margin-bottom: 10px; }
.hw-hub-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.hw-hub-list a {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--grid); border-radius: 10px;
  text-decoration: none; color: var(--text-primary); height: 100%;
}
.hw-hub-list a:hover { background: var(--wash); border-color: var(--border); }
.hw-hub-list a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hw-hub-name { font-weight: 600; }
.hw-hub-list .meta-line { font-size: 12px; color: var(--text-muted); }
.hw-hub-group + .hw-hub-group { margin-top: 16px; }

/* GGUF file picker above the analyzer's tabs */
.gguf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; font-size: 14px; }
.gguf-bar[hidden] { display: none; }
.gguf-bar label { font-weight: 600; }
.gguf-bar select {
  font: inherit; color: var(--text-primary); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; max-width: 100%;
}
.gguf-note { font-size: 13px; color: var(--text-secondary); }
.linklike {
  border: 0; background: transparent; padding: 0; font: inherit; font-weight: 600; color: var(--text-primary);
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px;
}
.linklike:hover { text-decoration-style: solid; }
table.home tr.current th, table.home tr.current td { background: var(--wash); }

/* Resources dropdown: a button that shows a list of links under it. */
.nav-menu { position: relative; }
.nav-button {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border: 0; border-radius: 8px;
  background: transparent; font-size: 14px; color: var(--text-secondary);
}
.nav-button:hover, .nav-button[aria-expanded="true"] { background: var(--wash); color: var(--text-primary); }
.nav-button[data-current] { color: var(--text-primary); font-weight: 600; background: var(--wash); }
.nav-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-button svg { transition: transform 0.15s; }
.nav-button[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-list {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; min-width: 180px; margin: 0; padding: 4px;
  list-style: none; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.site-nav .nav-list a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text-primary); white-space: nowrap; }
@media (max-width: 600px) {
  /* Name and theme button on the first row, the menu and links on their own row below. */
  .site-nav { order: 3; width: 100%; justify-content: space-between; }
  .site-nav > a, .nav-menu { flex: 1 1 auto; text-align: center; }
  .nav-button { width: 100%; justify-content: center; }
  /* Five items share one row: tighter padding and slightly smaller text so they fit a 360px phone. */
  .site-nav { gap: 0; flex-wrap: wrap; }  /* on the narrowest phones the row wraps rather than scrolling sideways */
  .site-nav > a, .nav-button { padding: 7px 5px; font-size: 13px; }
  .nav-button { gap: 3px; }
}
@media (max-width: 380px) {
  .site-nav > a, .nav-button { padding: 7px 3px; font-size: 12.5px; }
}

/* Site footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.site-footer-inner { max-width: 1120px; margin: 0 auto; padding: 16px; font-size: 13px; color: var(--text-muted); }

/* Landing page: two trending tables side by side (this month left, today right), stacked on narrow screens */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Both cards are as tall as the taller one, with the page links along the bottom of each. */
.trending-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.trending-pair > .trending { min-width: 0; margin: 0; display: flex; flex-direction: column; }
.trending-pair > .trending .table-scroll { flex: 1 1 auto; }
.trending-pair > .trending .pager { margin-top: auto; padding-top: 10px; }
@media (max-width: 980px) { .trending-pair { grid-template-columns: 1fr; } }
.home-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.trending-head { margin-bottom: 4px; }
.trending-head .page-heading { margin-bottom: 4px; font-size: 20px; }
.button-link { display: inline-block; text-decoration: none; white-space: nowrap; }
.trending-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.trending-table th, .trending-table td { padding: 8px 6px; border-bottom: 1px solid var(--grid); text-align: left; white-space: nowrap; }
.trending-table thead th { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.trending-table thead th[title] { cursor: help; }
.trending-table tbody tr:last-child th, .trending-table tbody tr:last-child td { border-bottom: 0; }
/* Every row the same height (two lines: name, then type), so a short last page padded with empty rows keeps
   the card at full height. */
.trending-table tbody tr { height: 54px; }
.trending-table tbody tr:not(.filler):hover { background: var(--wash); }
.trending-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.trending-table .rank { width: 1%; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* The model cell takes the leftover width and wraps long names rather than widening the table. */
.trending-table tbody th { font-weight: 600; white-space: normal; overflow-wrap: break-word; width: 100%; min-width: 150px; }
.trending-table tbody th a { color: inherit; text-decoration: none; }
.trending-table tbody th a:hover { text-decoration: underline; }
.trending-table .org { color: var(--text-muted); font-weight: 400; }
.trending-table .meta-line { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.empty { margin: 8px 0 4px; color: var(--text-secondary); }
@media (max-width: 600px) {
  /* Organization above the name, so names break between words rather than mid-word. */
  .trending-table .org { display: block; }
}

/* Color theme menu in the header */
.theme-menu { position: relative; }
.theme-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 150px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.theme-list button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 6px;
  padding: 7px 10px 7px 30px; font-size: 14px; color: var(--text-primary); position: relative;
}
.theme-list button:hover, .theme-list button:focus-visible { background: var(--wash); outline: none; }
.theme-list button[aria-checked="true"] { font-weight: 600; }
.theme-list button[aria-checked="true"]::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 9px; height: 5px; margin-top: -4px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
}

/* Trending table pages */
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 14px; }
.pager-link {
  min-width: 34px; padding: 5px 10px; border-radius: 8px; font-size: 13px; text-align: center;
  color: var(--text-secondary); text-decoration: none;
}
a.pager-link:hover { background: var(--wash); color: var(--text-primary); }
a.pager-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pager-link[aria-current="page"] { background: var(--brand); color: var(--on-brand); font-weight: 600; }
.pager-link[aria-disabled="true"] { opacity: 0.4; }

/* Context memory table */
.ctx-table { font-size: 13px; margin-top: 6px; }
.ctx-table .muted-cell { color: var(--text-muted); }
.ctx-table .note-inline { font-size: 11px; color: var(--text-muted); margin-left: 4px; }
#ctx .pane-sub b { color: var(--text-primary); font-weight: 600; }
