/* ------------------------------------------------------------------
   VRAM Guide — instrument panel
   Numerals are always mono. Language is always Archivo. No exceptions.
------------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --paper:   #edf0f3;
  --panel:   #ffffff;
  --sunken:  #e3e8ec;
  --ink:     #0f151c;
  --muted:   #5a6674;
  --faint:   #8a97a5;
  --rule:    #ccd4dc;

  --weights: #1f6f6b;
  --kv:      #c68a1f;
  --overhead:#8a97a5;
  --alarm:   #c43d2b;

  --ok:      #1f6f6b;
  --warn:    #b3760f;
  --bad:     #c43d2b;

  --sans: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --r: 3px;
  --shadow: 0 1px 2px rgba(15, 21, 28, .06), 0 8px 24px -16px rgba(15, 21, 28, .3);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

/* Every number, everywhere. */
.num, .n, td.num, th.num, output, kbd, code, pre {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

a { color: var(--weights); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--weights);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
  position: sticky; top: 0; z-index: 20;
}
.masthead .wrap {
  display: flex; align-items: center; gap: 20px;
  height: 54px;
}
.logo {
  font-family: var(--mono); font-weight: 700; font-size: 15px;
  letter-spacing: -.04em; color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.logo .dot {
  width: 9px; height: 9px; background: var(--weights);
  display: inline-block;
}
.masthead nav { margin-left: auto; display: flex; gap: 20px; font-size: 13.5px; }
.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover { color: var(--ink); }

/* ---------- generic structure ---------- */

.eyebrow {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase; color: var(--faint);
}
h1 {
  font-size: clamp(28px, 4.4vw, 44px); line-height: 1.05;
  letter-spacing: -.035em; font-weight: 700; margin: .35em 0 .3em;
}
h2 { font-size: 21px; letter-spacing: -.02em; margin: 0 0 4px; font-weight: 600; }
h3 { font-size: 15px; letter-spacing: -.01em; margin: 0 0 6px; font-weight: 600; }
.lede { font-size: 17px; color: var(--muted); max-width: 62ch; margin: 0 0 8px; }
.hint { font-size: 13px; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.section { padding: 40px 0; border-top: 1px solid var(--rule); }
.section:first-of-type { border-top: 0; }
.section-head { margin-bottom: 18px; }

/* ---------- the calculator ---------- */

.calc {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  margin: 28px 0;
  overflow: hidden;
}
.controls {
  padding: 20px;
  border-right: 1px solid var(--rule);
  background: linear-gradient(var(--panel), var(--sunken));
  display: flex; flex-direction: column; gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
  display: flex; justify-content: space-between; align-items: baseline;
}
.field > label .val { color: var(--ink); font-size: 12px; letter-spacing: -.02em; }

select, input[type='number'] {
  font: 500 14px/1.4 var(--sans);
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--rule); border-radius: var(--r);
  padding: 8px 10px; width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235a6674' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px;
}
input[type='number'] { background-image: none; padding-right: 10px; font-family: var(--mono); }
select:hover { border-color: var(--faint); }

input[type='range'] {
  width: 100%; appearance: none; background: transparent; height: 18px; margin: 0;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 3px; background: var(--rule); border-radius: 2px;
}
input[type='range']::-moz-range-track { height: 3px; background: var(--rule); border-radius: 2px; }
input[type='range']::-webkit-slider-thumb {
  appearance: none; width: 15px; height: 15px; margin-top: -6px;
  background: var(--ink); border-radius: 50%; cursor: grab;
}
input[type='range']::-moz-range-thumb {
  width: 15px; height: 15px; border: 0; background: var(--ink); border-radius: 50%; cursor: grab;
}

/* segmented chips */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button {
  font: 500 12px/1 var(--mono);
  padding: 6px 8px; border: 1px solid var(--rule); background: var(--panel);
  color: var(--muted); border-radius: var(--r); cursor: pointer;
  letter-spacing: -.02em;
}
.chips button:hover { border-color: var(--faint); color: var(--ink); }
.chips button[aria-pressed='true'] {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
}

.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--muted); }
.toggle input { accent-color: var(--weights); width: 15px; height: 15px; }

/* ---------- the gauge: the signature element ---------- */

