/* GPU calculator. Light only, like the rest of the site; series colors are the validated categorical slots
   in stack order (training: weights..logits = slots 1-6; inference: weights, activations, KV = slots 1, 5, 7). */
.gc {
  --s-weights: #2a78d6;
  --s-grads: #eb6834;
  --s-optim: #1baf7a;
  --s-gather: #eda100;
  --s-act: #e87ba4;
  --s-logits: #008300;
  --s-kv: #6250d6;
  --s-overhead: #94a3b8;
  --gc-track: #eef2f7;
  --gc-surface: #ffffff;
  --gc-danger: #c2410c;
  max-width: 1200px;
  margin: 2.5rem auto 4rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* ---------------------------------------------------------------- form */
.gc-form {
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 6.5rem);
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 1.1rem 1.2rem;
}
.gc-form fieldset { border: 0; padding: 0 0 1rem; margin: 0 0 1rem; border-bottom: 1px solid var(--card-border); }
.gc-form fieldset:last-of-type { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.gc-form legend {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 0.6rem;
}
.gc-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; font-weight: 500; color: var(--text-main); margin-bottom: 0.7rem; min-width: 0; }
.gc-field small, .gc-form small { font-weight: 400; color: var(--text-muted); font-size: 0.78rem; line-height: 1.35; }
.gc-inline { flex-direction: row; align-items: center; justify-content: space-between; }
.gc-form .gc-inline select { width: 5.5rem; flex: none; }
.gc-inline { white-space: nowrap; }
.gc-form select, .gc-form input[type="number"], .gc-form input[type="text"] {
  font: inherit;
  font-weight: 400;
  font-size: 0.92rem;
  color: var(--text-main);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  width: 100%;
  min-width: 0;
}
.gc-form select:focus, .gc-form input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.gc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.gc-row-3 { grid-template-columns: repeat(3, 1fr); }
.gc-row:has(> [hidden]) { grid-template-columns: 1fr; }
.gc-row-3:has(> [hidden]) { grid-template-columns: 1fr 1fr; }
.gc-row [hidden], .gc-form [hidden] { display: none !important; }
.gc-hf { display: flex; gap: 0.4rem; margin-bottom: 0.35rem; }
.gc-hf .btn { padding: 0.4rem 0.8rem; font-size: 0.85rem; flex: none; }
.gc-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; margin: 0.25rem 0; cursor: pointer; }
.gc-check input { accent-color: var(--primary); width: 1rem; height: 1rem; }
.gc-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--gc-track); border-radius: 10px; padding: 3px; margin-bottom: 0.8rem; }
.gc-seg label { cursor: pointer; }
.gc-seg input { position: absolute; opacity: 0; pointer-events: none; }
.gc-seg span { display: block; text-align: center; padding: 0.42rem 0.5rem; border-radius: 8px; font-size: 0.88rem; font-weight: 600; color: var(--text-muted); }
.gc-seg input:checked + span { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.gc-seg input:focus-visible + span { outline: 2px solid var(--primary); }
.gc-adv summary { cursor: pointer; font-size: 0.85rem; color: var(--text-muted); margin: 0.3rem 0 0.6rem; }

/* ---------------------------------------------------------------- output cards */
.gc-out { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.gc-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 1.2rem 1.4rem;
  min-width: 0;
}
.gc-card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.gc-card-title h3, .gc-notes h3 { font-family: var(--font-heading); font-size: 1.05rem; font-weight: 600; }
.gc-card-title span { color: var(--text-muted); font-size: 0.85rem; }

.gc-kicker { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.2rem; }
.gc-hero { font-family: var(--font-body); font-size: 1.6rem; font-weight: 600; line-height: 1.15; color: var(--text-main); }
.gc-hero-n { font-size: 3.4rem; font-weight: 700; color: var(--primary); margin-right: 0.15rem; }
.gc-none { font-size: 1.6rem; font-weight: 600; color: var(--gc-danger); margin: 0.3rem 0; }
.gc-head-sub { color: var(--text-muted); }
.gc-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.8rem; }
.gc-chip { background: var(--gc-track); border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.85rem; font-weight: 500; color: var(--text-main); }
.gc-head-extra { margin-top: 0.8rem; color: var(--text-muted); font-size: 0.92rem; }
.gc-head-extra b { color: var(--text-main); }
.gc-warn { margin: 0.9rem 0 0; padding: 0.7rem 0.9rem 0.7rem 2rem; background: #fff7ed; border-radius: 10px; color: #7c2d12; font-size: 0.86rem; }
.gc-warn li + li { margin-top: 0.3rem; }

/* tall segmented bar: 28px, 2px surface gaps, 4px corners, values inside wide blocks */
.gc-bar { position: relative; display: flex; gap: 2px; height: 28px; margin: 0.2rem 0 0.8rem; }
.gc-blk { flex: 0 0 auto; border-radius: 4px; display: flex; align-items: center; min-width: 2px; overflow: hidden; cursor: default; }
.gc-blk span { color: #fff; font-size: 0.78rem; font-weight: 600; padding-left: 0.4rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gc-blk.gc-gather span, .gc-blk.gc-act span, .gc-blk.gc-optim span, .gc-blk.gc-overhead span { color: #0b0b0b; }
.gc-free { flex: 1 1 auto; background: var(--gc-track); border-radius: 4px; }
.gc-limit { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--text-main); border-radius: 1px; }
.gc-limit::before { content: ""; position: absolute; inset: 0 -6px; } /* wider hover target */
.gc-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; padding: 0; margin: 0 0 0.9rem; font-size: 0.84rem; color: var(--text-muted); }
.gc-legend li { display: flex; align-items: center; gap: 0.4rem; }
.gc-legend i, .gc-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.gc-sw { margin-right: 0.5rem; vertical-align: -1px; }
.gc-legend .gc-limit-key { width: 2px; height: 12px; border-radius: 1px; background: var(--text-main); }

