/* Browser test range: one stylesheet for every fixture page.
   Palette and fonts follow website/design-tokens.css (shared/design-tokens.json). */
@font-face { font-family: "Range Display"; src: url("/assets/space-grotesk.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Range Mono"; src: url("/assets/ibm-plex-mono.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  --canvas: #F3F0E7;
  --surface: #FFFDF7;
  --ink: #122019;
  --muted: #526259;
  --line: #D8D4C8;
  --forest: #134E3A;
  --forest-hover: #0F412F;
  --lime: #D6F06F;
  --mint: #B7E4C7;
  --signal: #F28C45;
  --signal-ink: #7A3A0C;
  --danger: #A22E24;
  --focus: #9D4B12;
  --terminal: #0C1712;
  --terminal-text: #DDF7D7;
  --terminal-dim: #8DB59A;
  --radius: 14px;
  --radius-small: 8px;
  --measure: 72ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0F1A15;
    --surface: #16241D;
    --ink: #E6EFE8;
    --muted: #9DB2A5;
    --line: #2B3D33;
    --forest: #7FD1A8;
    --forest-hover: #9BDFBC;
    --lime: #D6F06F;
    --mint: #2E5A45;
    --signal: #F5A46E;
    --signal-ink: #F5A46E;
    --danger: #F08A80;
    --focus: #F5A46E;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.6 "Range Display", "Segoe UI", system-ui, sans-serif;
  padding-bottom: 168px; /* room for the event log */
}
a { color: var(--forest); text-underline-offset: 3px; }
a:hover { color: var(--forest-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, kbd, .mono { font-family: "Range Mono", Consolas, monospace; font-size: 0.92em; }

/* ---------- page frame ---------- */
.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  max-width: 1120px; margin: 0 auto; padding: 18px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 18px; border-radius: 4px; display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; }
.brand-mark i:nth-child(1) { background: var(--forest); }
.brand-mark i:nth-child(2) { background: var(--lime); }
.brand-mark i:nth-child(3) { background: var(--signal); }
.brand-mark i:nth-child(4) { background: var(--mint); }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.top nav a { padding: 4px 9px; border-radius: 999px; text-decoration: none; color: var(--muted); font-size: 13.5px; }
.top nav a[aria-current="page"] { background: var(--ink); color: var(--canvas); }
.top nav a:not([aria-current]):hover { color: var(--ink); background: var(--surface); }

main { max-width: 1120px; margin: 0 auto; padding: 8px 20px 48px; }
.page-head { max-width: var(--measure); margin: 24px 0 28px; }
.page-head h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.08; letter-spacing: -0.025em; margin: 0 0 12px; }
.page-head p { margin: 0; color: var(--muted); font-size: 17px; }

/* ---------- a test point ---------- */
.bench {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 0 0 14px; overflow: hidden;
}
.bench-text { padding: 18px 20px; border-right: 1px solid var(--line); }
.bench-rig { padding: 18px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.bench h2 { font-size: 18px; line-height: 1.3; margin: 0 0 6px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tid { font-family: "Range Mono", Consolas, monospace; font-size: 13px; font-weight: 400; color: var(--forest); background: color-mix(in srgb, var(--lime) 55%, transparent); padding: 1px 7px; border-radius: 6px; }
.bench p { margin: 0 0 8px; color: var(--muted); font-size: 15px; max-width: 60ch; }
.expect { margin: 10px 0 0; padding: 8px 10px 8px 12px; border-left: 3px solid var(--signal); background: color-mix(in srgb, var(--signal) 10%, transparent); border-radius: 0 var(--radius-small) var(--radius-small) 0; font-size: 14px; color: var(--ink); }
.expect b { color: var(--signal-ink); font-weight: 600; margin-right: 6px; }
@media (max-width: 760px) {
  .bench { grid-template-columns: 1fr; }
  .bench-text { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---------- controls ---------- */
button, .button {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--forest);
  background: var(--forest); color: var(--canvas); text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .button:hover { background: var(--forest-hover); color: var(--canvas); }
button.quiet { background: transparent; color: var(--forest); }
button.quiet:hover { background: color-mix(in srgb, var(--forest) 10%, transparent); color: var(--forest); }
button:disabled { cursor: not-allowed; background: var(--line); border-color: var(--line); color: var(--muted); }
label { font-size: 14px; color: var(--muted); display: inline-flex; flex-direction: column; gap: 4px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--canvas);
  border: 1px solid color-mix(in srgb, var(--muted) 60%, transparent); border-radius: 9px; padding: 7px 10px; min-width: 0;
}
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--forest); }
textarea { min-height: 70px; width: 100%; resize: vertical; }
[contenteditable] { border: 1px dashed var(--muted); border-radius: 9px; padding: 8px 10px; min-width: 200px; background: var(--canvas); }
.result { font-family: "Range Mono", Consolas, monospace; font-size: 13px; color: var(--forest); min-height: 1.4em; flex-basis: 100%; }
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; width: 100%; }

/* ---------- event log ---------- */
.log {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--terminal); color: var(--terminal-text);
  font-family: "Range Mono", Consolas, monospace; font-size: 12.5px; line-height: 1.55;
  border-top: 3px solid var(--lime);
}
.log-head { display: flex; align-items: center; gap: 12px; padding: 6px 16px; color: var(--terminal-dim); }
.log-head strong { color: var(--lime); font-weight: 400; }
.log-head button { margin-left: auto; padding: 2px 10px; font-size: 12px; background: transparent; color: var(--terminal-text); border-color: #2C4A3A; border-radius: 6px; }
.log-head button + button { margin-left: 0; }
.log ol { list-style: none; margin: 0; padding: 0 16px 10px; height: 120px; overflow-y: auto; }
.log-head strong, .log-head button { white-space: nowrap; }
@media (max-width: 560px) {
  .log-hint { display: none; }
  .log ol { height: 96px; }
  body { padding-bottom: 144px; }
}
.log li { white-space: pre-wrap; word-break: break-word; }
.log li time { color: var(--terminal-dim); margin-right: 10px; }
.log li .lt { color: var(--lime); margin-right: 8px; }
.log.collapsed ol { display: none; }
body:has(.log.collapsed) { padding-bottom: 48px; }

/* ---------- index ---------- */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); height: 132px; border-radius: var(--radius); overflow: hidden; margin: 8px 0 0; }
.bars i { display: block; }
.bars i:nth-child(1) { background: #FFFDF7; } .bars i:nth-child(2) { background: #D6F06F; } .bars i:nth-child(3) { background: #B7E4C7; }
.bars i:nth-child(4) { background: #3E8F6B; } .bars i:nth-child(5) { background: #F28C45; } .bars i:nth-child(6) { background: #A22E24; } .bars i:nth-child(7) { background: #134E3A; }
.bars-low { display: grid; grid-template-columns: repeat(14, 1fr); height: 22px; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; margin-top: -2px; }
.bars-low i:nth-child(odd) { background: #0C1712; } .bars-low i:nth-child(even) { background: #E6EFE8; }
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: end; margin: 28px 0 40px; }
.hero h1 { font-size: clamp(38px, 7vw, 72px); line-height: 0.98; letter-spacing: -0.035em; margin: 0; }
.hero p { color: var(--muted); font-size: 17px; margin: 0 0 6px; max-width: 46ch; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; gap: 14px; } }
.fixtures { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.fixtures li { border-bottom: 1px solid var(--line); }
.fixtures a { display: grid; grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; padding: 16px 4px; text-decoration: none; color: var(--ink); align-items: baseline; }
.fixtures a:hover { background: var(--surface); }
.fixtures .fid { font-family: "Range Mono", Consolas, monospace; font-size: 13px; color: var(--forest); }
.fixtures .fname { font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.fixtures .fdesc { color: var(--muted); font-size: 15px; }
@media (max-width: 760px) { .fixtures a { grid-template-columns: 56px minmax(0, 1fr); } .fixtures .fdesc { grid-column: 2; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 32px 0 0; }
.facts div { padding: 16px 18px; border-right: 1px solid var(--line); }
.facts div:last-child { border-right: 0; }
.facts h3 { margin: 0 0 4px; font-size: 15px; }
.facts p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- fixture specifics ---------- */
.covered-wrap { position: relative; display: inline-block; }
.cover { position: absolute; inset: -4px; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--signal) 55%, transparent) 0 6px, transparent 6px 12px); border-radius: 10px; }
.drop { flex: 1 1 220px; min-height: 92px; border: 2px dashed var(--muted); border-radius: var(--radius); display: grid; place-items: center; color: var(--muted); text-align: center; padding: 10px; }
.drop.over { border-color: var(--forest); background: color-mix(in srgb, var(--lime) 25%, transparent); color: var(--ink); }
.chip { padding: 10px 14px; border-radius: 10px; background: var(--mint); color: var(--ink); user-select: none; cursor: grab; }
.zone { flex: 1 1 160px; min-height: 64px; border: 2px dashed var(--line); border-radius: var(--radius); display: grid; place-items: center; color: var(--muted); }
.zone.got { border-color: var(--forest); color: var(--forest); }
.menu { position: relative; }
.menu-panel { display: none; position: absolute; top: 100%; left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-width: 180px; z-index: 5; }
.menu:hover .menu-panel, .menu:focus-within .menu-panel { display: grid; }
.menu-panel a { padding: 6px 10px; border-radius: 6px; text-decoration: none; }
.menu-panel a:hover { background: color-mix(in srgb, var(--lime) 35%, transparent); }
.virtual { height: 220px; overflow-y: auto; width: 100%; border: 1px solid var(--line); border-radius: 10px; position: relative; background: var(--canvas); }
.virtual-inner { position: relative; }
.virtual-row { position: absolute; left: 0; right: 0; height: 32px; padding: 4px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tall { height: 3200px; border-radius: var(--radius); background: linear-gradient(var(--surface), color-mix(in srgb, var(--mint) 70%, var(--surface))); display: flex; align-items: flex-end; justify-content: center; padding: 20px; margin: 14px 0; border: 1px solid var(--line); }
.media-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.media-grid figure { margin: 0; font-size: 13px; color: var(--muted); }
.media-grid img, .media-grid canvas, .bg-sample { display: block; border-radius: 10px; border: 1px solid var(--line); }
.bg-sample { width: 96px; height: 96px; background: url("/assets/pattern.svg") center / cover; }
iframe { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); width: 100%; max-width: 420px; height: 150px; }
.sticky-bar { position: sticky; top: 0; z-index: 4; background: var(--ink); color: var(--canvas); padding: 8px 14px; border-radius: 10px; font-size: 14px; }
.keys { font-family: "Range Mono", Consolas, monospace; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; width: 100%; min-height: 44px; background: var(--canvas); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--forest); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.wide-table { overflow-x: auto; width: 100%; }
.wide-table table { border-collapse: collapse; min-width: 640px; font-size: 14px; }
.wide-table td, .wide-table th { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
footer.site { max-width: 1120px; margin: 0 auto; padding: 0 20px 24px; color: var(--muted); font-size: 13px; }

/* Dark overrides that must follow the base rules above. */
@media (prefers-color-scheme: dark) {
  .tid { background: color-mix(in srgb, var(--lime) 16%, transparent); color: var(--lime); }
}
