/* Moving light marks the selected conceptual power route. */
.system{--flow:var(--accent);--flow-cycle:2.2s}
.system[data-function=obc],.system[data-function=pdu]{--flow-cycle:2.6s}
.energy-lines{position:absolute;inset:0;width:100%;height:100%;z-index:2;pointer-events:none;overflow:visible}
.integrated-unit{z-index:1}
.port{z-index:3}
.energy-route{display:none}
.system[data-function=obc] [data-route=obc],
.system[data-function=dcdc] [data-route=dcdc],
.system[data-function=pdu] [data-route=pdu]{display:inline}
.route-rail{stroke:var(--flow);stroke-width:1;stroke-linejoin:round;opacity:.18}
/* One shared cycle: enter (0–18%), split (18–68%), rejoin and exit (68–96%). */
.flow-packet{stroke:var(--flow);stroke-width:2.8;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:8 112;stroke-dashoffset:var(--packet-start,8px);opacity:0;filter:drop-shadow(0 0 3px var(--flow));animation:power-enter var(--flow-cycle) linear infinite}
.flow-branch{stroke-width:2.3;animation-name:power-branch}
/* A consistent physical trail length on quarter- and three-quarter circuits.
   Typed lengths keep the dash offsets continuously interpolated. */
.flow-branch-short{--packet-start:16px;--packet-end:-84px;stroke-dasharray:16 104}
.flow-branch-long{--packet-start:5.3333px;--packet-end:-94.6667px;stroke-dasharray:5.3333 114.6667;animation-name:power-branch-long}
.flow-exit{animation-name:power-exit}
.junction-flash{fill:var(--flow);opacity:0;filter:drop-shadow(0 0 5px var(--flow));animation:junction-split var(--flow-cycle) ease-in-out infinite}
.junction-merge{animation-name:junction-merge}
.connection .node{fill:var(--inactive-node,#646464);transition:fill 240ms ease}
.node-halo{fill:none;stroke:var(--flow);stroke-width:1;opacity:0;transform-box:fill-box;transform-origin:center}
.system[data-function=obc] [data-port=ac],
.system[data-function=obc] [data-port=hv],
.system[data-function=dcdc] [data-port=hv],
.system[data-function=dcdc] [data-port=lv],
.system[data-function=pdu] [data-port=hv],
.system[data-function=pdu] [data-port=vehicle]{color:var(--flow)}
.system[data-function=obc] [data-port=ac] .node,
.system[data-function=obc] [data-port=hv] .node,
.system[data-function=dcdc] [data-port=hv] .node,
.system[data-function=dcdc] [data-port=lv] .node,
.system[data-function=pdu] [data-port=hv] .node,
.system[data-function=pdu] [data-port=vehicle] .node{fill:var(--flow)}
.unit-aura{position:absolute;inset:-1px;border:1px solid var(--flow);box-shadow:0 0 24px color-mix(in srgb,var(--flow) 16%,transparent);pointer-events:none;animation:unit-breathe var(--flow-cycle) ease-in-out infinite}
.system .core-symbol{width:52px;flex-shrink:0;line-height:0}
.conversion-signal{width:100%;height:auto;overflow:visible;stroke-width:2.3;stroke-linecap:round;stroke-linejoin:round}
.signal-base{stroke:currentColor;opacity:.45}
.signal-current{stroke:var(--flow);stroke-dasharray:26 94;filter:drop-shadow(0 0 3px var(--flow));animation:signal-travel var(--flow-cycle) linear infinite}
.system .unit-functions span.active{background:color-mix(in srgb,var(--flow) 14%,var(--diagram));color:var(--ink);border-color:var(--flow)}
.diagram-flow{color:var(--flow)}
.flow-packet,.junction-flash,.signal-current,.unit-aura{animation-play-state:paused!important}
.system[data-motion=running] .flow-packet,
.system[data-motion=running] .signal-current,
.system[data-motion=running] .junction-flash,
.system[data-motion=running] .unit-aura{animation-play-state:running!important}
/* Only the onboard charger has an AC input. DC modes keep the symbol still. */
.system[data-function=idle] .unit-aura,.system:not([data-function=obc]) .signal-current{display:none}
@keyframes power-enter{0%{stroke-dashoffset:var(--packet-start,8px);opacity:0}2%{opacity:1}18%{stroke-dashoffset:var(--packet-end,-92px);opacity:1}20%,100%{stroke-dashoffset:-100px;opacity:0}}
@keyframes power-branch{0%,18%{stroke-dashoffset:var(--packet-start,8px);opacity:0}19%{opacity:1}68%{stroke-dashoffset:var(--packet-end,-92px);opacity:1}70%,100%{stroke-dashoffset:-100px;opacity:0}}
/* Both heads leave the split at the same physical speed. After that first
   readable beat, the longer branch catches up and reaches the outlet in sync. */
@keyframes power-branch-long{0%,18%{stroke-dashoffset:5.3333px;opacity:0}19%{opacity:1}26%{stroke-dashoffset:0px;opacity:1}68%{stroke-dashoffset:-94.6667px;opacity:1}70%,100%{stroke-dashoffset:-100px;opacity:0}}
@keyframes power-exit{0%,68%{stroke-dashoffset:var(--packet-start,8px);opacity:0}69%{opacity:1}96%{stroke-dashoffset:var(--packet-end,-92px);opacity:1}98%,100%{stroke-dashoffset:-100px;opacity:0}}
@keyframes junction-split{0%,14%,25%,100%{opacity:0}18%{opacity:.95}}
@keyframes junction-merge{0%,64%,76%,100%{opacity:0}68%{opacity:.95}}
@keyframes signal-travel{from{stroke-dashoffset:120}to{stroke-dashoffset:0}}
@keyframes unit-breathe{0%,100%{opacity:.08}68%{opacity:.4}}
@media(max-width:1000px){.system .core-symbol{width:40px}}
@media(max-width:760px){.system .core-symbol{width:44px}}
@media(max-width:374px){.system .core-symbol{width:34px}}
@media(prefers-reduced-motion:reduce){.flow-packet,.junction-flash,.signal-current,.node-halo,.unit-aura{animation:none!important}.flow-packet,.junction-flash,.signal-current,.node-halo{display:none}.unit-aura{opacity:.35}}
@media print{.flow-packet,.junction-flash,.signal-current,.node-halo,.unit-aura{display:none}}

/* Neutral palette for the product schematics. */
.product .system{--surface:#181818;--ink:#f5f5f5;--muted:#a6a6a6;--line:#303030;--accent:#f5f5f5;--diagram:#0b0b0b;--inactive-node:#666;color:var(--ink)}
#product .circuit-lines{color:#777}
#product .trace{stroke:#606060}
#product .inner-trace{stroke:#999}
#product .integrated-unit{border-radius:7px;background:#181818;border-color:#666;color:var(--ink);box-shadow:0 0 0 9px #ffffff04}
#product .unit-label{color:#aaa}
#product .core-symbol{color:#bbb}
#product .unit-functions{color:#999}
#product .unit-functions span:not(.active){border-color:#505050}
#product .unit-corner{background:#ccc}
#product .port{color:#999}

[data-theme="blue"] .product .system {
  --surface: #e6ecff;
  --line: #c2cdeb;
  --ink: #162345;
  --muted: #4e5b77;
  --accent: var(--brand-blue);
  --diagram: #f7f9ff;
  --inactive-node: #7484b0;
}

[data-theme="blue"] #product .integrated-unit {
  background: var(--surface);
  border-color: #8596ca;
  box-shadow: 0 0 0 9px #1c39b909;
}

[data-theme="blue"] #product :is(.circuit-lines, .unit-label, .core-symbol, .unit-functions, .port) {
  color: var(--muted);
}

[data-theme="blue"] #product :is(.trace, .inner-trace) { stroke: #8391b6; }
[data-theme="blue"] #product .unit-functions span:not(.active) { border-color: #a6b4d8; }
[data-theme="blue"] #product .unit-corner { background: #7484b0; }

/* Each phase reaches the conversion unit before a pulse travels down the DC output. */
.rectifier-chart {
  margin: 16px 0 10px;
}

.rectifier-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 8px;
}

