:root {
  --film: #F6F8FB; --sheet: #FFFFFF; --ink: #111A2B; --graphite: #5B6575; --rule: #E3E8EF;
  --accent: #F2A516; --accent-ink: #111A2B; --primary: #1F4E79; --primary-ink: #FFFFFF; --pass: #2E7D4F; --fail: #B3261E; --warn-bg: #FFF7E6;
  --cu: #B87333; --al: #A9B2B8;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --film: #0F1620; --sheet: #172130; --ink: #E8EDF4; --graphite: #9AA6B6; --rule: #2A3646;
    --accent: #F5B331; --primary: #6FA8DC; --primary-ink: #0F1620; --pass: #5DBB84; --fail: #F0796F; --warn-bg: #2E2614; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --film: #0F1620; --sheet: #172130; --ink: #E8EDF4; --graphite: #9AA6B6; --rule: #2A3646;
  --accent: #F5B331; --primary: #6FA8DC; --primary-ink: #0F1620; --pass: #5DBB84; --fail: #F0796F; --warn-bg: #2E2614; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--film); color: var(--ink);
  font: 400 16px/1.6 "Inter", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif; font-feature-settings: "cv11", "ss01";
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; margin: 0; }
:lang(ne) h1, :lang(ne) h2, :lang(ne) h3 { letter-spacing: 0; line-height: 1.35; }
h1 { font-size: 39px; }
h2 { font-size: 25px; }
h3 { font-size: 20px; }
small { font-size: 13px; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* header */
.top { display: flex; flex-wrap: wrap; gap: var(--s5); align-items: end; justify-content: space-between;
  padding: var(--s6) var(--s6) var(--s5); border-bottom: 1px solid var(--rule); }
.brand p { margin: var(--s2) 0 0; color: var(--graphite); max-width: 48ch; }
.switches { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--rule); background: var(--sheet); border-radius: 2px; }
.seg button { font: inherit; font-size: 14px; background: none; border: 0; color: var(--ink); padding: var(--s2) var(--s3);
  cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; min-height: 44px; justify-content: center; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button small { color: var(--graphite); font-size: 12px; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--sheet); }
.seg button[aria-checked="true"] small { color: inherit; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.guide-link { font-size: 14px; padding: var(--s2) 0; text-underline-offset: 3px; }

/* bench layout */
.page { max-width: 1320px; margin: 0 auto; padding: var(--s6); }
/* The result panel is sticky only inside .bench (form + result), so it never covers the working below. */
.bench { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s6); align-items: start; }
.bench > * { min-width: 0; }
.form { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
.result { position: sticky; top: var(--s4); background: var(--sheet); border: 1px solid var(--rule);
  border-radius: 6px; padding: var(--s5); max-height: calc(100vh - 2 * var(--s4)); overflow-y: auto; overscroll-behavior: contain; }
.working { margin-top: var(--s6); border-top: 1px solid var(--rule); }

.step { background: var(--sheet); border: 1px solid var(--rule); padding: var(--s5); }
.step h2 { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s4); }
.n { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; flex: none;
  background: color-mix(in srgb, var(--accent) 22%, var(--sheet)); color: var(--ink); align-self: center; }
.step h2 { align-items: center; }
.ic { vertical-align: -3px; flex: none; }

