/* EVNETICS widgets.css (owner C) · v3 direction B. Loaded after main.css on every page.
   Holds: the /chargers/ page and its 3D viewer card, the /home-charging/ page, and the 2D widgets
   (supply planner, single-line diagram, data viz). Every colour is a main.css token, so both themes
   follow automatically; the 3D studio re-reads the same tokens on the evn:theme event. */

/* ================================================================== /chargers/ */
.cx { padding-block: 48px var(--sec-y); }
.cx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.cx-ch { min-width: 0; }
.cx-ch > :last-child { margin-bottom: 0; }
.cx-intro { display: flex; flex-direction: column; gap: 22px; padding-bottom: 32px; }
.cx-intro > * { margin: 0; }
.cx-intro .lede { max-width: 30em; }
.cx-side { min-width: 0; }

/* the studio card: photo poster first, the 3D canvas fades in over it */
.cx-stage {
  position: relative; overflow: hidden; isolation: isolate;
  aspect-ratio: 4 / 5; max-height: 74svh; width: 100%;
  border-radius: var(--r-lg); background: var(--surface);
}
.cx-poster { position: absolute; inset: 0; display: grid; place-items: center; padding: 12%; transition: opacity .6s var(--ease); }
.cx-poster picture { display: block; width: min(100%, 440px); aspect-ratio: 1; background: var(--plate); border-radius: var(--r-sm); overflow: hidden; }
.cx-poster img { width: 100%; height: 100%; object-fit: contain; }
.cx-stage.is-live .cx-poster { opacity: 0; pointer-events: none; }
.cx-switch { position: absolute; z-index: 3; top: 14px; left: 14px; right: 14px; width: max-content; max-width: calc(100% - 28px); background: var(--card); box-shadow: var(--shadow); }
.cx-switch button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); box-shadow: none; }
.cx-stage:not(.is-live) .cx-switch { display: none; }