.rectifier-lines {
  width: 100%;
  height: auto;
  color: var(--muted);
}

.rectifier-grid {
  opacity: .21;
}

.rectifier-rails {
  stroke: currentColor;
  stroke-width: 1.4;
  opacity: .7;
}

.rectifier-unit {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.1;
}

.rectifier-terminals {
  fill: var(--muted);
}

.rectifier-symbol {
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rectifier-unit-name {
  fill: var(--ink);
  font: 15px 'IBM Plex Mono', monospace;
  letter-spacing: .1em;
}

.rectifier-ac-pulses, .rectifier-dc-pulse {
  stroke: var(--flow);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 13 115;
  opacity: 0;
  filter: drop-shadow(0 0 3px var(--flow));
}

.rectifier[data-motion="running"] .rectifier-ac-pulses {
  animation: rectifier-ac 3.2s linear infinite;
}

.rectifier[data-motion="running"] .rectifier-dc-pulse {
  animation: rectifier-dc 3.2s linear infinite;
}

@keyframes rectifier-ac {
  0% { stroke-dashoffset: 13; opacity: 0; }
  4%, 45% { opacity: 1; }
  49%, 100% { stroke-dashoffset: -100; opacity: 0; }
}

@keyframes rectifier-dc {
  0%, 49% { stroke-dashoffset: 13; opacity: 0; }
  53%, 89% { opacity: 1; }
  93%, 100% { stroke-dashoffset: -100; opacity: 0; }
}

@media (max-width: 760px) {
  .rectifier-unit-name { font-size: 19px; }
  .rectifier-labels { font-size: 7px; }
}
