/* Portada (login/inicio) común a todos los visores MINAM.
   Cada visor solo define sus variables de tema en su propio index.html (bloque <style>).
   Colores y tipografías vienen de ../assets/tokens.css */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fondo); color: #eef6f2; font-family: var(--font-institucional); }
svg.i { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:root {
  /* Variables de tema (se sobrescriben por visor) */
  --acento-1: #3fe0c2;           /* inicio del degradado de la palabra destacada */
  --acento-2: #1fb4e6;           /* fin del degradado */
  --luz: 63, 224, 194;           /* RGB del brillo de pulsos, líneas y tarjetas */
  --fondo-alterno: radial-gradient(120% 90% at 70% 40%, #0b3a52, #04141c 70%);
  --ancho-izq: min(520px, 38vw);
}

.escena { position: fixed; inset: 0; overflow: hidden; isolation: isolate; background: var(--fondo-alterno), var(--fondo); }

/* Lienzo 16:9: el fondo y todo lo posicionado en % (puntos, etiquetas) viaja con la imagen. */
.lienzo { position: absolute; z-index: 0; top: 50%; width: max(100vw, 177.78vh); aspect-ratio: 16 / 9; transform: translateY(-50%); }
.lienzo.der { right: 0; }
.lienzo.centro { left: 50%; transform: translate(-50%, -50%); }
.lienzo > img.fondo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; animation: revela 2.2s ease-out both; }
@keyframes revela { from { opacity: 0; filter: blur(10px) brightness(.5); transform: scale(1.03); } to { opacity: 1; filter: none; transform: none; } }

/* Etiquetas flotantes dentro del paisaje (p. ej. «Monitoreo satelital») */
.etiqueta { position: absolute; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 9px;
  background: rgba(8, 28, 38, .72); border: 1px solid rgba(var(--luz), .35); backdrop-filter: blur(6px); color: #fff; font-size: 13px; font-weight: 500;
  opacity: 0; animation: aparece .8s ease-out 3.2s forwards; }
.etiqueta svg.i { font-size: 22px; color: rgb(var(--luz)); }
.etiqueta small { display: block; color: #bcd3d8; font-size: 11px; }

.velo { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(4,20,28,.96) 0%, rgba(4,20,28,.82) 22%, rgba(4,20,28,.35) 38%, rgba(4,20,28,0) 52%),
              radial-gradient(130% 100% at 68% 45%, transparent 62%, rgba(4,20,28,.5) 100%); }
#fx { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }

/* Marca institucional */
.marca { position: absolute; z-index: 5; top: 24px; left: clamp(1.2rem, 4vw, 4rem); animation: sube .8s ease-out .2s both; }
.marca img { display: block; width: 200px; height: 62px; object-fit: cover; border-radius: 7px; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.35); }