/* specs: numbered rows that frame each part in the 3D card */
.cx-specs-ch { padding-block: 36px 24px; }
.cx-specs { margin: 0; border-block: 1px solid var(--line); padding-block: 4px; }
.cx-spec {
  position: relative; display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr); gap: 4px 20px; align-items: baseline;
  padding: 15px 12px; margin-inline: -12px; border-radius: var(--r-sm);
  transition: background-color .18s var(--ease);
}
.cx-spec + .cx-spec::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; border-top: 1px solid var(--line); transition: opacity .18s var(--ease); }
.cx-spec.is-live:hover::before, .cx-spec.is-live:hover + .cx-spec::before,
.cx-spec.is-active::before, .cx-spec.is-active + .cx-spec::before { opacity: 0; }
.cx-spec dt { font-weight: 600; color: var(--ink); }
.cx-spec dd { margin: 0; color: var(--muted); }
.cx-n {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; margin-right: 12px; vertical-align: -6px;
  border-radius: 50%; border: 1.5px solid var(--line-strong); color: var(--muted);
  font: 600 14px/1 var(--font-body); font-variant-numeric: tabular-nums;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.cx-spec.is-live { cursor: pointer; }
.cx-spec.is-live:hover { background: var(--surface); }
.cx-spec.is-active { background: var(--rec-bg); }
.cx-spec.is-active .cx-n, .cx-spec.is-live:hover .cx-n { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.vw-spec-b {
  display: inline-flex; align-items: center; padding: 0; margin: 0; border: 0; background: none;
  font: inherit; font-weight: 600; color: inherit; text-align: left; cursor: pointer; border-radius: var(--r-sm);
}
.vw-spec-b .cx-n { margin-right: 12px; vertical-align: 0; }
@media (max-width: 599px) {
  .cx-spec { grid-template-columns: minmax(0, 1fr); padding-block: 13px; }
  .cx-spec dd { padding-left: 40px; }
}

.cx-photo { display: flex; align-items: center; gap: 16px; margin: 28px 0 0; }
.cx-plate { display: block; flex: none; width: 104px; height: 104px; background: var(--plate); border-radius: var(--r-sm); overflow: hidden; }
.cx-plate picture, .cx-plate img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cx-photo figcaption { font-size: 15px; color: var(--muted); }

.cx-speed { padding-block: 36px; }
.cx-note { margin: 0 0 18px; font-size: 18px; color: var(--muted); max-width: 34em; }
.cx-note strong { display: block; margin-bottom: 6px; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.25; letter-spacing: var(--track); color: var(--ink); }

.cx-telto { padding-block: 56px 32px; display: flex; flex-direction: column; gap: 18px; }
.cx-telto > * { margin: 0; }
.cx-telto .cx-photo { margin-top: 10px; }

.cx-config { padding-block: 32px 8px; display: flex; flex-direction: column; gap: 20px; }
.cx-config > * { margin: 0; }
.cx-config h3 { font-size: 24px; }
.cx-cfg { display: flex; flex-direction: column; gap: 18px; }
.cx:not(.is-3d) .cx-cfg { display: none; }
.cx-set { margin: 0; padding: 0; border: 0; min-width: 0; }
.cx-set legend { padding: 0; margin-bottom: 10px; font-size: 15px; font-weight: 600; color: var(--ink); }
.cx-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.cx-opts label { position: relative; display: inline-flex; }
.cx-opts input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.cx-opts span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 9px 18px; cursor: pointer;
  border-radius: var(--r-pill); border: 1.5px solid var(--line-strong); background: transparent;
  font-size: 16px; font-weight: 500; color: var(--ink);
  transition: border-color .18s var(--ease), background-color .18s var(--ease);
}
.cx-opts span:hover { border-color: var(--ink); }
.cx-opts input:checked + span { border-color: var(--brand-text); background: var(--rec-bg); color: var(--brand-text); font-weight: 600; }
.cx-opts input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.cx-cfg-line { font-size: 16px; }
.cx-cfg-line a { font-weight: 500; }

/* desktop: text chapters on the left, the studio card sticky on the right */
@media (min-width: 1000px) {
  .cx { padding-top: 56px; }
  .cx-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 56px; }
  .cx-ch { grid-column: 1; }
  .cx-side { grid-column: 2; grid-row: 1 / span 6; }
  .cx-stage {
    position: sticky; top: calc(var(--header-h) + 20px);
    aspect-ratio: auto; height: calc(100svh - var(--header-h) - 40px); min-height: 540px; max-height: 860px;
  }
  .cx-intro { padding-top: 48px; padding-bottom: 8px; }
  .cx-specs-ch { padding-top: 44px; }
  .cx-speed, .cx-telto, .cx-config { min-height: 52svh; display: flex; flex-direction: column; justify-content: center; }
  /* the last chapter is as tall as the card, so the card stays pinned beside the configurator */
  .cx-config { min-height: clamp(540px, calc(100svh - var(--header-h) - 40px), 860px); padding-block: 24px; }
  .cx-speed { gap: 0; }
}
@media (max-width: 999px) {
  .cx-side { margin-bottom: 8px; }
}
@media (max-width: 599px) {
  .cx { padding-top: 28px; }
  .cx-intro { gap: 16px; padding-bottom: 24px; }
  .cx-stage { aspect-ratio: 5 / 6; max-height: 68svh; }
  .cx-switch { top: 10px; left: 10px; }
  .cx-switch button { min-height: 40px; padding: 8px 12px; font-size: 14px; }
}