.readout { padding: 24px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.verdict-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.verdict {
  font-size: clamp(24px, 3.4vw, 34px); font-weight: 700;
  letter-spacing: -.035em; line-height: 1; margin: 0;
}
.verdict[data-tone='ok']   { color: var(--ok); }
.verdict[data-tone='warn'] { color: var(--warn); }
.verdict[data-tone='bad']  { color: var(--bad); }
.usage { font-family: var(--mono); font-size: 15px; color: var(--muted); letter-spacing: -.03em; }
.usage b { color: var(--ink); font-weight: 700; }

.gauge { position: relative; }
.gauge-track {
  position: relative; height: 46px; background: var(--sunken);
  border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden;
  display: flex;
}
.seg { height: 100%; position: relative; transition: width .28s cubic-bezier(.4, 0, .2, 1); }
.seg-weights  { background: var(--weights); }
.seg-kv       { background: var(--kv); }
.seg-overhead { background: var(--overhead); }
.seg-spill {
  background: repeating-linear-gradient(45deg, var(--alarm), var(--alarm) 5px, #a8331f 5px, #a8331f 10px);
}
/* the hard ceiling — the whole point of the instrument */
.ceiling {
  position: absolute; top: -5px; bottom: -5px; width: 2px;
  background: var(--ink); transition: left .28s cubic-bezier(.4, 0, .2, 1);
  z-index: 3;
}
.ceiling::after {
  content: attr(data-label);
  position: absolute; left: 6px; top: -3px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .06em; color: var(--ink); white-space: nowrap;
}
.gauge-scale {
  display: flex; justify-content: space-between; margin-top: 22px;
  font-family: var(--mono); font-size: 10.5px; color: var(--faint);
}

.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.legend-item { display: flex; align-items: baseline; gap: 7px; font-size: 13px; }
.legend-item .sw { width: 9px; height: 9px; border-radius: 1px; flex: none; transform: translateY(1px); }
.legend-item .lbl { color: var(--muted); }
.legend-item .amt { font-family: var(--mono); font-weight: 500; letter-spacing: -.02em; margin-left: auto; }

/* stat strip */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  border-top: 1px solid var(--rule);
}
.stat { padding: 14px 16px 12px; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: 0; }
.stat .k {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 3px;
}
.stat .v { font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: -.04em; }
.stat .u { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }

.note {
  font-size: 13px; color: var(--muted); border-left: 2px solid var(--kv);
  padding: 2px 0 2px 12px; margin: 0;
}
.note.bad { border-color: var(--alarm); }

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
  padding: 0 12px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--rule); }
tbody tr:hover { background: var(--sunken); }
td.num, th.num { text-align: right; }
tbody tr[data-status='overflow'] td { color: var(--faint); }
tbody tr[data-best='true'] { background: rgba(31, 111, 107, .06); }
tbody tr[data-best='true'] td:first-child { box-shadow: inset 2px 0 0 var(--weights); }

.pill {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 2px; text-transform: uppercase; white-space: nowrap;
}
.pill[data-tone='ok']   { background: rgba(31, 111, 107, .12); color: var(--ok); }
.pill[data-tone='warn'] { background: rgba(198, 138, 31, .16); color: var(--warn); }
.pill[data-tone='bad']  { background: rgba(196, 61, 43, .11); color: var(--bad); }

/* ---------- cards / grids ---------- */

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  display: block; padding: 14px 16px; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r);
}
.card:hover { border-color: var(--ink); }
.card .t { font-weight: 600; letter-spacing: -.01em; }
.card .s { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: -.02em; }

/* ---------- grouped indexes ---------- */

/* The sticky masthead is 54px; anchored group headings clear it. */
.section[id], .subgroup[id] { scroll-margin-top: 68px; }

.jump { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 18px; }
.jump a {
  font: 500 12px/1 var(--mono); letter-spacing: -.02em;
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 9px; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--panel); color: var(--muted); text-decoration: none;
}
.jump a:hover { border-color: var(--ink); color: var(--ink); }
.jump .n { color: var(--faint); }

.subgroup + .subgroup { margin-top: 26px; }
.subgroup-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--rule);
}
.subgroup-head h3 { margin: 0; }
.subgroup-head .meta {
  font-family: var(--mono); font-size: 11.5px; color: var(--faint);
  letter-spacing: -.02em; margin-left: auto;
}

.prose { max-width: 66ch; }
.prose p { margin: 0 0 14px; }
.prose h2 { margin-top: 30px; }
.prose ul { padding-left: 18px; margin: 0 0 14px; }
.prose li { margin-bottom: 5px; }
code {
  background: var(--sunken); padding: 1px 5px; border-radius: 2px; font-size: .9em;
  border: 1px solid var(--rule);
}
pre {
  background: var(--ink); color: #dfe6ec; padding: 14px 16px; border-radius: var(--r);
  overflow-x: auto; font-size: 12.5px; line-height: 1.6;
}
pre code { background: none; border: 0; padding: 0; color: inherit; }

.crumbs { font-family: var(--mono); font-size: 11.5px; color: var(--faint); padding-top: 22px; letter-spacing: -.01em; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

footer {
  border-top: 1px solid var(--rule); margin-top: 48px; padding: 28px 0 44px;
  font-size: 13px; color: var(--muted);
}
footer .wrap { display: flex; gap: 24px; flex-wrap: wrap; align-items: baseline; }
footer a { color: var(--muted); }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .calc { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--rule); }
  .readout { padding: 18px; }
  .stat { border-right: 0; border-bottom: 1px solid var(--rule); }
}

@media (prefers-reduced-motion: reduce) {
  .seg, .ceiling { transition: none; }
}

@media print {
  .masthead, .controls, footer { display: none; }
  .panel { box-shadow: none; }
}