.gc-weights { background: var(--s-weights); }
.gc-grads { background: var(--s-grads); }
.gc-optim { background: var(--s-optim); }
.gc-gather { background: var(--s-gather); }
.gc-act { background: var(--s-act); }
.gc-logits { background: var(--s-logits); }
.gc-kv { background: var(--s-kv); }
.gc-overhead { background: var(--s-overhead); }

/* ---------------------------------------------------------------- tables */
.gc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.gc-table th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--card-border); }
.gc-table td { padding: 0.42rem 0.5rem; border-bottom: 1px solid #f1f5f9; font-variant-numeric: tabular-nums; }
.gc-table td:nth-child(n+2), .gc-table th:nth-child(n+2) { text-align: right; }
.gc-table tfoot td { font-weight: 600; border-bottom: 0; }
.gc-table tfoot tr + tr td { font-weight: 400; color: var(--text-muted); }
.gc-compare td:nth-child(5), .gc-compare th:nth-child(5) { text-align: center; }
.gc-compare tbody tr { cursor: pointer; }
.gc-compare tbody tr:hover, .gc-compare tbody tr:focus { background: #f8fafc; outline: none; }
.gc-compare tr.gc-current td { background: var(--primary-glow); font-weight: 600; }
.gc-compare tr.gc-current td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* ---------------------------------------------------------------- every GPU */
.gc-node + .gc-node { margin-top: 1rem; }
.gc-node-name { font-size: 0.8rem; font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.45rem; }
.gc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; }
.gc-tile, .gc-stage { border: 1px solid var(--card-border); border-radius: 10px; padding: 0.5rem 0.6rem; background: #fff; cursor: default; }
.gc-tile:hover, .gc-tile:focus, .gc-stage:hover, .gc-stage:focus { border-color: var(--card-hover-border); outline: none; }
.gc-tile p, .gc-stage p { display: flex; justify-content: space-between; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; font-variant-numeric: tabular-nums; }
.gc-tile p span + span, .gc-stage p span + span { color: var(--text-muted); font-weight: 500; }
.gc-tile small { display: block; margin-top: 0.3rem; font-size: 0.74rem; color: var(--text-muted); }
.gc-over { border-color: var(--gc-danger); }
.gc-stages { display: flex; flex-direction: column; gap: 0.5rem; }
/* thin segmented bar: 8px, fully rounded ends */
.gc-mini { display: flex; gap: 2px; height: 8px; background: var(--gc-track); border-radius: 4px; overflow: hidden; }
.gc-mini b { flex: 0 0 auto; min-width: 1px; }
.gc-mini b:first-child { border-radius: 4px 0 0 4px; }

/* ---------------------------------------------------------------- notes + tooltip */
.gc-notes summary { cursor: pointer; list-style: none; }
.gc-notes summary::-webkit-details-marker { display: none; }
.gc-notes summary h3::after { content: " +"; color: var(--text-subtle); }
.gc-notes[open] summary h3::after { content: " \2212"; }
.gc-notes ul { margin: 0.8rem 0 0; padding-left: 1.1rem; color: var(--text-muted); font-size: 0.9rem; }
.gc-notes li + li { margin-top: 0.45rem; }
.gc-notes b { color: var(--text-main); }

.gc-tip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  max-width: 300px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
}
.gc-tip b { display: block; font-weight: 600; }
.gc-tip span { display: block; font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.gc-tip small { display: block; color: #cbd5e1; margin-top: 0.15rem; }
.gc-tip[hidden] { display: none; }

@media (max-width: 900px) {
  .gc { grid-template-columns: minmax(0, 1fr); padding: 0 1rem; margin-top: 1.5rem; }
  .gc-form { position: static; max-height: none; }
  .gc-hero-n { font-size: 2.8rem; }
  .gc-compare th:nth-child(2), .gc-compare td:nth-child(2), .gc-compare th:nth-child(4), .gc-compare td:nth-child(4) { display: none; }
}

/* ---------------------------------------------------------------- model search box */
.gc-combo { position: relative; }
.gc-combo-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0.25rem 0 0;
  padding: 0.3rem;
  list-style: none;
  max-height: 22rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px -6px rgba(15, 23, 42, 0.18);
}
.gc-combo-list[hidden] { display: none; }
.gc-combo-list [role="option"] { padding: 0.4rem 0.55rem; border-radius: 7px; cursor: pointer; }
.gc-combo-list [role="option"] span { display: block; font-size: 0.88rem; font-weight: 500; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-combo-list [role="option"] small { display: block; font-size: 0.76rem; color: var(--text-muted); }
.gc-combo-list [aria-selected="true"] { background: var(--primary-glow); }
.gc-combo-group { padding: 0.45rem 0.55rem 0.2rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-subtle); }
.gc-combo-note { padding: 0.35rem 0.55rem; font-size: 0.82rem; color: var(--text-muted); }

.gc-compare-tools { display: inline-flex; align-items: center; gap: 0.6rem; }
.gc-compare-tools select {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-main);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
}

/* ---------------------------------------------------------------- wide screens */
.gc-header-inner { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }

@media (min-width: 1440px) {
  /* the page, its header and the site nav widen together so their edges stay aligned */
  .gc, .gc-header-inner, body:has(.gc) .navbar { max-width: 1600px; }
  .gc { grid-template-columns: 380px minmax(0, 1fr); }
  /* results in two columns: the verdict and the comparison span both, the breakdowns sit side by side */
  .gc-out { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .gc-head, .gc-cmd, .gc-cmp, .gc-notes { grid-column: 1 / -1; }
  .gc-all .gc-tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (min-width: 1920px) {
  .gc, .gc-header-inner, body:has(.gc) .navbar { max-width: 1800px; }
}

/* ---------------------------------------------------------------- page header */
.gc-header { background: #fff; border-bottom: 1px solid var(--card-border); padding: 1.6rem 0 1.4rem; }
.gc-header .gc-header-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.gc-header h1 { font-family: var(--font-heading); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 0.35rem; }
.gc-header p { color: var(--text-muted); font-size: 1.02rem; max-width: 760px; }
.gc-header-link { flex: none; font-size: 0.9rem; font-weight: 600; color: var(--primary); text-decoration: none; padding-bottom: 0.15rem; }
.gc-header-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- share row */
.gc-share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--card-border); }
.gc-share-label { font-size: 0.82rem; color: var(--text-muted); margin-right: 0.3rem; }
.gc-share-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.gc-share-btn:hover { border-color: var(--card-hover-border); background: #f8fafc; }
.gc-share-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.gc-share-btn[hidden] { display: none; }
.gc-share-copy { margin-left: auto; }
@media (max-width: 600px) { .gc-share-copy { margin-left: 0; } }

/* ---------------------------------------------------------------- launch commands */
.gc-cmd[hidden] { display: none; }
.gc-tabs { display: inline-flex; background: var(--gc-track); border-radius: 9px; padding: 3px; }
.gc-tabs button { font: inherit; font-size: 0.84rem; font-weight: 600; color: var(--text-muted); background: none; border: 0; border-radius: 7px; padding: 0.3rem 0.85rem; cursor: pointer; }
.gc-tabs button[aria-selected="true"] { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.gc-tabs button:focus-visible { outline: 2px solid var(--primary); }
.gc-code { position: relative; }
.gc-code pre {
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 0.95rem 1.1rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.6;
}
.gc-cmd .gc-card-title h3 { margin-right: auto; }
.gc-cmd-notes { margin: 0.8rem 0 0; padding-left: 1.1rem; color: var(--text-muted); font-size: 0.85rem; }
.gc-cmd-notes:empty { display: none; }
.gc-cmd-notes li + li { margin-top: 0.3rem; }