/* fields */
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.row:last-child { margin-bottom: 0; }
.field { display: grid; gap: var(--s1); align-content: start; min-width: 0; }
fieldset.field { min-inline-size: 0; }
.field label, .field .lbl { font-weight: 600; font-size: 15px; }
.field .hint { color: var(--graphite); font-size: 13px; }
input[type=number], select {
  font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule);
  border-bottom: 2px solid var(--graphite); border-radius: 2px; padding: 10px 10px; min-height: 44px; width: 100%;
}
input[type=number]:focus, select:focus { border-bottom-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.unit { display: flex; }
.unit input { border-right: 0; min-width: 0; }
.unit select { width: auto; flex: none; }
.unit .suffix { display: grid; place-items: center; padding: 0 var(--s3); border: 1px solid var(--rule); border-bottom: 2px solid var(--graphite); color: var(--graphite); font-size: 14px; }
.choices { display: grid; gap: var(--s2); }
.choice { display: grid; grid-template-columns: 20px 1fr; gap: var(--s3); align-items: start; padding: var(--s3);
  border: 1px solid var(--rule); cursor: pointer; }
.choice input { margin: 3px 0 0; accent-color: var(--ink); width: 18px; height: 18px; }
.choice:has(input:checked) { border-color: var(--ink); background: color-mix(in srgb, var(--accent) 12%, var(--sheet)); }
.choice b { font-weight: 600; display: block; }
.choice span { color: var(--graphite); font-size: 14px; }
.check { display: flex; gap: var(--s2); align-items: center; font-weight: 600; font-size: 15px; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.err { color: var(--fail); font-size: 14px; margin: 0; }

/* simple mode: jobs, routes, explainers */
fieldset.field { border: 0; padding: 0; margin: 0 0 var(--s4); }
fieldset.field > legend { padding: 0; margin-bottom: var(--s2); font-weight: 600; font-size: 15px; }
.jobgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: var(--s2); }
.jobcard, .routecard { position: relative; display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border: 1px solid var(--rule); background: var(--sheet); cursor: pointer; min-height: 56px; font-size: 15px; line-height: 1.3; }
.jobcard input, .routecard input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.jobcard svg { flex: none; }
.jobcard:has(input:checked), .routecard:has(input:checked) { border-color: var(--ink); background: color-mix(in srgb, var(--accent) 14%, var(--sheet)); font-weight: 600; }
.jobcard:has(input:focus-visible), .routecard:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.routes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: var(--s2); }
.jobcard span, .routecard span { flex: 1; min-width: 0; }
.figwrap { margin: var(--s3) 0; color: var(--ink); }
.figwrap svg, svg.fig { width: 100%; max-width: 420px; height: auto; display: block; }
.figwrap.map { max-width: 460px; }
.routecard svg, .routecard svg.fig { width: 52px; height: 52px; flex: none; }
svg .acc { stroke: var(--accent); }
svg .c-r { fill: #C62828; stroke: none; } svg .c-y { fill: #E2B007; stroke: none; } svg .c-b { fill: #1F5FAF; stroke: none; } svg .c-n { fill: currentColor; stroke: none; }
details.why { margin-top: var(--s2); font-size: 14px; }
details.why summary { cursor: pointer; color: var(--graphite); text-decoration: underline; text-underline-offset: 3px; min-height: 28px; display: inline-flex; align-items: center; }
details.why[open] { background: var(--film); border: 1px solid var(--rule); padding: var(--s3); }
details.why[open] summary { color: var(--ink); margin-bottom: var(--s2); }
details.why p { margin: 0 0 var(--s2); max-width: 64ch; }
.result details.why[open] { background: var(--film); }
.rh { font-size: 17px; margin: var(--s4) 0 var(--s2); }
.volt { margin-top: var(--s4); }
.volt.bad dd { color: var(--fail); }
ul.plain { margin: 0; padding-left: 1.2em; display: grid; gap: var(--s2); font-size: 14px; }
.smaller { font-size: 14px; padding: var(--s3); border: 1px solid var(--rule); margin: var(--s4) 0 0; }
:lang(ne) body, [lang="ne"] { line-height: 1.6; }

/* result */
.xsec { margin: 0 0 var(--s4); display: grid; justify-items: center; }
.xsec svg { width: 100%; max-width: 240px; height: auto; }
.xsec svg .ring { transition: r 180ms ease-out; }
.xsec figcaption { color: var(--graphite); font-size: 13px; text-align: center; }
.buy { font-size: 20px; line-height: 1.3; font-weight: 700; margin: 0 0 var(--s3); }
.buy-sub { margin: 0 0 var(--s4); color: var(--graphite); font-size: 14px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s4); margin: 0 0 var(--s4); font-size: 15px; }
.kv dt { color: var(--graphite); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.meter { margin: 0 0 var(--s3); }
.meter .top-line { display: flex; justify-content: space-between; font-size: 14px; }
.meter .bar { height: 8px; background: var(--film); border: 1px solid var(--rule); margin-top: var(--s1); position: relative; }
.meter .bar i { position: absolute; inset: 0 auto 0 0; background: var(--pass); }
.meter.bad .bar i { background: var(--fail); }
.meter.bad .top-line b { color: var(--fail); }
.decided { font-size: 15px; padding: var(--s3) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: var(--s4) 0; }
.notes { margin: var(--s3) 0 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
.notes li { background: var(--warn-bg); padding: var(--s2) var(--s3); font-size: 14px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.fail-box { border: 1px solid var(--fail); padding: var(--s3); color: var(--ink); }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s4); }
.btn { font: inherit; font-weight: 600; font-size: 15px; background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); padding: 10px var(--s4); min-height: 44px; cursor: pointer; border-radius: 2px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn:active { transform: translateY(1px); }

/* working */
.working h2 { margin: var(--s5) 0 var(--s4); }
.working h3 { margin: var(--s5) 0 var(--s3); }
.working p, .working li { max-width: 64ch; }
.tablewrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
thead th { font-weight: 600; background: var(--film); position: sticky; top: 0; }
tr.chosen td { background: color-mix(in srgb, var(--accent) 22%, var(--sheet)); font-weight: 700; color: var(--ink); }
td.no { color: var(--fail); }
td.yes { color: var(--pass); }
.formula { font-family: inherit; background: var(--sheet); border: 1px solid var(--rule); padding: var(--s3) var(--s4); overflow-x: auto; }
ol.trail { padding-left: 1.4em; display: grid; gap: var(--s2); grid-template-columns: minmax(0, 1fr); overflow-wrap: anywhere; }

.sticky { display: none; }
.foot p { max-width: 62ch; }
p, li { text-wrap: pretty; }
.foot { padding: var(--s5) var(--s6) var(--s7); color: var(--graphite); font-size: 13px; max-width: 1320px; margin: 0 auto; }

@media (max-width: 1023px) {
  .page { padding: var(--s4); }
  .bench { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .result { position: static; max-height: none; overflow: visible; }
  .top { padding: var(--s5) var(--s4) var(--s4); }
  h1 { font-size: 31px; }
  .sticky { display: block; position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink); color: var(--sheet);
    padding: var(--s3) var(--s4); font-size: 15px; font-weight: 600; z-index: 5; }
  .sticky:empty { display: none; }
  .foot { padding-bottom: 96px; }
}
@media (max-width: 480px) {
  .step { padding: var(--s4); }
  .row { grid-template-columns: 1fr; }
  .seg button { padding: var(--s2); }
  .switches { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .xsec svg .ring { transition: none; } }
@media print {
  .switches, .form, .actions, .sticky, .guide-link { display: none !important; }
  .page, .bench { display: block; padding: 0; }
  .result { position: static; border: 0; max-height: none; overflow: visible; }
  body { background: #fff; color: #000; }
}

/* help "?" sits beside the field label; the explanation opens under the field */
.field, fieldset.field { position: relative; }
details.why { margin-top: 0; }
details.why > summary { position: absolute; top: -2px; right: 0; list-style: none; cursor: pointer; color: var(--graphite);
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; text-decoration: none; min-height: 0; }
details.why > summary::-webkit-details-marker { display: none; }
details.why > summary:hover, details.why[open] > summary { color: var(--ink); background: var(--film); }
details.why[open] { background: none; border: 0; padding: 0; }
.why-body { background: var(--film); border: 1px solid var(--rule); border-radius: 6px; padding: var(--s3) var(--s4); margin-top: var(--s2); }
.field > label, fieldset.field > legend { padding-right: 36px; }
.step > div > details.why > summary, .step details.why.top > summary { top: -48px; }
.result details.why > summary, .result details.why { position: static; }
details.box { border-top: 1px solid var(--rule); margin-top: var(--s3); }
details.box > summary { list-style: none; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::after { content: "+"; margin-left: auto; color: var(--graphite); font-weight: 400; }
details.box[open] > summary::after { content: "−"; }
details.box ul.plain { padding-bottom: var(--s3); }
.rh { display: flex; gap: var(--s2); align-items: center; }
.result details.box > summary { position: static; width: auto; height: auto; display: flex; gap: var(--s2); justify-content: flex-start;
  border-radius: 0; padding: var(--s2) 0; color: var(--ink); font-weight: 600; font-size: 15px; }
/* result rows */
.ask { margin: 0; color: var(--graphite); font-size: 14px; display: flex; gap: 6px; align-items: center; }
.kvs { display: grid; gap: 2px; margin: var(--s3) 0 var(--s4); }
.kvr { display: grid; grid-template-columns: 20px 1fr auto; gap: var(--s2); align-items: center; padding: 6px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.kvr span { color: var(--graphite); }
.kvr b { text-align: right; font-weight: 600; }
.kvr .ic { color: var(--graphite); }
.meter .top-line span { display: flex; gap: 6px; align-items: center; }
.meter .top-line .ic { color: var(--pass); }
.meter.bad .top-line .ic { color: var(--fail); }
.decided { display: flex; gap: var(--s2); align-items: baseline; }
.notes li { display: flex; gap: var(--s2); align-items: flex-start; }
.notes li .ic { margin-top: 3px; color: var(--graphite); }
.btn { display: inline-flex; gap: var(--s2); align-items: center; }
#w-h { display: flex; gap: var(--s3); align-items: center; }
.working h3 { display: flex; gap: var(--s2); align-items: center; }
.lead-s { color: var(--graphite); }
.legend { display: grid; grid-template-columns: max-content 1fr; gap: 4px var(--s4); font-size: 14px; margin: var(--s3) 0 var(--s4); max-width: 80ch; }
.legend dt { font-weight: 600; }
.legend dd { margin: 0; color: var(--graphite); }
/* pictures on installation options (engineer + HV) */
.choice.withpic { grid-template-columns: 20px 56px 1fr; align-items: center; }
.mpic svg, .mpic svg.fig { width: 52px; height: 52px; display: block; }
.mpic { color: var(--ink); }
@media (max-width: 480px) { .legend { grid-template-columns: 1fr; } .legend dd { margin-bottom: var(--s2); } }

/* route illustrations */
svg .wall { fill: color-mix(in srgb, var(--graphite) 28%, transparent); }
svg .soil { fill: #A07B52; opacity: .28; }
svg .sand { fill: #E6CF8F; opacity: .8; }
svg .brick { fill: #B5533C; opacity: .85; }
svg .sheath { fill: #2A2F33; stroke: none; }
fieldset.field > details.why > summary { top: -36px; }
.routes + details.why > summary { top: -38px; }

/* illustrations */
svg .fa { fill: color-mix(in srgb, var(--accent) 38%, transparent); }
svg .fw { fill: #1F5FAF; stroke: none; opacity: .75; }
.jobart { flex: none; }
.jobcard { min-height: 72px; }
.top { position: relative; overflow: hidden; }
.hero-art { position: absolute; right: var(--s6); top: 18px; width: 260px; height: 110px; color: var(--ink); opacity: .9; }
.hero-art .acc { stroke: var(--accent); }
@media (min-width: 1200px) { .top { padding-right: 320px; } }
@media (max-width: 1199px) { .hero-art { display: none; } }

svg .acc-s { stroke: var(--accent); stroke-width: 2.2; }

/* bill of materials */
ul.bom { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
ul.bom li { padding: var(--s3) 0; border-bottom: 1px solid var(--rule); }
.bom-top { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; }
.bom-top b { font-weight: 600; font-size: 15px; }
.bom-top .qty { flex: none; font-size: 13px; font-weight: 600; background: var(--film); border: 1px solid var(--rule); border-radius: 3px; padding: 1px 6px; }
.bom-spec { font-size: 14px; margin-top: 2px; }
.bom-why { font-size: 13px; color: var(--graphite); margin-top: 2px; }

/* ===== ElectricalCalc-family layout: nav, hero, bands, cards ===== */
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--s5); }
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--sheet) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.nav-in { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: var(--s4); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; text-decoration: none; color: var(--ink); }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.nav-links { display: flex; align-items: center; gap: var(--s5); font-size: 15px; }
.nav-links a { text-decoration: none; color: var(--graphite); }
.nav-links a:hover { color: var(--ink); }
.seg-sm button { min-height: 34px; padding: 4px 10px; font-size: 13px; }

.hero { padding: var(--s7) 0 var(--s7); border-bottom: 1px solid var(--rule); }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s6); align-items: center; }
.pill { display: inline-block; background: color-mix(in srgb, var(--accent) 20%, var(--sheet)); color: var(--pill-ink, #7A4F00); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; margin: 0 0 var(--s4); }
:root[data-theme="dark"] .pill { color: var(--accent); }
.hero h1 { font-size: 52px; line-height: 1.08; font-weight: 700; letter-spacing: -0.025em; max-width: 16ch; }
.hero .lead { font-size: 19px; line-height: 1.6; color: var(--graphite); max-width: 60ch; margin: var(--s4) 0 var(--s5); }
.cta { display: flex; flex-wrap: wrap; gap: var(--s3); }
.facts { list-style: none; padding: 0; margin: var(--s5) 0 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); font-size: 14px; color: var(--graphite); }
.facts b { color: var(--ink); }
.hero .hero-art { position: static; width: 100%; height: auto; display: block; color: var(--ink); }

.band { padding: var(--s8) 0; }
.band.alt { background: var(--sheet); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.band h2, .calc-head h2 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.sub { color: var(--graphite); margin: var(--s2) 0 var(--s5); max-width: 70ch; }
.cards4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); }
.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s5); }
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: var(--s5); box-shadow: 0 1px 2px rgba(17, 26, 43, .04); }
.band.alt .card { background: var(--film); }
.card h3 { font-size: 18px; margin: var(--s3) 0 var(--s2); }
.card p { margin: 0; color: var(--graphite); font-size: 15px; }
.card-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 12%, var(--sheet)); color: var(--primary); }
.steps4 { list-style: none; counter-reset: st; padding: 0; margin: var(--s5) 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); }
.steps4 li { counter-increment: st; background: var(--film); border: 1px solid var(--rule); border-radius: 12px; padding: var(--s5); display: grid; gap: var(--s2); }
.steps4 li::before { content: counter(st); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.steps4 b { font-size: 17px; }
.steps4 span { color: var(--graphite); font-size: 15px; }

.calc { padding: var(--s7) 0 var(--s6); }
.calc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.calc .bench { padding: 0; max-width: none; }
.calc .working { margin-top: var(--s6); }
.step, .result { border-radius: 12px; box-shadow: 0 1px 2px rgba(17, 26, 43, .04); }
.result { top: 76px; max-height: calc(100vh - 92px); }
.seg { border-radius: 8px; overflow: hidden; }
.seg button[aria-checked="true"] { background: var(--primary); color: var(--primary-ink); }
.btn { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); border-radius: 8px; text-decoration: none; padding: 12px 18px; }
.btn.ghost { background: var(--sheet); color: var(--ink); border-color: var(--rule); }
.btn:hover { filter: brightness(1.08); }
.jobcard, .routecard, .choice { border-radius: 10px; }
input[type=number], select { border-radius: 8px; border-bottom-width: 1px; }
.tablewrap { border-radius: 10px; }