/* 3D viewer overlays (created by viewer.js inside the card) */
.vw-canvas {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  opacity: 0; transition: opacity .7s var(--ease); touch-action: pan-y;
}
.cx-stage.is-live .vw-canvas { opacity: 1; }
.vw-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.vw-layer > * { position: absolute; left: 0; top: 0; }
.vw-layer [data-off] { visibility: hidden; }
.vw-dot {
  display: grid; place-items: center; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border-radius: 50%; background: var(--card); color: var(--ink); box-shadow: var(--shadow);
  font: 600 14px/1 var(--font-body); font-variant-numeric: tabular-nums;
  transition: background-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.vw-dot.is-hot { background: var(--brand); color: var(--on-brand); box-shadow: 0 0 0 6px var(--selection), var(--shadow); }
.vw-hint {
  margin: 34px 0 0 30px; padding: 8px 14px; white-space: nowrap; pointer-events: none;
  border-radius: var(--r-pill); background: var(--card); color: var(--ink); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 600; line-height: 1.2;
}
.vw-grab {
  width: 64px; height: 64px; margin: -32px 0 0 -32px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; pointer-events: auto; touch-action: none; cursor: grab;
}
.vw-grab:hover, .vw-grab:focus-visible { outline: 2px dashed var(--brand-text); outline-offset: -4px; }

/* the two cards after the grid */
.cx-more { padding-top: 32px; }
.cx-duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 24px; }
.cx-duo-card { display: flex; flex-direction: column; gap: 14px; padding: 36px; }
.cx-duo-card > * { margin: 0; }
.cx-duo-card h2 { font-size: clamp(26px, 2.4vw, 32px); line-height: 1.15; }
.cx-duo-card .ctas { margin-top: auto; padding-top: 10px; }
.cx-duo-card.card--brand p { color: var(--on-brand-muted); }
@media (max-width: 599px) { .cx-duo-card { padding: 24px; } }

/* ================================================================== /home-charging/ */
.hc-head { padding-bottom: 48px; }
.hc-head .sec-head { gap: 22px; }
.hc-head h1 { max-width: 14em; }
.hc-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 24px; }
.hc-product {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-lg);
}
.hc-plate { position: relative; aspect-ratio: 4 / 3; border-radius: 0; }
.hc-plate picture { position: absolute; inset: 22px; display: block; }
.hc-plate img { width: 100%; height: 100%; object-fit: contain; }
.hc-pc { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 28px 30px 30px; border-top: 1px solid var(--card-line); }
.hc-pc > * { margin: 0; }
.hc-pc h2 { font-weight: 700; font-size: clamp(26px, 2.2vw, 30px); line-height: 1.15; }
.hc-tag { color: var(--muted); font-size: 17px; }
.hc-pc .ticks { margin-top: 6px; font-size: 17px; }
.hc-go { margin-top: auto; padding-top: 8px; }
.hc-steps h3 { font-size: 21px; }

.hc-pk-head { align-items: center; }
.sec-head--row.hc-pk-head > .seg { flex: 0 1 auto; flex-direction: row; gap: 4px; max-width: 100%; }
.hc-sld {
  margin-bottom: 24px; padding: clamp(18px, 3vw, 40px);
  background: var(--surface); border-radius: var(--r-lg);
}
.hc-sld .sld { min-height: 120px; }
.hc-pkgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 24px; }
.hc-pkg { display: flex; flex-direction: column; gap: 10px; transition: opacity .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease); }
.hc-pkg > * { margin: 0; }
.hc-pkg .ticks { margin-top: 8px; font-size: 17px; }
#packages[data-phase] .hc-pkg { opacity: .9; } /* .9 keeps the muted text at AA (4.5:1+) in both themes; the brand outline marks the active one */
#packages[data-phase="single"] .hc-pkg[data-phase="single"],
#packages[data-phase="three"] .hc-pkg[data-phase="three"] { opacity: 1; border-color: var(--brand-text); box-shadow: 0 0 0 1px var(--brand-text); }
.hc-foot { margin: 20px 0 24px; }
.hc-which .sec-head { margin-bottom: 28px; }
.hc-search { max-width: 640px; }
@media (max-width: 599px) {
  .hc-head { padding-bottom: 32px; }
  .hc-pc { padding: 22px 20px 24px; }
  .sec-head--row.hc-pk-head > .seg { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; border-radius: var(--r-lg); }
  .hc-pk-head .seg button { padding: 10px 14px; font-size: 15px; border-radius: 18px; }
}