/* Columna izquierda */
.texto { position: absolute; z-index: 5; left: clamp(1.2rem, 4vw, 4rem); top: 50%; transform: translateY(-46%); width: var(--ancho-izq); min-width: 320px; }
.texto .logo-visor { display: block; height: 104px; width: auto; max-width: 240px; margin: 0 0 12px; animation: sube .8s ease-out .35s both; filter: drop-shadow(0 4px 16px rgba(0,0,0,.4)); }
h1 { margin: 0 0 14px; font-size: clamp(30px, 3.4vw, 54px); line-height: 1.05; font-weight: 700; letter-spacing: -.01em; text-shadow: 0 2px 22px rgba(0,0,0,.55); animation: sube .9s ease-out .5s both; }
h1 .linea { display: block; }
h1 .destacado { display: block; font-size: 1.28em; line-height: 1.02; background: linear-gradient(90deg, var(--acento-1), var(--acento-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bajada { max-width: 31em; margin: 0 0 26px; padding-top: 12px; border-top: 1px solid rgba(var(--luz), .55); color: #dbe8e6; font-size: clamp(14px, 1.25vw, 19px); line-height: 1.45; text-shadow: 0 1px 10px rgba(0,0,0,.6); animation: sube .9s ease-out .65s both; }

.opciones { display: grid; gap: 14px; max-width: 470px; animation: sube .9s ease-out .8s both; }
.opcion { display: flex; align-items: center; gap: 18px; min-height: 64px; padding: 12px 24px; border-radius: 10px; color: #fff; text-decoration: none; font-size: clamp(16px, 1.4vw, 20px); font-weight: 700;
  border: 1px solid transparent; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.opcion:hover, .opcion:focus-visible { transform: translateY(-2px); filter: brightness(1.12); outline: 2px solid #fff; outline-offset: 3px; }
.opcion svg.i { font-size: 32px; stroke-width: 1.9; }
.opcion .flecha { margin-left: auto; font-size: 22px; stroke-width: 2.4; opacity: .9; }
.opcion.ciudadana { background: linear-gradient(90deg, #0d4f26, #1f8a3e); border-color: rgba(94, 230, 130, .75); box-shadow: 0 8px 28px rgba(40, 190, 90, .28), inset 0 1px 0 rgba(255,255,255,.2); }
.opcion.tecnica { background: linear-gradient(90deg, #0a3d6b, #0b69a6); border-color: rgba(70, 190, 255, .75); box-shadow: 0 8px 28px rgba(0, 150, 255, .28), inset 0 1px 0 rgba(255,255,255,.2); }

/* Categorías inferiores (solo informativas) */
.categorias { position: absolute; z-index: 5; left: clamp(1.2rem, 4vw, 4rem); bottom: 4.5vh; display: flex; margin: 0; padding: 0; list-style: none; animation: sube .9s ease-out 1.1s both; }
.categorias li { display: grid; justify-items: center; gap: 7px; width: 118px; padding: 2px 8px; text-align: center; font-size: 12.5px; line-height: 1.25; color: #e6f0ee; }
.categorias li + li { border-left: 1px solid rgba(255,255,255,.25); }
.categorias svg.i { font-size: 34px; color: rgb(var(--luz)); }

/* Tarjetas a la derecha */
.tarjetas { position: absolute; z-index: 5; right: clamp(1rem, 2.4vw, 2.6rem); top: 50%; transform: translateY(-50%); display: grid; gap: 12px; width: min(330px, 24vw); margin: 0; padding: 0; list-style: none; }
.tarjeta { display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; border-radius: 10px; color: #fff; text-decoration: none;
  background: rgba(8, 30, 46, .68); backdrop-filter: blur(9px); border: 1px solid rgba(var(--luz), .3); box-shadow: 0 10px 28px rgba(0,0,0,.4);
  opacity: 0; animation: aparece .8s ease-out calc(4.2s + var(--n, 0) * .28s) forwards;
  transition: box-shadow 1.6s ease-out, border-color 1.6s ease-out, background 1.6s ease-out; }
.tarjeta.pulso { border-color: rgba(var(--luz), .95); background: rgba(10, 40, 58, .78); box-shadow: 0 0 22px rgba(var(--luz), .45), 0 10px 28px rgba(0,0,0,.4); transition-duration: .35s; }
.tarjeta:hover, .tarjeta:focus-visible { border-color: rgba(var(--luz), .9); outline: none; }
.tarjeta .foto { position: relative; width: 82px; height: 58px; flex: none; border-radius: 7px; overflow: hidden; background: linear-gradient(135deg, rgba(var(--luz), .35), rgba(8,30,46,.9)); }
.tarjeta .foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tarjeta h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 700; line-height: 1.2; }
.tarjeta p { margin: 0; color: #c3d6da; font-size: 12.5px; line-height: 1.3; }
.tarjeta .flecha { margin-left: auto; font-size: 18px; stroke-width: 2.4; color: rgb(var(--luz)); }
.tarjeta .cuerpo { min-width: 0; flex: 1; }
/* Tarjeta con datos (CFOI): los valores llegan después desde la API; mientras tanto «—» */
.tarjeta.datos { display: block; padding: 10px; }
.tarjeta.datos .fila { display: flex; gap: 12px; }
.tarjeta.datos .foto { width: 96px; height: 78px; }
.riesgo { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 4px; font-size: 13px; font-weight: 700; }
.riesgo .barra { flex: 1; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #35c44a, #e3d43a, #f08a1c, #e5311f); opacity: .9; }
.metricas { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.metricas li { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid rgba(255,255,255,.12); color: #d4e2e4; }
.metricas svg.i { font-size: 17px; }
.metricas b { margin-left: auto; color: #fff; font-weight: 700; }

@keyframes aparece { to { opacity: 1; } }
@keyframes sube { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.dev-aviso { position: fixed; z-index: 20; right: 10px; bottom: 8px; padding: 3px 9px; border-radius: 6px; background: rgba(0,0,0,.55); color: #aab; font-size: 11px; display: none; }
.sin-fondo .dev-aviso { display: block; }

@media (max-width: 1100px) { .tarjetas { width: 260px; } .tarjeta .foto { width: 62px; height: 46px; } .categorias li { width: 96px; font-size: 11.5px; } }

/* Tableta / celular: columna única, tarjetas en tira horizontal, sin líneas de conexión */
@media (max-width: 900px) {
  .lienzo { width: max(170vw, 70dvh); top: 12dvh; transform: translate(-50%, 0); left: 50%; right: auto; }
  .velo { background: linear-gradient(180deg, rgba(4,20,28,.2) 0%, rgba(4,20,28,.6) 32%, rgba(4,20,28,.97) 56%); }
  .marca img { width: 150px; height: 46px; }
  .marca { top: 14px; }
  .texto { top: auto; bottom: 25dvh; transform: none; width: auto; right: clamp(1.2rem, 4vw, 4rem); min-width: 0; }
  .texto .logo-visor { height: 64px; }
  h1 { font-size: clamp(24px, 7.4vw, 38px); }
  .bajada { display: none; }
  .opciones { gap: 10px; max-width: 420px; }
  .opcion { min-height: 52px; padding: 8px 18px; }
  .tarjetas { top: auto; bottom: 11dvh; right: 0; left: 0; transform: none; width: auto; display: flex; gap: 10px; overflow-x: auto; padding: 0 1.2rem 6px; scroll-snap-type: x proximity; }
  .tarjeta { flex: none; width: 250px; scroll-snap-align: start; }
  .tarjeta .flecha { display: none; }
  .categorias { bottom: 2dvh; left: 0; right: 0; justify-content: space-around; }
  .categorias li { width: auto; flex: 1; font-size: 10.5px; }
  .categorias svg.i { font-size: 24px; }
  .etiqueta { display: none; }
}
@media (max-width: 900px) and (max-height: 700px) { .tarjetas { display: none; } .texto { bottom: 14dvh; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tarjeta, .etiqueta { opacity: 1 !important; }
}

/* Tarjetas con datos (CFOI): más anchas y separadas */
.tarjetas:has(.datos) { width: min(360px, 26vw); gap: 28px; }
@media (max-width: 900px) { .tarjetas:has(.datos) { width: auto; gap: 10px; } .tarjeta.datos { width: 290px; } }
@media (max-width: 900px) { .dev-aviso { display: none !important; } }
