/* easyfea.css: self-contained, light and dark tokens. */

@font-face { font-family:'Lexend'; src:url('../../Fonts/Lexend%20Family/webfonts/Lexend-Regular.woff2') format('woff2');  font-weight:400; font-display:swap; }
@font-face { font-family:'Lexend'; src:url('../../Fonts/Lexend%20Family/webfonts/Lexend-Medium.woff2') format('woff2');   font-weight:500; font-display:swap; }
@font-face { font-family:'Lexend'; src:url('../../Fonts/Lexend%20Family/webfonts/Lexend-SemiBold.woff2') format('woff2'); font-weight:600; font-display:swap; }
@font-face { font-family:'JetBrains Mono'; src:url('../../Fonts/Jetbrains/woff2/JetBrainsMono-Regular.woff2') format('woff2'); font-weight:400; font-display:swap; }
@font-face { font-family:'JetBrains Mono'; src:url('../../Fonts/Jetbrains/woff2/JetBrainsMono-Bold.woff2') format('woff2');    font-weight:700; font-display:swap; }

:root {
  --ground:      #eceae4;
  --panel:       #faf9f6;
  --panel-2:     #f1efe9;
  --ink:         #1d2026;
  --ink-soft:    #4f5563;
  --ink-dim:     #767c89;
  --line:        #d6d3cb;
  --line-strong: #a7a39a;
  --accent:      #c2410c;
  --accent-ink:  #ffffff;
  --focus:       #2563eb;
  --stage-top:   #f7f6f2;
  --stage-bot:   #dcd9d1;
  --model-edge:  #2a2d33;
  --glyph:       #6b7280;
  --bad:         #b91c1c;
  --radius:      8px;
  --font-body:   'Lexend', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono:   'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ground:      #121419;
  --panel:       #1b1e25;
  --panel-2:     #232731;
  --ink:         #eceef3;
  --ink-soft:    #b3b8c4;
  --ink-dim:     #8a90a0;
  --line:        #313643;
  --line-strong: #555c6c;
  --accent:      #fb923c;
  --accent-ink:  #1b1e25;
  --focus:       #93c5fd;
  --stage-top:   #262a33;
  --stage-bot:   #15171c;
  --model-edge:  #0d0e11;
  --glyph:       #9ca3af;
  --bad:         #f87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* The hidden attribute must win over any display rule set below. */
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

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

.fe-visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--accent); color: var(--accent-ink); padding: 0.5rem 1rem; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---- Header ------------------------------------------------------------ */

.fe-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.25rem 0.6rem;
}
.fe-eyebrow {
  margin: 0; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-dim);
}
.fe-head h1 { margin: 0.1rem 0 0.2rem; font-size: 1.9rem; font-weight: 600; letter-spacing: -0.01em; }
.fe-lede { margin: 0; max-width: 62ch; color: var(--ink-soft); }

.fe-btn {
  font: inherit; font-size: 0.85rem; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.4rem 0.8rem; cursor: pointer;
}
.fe-btn:hover { border-color: var(--ink-soft); }
.fe-head-actions { display: flex; gap: 0.4rem; flex: none; margin-top: 0.35rem; }

/* ---- Product picker ---------------------------------------------------- */

.fe-products { padding: 0.4rem 1.25rem 0.9rem; }
.fe-product-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 0.6rem;
  overflow-x: auto;
}
.fe-product {
  width: 100%; height: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-rows: auto auto 1fr; gap: 0.15rem;
  font: inherit; color: inherit; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.65rem 0.6rem;
}
.fe-product:hover { border-color: var(--line-strong); }
.fe-product[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fe-product img, .fe-thumb-blank {
  display: block; width: 100%; height: 85px; object-fit: contain;
  background: linear-gradient(var(--stage-top), var(--panel-2)); border-radius: 5px;
}
.fe-product-name { font-weight: 600; margin-top: 0.3rem; }
.fe-product-desc { font-size: 0.8rem; color: var(--ink-soft); line-height: 1.4; }

/* ---- Main grid ---------------------------------------------------------- */

.fe-main {
  display: grid; grid-template-columns: 290px minmax(0, 1fr) 300px; gap: 0.75rem;
  padding: 0 1.25rem 1rem;
  height: max(480px, calc(100vh - 410px));
}

.fe-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; overflow-y: auto;
}
.fe-panel-title {
  margin: 0 0 0.7rem; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim);
}

.fe-field { margin-bottom: 1.1rem; }
.fe-label { margin: 0 0 0.35rem; font-size: 0.85rem; font-weight: 600; }
.fe-note { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.45; }
.fe-empty { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }

