/* Eco Electric · «Cómo funciona» (Fase 4.2)
   Escena SVG: cielo ~18 %, vivienda y equipos ~70 %, suelo ~12 %.
   Flujo de energía CONCEPTUAL. Se identifica por color + patrón de trazo + flechas + movimiento + leyenda. */

.ee-sec { background: var(--navy); color: var(--paper); }
.ee-sec .sec-head { border-top-color: rgba(247, 249, 246, .2); }
.ee-sec .eyebrow { color: var(--green); }
.ee-sec .lead { color: rgba(247, 249, 246, .86); }

/* ---------- Controles ---------- */
.ee__controls { display: flex; flex-wrap: wrap; gap: 16px 28px; margin-bottom: 22px; }
.ee__group { border: 0; margin: 0; padding: 0; min-width: 0; }
.ee__group legend { padding: 0; margin-bottom: 10px; font: 600 13px/1 var(--f-label); letter-spacing: .1em; text-transform: uppercase; color: var(--green); }
.ee__seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-radius: 18px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(247, 249, 246, .14); }
.ee__seg label { position: relative; cursor: pointer; }
.ee__seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ee__seg span { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 16px; border-radius: 13px; font-size: 16px; font-weight: 600; line-height: 1.1; color: rgba(247, 249, 246, .9); transition: background-color .2s, color .2s; }
.ee__seg span small { display: block; font: 600 11px/1.2 var(--f-label); letter-spacing: .08em; text-transform: uppercase; opacity: .78; margin-left: 2px; }
.ee__seg span svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ee__seg label:hover span { background: rgba(247, 249, 246, .08); color: #fff; }
.ee__seg input:checked + span { background: var(--green); color: var(--navy); }
.ee__seg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.ee__seg:not(.ee__seg--scene) span { flex-direction: column; align-items: flex-start; gap: 2px; justify-content: center; }

/* ---------- Escena isométrica (Fase 4.2 · A.1) ---------- */
.ee__stage { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.ee__figure { position: relative; margin: 0; border-radius: 22px; overflow: hidden; background: linear-gradient(180deg, #e9f1f7 0%, #f6f8f5 70%); box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .6); transition: background .5s; }
[data-sky="cloud"] .ee__figure { background: linear-gradient(180deg, #d5dde3 0%, #eceff0 70%); }
[data-sky="night"] .ee__figure { background: linear-gradient(180deg, #0a1a36 0%, #132c52 80%); }
.ee-scene { display: block; width: 100%; height: auto; }

/* Iconos de cielo: pequeños, en la esquina */
.ee-sun circle { fill: #F3B548; }
.ee-sun__rays { stroke: #F3B548; stroke-width: 3; stroke-linecap: round; fill: none; }
.ee-moon path { fill: #e9eef2; }
.ee-clouds path { fill: #fff; stroke: rgba(8, 29, 61, .08); }
.ee-sun, .ee-moon, .ee-clouds { transition: opacity .5s; }
.ee-moon, .ee-clouds { opacity: 0; }
[data-sky="cloud"] .ee-clouds { opacity: 1; }
[data-sky="cloud"] .ee-sun { opacity: .35; }
[data-sky="night"] .ee-sun { opacity: 0; }
[data-sky="night"] .ee-moon { opacity: 1; }

/* Materiales (luz suave desde la izquierda: caras +Y claras, +X en sombra) */
.iso-ground .g-top { fill: #c9d6bf; }
.iso-ground .g-side-y { fill: #8d9b88; }
.iso-ground .g-side-x { fill: #75836f; }
.g-pave { fill: #e4e2dc; }
.wall-x { fill: #ddd6c9; stroke: #b9b1a2; stroke-width: 1; }
.wall-y { fill: #f1ede5; stroke: #cfc7b8; stroke-width: 1; }
.gable { fill: #d6cfc1; }
.roof { fill: #2f3b4d; stroke: #1b2433; stroke-width: 1.2; stroke-linejoin: round; }
.roof-edge { fill: #1b2433; }
.ridge { stroke: #141b27; stroke-width: 3; stroke-linecap: round; }
.pv { fill: url(#ee-pv-g); stroke: #d6dee8; stroke-width: 1.4; stroke-linejoin: round; }
.pv-cells { stroke: rgba(170, 200, 240, .45); stroke-width: .9; fill: none; }
.win { fill: #3b4f66; stroke: #8f9aa6; stroke-width: 1; transition: fill .4s; }
.floor--a { fill: #e9e3d8; }
.floor--b { fill: #d9c4a2; }
.floor--tech { fill: #d7dbdf; }
.wall-in-x { fill: #e6e0d4; }
.wall-back { fill: #eef0f2; stroke: #c6ccd3; stroke-width: 1; }
.cut-top { fill: #44546a; }
.cutwall .fy, .cutwall .fx { fill: #e8e3d9; stroke: #c9c1b2; stroke-width: .8; }
.cutwall .ft { fill: #44546a; }   /* corte de sección, como en un plano */
.furn .fy { fill: #dfe4ea; } .furn .fx { fill: #c3cbd5; } .furn .ft { fill: #f1f4f7; }
.sofa .fy { fill: #8da2bb; } .sofa .fx { fill: #758aa4; } .sofa .ft { fill: #a7b9cf; }
.tv .fy, .tv .fx, .tv .ft { fill: #1b2433; }
.fridge .fy { fill: #f4f6f8; } .fridge .fx { fill: #d6dce3; } .fridge .ft { fill: #ffffff; }
.counter .fy { fill: #cfc6b6; } .counter .fx { fill: #b8ae9c; } .counter .ft { fill: #efe9dd; }
.ac .fy { fill: #fafbfc; } .ac .fx { fill: #dde3ea; } .ac .ft { fill: #fff; }
.lamp-stem .fy, .lamp-stem .fx, .lamp-stem .ft { fill: #6b7787; }
.lamp-shade { fill: #9aa5b3; transition: fill .4s; }
.sconce .fy, .sconce .fx, .sconce .ft { fill: #9aa5b3; transition: fill .4s; }
[data-house="all"] .sconce .fy, [data-house="all"] .sconce .ft, [data-house="partial"] .room--a .sconce .fy, [data-house="partial"] .room--a .sconce .ft { fill: #FFD98A; }
.light-pool { fill: url(#ee-pool); opacity: 0; transition: opacity .5s; }
.hedge .fy { fill: #7f9b62; } .hedge .fx { fill: #6b8752; } .hedge .ft { fill: #93ad74; }
.pole .fy, .pole .fx, .pole .ft { fill: #6a5a48; }
.insul .fy, .insul .fx, .insul .ft { fill: #dfe6ec; }
.post .fy, .post .fx, .post .ft { fill: #59667a; }
.dev .fy { fill: #f7f9fb; } .dev .fx { fill: #d9dfe6; } .dev .ft { fill: #ffffff; }
.dev, .dev polygon { stroke: #081D3D; stroke-width: .9; stroke-linejoin: round; }
.bat .fy { fill: #12345e; } .bat .fx { fill: #0b2647; } .bat .ft { fill: #1d4677; }
.board .fy { fill: #c8d0d9; } .board .fx { fill: #aeb8c4; } .board .ft { fill: #dde3e9; }
.meter .fy { fill: #f3f6f8; }
.meter-dial { fill: #fff; stroke: #081D3D; stroke-width: 1.2; }
.inv-lines, .board-lines { stroke: #081D3D; stroke-width: 1.6; stroke-linecap: round; fill: none; }
.bat-bolt { stroke: #80B721; stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ee-led { fill: #80B721; }
.is-inv-off .ee-led { fill: #c2412b; }
.ee-wire { fill: none; stroke: #1b2b35; stroke-width: 1.6; }

/* Estados de la vivienda: luz interior según circuitos con energía */
[data-house="all"] .light-pool, [data-house="partial"] .room--a .light-pool { opacity: 1; }
[data-house="all"] .lamp-shade, [data-house="partial"] .room--a .lamp-shade { fill: #FFD98A; }
[data-house="all"] .win-w1 { fill: #FFE2A0; }
[data-house="off"] .room, [data-house="partial"] .room--b { filter: saturate(.4) brightness(.86); }
[data-sky="night"] .iso-ground, [data-sky="night"] .iso-w1, [data-sky="night"] .iso-w2 > :not(.room), [data-sky="night"] .iso-tech, [data-sky="night"] .iso-tech-front, [data-sky="night"] .iso-deco, [data-sky="night"] .ee-grid-net { filter: brightness(.62) saturate(.8); }
[data-sky="night"] .room { filter: brightness(.7); }
[data-sky="night"][data-house="all"] .room, [data-sky="night"][data-house="partial"] .room--a { filter: none; }
[data-sky="cloud"] .iso-ground, [data-sky="cloud"] .iso-w1, [data-sky="cloud"] .iso-deco { filter: saturate(.75) brightness(.95); }
.ee-backed, .ee-unbacked { display: none; }
[data-house="partial"] .ee-backed, [data-house="partial"] .ee-unbacked { display: block; }

/* Red, corte y sistema aislado */
.ee-cut circle { fill: #fff; stroke: #c2412b; stroke-width: 2.6; }
.ee-cut path { stroke: #c2412b; stroke-width: 3.2; stroke-linecap: round; }
.ee-cut, .ee-nogrid { display: none; }
.is-cut .ee-cut { display: block; }
.is-cut .ee-wire { stroke-dasharray: 5 5; opacity: .5; }
.is-nogrid .ee-grid-net, .is-nogrid .ee-meter, .is-nogrid .ee-only-grid, .is-nogrid [data-cable="import"], .is-nogrid [data-cable="export"] { display: none; }
.is-nogrid .ee-nogrid { display: block; }
.ee-bat, .ee-only-bat, [data-cable="charge"], [data-cable="discharge"] { display: none; }
.has-bat .ee-bat, .has-bat .ee-only-bat, .has-bat [data-cable="charge"], .has-bat [data-cable="discharge"] { display: initial; }
.ee__key li.ee-only-bat { display: none; }
.has-bat .ee__key li.ee-only-bat { display: list-item; }
.is-nogrid .ee__key li.ee-only-grid { display: none; }

/* Etiquetas discretas */
.ee-tag__lead { stroke: rgba(8, 29, 61, .55); stroke-width: 1.6; }
.ee-tag__dot { fill: #081D3D; stroke: #fff; stroke-width: 1.5; }
.ee-tag__box { fill: rgba(255, 255, 255, .95); stroke: rgba(8, 29, 61, .18); }
.ee-tag__t { font: 600 20px/1 var(--f-body); fill: #081D3D; }
[data-sky="night"] .ee-tag__lead { stroke: rgba(255, 255, 255, .55); }
.ee-lbl { font: 600 19px/1 var(--f-body); fill: #081D3D; paint-order: stroke; stroke: rgba(255, 255, 255, .92); stroke-width: 4px; stroke-linejoin: round; }
[data-sky="night"] .ee-lbl { fill: #f7f9f6; stroke: rgba(6, 20, 43, .85); }
.ee-lbl--alert { fill: #a8321d !important; }

/* ---------- Recorridos de energía ----------
   Cable gris (siempre visible) = cableado inactivo. Activo: color según el origen,
   trazo propio por tipo y flechas que viajan del origen al destino (SMIL animateMotion). */
.ee-cable { fill: none; stroke: rgba(8, 29, 61, .28); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
[data-sky="night"] .ee-cable { stroke: rgba(255, 255, 255, .22); }
.ee-halo, .ee-flow { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity .35s; }
.ee-halo { stroke: rgba(8, 29, 61, .42); stroke-width: 9; }
[data-sky="night"] .ee-halo { stroke: rgba(255, 255, 255, .2); }
.ee-flow { stroke-width: 4; }
.ee-flow.is-on, .ee-halo.is-on { opacity: 1; }
.ee-flow[data-src="solar"] { stroke: #F3B548; }
.ee-flow[data-src="grid"] { stroke: #4A9BF0; stroke-dasharray: 2 6; stroke-width: 4.5; }
.ee-flow[data-src="bat"] { stroke: #80B721; stroke-dasharray: 14 5 3 5; }
.ee-flow[data-src="mix"] { stroke: #B9D75A; stroke-dasharray: 10 6; }
.ee-flow.is-weak { stroke-width: 2.6; opacity: .85; }
.ee-flow.is-cond { stroke-width: 2.6; stroke-dasharray: 2 6; opacity: .95; }
.ee-halo.is-cond, .ee-halo.is-weak { opacity: .5; stroke-width: 6; }
.ee-run { stroke: #081D3D; stroke-width: 1; stroke-linejoin: round; }
.ee-run--solar { fill: #F3B548; }
.ee-run--grid { fill: #4A9BF0; }
.ee-run--bat { fill: #80B721; }

/* Pines numerados: solo en móvil */
.ee-pins { display: none; }
.ee-pins circle { fill: #081D3D; stroke: #fff; stroke-width: 3; }
.ee-pins text { font: 700 26px/1 var(--f-body); fill: #fff; text-anchor: middle; }
.ee__key { display: none; }

/* ---------- Panel explicativo (texto breve + recorrido en pasos) ---------- */
.ee__panel { display: flex; flex-direction: column; gap: 14px; padding: 26px; border-radius: 22px; background: var(--paper); color: var(--text); }
.ee__crumb { margin: 0; font: 600 12px/1.3 var(--f-label); letter-spacing: .08em; text-transform: uppercase; color: var(--green-text); }
.ee__title { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(26px, 2.3vw, 32px); line-height: 1.04; color: var(--navy); }
.ee__body { margin: 0; font-size: 16.5px; line-height: 1.5; color: var(--text); }
.ee__flows { margin: 0; padding: 0; list-style: none; counter-reset: ee; display: flex; flex-direction: column; gap: 8px; }
.ee__flows li { counter-increment: ee; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 15px; line-height: 1.35; color: var(--navy); font-weight: 600; }
.ee__flows li::before { content: counter(ee); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font: 700 14px/1 var(--f-body); color: var(--navy); background: #e4e9ee; }
.ee__flows li[data-c="solar"]::before { background: #F3B548; }
.ee__flows li[data-c="grid"]::before { background: #4A9BF0; }
.ee__flows li[data-c="bat"]::before { background: #80B721; }
.ee__flows li[data-c="off"]::before { background: #c9cfd6; }
.ee__flows li small { display: block; font-weight: 400; color: var(--text-2); font-size: 13px; }
.ee__equip { margin: 0; padding-left: 12px; border-left: 3px solid var(--blue); font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.ee__note { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fff4dc; color: #4d3a0c; font-size: 14px; line-height: 1.45; }
.ee__note[hidden] { display: none; }
.ee__legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.ee__legend span { display: inline-flex; align-items: center; gap: 8px; }
.ee__legend svg { width: 40px; height: 10px; flex-shrink: 0; }
.lg { fill: none; stroke-width: 4; stroke-linecap: round; }
.lg--solar { stroke: #D9951C; stroke-dasharray: 10 6; }
.lg--grid { stroke: #2F7FD8; stroke-dasharray: 2 6; stroke-width: 5; }
.lg--bat { stroke: #5E8F14; stroke-dasharray: 14 5 3 5; }
.lg--cond { stroke: #3d5162; stroke-dasharray: 2 5; stroke-width: 3; }
.lg--off { stroke: rgba(8, 29, 61, .3); stroke-width: 3; }
.ee__disclaimer { margin: 16px 0 0; color: rgba(247, 249, 246, .8); border-color: rgba(247, 249, 246, .35); }

@media (max-width: 1100px) { .ee__stage { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .ee__controls { gap: 14px; }
  .ee__group { width: 100%; }
  .ee__seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ee__seg--scene { grid-template-columns: 1fr 1fr; }
  .ee__seg span { min-height: 52px; padding: 8px 10px; font-size: 15px; width: 100%; justify-content: center; text-align: center; }
  .ee__seg:not(.ee__seg--scene) span { align-items: center; }
  .ee__figure { border-radius: 16px; }
  .ee-labels, .ee-roomlbls, .iso-deco, .ee-sky-ic { display: none !important; }
  .ee-pins { display: block; }
  .ee-cut text { display: none; }
  .ee__key { display: grid; list-style: none; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; padding: 14px; font-size: 14px; line-height: 1.25; color: var(--navy); background: #fff; border-top: 1px solid var(--line); }
  .ee__key li { display: flex; align-items: center; gap: 8px; min-height: 28px; }
  .ee__key b { flex-shrink: 0; margin-right: 0; }
  .ee__panel { padding: 18px; border-radius: 16px; }
}
.ee__key b { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; }