.tabs { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.tabs button { font: inherit; font-size: 14px; border: 1px solid var(--rule); background: var(--film); color: var(--ink); border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 40px; }
.tabs button[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.ex-panel { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s5); }
.ex-story h3 { font-size: 22px; margin-bottom: var(--s2); }
.ex-story p { color: var(--graphite); }
.ex-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.kpi { background: var(--film); border: 1px solid var(--rule); border-radius: 12px; padding: var(--s4); }
.kpi b { display: block; font-size: 22px; letter-spacing: -0.01em; }
.kpi span { color: var(--graphite); font-size: 13px; }
.ex-why { grid-column: 1 / -1; font-size: 15px; background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--rule)); border-radius: 10px; padding: var(--s3) var(--s4); margin: 0; }

.foot { border-top: 1px solid var(--rule); background: var(--sheet); padding: var(--s6) 0 var(--s7); max-width: none; }
.foot p { max-width: 80ch; margin: 0 0 var(--s2); }
.foot a { color: var(--primary); }

@media (max-width: 1023px) {
  .hero-in { grid-template-columns: 1fr; }
  .hero .hero-art { display: none; }
  .cards4, .steps4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-panel { grid-template-columns: 1fr; }
  .result { max-height: none; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 34px; }
  .hero .lead { font-size: 17px; }
  .band { padding: var(--s7) 0; }
  .band h2, .calc-head h2 { font-size: 26px; }
  .cards4, .cards3, .steps4 { grid-template-columns: 1fr; }
  .nav-links a { display: none; }
  .wrap { padding: 0 var(--s4); }
}
@media print { .nav, .hero, .band, #examples, #honest, .calc-head { display: none !important; } }

/* ===== wire theme ===== */
:root { --ph-r: #C62828; --ph-y: #E2A400; --ph-b: #1F5FAF; --ph-n: #1C1F24; --cu: #C0702F; --sheath: #1E2328; }
:root[data-theme="dark"] { --ph-n: #9AA6B6; --sheath: #0A0D11; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ph-n: #9AA6B6; --sheath: #0A0D11; } }
.phase-bar { height: 4px; background: linear-gradient(90deg, var(--ph-r) 0 25%, var(--ph-y) 25% 50%, var(--ph-b) 50% 75%, var(--ph-n) 75% 100%); }
.theme-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.theme-btn:hover { border-color: var(--graphite); }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }

/* section titles carry a stripped-wire end in the phase colours */
.band h2::before, .calc-head h2::before { content: ""; display: block; width: 64px; height: 6px; border-radius: 3px; margin-bottom: 14px;
  background: linear-gradient(90deg, var(--cu) 0 22%, var(--ph-r) 22% 48%, var(--ph-y) 48% 74%, var(--ph-b) 74% 100%); }

/* tool cards: top band in the colour of that cable's sheath */
.card[data-sheath] { position: relative; overflow: hidden; padding-top: calc(var(--s5) + 6px); }
.card[data-sheath]::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--ph-n); }
.card[data-sheath="hv"]::before { background: var(--ph-r); }
.card[data-sheath="line"]::before { background: #9AA5AE; }
.card[data-sheath="buy"]::before { background: var(--cu); }

/* how-it-works: steps hang on one live wire with current flowing along it */
.steps4 { position: relative; }
.steps4::before { content: ""; position: absolute; left: 4%; right: 4%; top: 39px; height: 3px; border-radius: 2px; z-index: 0;
  background: repeating-linear-gradient(90deg, var(--cu) 0 14px, color-mix(in srgb, var(--cu) 35%, transparent) 14px 22px); background-size: 22px 3px;
  animation: current 1.1s linear infinite; }
@keyframes current { to { background-position: 22px 0; } }
.steps4 li { position: relative; z-index: 1; }
.steps4 li::before { box-shadow: 0 0 0 4px var(--film), 0 0 0 6px var(--cu); }
@media (prefers-reduced-motion: reduce) { .steps4::before { animation: none; } }
@media (max-width: 1023px) { .steps4::before { display: none; } }

/* result header printed like the marking on a real cable sheath */
.sheath-print { margin: 0 0 var(--s4); border-radius: 999px; background: var(--sheath); color: #C9CED4; overflow: hidden; white-space: nowrap;
  font: 600 11px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .14em; text-transform: uppercase; padding: 9px 0;
  box-shadow: inset 0 2px 3px rgba(255,255,255,.08), inset 0 -3px 4px rgba(0,0,0,.45); }
.sheath-print span { display: block; padding: 0 18px; overflow: hidden; text-overflow: ellipsis; }

/* hero: faint cable runs behind the copy */
.hero { position: relative; overflow: hidden; }
.hero-wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .5; }
.hero-in { position: relative; }