/* Segmented control */
.fe-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.fe-seg-btn {
  font: inherit; font-size: 0.82rem; color: var(--ink); background: transparent;
  border: 0; border-right: 1px solid var(--line); padding: 0.35rem 0.7rem; cursor: pointer;
}
.fe-seg-btn:last-child { border-right: 0; }
.fe-seg-btn:hover:not(:disabled) { background: var(--panel-2); }
.fe-seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.fe-seg-btn:disabled { color: var(--ink-dim); cursor: default; }

/* Materials */
.fe-sublabel { display: block; font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 0.2rem; }
.fe-mat { margin-bottom: 0.8rem; }
.fe-select {
  width: 100%; font: inherit; font-size: 0.85rem; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 0.3rem 0.4rem;
}
.fe-prop-line { margin: 0.35rem 0 0; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-soft); }
.fe-term {
  font: inherit; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.fe-term[aria-expanded="true"] { color: var(--accent); }
.fe-sep { color: var(--ink-dim); }
.fe-gloss { border-left: 2px solid var(--accent); padding-left: 0.5rem; }

/* Loads */
.fe-switch-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; }
.fe-switch-row input { accent-color: var(--accent); width: 1rem; height: 1rem; }
.fe-loads { list-style: none; margin: 0.7rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.fe-load { border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.6rem; background: var(--panel-2); }
.fe-load.is-hot { border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); }
.fe-load-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.2rem; }
.fe-load-name { font-weight: 600; font-size: 0.86rem; }
.fe-link { font: inherit; font-size: 0.78rem; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.fe-slider { display: grid; grid-template-columns: 1fr auto; align-items: baseline; margin-top: 0.35rem; }
.fe-slider .fe-sublabel { margin: 0; }
.fe-readout { font-family: var(--font-mono); font-size: 0.78rem; }
.fe-range { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 0.15rem 0 0; }
.fe-dir { margin-top: 0.45rem; }
.fe-custom { border: 0; margin: 0.4rem 0 0; padding: 0; display: flex; gap: 0.3rem; flex-wrap: wrap; }
.fe-custom legend { padding: 0; margin-bottom: 0.2rem; }
.fe-num { width: 4.2rem; font: inherit; font-size: 0.8rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 5px; padding: 0.2rem 0.3rem; }
.fe-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.fe-palette { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.7rem; align-items: center; }
.fe-palette .fe-sublabel { flex-basis: 100%; }
.fe-chip {
  font: inherit; font-size: 0.78rem; color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.2rem 0.6rem; cursor: pointer;
}
.fe-chip:hover { border-color: var(--accent); }
.fe-stale {
  margin: 0 0 0.6rem; font-size: 0.85rem; padding: 0.45rem 0.6rem; border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border: 1px solid var(--accent);
}

/* Supports list */
.fe-supports { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.fe-supports li { display: grid; grid-template-columns: 16px 1fr; gap: 0.55rem; font-size: 0.84rem; line-height: 1.45; }
.fe-support-mark { width: 16px; height: 16px; margin-top: 0.15rem; border-radius: 3px; border: 1px solid var(--ink-soft); }
.fe-support-fixed { background: repeating-linear-gradient(135deg, var(--ink) 0 2px, var(--panel) 2px 5px); }
.fe-support-roller { background: radial-gradient(circle, var(--accent) 0 3.5px, transparent 4px) 0 0 / 8px 16px var(--panel-2); }

/* ---- Stage -------------------------------------------------------------- */

.fe-stage { min-width: 0; min-height: 0; }
.fe-viewport {
  position: relative; height: 100%; border-radius: var(--radius); overflow: hidden;
  container-type: inline-size;
  border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 50% 20%, var(--stage-top), var(--stage-bot));
}
.fe-viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.fe-stage-bar {
  position: absolute; left: 0.6rem; right: 0.6rem; bottom: 0.6rem;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.8rem; pointer-events: none;
}
.fe-stage-bar .fe-seg { flex: none; flex-wrap: nowrap; }
.fe-stage-bar > * { pointer-events: auto; }
.fe-stage-note {
  position: absolute; top: 0.6rem; left: 0.6rem;
  margin: 0; max-width: 46ch; font-size: 0.8rem; line-height: 1.4; color: var(--ink-soft);
  background: color-mix(in srgb, var(--panel) 85%, transparent); border-radius: 6px; padding: 0.3rem 0.5rem;
}
.fe-stage-note:empty { display: none; }

/* ---- Run bar (sticky at the foot of the set-up panel) -------------------- */

.fe-run {
  position: sticky; bottom: -0.9rem; z-index: 2;
  margin: 0.4rem -1rem -0.9rem; padding: 0.7rem 1rem 0.8rem;
  background: var(--panel); border-top: 1px solid var(--line);
  display: grid; gap: 0.4rem;
}
.fe-run .fe-note { margin: 0; }
.fe-run-btn {
  font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer;
  color: var(--accent-ink); background: var(--accent); border: 0; border-radius: var(--radius); padding: 0.6rem 1rem;
}
.fe-run-btn:hover:not(:disabled) { filter: brightness(1.08); }
.fe-run-btn:disabled { opacity: 0.45; cursor: default; }
.fe-progress-label { margin: 0; font-size: 0.82rem; }
.fe-progress { height: 8px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.fe-progress span { display: block; height: 100%; background: var(--accent); transition: width 0.15s; }

/* ---- Results key numbers ---------------------------------------------------- */

.fe-keys { margin: 0; display: grid; gap: 0.5rem; }
.fe-keys.is-stale { opacity: 0.5; }
.fe-kv { display: flex; justify-content: space-between; gap: 0.5rem; border-bottom: 1px solid var(--line); padding-bottom: 0.35rem; }
.fe-kv dt { font-size: 0.84rem; color: var(--ink-soft); }
.fe-kv dd { margin: 0; font-family: var(--font-mono); font-size: 0.9rem; font-weight: 700; }

/* ---- Results card ------------------------------------------------------------ */

.fe-card.is-stale { opacity: 0.55; }
.fe-card .fe-label { margin-top: 0.9rem; }
.fe-card .fe-label:first-child { margin-top: 0; }
.fe-verdict { margin: 0 0 0.5rem; font-size: 0.9rem; line-height: 1.5; }
.fe-table-wrap { overflow-x: auto; }
.fe-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.fe-table th, .fe-table td { text-align: left; padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.fe-table thead th { font-weight: 600; color: var(--ink-soft); border-bottom-color: var(--line-strong); }
.fe-table tbody th { font-weight: 600; }
.fe-warnings { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.45rem; font-size: 0.84rem; line-height: 1.45; }
.fe-more { font-size: 0.78rem; white-space: nowrap; }
.fe-assume { margin-top: 0.9rem; font-size: 0.82rem; }
.fe-assume summary { cursor: pointer; font-weight: 600; }
.fe-assume ul { margin: 0.5rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.45rem; line-height: 1.45; color: var(--ink-soft); }
.fe-assume li { transition: background 0.3s; border-radius: 4px; }
.fe-assume li.is-flagged { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--ink); }

/* ---- Challenges ------------------------------------------------------------------ */

.fe-challenges { margin: 0 1.25rem 0.75rem; overflow: visible; }
.fe-challenges-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.fe-challenges-head .fe-panel-title { margin: 0; }
.fe-challenge-list {
  list-style: none; margin: 0.7rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.6rem;
}
.fe-challenge {
  display: grid; grid-template-rows: auto 1fr auto; gap: 0.35rem; align-items: start;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.7rem; background: var(--panel-2);
}
.fe-challenge.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fe-challenge h3 { margin: 0; font-size: 0.92rem; }
.fe-challenge p { margin: 0; font-size: 0.82rem; line-height: 1.45; color: var(--ink-soft); }
.fe-challenge .fe-btn { justify-self: start; }
.fe-challenge-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.fe-challenge-head .fe-label { margin: 0; }
.fe-chip-status {
  flex: none; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.05rem 0.45rem; color: var(--ink-soft);
}
.fe-chip-status.is-met { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fe-challenge-banner {
  border: 1px solid var(--accent); border-radius: 6px; padding: 0.55rem 0.65rem; margin-bottom: 0.9rem;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel)); display: grid; gap: 0.35rem;
}
.fe-challenge-banner .fe-note { margin: 0; }
.fe-challenge-banner .fe-link { justify-self: start; }
.fe-challenge-note { margin: 0; font-size: 0.84rem; font-weight: 500; }
.fe-hand { width: 7rem; }

/* ---- Help dialog --------------------------------------------------------------- */

.fe-help {
  width: min(720px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); padding: 0;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.fe-help::backdrop { background: rgb(0 0 0 / 0.45); }
.fe-help-inner { padding: 1rem 1.25rem 1.25rem; font-size: 0.9rem; line-height: 1.55; }
.fe-help-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.fe-help h2 { margin: 0; font-size: 1.3rem; }
.fe-help h3 { margin: 1.1rem 0 0.4rem; font-size: 1rem; }
.fe-help ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; }
.fe-help p { margin: 0.35rem 0; }
.fe-glossary { margin: 0; display: grid; grid-template-columns: minmax(150px, 30%) 1fr; gap: 0.4rem 1rem; }
.fe-glossary dt { font-weight: 600; }
.fe-glossary dd { margin: 0; color: var(--ink-soft); }
@media (max-width: 560px) { .fe-glossary { grid-template-columns: 1fr; } .fe-glossary dd { margin-bottom: 0.4rem; } }

/* ---- Comparison table -------------------------------------------------------- */

.fe-compare { margin: 0 1.25rem 1rem; overflow: visible; }
.fe-compare-table { font-size: 0.82rem; }
.fe-compare-table .is-num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.fe-compare-table .is-best { font-weight: 700; }
.fe-best {
  font-family: var(--font-body); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent-ink); background: var(--accent); border-radius: 3px; padding: 0 0.25rem;
}

