/* ===================================================================
   P14 CIMENTACIONES — Hoja de estilos (Versión Móvil Dinámica)
   =================================================================== */

:root {
  --verde-p14:     #4BAE2A;
  --carbon:        #17191C;
  --texto-ppal:    #2D3748;
  --texto-sec:     #718096;
  --fondo-app:     #F4F7F6;
  --fondo-tarjeta: #FFFFFF;
  --borde-suave:   rgba(0,0,0,0.04);
  --sombra-suave:  0 8px 20px rgba(0, 0, 0, 0.04);
  --sombra-flote:  0 15px 30px rgba(75, 174, 42, 0.12);
  
  --alto-cabecera: 70px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--fondo-app);
  background-image: radial-gradient(circle at 100% 0%, #ffffff 0%, transparent 50%),
                    radial-gradient(circle at 0% 100%, rgba(75, 174, 42, 0.05) 0%, transparent 50%);
  color: var(--texto-ppal);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===================================================================
   CABECERA EFECTO VIDRIO
   =================================================================== */
.cabecera {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  height: var(--alto-cabecera);
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.cabecera__logo {
  height: 38px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.cabecera__marca { display: none; }

/* ===================================================================
   CONTENEDOR PRINCIPAL
   =================================================================== */
.contenido {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* ===================================================================
   TARJETAS DE SECCIÓN (Dinámica Autónoma para Móviles)
   =================================================================== */
.seccion {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px 24px;
  background: var(--fondo-tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  
  /* Animación doble: Entrada al cargar + Levitación continua */
  opacity: 0;
  transform: translateY(20px);
  animation: 
    deslizarArriba 0.6s ease-out forwards, 
    respiracion 6s ease-in-out infinite alternate;
}

/* Retardo para que, si hay varias, leviten de forma desacompasada */
.menu li:nth-child(1) .seccion { animation-delay: 0.1s, 0.1s; }
.menu li:nth-child(2) .seccion { animation-delay: 0.2s, 1.5s; }
.menu li:nth-child(3) .seccion { animation-delay: 0.3s, 0.7s; }

/* Efecto FÍSICO al tocar la pantalla (Hundimiento) */
.seccion:active {
  transform: scale(0.96) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.1s;
}

/* Línea decorativa verde fija arriba */
.seccion::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--verde-p14);
}

/* ===================================================================
   INTERIOR: ICONOS Y TEXTOS
   =================================================================== */
.seccion__icono {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  background: rgba(75, 174, 42, 0.1);
  color: var(--verde-p14);
  border-radius: 14px;
  
  /* Animación continua de latido */
  animation: latido 3s infinite cubic-bezier(0.66, 0, 0, 1);
}

.seccion__icono svg {
  width: 28px;
  height: 28px;
  display: block;
}

/* Al tocar, el icono se rellena */
.seccion:active .seccion__icono {
  background: var(--verde-p14);
  color: #fff;
  transition: all 0.1s;
}

.seccion__texto {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.seccion__titulo {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--carbon);
  margin: 0;
}

.seccion__descripcion {
  display: block;
  font-size: 0.95rem;
  color: var(--texto-sec);
  margin: 0;
  line-height: 1.4;
}

.seccion__fuera {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 20px;
  height: 20px;
  color: #CBD5E0;
}

.seccion__fuera svg { width: 100%; height: 100%; display: block; }

/* ===================================================================
   PIE DE PÁGINA
   =================================================================== */
.pie {
  margin-top: 60px;
  text-align: center;
  font-size: 0.85rem;
  color: #A0AEC0;
  letter-spacing: 0.5px;
}

/* ===================================================================
   FOTOGRAMAS CLAVE DE LAS ANIMACIONES (KEYFRAMES)
   =================================================================== */

/* Entrada inicial */
@keyframes deslizarArriba {
  to { opacity: 1; }
}

/* Levitación continua de la tarjeta */
@keyframes respiracion {
  0% { transform: translateY(0); box-shadow: var(--sombra-suave); }
  100% { transform: translateY(-6px); box-shadow: var(--sombra-flote); }
}

/* Latido expansivo del icono */
@keyframes latido {
  0% { box-shadow: 0 0 0 0 rgba(75, 174, 42, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(75, 174, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(75, 174, 42, 0); }
}

/* Adaptación a móviles compactos */
@media (max-width: 600px) {
  .contenido { padding: 24px 16px; }
  .menu { grid-template-columns: 1fr; }
  .cabecera { padding: 0 16px; }
}

/* ===================================================================
   PANTALLAS INTERIORES (Mi Tarjeta y apartados empotrados)
   Estilos compartidos: cabecera con título y botón de volver,
   botones, estados de carga y error.
   =================================================================== */

.cabecera__titulo {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--carbon);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.volver {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: 0 8px 0 -10px;
  background: none;
  border: 0;
  border-radius: 12px;
  color: var(--carbon);
  cursor: pointer;
}

.volver:active { background: rgba(75, 174, 42, 0.1); color: var(--verde-p14); }
.volver svg { width: 24px; height: 24px; }

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  background: var(--verde-p14);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  border: 0;
  border-radius: 14px;
  box-shadow: var(--sombra-flote);
  cursor: pointer;
}

.boton:active { transform: scale(0.97); }

.boton--secundario {
  background: var(--fondo-tarjeta);
  color: var(--carbon);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

.boton:focus-visible,
.volver:focus-visible {
  outline: 3px solid var(--verde-p14);
  outline-offset: 2px;
}

/* --- Apartados empotrados (vistas/contenido.html) --- */
body.vista-contenido {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.marco { flex: 1 1 auto; position: relative; min-height: 0; }
.marco iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

.estado {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  background: var(--fondo-app);
}

.estado[hidden] { display: none; }
.estado__titulo { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--carbon); }
.estado__texto  { margin: 0; max-width: 34ch; color: var(--texto-sec); }

.barra {
  width: 160px;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.barra::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  background: var(--verde-p14);
  animation: recorrer 1.1s ease-in-out infinite;
}

@keyframes recorrer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* Quien tenga activada en el móvil la opción de reducir animaciones
   ve la app quieta. Para el resto no cambia nada. */
@media (prefers-reduced-motion: reduce) {
  .seccion, .seccion__icono, .barra::after { animation: none !important; }
  .seccion { opacity: 1; transform: none; box-shadow: var(--sombra-suave); }
}