/* ================================================================== single-line diagram (sld.js) */
.sld-svg { display: block; width: 100%; max-width: 880px; height: auto; margin-inline: auto; overflow: visible; }
.sld-own { opacity: .6; }
.sld-box { fill: var(--card); stroke: var(--line-strong); stroke-width: 1.5; }
.sld-db { fill: var(--card); stroke: var(--ink); stroke-width: 1.5; }
.sld-dev { fill: var(--surface); stroke: var(--muted); stroke-width: 1.2; }
.sld-pole { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.sld-c { fill: none; stroke: var(--brand-text); stroke-width: 2; stroke-linecap: round; }
.sld-c.n { stroke: var(--muted); }
.sld-flow { fill: none; stroke: var(--brand-text); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 18; opacity: 0; }
.sld-t { fill: var(--ink); font-family: var(--font-body); font-weight: 600; font-size: 14px; }
.sld-m { fill: var(--muted); font-family: var(--font-body); font-weight: 500; font-size: 12px; }
.sld-k { fill: var(--muted); font-family: var(--font-body); font-weight: 500; font-size: 13px; }
.sld-lead { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.sld-dim { fill: none; stroke: var(--muted); stroke-width: 1; }
.sld-plug { fill: var(--brand); }
.sld-ok { fill: var(--rec-bg); stroke: var(--ok); stroke-width: 1.6; }
.sld-okm { fill: none; stroke: var(--ok); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sld-ph { opacity: 0; transition: opacity .3s var(--ease); }
.sld-ph.is-on { opacity: 1; }
.sld-ph.is-on .sld-c { stroke-dasharray: 1; animation: sld-draw .55s var(--ease) both; }
.sld-svg.is-still .sld-ph { transition: none; }
.sld-svg.is-still .sld-c { animation: none; stroke-dasharray: none; }
@keyframes sld-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .sld-svg.is-flowing .sld-ph.is-on .sld-flow { opacity: .9; animation: sld-flow 1.1s linear infinite; }
}
@keyframes sld-flow { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }

/* ================================================================== supply planner (planner.js) */
.plan {
  display: flex; flex-direction: column; gap: 24px; padding: 32px;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-lg);
}
.section--surface .plan { border-color: transparent; }
.plan-f { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.plan-row { display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: flex-end; }
.plan-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.plan-l { font-size: 15px; font-weight: 600; color: var(--ink); }
.plan-v { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: var(--track); color: var(--brand-text); font-variant-numeric: tabular-nums; }
.plan-range { width: 100%; height: 32px; margin: 0; accent-color: var(--brand); cursor: pointer; background: transparent; }
.plan .seg { align-self: flex-start; }
.plan-st { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface); align-self: flex-start; }
.plan-sb {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  color: var(--ink); font: 600 22px/1 var(--font-body);
}
.plan-sb[aria-disabled="true"] { opacity: .45; cursor: default; box-shadow: none; }
.plan-st output { min-width: 44px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 20px; font-variant-numeric: tabular-nums; }
.plan-sw {
  display: inline-flex; align-items: center; gap: 14px; min-height: 44px; padding: 0; border: 0; background: none;
  font-size: 17px; font-weight: 600; color: var(--ink); text-align: left; align-self: flex-start; border-radius: var(--r-pill);
}
.plan-k {
  position: relative; flex: none; width: 48px; height: 28px; border-radius: var(--r-pill);
  background: var(--line-strong); transition: background-color .18s var(--ease);
}
.plan-k::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow); transition: transform .18s var(--ease);
}
.plan-sw[aria-checked="true"] .plan-k { background: var(--brand); }
.plan-sw[aria-checked="true"] .plan-k::after { transform: translateX(20px); background: var(--on-brand); }
.plan-out { display: flex; flex-direction: column; gap: 14px; padding: 24px; border-radius: var(--r-sm); background: var(--surface); }
.section--surface .plan-out { background: var(--rec-bg); }
.plan-say { display: flex; flex-direction: column; gap: 4px; }
.plan-read { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.15; letter-spacing: var(--track); color: var(--ink); font-variant-numeric: tabular-nums; }
.plan-s { font-size: 16px; line-height: 1.5; color: var(--muted); }
.plan-s::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--ok); vertical-align: 0; }
.plan-out.is-over .plan-s { color: var(--danger); font-weight: 500; }
.plan-out.is-over .plan-s::before { background: var(--danger); }
.plan-g { display: block; width: 100%; height: 64px; overflow: visible; }
.plan-tr { fill: var(--card); stroke: var(--line-strong); stroke-width: 1; }
.plan-sg { fill: var(--brand); }
.plan-sg.is-share { fill: var(--brand-text); }
.plan-ov { fill: var(--danger); opacity: .85; }
.plan-ht { fill: var(--card); opacity: .45; }
.plan-ghost { fill: none; stroke: var(--brand-text); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .7; }
.plan-tk { stroke: var(--line-strong); stroke-width: 1; }
.plan-lim { stroke: var(--ink); stroke-width: 2; }
.plan-tl { fill: var(--muted); font-family: var(--font-body); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.plan-tl.is-lim { fill: var(--ink); font-weight: 600; }
.plan-a { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; }
.plan-cta { white-space: normal; text-align: left; }
.plan-reset { padding: 4px 0; border: 0; background: none; color: var(--brand-text); font-size: 15px; font-weight: 500; text-align: left; text-decoration: underline; text-underline-offset: 4px; }
.plan-reset:hover { text-decoration-thickness: 2px; }
.planner-fallback[hidden] { display: none !important; }
@media (max-width: 599px) {
  .plan { padding: 22px 18px; gap: 20px; }
  .plan-out { padding: 18px 16px; }
  .plan-read { font-size: 22px; }
  .plan .seg button { padding: 10px 14px; font-size: 15px; }
}

/* ================================================================== data viz (dataviz.js) */
.dv-vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.g48 { display: flex; flex-direction: column; gap: 12px; max-width: 360px; margin: 0; }
.g48 svg { display: block; width: 100%; height: auto; }
.g48-e { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.g48-f { fill: var(--brand); }
.g48-p { fill: var(--brand-text); opacity: .55; }
.g48-f, .g48-p { opacity: 0; transition: opacity .14s var(--ease); }
.g48.is-on .g48-f { opacity: 1; }
.g48.is-on .g48-p { opacity: .55; }
.g48-cap { margin: 0; font-size: 15px; color: var(--muted); }
.tka { display: block; width: 100%; max-width: 260px; margin: 0; }
.tka svg { display: block; width: 100%; height: auto; }
.tka-t { stroke: var(--line); stroke-width: 3; transition: stroke .16s var(--ease); }
.tka-t.on { stroke: var(--brand); }
.tka-n { fill: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 54px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.dv-bars .bar { transform-origin: bottom; }
@media (prefers-reduced-motion: no-preference) {
  .dv-bars.is-waiting .bar { transform: scaleY(0); }
  .dv-bars.is-in .bar { transform: none; transition: transform .7s var(--ease); }
}

/* official TeltoCharge lifestyle photo in the chargers story (owner 2026-11-15) */
.cx-wide { margin: 24px 0 0; display: flex; flex-direction: column; gap: 8px; }
.cx-wide img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-lg); background: var(--surface); }
.cx-wide figcaption { font-size: 15px; color: var(--muted); }

/* no 3D any more (owner 2026-11-15): the chapters no longer need scroll room beside a sticky model */
@media (min-width: 1000px) {
  .cx-speed, .cx-telto, .cx-config { min-height: 0; justify-content: flex-start; padding-top: 56px; }
  .cx-config { padding-block: 56px 0; }
  .cx-stage { height: auto; aspect-ratio: 4 / 5; min-height: 0; max-height: none; }
}
.cx-options { margin-top: 18px; }

/* the pinned photo follows the chapter: ABB Terra AC, then TeltoCharge (owner 2026-11-15) */
.cx-poster--telto { opacity: 0; }
.cx-stage.is-telto .cx-poster--abb { opacity: 0; }
.cx-stage.is-telto .cx-poster--telto { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .cx-poster { transition: none; } }