/* ---- Viewport overlays ------------------------------------------------------ */

.fe-legend {
  position: absolute; top: 0.6rem; right: 0.6rem; width: 168px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line);
  border-radius: 6px; padding: 0.5rem 0.6rem; font-size: 0.75rem;
}
.fe-legend-title { margin: 0 0 0.4rem; font-weight: 600; }
.fe-scale { position: relative; display: flex; gap: 0.4rem; height: 120px; }
.fe-ramp { width: 14px; border-radius: 3px; border: 1px solid var(--line-strong); }
.fe-ticks { display: flex; flex-direction: column; justify-content: space-between; font-family: var(--font-mono); font-size: 0.7rem; }
.fe-mark { position: absolute; left: -3px; width: 20px; height: 0; border-top: 2px solid var(--ink); }
.fe-mark::after { content: ''; position: absolute; left: 20px; top: -4px; border: 3px solid transparent; border-left-color: var(--ink); }
.fe-legend-note { margin: 0.45rem 0 0; color: var(--ink-soft); line-height: 1.35; }
.fe-bands { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.fe-bands li { display: flex; align-items: center; gap: 0.4rem; }
.fe-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line-strong); flex: none; }

.fe-probe {
  position: absolute; z-index: 3; pointer-events: none; display: grid; gap: 0.1rem; min-width: 170px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0.35rem 0.5rem;
  font-size: 0.75rem; box-shadow: 0 4px 14px rgb(0 0 0 / 0.15);
}
.fe-probe span { font-family: var(--font-mono); }