/* components catalogue */
.comp-nav { margin-top: var(--s5); }
.comp-nav a { text-decoration: none; font-size: 14px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); border-radius: 999px; padding: 8px 14px; }
.comp-nav a:hover { border-color: var(--primary); }
.comp-main { padding-top: var(--s6); padding-bottom: var(--s7); }
.comp-group { margin-bottom: var(--s7); scroll-margin-top: 80px; }
.comp-group > h2 { font-size: 28px; margin-bottom: var(--s4); }
.comp-group > h2::before { content: ""; display: block; width: 64px; height: 6px; border-radius: 3px; margin-bottom: 14px;
  background: linear-gradient(90deg, var(--cu) 0 22%, var(--ph-r) 22% 48%, var(--ph-y) 48% 74%, var(--ph-b) 74% 100%); }
.comp-group h2 span, .comp h3 span { font-weight: 500; color: var(--graphite); font-size: .8em; margin-left: 6px; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: var(--s4); }
.comp { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; scroll-margin-top: 80px; }
.comp:target { outline: 3px solid var(--accent); }
.comp-ph { margin: 0; position: relative; aspect-ratio: 3 / 2; background: var(--film); }
.comp-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comp-ph figcaption { position: absolute; left: 0; right: 0; bottom: 0; font-size: 12px; color: #E8EDF4; background: linear-gradient(transparent, rgba(0,0,0,.65)); padding: 16px 10px 6px; }
.comp-ph figcaption a { color: inherit; }
.comp-ph.none { display: grid; place-items: center; color: var(--graphite); }
.comp-body { padding: var(--s4) var(--s5) var(--s5); }
.comp-body h3 { font-size: 18px; margin-bottom: var(--s2); }
.comp-body p { color: var(--graphite); margin: 0 0 var(--s3); font-size: 15px; }
.comp-body dl { margin: 0; display: grid; gap: var(--s2); font-size: 14px; }
.comp-body dt { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.comp-body dd { margin: 0 0 var(--s2) 21px; color: var(--ink); }
.bom-top b a { color: inherit; text-decoration-color: color-mix(in srgb, var(--primary) 45%, transparent); text-underline-offset: 3px; }

/* steps sit open on the wire so the current is visible through each terminal */
.steps4 li { background: transparent; border: 0; padding: 0 var(--s4) 0 0; }
.steps4::before { top: 15px; left: 15px; right: 0; }
.sheath-print { border: 1px solid color-mix(in srgb, var(--graphite) 35%, transparent); }
.steps4 li { align-content: start; }

/* installation options with real photos */
.routecard:has(.route-photo) { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; gap: 0; }
.routecard .route-photo { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.routecard:has(.route-photo) span { padding: var(--s3); }
.routes:has(.route-photo) { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.mpic .route-photo { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }
.choice.withpic:has(.route-photo) { grid-template-columns: 20px 64px 1fr; }

:root[data-theme="dark"] { --pill-ink: #FFD27A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pill-ink: #FFD27A; } }

.sub { max-width: 64ch; }
.foot p { max-width: 70ch; }
.ex-story p { max-width: 60ch; }
.card p { max-width: 48ch; }

/* cards: icon sits inline with the heading; a stripped-wire mark in the cable's sheath colour leads it */
.card[data-sheath] { padding-top: var(--s5); overflow: visible; }
.card[data-sheath]::before { content: none; }
.card { display: grid; grid-template-columns: auto 1fr; column-gap: var(--s3); align-items: center; }
.card > .card-ic { width: auto; height: auto; background: none; border-radius: 0; color: var(--primary); grid-row: 1; }
.card > h3 { margin: 0; grid-row: 1; }
.card > p { grid-column: 1 / -1; margin-top: var(--s3); }
.card > h3::before { content: ""; display: inline-block; width: 22px; height: 7px; border-radius: 4px; margin-right: 10px; vertical-align: 3px;
  background: linear-gradient(90deg, var(--sheath-c, var(--ph-n)) 0 68%, var(--cu) 68% 100%); }
.card[data-sheath="hv"] { --sheath-c: var(--ph-r); }
.card[data-sheath="line"] { --sheath-c: #9AA5AE; }
.card[data-sheath="buy"] { --sheath-c: var(--cu); }
#honest .card > h3::before { --sheath-c: var(--ph-b); }
.card > .card-ic { display: none; }
.card { grid-template-columns: 1fr; }
.card > h3 { font-size: 19px; }
.comp-ph { overflow: hidden; }
.comp-ph img { position: absolute; inset: 0; }
