/* Self-hosted fonts (SIL Open Font License): Barlow, Barlow Condensed, IBM Plex Mono. Latin subset. */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: italic; font-weight: 600; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-600-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

/* Layout: header band, then a three-column bench (controls | schematic + cluster | telemetry + log); stacks to one column on phones. */
:root {
  --bg: #0b0c0e;
  --panel: #131519;
  --panel-2: #191c21;
  --line: #262a31;
  --fg: #d3d7dd;
  --dim: #8a919b;
  --red: #e5262d;
  --red-dim: #5a1519;
  --amber: #e9a23b;
  --blue: #55a8ff;
  --green: #3fcf8e;
  --font-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --font-body: "Barlow", "Segoe UI", Arial, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  padding-inline: 16px;
  padding-block: 0 32px;
}
.wrap { max-width: 1320px; margin-inline: auto; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.logo-link { display: block; line-height: 0; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.site { font: 500 13px/1 var(--font-data); letter-spacing: .04em; color: var(--fg); text-decoration: none; padding-left: 2px; }
.site:hover { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.site:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.logo { width: 150px; max-width: 100%; height: auto; mix-blend-mode: screen; display: block; }
.ttl { min-width: 0; flex: 1 1 260px; }
.ttl h1 { margin: 0; font: italic 600 26px/1.1 var(--font-display); letter-spacing: .02em; text-transform: uppercase; text-wrap: balance; }
.ttl p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 500 12px/1 var(--font-data); padding: 7px 10px; border: 1px solid var(--line); background: var(--panel); color: var(--dim); letter-spacing: .03em; }
.chip b { color: var(--fg); font-weight: 500; }
.chip.on { border-color: var(--red); color: var(--fg); }
.chip.on b { color: var(--red); }

/* grid */
.bench { display: grid; gap: 16px; padding-top: 16px; grid-template-columns: 300px minmax(0, 1fr) 340px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .bench { grid-template-columns: minmax(0, 1fr) 320px; } .col-c { grid-column: 1 / -1; order: -1; } }
@media (max-width: 760px) { .bench { grid-template-columns: minmax(0, 1fr); } }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); padding: 14px; min-width: 0; }
.panel h2 { margin: 0 0 10px; font: 600 15px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel h2 em { font: 400 11px var(--font-data); letter-spacing: 0; text-transform: none; color: var(--dim); font-style: normal; }

/* buttons */
button { font: 600 13px/1 var(--font-body); color: var(--fg); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 12px; cursor: pointer; letter-spacing: .02em; }
button:hover:not(:disabled) { border-color: #4a515c; }
button:disabled { opacity: .38; cursor: not-allowed; }
button:focus-visible, input:focus-visible, .fuse:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button.go { background: var(--red); border-color: var(--red); color: #fff; }
button.go:hover:not(:disabled) { background: #f0383e; border-color: #f0383e; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row > button { flex: 1 1 auto; }

/* fault switches */
.faults { display: flex; flex-direction: column; gap: 6px; }
.fault { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; }
.fault.active { border-color: var(--red); background: #1c1315; }
.fault span { min-width: 0; }
.fault small { display: block; color: var(--dim); font-size: 11.5px; }
.fault input { position: absolute; opacity: 0; pointer-events: none; }
.sw { flex: none; width: 34px; height: 18px; border: 1px solid #3a4049; background: #0f1114; position: relative; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: var(--dim); transition: transform .15s; }
.fault input:checked + .sw { border-color: var(--red); }
.fault input:checked + .sw::after { transform: translateX(16px); background: var(--red); }
.fault input:focus-visible + .sw { outline: 2px solid var(--blue); outline-offset: 2px; }

/* sliders and fields */
.fld { display: grid; gap: 6px; margin-bottom: 12px; }
.fld:last-child { margin-bottom: 0; }
.fld label, .fld .lab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 500; }
.fld output { font: 500 13px var(--font-data); color: var(--fg); }
.fld small { color: var(--dim); font-size: 11.5px; }
input[type="range"] { width: 100%; accent-color: var(--red); margin: 0; }
input[type="number"] { width: 100%; background: #0f1114; color: var(--fg); border: 1px solid var(--line); padding: 8px; font: 500 13px var(--font-data); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { flex: 1 1 auto; padding: 8px 6px; font-family: var(--font-data); font-size: 12px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--red-dim); border-color: var(--red); }

/* source tags */
.tag { font: 500 10px/1 var(--font-data); padding: 3px 5px; letter-spacing: .06em; border: 1px solid; vertical-align: 1px; white-space: nowrap; }
.t-doc { color: var(--green); border-color: #1d5c42; }
.t-user { color: var(--blue); border-color: #234f7a; }
.t-model { color: var(--amber); border-color: #66481a; }

/* schematic */
.schem { background: #0e1013; border: 1px solid var(--line); padding: 4px; }
.schem svg { display: block; width: 100%; height: auto; }
.schem text { font-family: var(--font-data); fill: var(--dim); font-size: 11px; }
.schem .big { fill: var(--fg); font-size: 13px; }
.schem .lab { fill: var(--fg); font-size: 10.5px; letter-spacing: .06em; }
.schem .box { fill: #14171b; stroke: #343a43; stroke-width: 1.5; }
/* M1 starter motor: flashes red while cranking, solid green while the engine runs */
.schem .box.m1-crank { stroke: var(--red); fill: var(--red-dim); animation: m1flash .5s steps(1) infinite; }
.schem .box.m1-run { stroke: var(--green); fill: #10241b; }
@keyframes m1flash { 50% { stroke: #343a43; fill: #14171b; } }
.schem .w { stroke: #353b44; stroke-width: 3; fill: none; stroke-linecap: square; }
.schem .w.live { stroke: var(--red); stroke-dasharray: 9 7; animation: flow .7s linear infinite; }
.schem .w.chg { stroke: var(--green); stroke-dasharray: 9 7; animation: flow .7s linear infinite; }
.schem .w.slow { animation-duration: 1.6s; }
.schem .w.rev { animation-direction: reverse; }
@keyframes flow { to { stroke-dashoffset: -16; } }
.schem .blade { stroke: var(--dim); stroke-width: 3.5; stroke-linecap: round; }
.schem .blade.on { stroke: var(--red); }
.schem .nd { fill: #4a515c; }
.schem .nd.live { fill: var(--red); }
.fuse { cursor: pointer; }
.fuse rect { fill: #14171b; stroke: #5d6671; stroke-width: 1.5; }
.fuse.blown rect { stroke: var(--red); fill: #2a1114; }
.fuse .gap { stroke: var(--bg); stroke-width: 6; display: none; }
.fuse.blown .gap { display: block; }
.fuse text { font-size: 10px; }
.relay-box { fill: #14171b; stroke: #4a515c; stroke-width: 1.5; }
.relay-box.on { fill: var(--red-dim); stroke: var(--red); }
.modehint { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 10px 4px; font-size: 12px; color: var(--dim); }
.modehint i { display: inline-block; width: 18px; height: 3px; vertical-align: 3px; margin-right: 5px; }

/* instrument cluster */
.cluster { background: #070809; border: 1px solid var(--line); padding: 14px; display: grid; grid-template-columns: 1fr minmax(0, 2.2fr) 1fr; gap: 14px; align-items: center; }
.dial { aspect-ratio: 1; max-width: 100%; border: 3px solid #5a6069; border-radius: 50%; display: grid; place-items: center; text-align: center; background: radial-gradient(circle at 50% 40%, #15171a, #090a0b); }
.dial b { font: 600 24px/1 var(--font-data); color: #cfd4da; display: block; }
.dial span { font: 500 10px var(--font-data); color: var(--dim); letter-spacing: .1em; }
.mfd { min-height: 112px; border: 1px solid #23272d; background: #0b0d10; padding: 12px; display: flex; align-items: center; gap: 14px; justify-content: center; text-align: left; transition: background .2s; }
.mfd svg { flex: none; width: 54px; height: auto; }
.mfd .msg { font: 600 22px/1.1 var(--font-display); letter-spacing: .04em; text-wrap: balance; }
.mfd .sub { display: block; font: 400 11px var(--font-data); color: var(--dim); margin-top: 6px; letter-spacing: .04em; }
.mfd.off .msg, .mfd.off svg { opacity: .0; }
.mfd.c1 { background: #260c0e; border-color: #6b1b20; }
.mfd.c1 .msg { color: #ff6b6f; }
.mfd.c2 { background: #14171b; border-color: #4a515a; }
.mfd.c2 .msg { color: #f2f4f6; }
.mfd.c0 .msg { color: var(--dim); font-weight: 500; }
@media (max-width: 520px) { .cluster { grid-template-columns: 1fr; } .dial { display: none; } }

/* telemetry */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); padding: 8px 10px; min-width: 0; }
.stat small { display: block; color: var(--dim); font: 500 10.5px var(--font-data); letter-spacing: .06em; text-transform: uppercase; }
.stat b { display: block; font: 500 20px/1.25 var(--font-data); font-variant-numeric: tabular-nums; }
.stat b i { font-style: normal; font-size: 12px; color: var(--dim); margin-left: 3px; }
.stat.warn b { color: var(--amber); }
.stat.bad b { color: var(--red); }
.stat.good b { color: var(--green); }
.stat.span2 { grid-column: 1 / -1; }
.bar { height: 6px; background: #0f1114; border: 1px solid var(--line); margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--green); width: 0; }
.bar.low i { background: var(--amber); }
.bar.crit i { background: var(--red); }
.outs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; }
.outs div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.outs b { font: 500 12.5px var(--font-data); }
.outs .cut b { color: var(--red); }
.dtc { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.dtc li { padding: 6px 8px; background: #1c1315; border-left: 3px solid var(--red); }
.dtc li.none { background: transparent; border-left-color: var(--line); color: var(--dim); }
.log { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.log li { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid #1b1e23; }
.log time { font: 400 11px var(--font-data); color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.note { color: var(--dim); font-size: 12px; margin: 10px 0 0; }
.note a { color: var(--fg); }
.foot { margin-top: 18px; color: var(--dim); font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
/* reduced motion: keep the current-flow dashes moving (they show direction) but slow and gentle, and drop the switch transition */
@media (prefers-reduced-motion: reduce) { .schem .w.live, .schem .w.chg, .schem .w.slow { animation-duration: 3s; } .sw::after { transition: none; } .schem .box.m1-crank { animation-duration: 1.2s; } }

/* guided demos */
.demos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
button.demo { text-align: left; display: grid; gap: 4px; padding: 10px 12px; line-height: 1.3; }
button.demo b { font: 600 15px/1.15 var(--font-display); letter-spacing: .03em; text-transform: uppercase; }
button.demo span { font-weight: 400; font-size: 12px; color: var(--dim); }
button.demo[aria-current="true"] { border-color: var(--red); background: #1c1315; }
.demobar { margin-top: 12px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); display: grid; gap: 10px; }
.demobar .dt { font: 600 13px var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.demobar p { margin: 0; font-size: 15px; line-height: 1.4; min-height: 3.9em; }
.demobar .bar { margin: 0; }
.demobar .bar i { background: var(--red); }
.t-demo { color: var(--dim); border-color: var(--line); }
.fault{position:relative}

/* site navigation and footer - match the rest of smartr230.co.uk (added for the standalone page) */
.site-nav { margin-inline: -16px; background: #0a0a0a; border-bottom: 1px solid #333; padding: 14px 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.site-nav a { color: #d0d0d0; text-decoration: none; font: 600 14px/1.2 var(--font-body); transition: color .2s ease; }
.site-nav a:hover, .site-nav a.active { color: #e63946; }
.site-nav a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.site-foot { margin: 24px -16px 0; margin-bottom: -32px; background: #0a0a0a; border-top: 1px solid #333; padding: 30px 20px; text-align: center; color: #808080; font-size: 14px; }
.site-foot p { margin: 0 0 8px; }
.site-foot p:last-child { margin-bottom: 0; }

/* fix: the demo bar showed empty before any demo ran, because display:grid overrode the hidden attribute (present in the original page) */
.demobar[hidden] { display: none; }

/* Buy button in the top links */
.site-nav a.nav-buy { background: #e63946; color: #fff; padding: 7px 16px; border-radius: 6px; }
.site-nav a.nav-buy:hover { background: #ff4d5a; color: #fff; }