.fe-shape {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; max-width: 420px;
  background: color-mix(in srgb, var(--panel) 88%, transparent); border-radius: 6px; padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
}
.fe-check { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.fe-check input { accent-color: var(--accent); }
.fe-shape-note { flex-basis: 100%; color: var(--ink-soft); }

/* Narrow viewports: a smaller legend, and a stage note that stops short of it. */
@container (max-width: 560px) {
  .fe-legend { width: 132px; padding: 0.4rem 0.45rem; }
  .fe-scale { height: 84px; }
  .fe-legend-note { font-size: 0.68rem; }
  .fe-stage-note { max-width: calc(100% - 160px); font-size: 0.74rem; }
  .fe-shape { font-size: 0.72rem; }
}

/* Centre mark for placing a load from the keyboard. */
.fe-crosshair { display: none; position: absolute; left: 50%; top: 50%; z-index: 2; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: none; }
.fe-crosshair::before, .fe-crosshair::after { content: ''; position: absolute; background: var(--focus); }
.fe-crosshair::before { left: 10px; top: 0; width: 2px; height: 22px; }
.fe-crosshair::after { top: 10px; left: 0; height: 2px; width: 22px; }
.fe-viewport.is-placing:focus-visible .fe-crosshair { display: block; }

/* ---- Footer ------------------------------------------------------------- */

.fe-foot { padding: 0.4rem 1.25rem 1.4rem; font-size: 0.8rem; color: var(--ink-dim); }
.fe-foot p { margin: 0; }

/* ---- Narrow windows (split screen) --------------------------------------- */

/* Below 1180 px the three columns squeeze the viewport, so it takes the full
   width and the two panels sit side by side underneath; one column below 760. */
@media (max-width: 1179px) {
  .fe-main { grid-template-columns: 1fr 1fr; height: auto; }
  .fe-stage { grid-column: 1 / -1; order: -1; height: 60vh; min-height: 380px; }
  .fe-panel { overflow: visible; }
}
@media (max-width: 1023px) {
  .fe-product-list { grid-template-columns: repeat(6, 150px); }
}
@media (max-width: 759px) {
  .fe-main { grid-template-columns: 1fr; }
  .fe-stage { height: 55vh; min-height: 340px; }
}

@media (max-width: 560px) {
  .fe-head { flex-direction: column; padding-inline: 1rem; }
  .fe-products, .fe-main, .fe-foot { padding-inline: 1rem; }
  .fe-compare, .fe-challenges { margin-inline: 1rem; }
}
