/* BESS Panimávida · «Explora» (mapa interactivo) y «Por dentro» (contenedor en 3D), con el sistema del sitio de Rho (16-11-2026).
   Usa los tokens de estilos.css. Colores por grupo, solo en puntos y detalles: azul = patio de energía, ámbar = red eléctrica, verde = sitio. */

.g-energia { --c: #2f6fed; }
.g-red { --c: #f8a537; }
.g-sitio { --c: #54b549; }

/* ------------------------------------------------------------------ 3 · explora: foto a la izquierda, lista a la derecha */
.mapa { --lista: 320px; }
.mapa-escena { position: relative; isolation: isolate; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 18px; background: #e3e6ea; }
.mapa-lienzo { position: absolute; inset: 0; transform-origin: 0 0; transition: transform 1.15s var(--ease); }   /* sin will-change: la capa se volvería a rasterizar borrosa al acercar */
.mapa-lienzo img { width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.mapa-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mapa-sombra { fill: rgba(10, 20, 36, .62); opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.mapa-escena.enfocado .mapa-sombra { opacity: 1; }
.forma polygon { fill: transparent; stroke: transparent; stroke-width: calc(2.2px / (var(--s, 1) * var(--k, 1))); stroke-linejoin: round; transition: fill .25s, stroke .25s; cursor: pointer; pointer-events: visiblePainted; }
.forma.contorno polygon { fill: none; pointer-events: visibleStroke; stroke-width: calc(14px / (var(--s, 1) * var(--k, 1))); stroke: rgba(0, 0, 0, 0); }
.forma.encima polygon { fill: color-mix(in srgb, var(--c) 22%, transparent); stroke: #fff; }
.forma.contorno.encima polygon { fill: none; stroke-width: calc(2.2px / (var(--s, 1) * var(--k, 1))); }
.mapa-escena.enfocado .forma.encima polygon { fill: transparent; }
#mapa-sel polygon { fill: none; stroke: #fff; stroke-width: calc(2.6px / (var(--s, 1) * var(--k, 1))); stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
#mapa-sel.dibuja polygon { animation: trazar 1.3s var(--ease) .25s forwards; }
@keyframes trazar { to { stroke-dashoffset: 0; } }

.mapa-marcadores { position: absolute; inset: 0; pointer-events: none; }
.marca { position: absolute; display: block; width: 28px; height: 28px; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto;
  transform: translate(-50%, -50%) scale(calc(1 / var(--s, 1))); transition: transform 1.15s var(--ease), opacity .4s; }
.marca-punto { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(10, 20, 36, .45); transition: transform .25s var(--ease-out); }
.marca-punto::after { content: ""; position: absolute; inset: -7px; border: 2px solid #fff; border-radius: 50%; opacity: 0; pointer-events: none; }
.marca.activo .marca-punto::after { animation: latir 2.6s ease-out infinite; }
@keyframes latir { 0% { transform: scale(.6); opacity: .9; } 70%, 100% { transform: scale(2); opacity: 0; } }
.marca-nombre { position: absolute; left: 24px; top: 50%; transform: translate(-4px, -50%); padding: 7px 11px; border-radius: 999px; background: #fff; color: var(--ink);
  font: 600 12.5px/1 var(--sans); white-space: nowrap; box-shadow: 0 8px 20px -10px rgba(10, 20, 36, .6); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--ease-out); }
.marca:hover .marca-nombre, .marca.activo .marca-nombre { opacity: 1; transform: translate(0, -50%); }
.marca:hover, .marca.activo { z-index: 2; }
.marca:hover .marca-punto, .marca.activo .marca-punto { transform: scale(1.3); }
/* elemento elegido: círculo punteado alrededor del punto (como los mapas de rondesignlab) */
.marca::before { content: ""; position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border: 1.5px dashed rgba(255, 255, 255, .95); border-radius: 50%; background: rgba(255, 255, 255, .12); opacity: 0; transform: scale(.6); transition: opacity .3s, transform .45s var(--ease-out); pointer-events: none; }
.marca.activo::before { opacity: 1; transform: none; }
.mapa-escena.enfocado .marca:not(.activo) { opacity: .45; }
.mapa-escena:not(.visto) .marca { opacity: 0; }
.mapa-escena.visto .marca { animation: brotar .6s var(--ease) both; animation-delay: calc(.5s + var(--i) * 70ms); }
@keyframes brotar { from { opacity: 0; } }

 }
.mapa-ref { position: absolute; top: 14px; left: 14px; }
.mapa-controles { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 8px; }
.boton-vidrio { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: #fff; color: var(--ink);
  font: 600 13.5px/1 var(--sans); cursor: pointer; box-shadow: 0 10px 24px -12px rgba(10, 20, 36, .6); transition: background-color .2s, color .2s, transform .2s var(--ease-out); }
.boton-vidrio:hover { background: var(--soft); }
.boton-vidrio:active { transform: scale(.97); }
.boton-vidrio svg { width: 11px; height: 11px; }
.boton-vidrio[aria-pressed="true"] { background: var(--brand); color: #fff; }

/* ficha del elemento: tarjeta blanca sólida sobre la foto (sin desenfoque de fondo) */
.mapa-ficha { position: absolute; top: 14px; right: 14px; width: min(340px, 36%); max-height: calc(100% - 28px); overflow: auto; padding: 20px 22px 18px; border-radius: 20px;
  background: rgba(255, 255, 255, .97); color: var(--ink); box-shadow: 0 24px 50px -24px rgba(10, 20, 36, .7), inset 0 0 0 1px rgba(255, 255, 255, .6); scrollbar-width: thin; }
.mapa-ficha.abre, .bat-ficha.abre { animation: ficha .45s var(--ease-out) both; }
@keyframes ficha { from { opacity: 0; transform: translateX(14px); } }
@keyframes ficha-izq { from { opacity: 0; transform: translateX(-14px); } }
/* el elemento está al borde derecho: la ficha pasa a la izquierda, bajo el aviso y sobre los botones */
.mapa-ficha.izq { right: auto; left: 14px; top: 52px; max-height: calc(100% - 52px - 66px); }
.mapa-ficha.izq.abre { animation-name: ficha-izq; }
.ficha-cat { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ficha-cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--aqua)); }
.mapa-ficha h3, .bat-ficha h3 { margin: 10px 0 8px; font-size: clamp(20px, 1.7vw, 24px); font-weight: 700; line-height: 1.12; letter-spacing: -.035em; }
.ficha-texto { font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.ficha-texto.suave { margin-top: 10px; }
.ficha-datos { margin-top: 14px; border-top: 1px solid var(--line); }
.ficha-datos > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.ficha-datos dt { color: var(--faint); }
.ficha-datos dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ficha-nota { margin-top: 10px; font-size: 12.5px; color: var(--faint); }
.ficha-ref { display: inline-block; margin-top: 12px; padding: 5px 10px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-deep); font-size: 12px; font-weight: 500; }
.mapa-ficha .boton { display: inline-flex; align-items: center; gap: 4px; height: 38px; margin-top: 14px; padding: 0 16px; border-radius: 999px; background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 600; text-decoration: none; transition: background-color .2s, transform .2s var(--ease-out); }
.mapa-ficha .boton:hover { background: var(--brand-dark); }
.mapa-ficha .boton:active { transform: scale(.97); }
.ficha-nav { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
/* en escritorio la navegación queda fija al pie aunque la ficha tenga scroll */
.mapa-ficha .ficha-nav { position: sticky; bottom: -18px; margin: 16px -22px -18px; padding: 12px 22px 16px; background: #fff; }
.ficha-nav .boton-redondo { width: 34px; height: 34px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font: 600 14px/1 var(--sans); }
.ficha-nav .boton-redondo:hover { background: var(--line); }
.ficha-pos { font-size: 12px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.ficha-cerrar { margin-left: auto; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font: 600 13px/1 var(--sans); cursor: pointer; transition: background-color .2s; }
.ficha-cerrar:hover { background: var(--line); }

/* lista de elementos por grupo, a la derecha de la foto */
.mapa-lista { gap: 10px; padding: 0 6px 6px; }
.mapa-lista .lista-t { margin: 0 -6px -4px; }
.mapa-grupo-t { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.mapa-grupo-t::before { content: ""; width: 16px; height: 2px; border-radius: 2px; background: var(--c); }
.mapa-grupo ul { display: flex; flex-wrap: wrap; gap: 4px; }
.mapa-grupo button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 999px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink);
  font: 500 13px/1.15 var(--sans); cursor: pointer; transition: background-color .2s, color .2s, transform .15s var(--ease-out); }
.mapa-grupo button i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.mapa-grupo button:hover { background: var(--brand-soft); }
.mapa-grupo button:active { transform: scale(.97); }
.mapa-grupo button[aria-pressed="true"] { background: var(--brand); box-shadow: none; color: #fff; }
.mapa-grupo button[aria-pressed="true"] i { box-shadow: 0 0 0 2px #fff; }
/* contenedores de baterías: el nombre una vez y un botón por número */
.mapa-serie { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 4px 4px 11px; border-radius: 999px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.mapa-serie-t { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: 13px; font-weight: 500; line-height: 1.1; }
.mapa-serie-t i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.mapa-serie-n { display: flex; gap: 3px; }
.mapa-grupo .mapa-serie-n button { justify-content: center; width: 26px; height: 26px; padding: 0; border-radius: 50%; background: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.mapa-grupo .mapa-serie-n button:hover { background: var(--brand-soft); }
.mapa-grupo .mapa-serie-n button[aria-pressed="true"] { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------------ 4 · por dentro (compacto): panel claro a la izquierda y el modelo sobre marino a la derecha */
.bat-grid { --lista: 320px; --alto-3d: clamp(360px, calc(var(--util) - 96px), 520px); --media: min(calc(min(100vw, 1180px) - 68px - var(--lista) - var(--hueco)), 860px); }
.bat-lado { gap: 10px; height: var(--alto-3d); }
.segmentado { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 20px; background: var(--soft); }
.segmentado button { flex: 1 1 auto; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 600 13.5px/1 var(--sans); text-align: center; cursor: pointer; transition: background-color .2s, color .2s; }
.segmentado button:hover { color: var(--ink); }
.segmentado button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.segmentado button:disabled { opacity: .4; cursor: default; }
.bat-panel, .bat-ficha { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; border-radius: 18px; background: var(--soft); color: var(--ink); scrollbar-width: thin; }
.bat-panel:empty { display: block; }
.bat-lado:has(.bat-ficha:not([hidden])) .bat-panel { display: none; }
.bat-panel h3 { font-size: 18px; font-weight: 700; line-height: 1.15; letter-spacing: -.03em; }
.bat-panel p { margin-top: 6px; font-size: 13.5px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
.bat-panel input[type="range"] { width: 100%; margin: 12px 0 4px; accent-color: var(--brand); }
.bat-panel .datos { margin-top: 10px; border-top: 1px solid #e3e5ea; }
.fila-dato { display: grid; grid-template-columns: 1fr auto; gap: 1px 12px; padding: 6px 0; border-bottom: 1px solid #e3e5ea; }
.fila-dato dt { font-size: 13px; color: var(--muted); }
.fila-dato dd { font-size: 13.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.fila-dato .fuente { grid-column: 1 / -1; font-size: 11px; font-weight: 500; line-height: 1.35; color: var(--faint); }
.fila-dato .tipo { margin-left: 8px; color: var(--azul); }
.bat-panel .pasos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.bat-panel .pasos::before, .bat-panel .pasos::after { display: none; }
.bat-panel .pasos li { display: block; }
.bat-panel .pasos button { min-width: 34px; height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px #e3e5ea; color: var(--ink); font: 600 12.5px/1 var(--sans); cursor: pointer; }
.bat-panel .pasos button[aria-current="true"] { background: var(--brand); box-shadow: none; color: #fff; }
.bat-panel .migas { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 10px; font-size: 11.5px; font-weight: 600; line-height: 1.4; color: var(--faint); }
.bat-panel .migas [aria-current="true"] { color: var(--azul); }
.bat-panel .interruptor { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.bat-panel .interruptor input { accent-color: var(--brand); }
.bat-panel .segmentado { display: inline-flex; margin-top: 10px; background: #fff; box-shadow: inset 0 0 0 1px #e3e5ea; }
.bat-panel .segmentado button { flex: 0 0 auto; height: 30px; padding: 0 12px; font-size: 13px; }
.bat-panel .acciones { display: flex; gap: 8px; margin-top: 12px; }
.bat-panel .acciones button { flex: 1; height: 34px; border: 0; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px #e3e5ea; color: var(--ink); font: 600 13px/1 var(--sans); cursor: pointer; }
.bat-panel .acciones button:hover { background: var(--line); }
.bat-panel .acciones button:disabled { opacity: .35; cursor: default; }
.bat-ficha .ficha-cat { color: var(--azul); }
.bat-ficha .ficha-cat::before { background: var(--azul); }
.bat-ficha .ficha-texto.suave { color: var(--faint); }
.bat-ficha .ficha-cerrar { margin-top: 12px; background: #fff; }

.bat { position: relative; isolation: isolate; height: var(--alto-3d); overflow: hidden; border-radius: 18px; background: #e9eef6; }
.bat-lienzo { position: absolute; inset: 0; }
.bat-lienzo canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.bat-lienzo canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.bat-estado { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center;
  background: url(media/3d/poster-rayos-v1.webp) center / cover no-repeat; }
.bat-estado::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(10, 20, 36, .5); }
.bat-estado > * { position: relative; }
.bat-chip { padding: 8px 14px; border-radius: 999px; background: rgba(10, 20, 36, .6); font-size: 13px; font-weight: 600; color: #fff; }
.bat-estado.cargando .btn { display: none; }
.bat-estado.cargando .bat-chip::after { content: ""; display: block; width: 160px; height: 2px; margin: 12px auto 0; border-radius: 2px;
  background: var(--aqua-l); animation: cargar 1.2s ease-in-out infinite alternate; }
@keyframes cargar { from { opacity: .25; } to { opacity: 1; } }
.bat-reiniciar { position: absolute; top: 12px; right: 12px; }
.bat-ref { position: absolute; top: 19px; right: 64px; }
.bat-pista { position: absolute; left: 12px; bottom: 12px; }

/* ------------------------------------------------------------------ tamaños */
@media (min-width: 1024px) and (max-height: 880px) {
  .mapa-lista { gap: 12px; padding: 14px 14px 16px; }
  .mapa-grupo button { padding: 5px 9px; font-size: 12px; }
  .mapa-serie-t { font-size: 12px; }
  .mapa-grupo .mapa-serie-n button { width: 24px; height: 24px; }
}
@media (max-width: 1023px) {
  .mapa-lista { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .mapa-lista .lista-t { grid-column: 1 / -1; margin-bottom: -8px; }
  .bat-lado { display: contents; }
  .bat-modos { order: 1; display: flex; flex-wrap: wrap; border-radius: 22px; }
  .bat-modos button { flex: 1 1 auto; text-align: center; }
  .bat { order: 2; height: clamp(360px, 56vw, 500px); }
  .bat-panel, .bat-ficha { order: 3; flex: none; max-height: none; }
}
@media (max-width: 760px) {
  .mapa-escena { border-radius: 18px; }
  .mapa-ref { top: 10px; left: 10px; }
  .mapa-controles { left: 10px; bottom: 10px; }
  .boton-vidrio { height: 34px; padding: 0 13px; font-size: 12.5px; }
  .marca { width: 24px; height: 24px; }
  .marca-punto { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; box-shadow: 0 0 0 2px #fff, 0 3px 8px rgba(10, 20, 36, .45); }
  .marca-nombre { display: none; }
  .mapa-ficha { position: static; width: auto; max-height: none; margin-top: 12px; box-shadow: var(--aro), var(--sombra); }
  .mapa-ficha.abre { animation-name: ficha-abajo; }
  .mapa-ficha .ficha-nav { position: static; margin: 16px 0 0; padding: 12px 0 0; }
  .mapa-lista { grid-template-columns: 1fr; gap: 14px; }
  .bat { height: 380px; border-radius: 18px; }
  .bat-ref { top: 20px; right: 64px; }
}
@keyframes ficha-abajo { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  .mapa-lienzo, .marca { transition: none; }
  .marca-punto::after { animation: none; }
  #mapa-sel.dibuja polygon { animation: none; stroke-dashoffset: 0; }
}
@media print {
  .mapa-controles, .bat-estado, .bat-reiniciar { display: none !important; }
}
