/* EVbro — Car figure on the home tab, plan view (features/car-figure.js).
   Standalone sheet: the load ORDER (templates/index.html) follows the original cascade; do not change it.
   Colour tokens: --cf-body is the car's own colour when the car sheet names one (set by car-figure.js), --cf-line its seam colour. */

.car-figure {
  --cf-body: var(--surface-secondary);
  --cf-line: var(--muted-light);
  --cf-roof: rgba(0, 0, 0, 0.05);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 8px 12px 10px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 18px;
}
:root:not([data-theme="light"]) .car-figure { --cf-roof: rgba(255, 255, 255, 0.06); background: #141721; border-color: rgba(255, 255, 255, 0.08); }   /* as the action tiles */
.car-figure svg {
  display: block;
  width: 100%;
  max-width: 236px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
}
.car-figure-summary {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
}
.car-figure-summary[data-state="closed"] { color: var(--accent-green); }
.car-figure-summary[data-state="open"] { color: var(--accent-amber); }

/* Body, roof, mirrors and lights */
.cf-body { fill: var(--cf-body); stroke: var(--cf-line); stroke-width: 1.3; stroke-linejoin: round; }
.cf-roof { fill: var(--cf-roof); stroke: var(--cf-line); stroke-width: 0.6; }
.cf-mirror { fill: var(--cf-body); stroke: var(--cf-line); stroke-width: 1; }
.cf-light { stroke: none; }
.cf-light-front { fill: rgba(255, 236, 170, 0.9); }
.cf-light-rear { fill: rgba(255, 92, 92, 0.85); }

/* Glass: windshield, rear window, side windows and sunroof share one gradient */
.cf-glass-stop-a { stop-color: rgba(var(--accent-rgb), 0.5); }
.cf-glass-stop-b { stop-color: rgba(var(--accent-rgb), 0.2); }
.cf-glass { fill: url(#cfGlassGrad); stroke: rgba(var(--accent-rgb), 0.55); stroke-width: 0.7; }

/* Parts that report a state (doors, windows, hood, trunk, sunroof) */
.cf-part { cursor: pointer; transition: fill 0.2s ease, stroke 0.2s ease, transform 0.3s ease; }
.cf-part[data-state="closed"] { fill: transparent; stroke: var(--cf-line); stroke-width: 1; }
.cf-part.cf-glass-part[data-state="closed"] { fill: url(#cfGlassGrad); stroke: rgba(var(--accent-rgb), 0.55); stroke-width: 0.7; }
.cf-part.cf-panel[data-state="closed"] { fill: rgba(0, 0, 0, 0.035); }
:root:not([data-theme="light"]) .cf-part.cf-panel[data-state="closed"] { fill: rgba(255, 255, 255, 0.04); }
.cf-part[data-state="open"] { fill: var(--accent-amber); stroke: var(--accent-amber); stroke-width: 1.2; fill-opacity: 0.8; }
.cf-part.cf-panel[data-state="open"] { fill-opacity: 0.55; filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, 0.35)); }
.cf-part[data-state="unknown"] { fill: none; stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 2 2; }

/* Doors swing out on the hinge at their front edge: right side (top of the drawing) upwards, left side downwards */
.cf-door { transform-box: fill-box; }
.cf-door-right { transform-origin: 0% 0%; }
.cf-door-left { transform-origin: 0% 100%; }
.cf-door-right[data-state="open"] { transform: rotate(-20deg); }
.cf-door-left[data-state="open"] { transform: rotate(20deg); }

/* Wheels (always dark rubber, whatever the theme) and their pressure pills */
.cf-wheel rect { fill: #26272b; stroke: rgba(255, 255, 255, 0.16); stroke-width: 0.6; }
.cf-wheel .cf-rim { fill: rgba(255, 255, 255, 0.3); stroke: none; }
.cf-wheel[data-state="unknown"] rect { opacity: 0.45; }
.cf-wheel[data-state="warn"] rect:first-child { fill: var(--accent-red); }
.cf-pill rect { fill: var(--surface); stroke: var(--border-color); stroke-width: 0.8; }
.cf-pill[data-state="unknown"] { display: none; }
.cf-pill[data-state="warn"] rect { fill: rgba(255, 69, 58, 0.14); stroke: var(--accent-red); }
.cf-tyre { font-size: 8.6px; font-weight: 700; fill: var(--text-secondary); text-anchor: middle; font-family: inherit; }
.cf-pill[data-state="warn"] .cf-tyre { fill: var(--accent-red); }

/* Lock glyph on the hood and the charge port at the rear */
.cf-lock { cursor: pointer; }
.cf-lock path, .cf-lock rect { stroke-width: 1.6; fill: none; stroke: var(--text-muted); }
.cf-lock[data-state="locked"] path, .cf-lock[data-state="locked"] rect { stroke: var(--accent-green); }
.cf-lock[data-state="unlocked"] path, .cf-lock[data-state="unlocked"] rect { stroke: var(--accent-amber); }
.cf-lock[data-state="locked"] rect { fill: rgba(48, 209, 88, 0.2); }
.cf-lock[data-state="unlocked"] rect { fill: rgba(255, 159, 10, 0.2); }
.cf-lock[data-state="unlocked"] .cf-lock-shackle { transform: translate(-3px, -2px) rotate(-18deg); transform-origin: 10px 10px; }
.cf-cable { display: none; }
.cf-cable[data-state="plugged"], .cf-cable[data-state="charging"] { display: block; }
.cf-cable circle { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.cf-cable[data-state="charging"] circle { fill: var(--accent-green); }
.cf-cable path { stroke: var(--surface); stroke-width: 1.4; fill: none; }

/* ───── The car as a picture (layers rendered from a 3D model; features/car-figure.js, «photo»). Without the pictures the plan
   above stays. The paint is a colour multiplied over each layer through its paint mask, so the shading of the render stays. ───── */
.car-figure.has-photo > svg { display: none; }
/* until it is known whether this car is drawn as a picture, the plan is not shown either (it flashed before the picture, 25-11-2026) */
.car-figure:not(.has-photo):not(.no-photo) > svg { visibility: hidden; }
.car-figure:not(.has-photo) .cf-photo { display: none; }
.cf-photo { position: relative; width: 100%; max-width: 440px; margin: 0 auto; isolation: isolate; --cf-paint: #d7d9dc; --cf-paint-roof: var(--cf-paint); }
.cf-layer { position: absolute; inset: 0; transition: opacity 0.25s ease; }
.cf-layer[hidden] { display: none; }
.cf-layer img { display: block; width: 100%; height: 100%; }
.cf-layer[data-layer="base"] img { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.28)); }
.cf-tint {
  position: absolute; inset: 0; pointer-events: none; background: var(--cf-paint); mix-blend-mode: multiply;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.cf-tint-roof { background: var(--cf-paint-roof); }
/* open parts glow amber (the colour that means «open» everywhere in EVbro); a part without data is shown faded, never as «closed» */
.cf-layer[data-state="open"] img { filter: drop-shadow(0 0 3px rgba(255, 159, 10, 0.95)) drop-shadow(0 0 7px rgba(255, 159, 10, 0.55)); }
/* without data a part is drawn closed (faded, it showed the engine bay through: «the hood looks grey», 25-11-2026) and outlined */
.cf-unknown { fill: none; stroke: transparent; }
.cf-unknown[data-state="unknown"] { stroke: var(--text-muted); stroke-width: 3; stroke-dasharray: 10 8; }
.cf-hl-window[data-state="unknown"] rect, .cf-hl-roof[data-state="unknown"] rect { stroke: var(--text-muted); stroke-width: 3; stroke-dasharray: 10 8; }

.car-figure .cf-overlay { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; margin: 0; overflow: visible; pointer-events: none; }
.cf-overlay .cf-hit, .cf-overlay .cf-hl, .cf-overlay .cf-lock { pointer-events: all; cursor: pointer; }
.cf-hit { fill: transparent; }
.cf-hl rect { fill: transparent; stroke: transparent; transition: fill 0.2s ease, stroke 0.2s ease; }
.cf-hl-window[data-state="open"] rect { fill: rgba(255, 159, 10, 0.88); }
.cf-hl-window[data-state="vent"] rect { fill: rgba(255, 159, 10, 0.3); stroke: var(--accent-amber); stroke-width: 3; stroke-dasharray: 9 6; }
.cf-hl-roof[data-state="open"] rect { stroke: var(--accent-amber); stroke-width: 6; }
.cf-hl-roof[data-state="tilt"] rect { stroke: var(--accent-amber); stroke-width: 5; stroke-dasharray: 14 9; }
.cf-overlay .cf-pill rect { stroke-width: 2; }
.cf-overlay .cf-tyre { font-size: 25px; }
.cf-tyre-temp { font-size: 19px; font-weight: 600; fill: var(--text-muted); text-anchor: middle; font-family: inherit; }
.car-credit { font-size: 0.75rem; margin: 0.5rem 0 0; overflow-wrap: anywhere; }

/* The hose beside the rear wheel while the cable is plugged in (features/car-figure.js, renderHose), ending in a charging gun;
   under the gun, inside the picture, the power and the time the charge ends */
.cf-hose { display: none; cursor: pointer; }
.cf-hose[data-state="plugged"], .cf-hose[data-state="charging"] { display: inline; }
.cf-overlay .cf-hose { pointer-events: all; }
.cf-hose-line { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.cf-hose-plug { fill: var(--accent); }
.cf-hose[data-state="charging"] .cf-hose-line { stroke: var(--accent-green); }
.cf-hose[data-state="charging"] .cf-hose-plug { fill: var(--accent-green); }
.cf-hose-power { font-size: 30px; font-weight: 700; fill: var(--text-primary); text-anchor: middle; font-family: inherit; font-variant-numeric: tabular-nums; }
.cf-hose-end { font-size: 25px; font-weight: 600; fill: var(--text-muted); text-anchor: middle; font-family: inherit; }
.cf-hose[data-state="charging"] .cf-hose-end { fill: var(--accent-green); }
