body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  padding: 0;
  display: flex;
  justify-content: center;
  background: #fff;
  flex: 1;
}

.header {
  width: 100%;
  height: 100px;
  position: relative;
  overflow: hidden;
  background-image: url('../imagenes/cabecera4.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.logo {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 90px;
  height: 90px;
  z-index: 10;
}
.title-image {
  position: absolute;
  top: 50%;
  left: 95px;
  transform: translateY(-50%);
  height: 80px;
  z-index: 10;
  max-width: 500px;
  object-fit: contain;
}

/* ========== MENÚ ACCESIBLE Y EFECTOS CORREGIDO ========== */
.menu-container {
  width: 100%;
  background: linear-gradient(to right, #191970 0%, #8B0000 50%, #c04306 100%);
  box-shadow: 0 8px 16px rgba(0,0,0,.4);
  position: relative;
  z-index: 5;
  padding: 4px 0;
}
.menu {
  display: flex;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.menu li {
  position: relative;
  margin: 0 5px;
}
.menu a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 15px;
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  transition: background .3s, color .3s, box-shadow .3s, outline .2s;
  position: relative;
  border-radius: 6px;
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  box-shadow: 3px 3px 6px rgba(0,0,0,.5), -3px -3px 6px rgba(255,255,255,.1), inset 1px 1px 2px rgba(255,255,255,.2);
  width: auto;
  height: auto;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,.2);
}
.menu a:focus,
.menu a:focus-visible {
  outline: 3px solid #FFD700;
  background: #331212;
  color: #FFD700;
  z-index: 2;
}
.menu a:hover,
.menu a:active {
  background: linear-gradient(145deg, #c04306, #8B0000);
  color: #FFD700;
  box-shadow: 5px 5px 10px rgba(0,0,0,.6), -5px -5px 10px rgba(255,255,255,.15), inset 1px 1px 3px rgba(255,255,255,.3);
  text-shadow: 0 1px 0 #ccc;
}

.menu a .ripple,
.ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255,215,0,.6);
  transform: scale(0);
  animation: ripple .6s linear;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-container .menu a,
  .menu-container .menu .ripple,
  .menu-container .menu a::before,
  .menu-container .menu a::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media screen and (-ms-high-contrast: none) {
  .menu a::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(145deg, #c04306, #8B0000);
    border-radius: 6px;
    opacity: 0;
    transition: opacity .4s ease;
    z-index: -1;
  }
  .menu a:hover::before, .menu a:focus::before { opacity: 1; }
  .menu a:hover, .menu a:focus {
    color: #FFD700;
    box-shadow: 5px 5px 10px rgba(0,0,0,.6), -5px -5px 10px rgba(255,255,255,.15), inset 1px 1px 3px rgba(255,255,255,.3);
    text-shadow: 0 1px 0 #ccc;
  }
}

@media screen and (-ms-high-contrast: active) {
  .menu a {
    background: Window;
    color: WindowText;
    border: 2px solid WindowText;
  }
  .menu a:hover, .menu a:focus {
    background: Highlight;
    color: HighlightText;
    box-shadow: 0 4px 8px rgba(0,0,0,.5);
    border: 2px solid HighlightText;
  }
}
@media screen and (-ms-high-contrast: none) {
  .menu a::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(to right,
      rgba(255,255,255,0) 0%,
      rgba(255,255,255,.1) 50%,
      rgba(255,255,255,0) 100%);
    transform: rotate(30deg);
    transition: all .6s ease;
    opacity: 0;
    z-index: 1;
  }
  .menu a:hover::after, .menu a:focus::after { animation: shine3d .6s ease; }
}
@keyframes shine3d {
  0%   { transform: translateX(-100%) translateY(-100%) rotate(30deg); opacity: 0; }
  50%  { opacity: 1; }
  100% { transform: translateX(100%) translateY(100%) rotate(30deg); opacity: 0; }
}
.menu a {
  position: relative;
  overflow: hidden;
}
@media screen and (-ms-high-contrast: none) {
  .menu a {
    border-bottom: 1px solid rgba(0,0,0,.3);
    border-right: 1px solid rgba(0,0,0,.3);
  }
  .menu a:hover, .menu a:focus {
    border-bottom: 1px solid rgba(0,0,0,.5);
    border-right: 1px solid rgba(0,0,0,.5);
  }
}

/* ---------- SLIDER ---------- */
.slider {
  margin-top: 15px;
  width: 100%;
  max-width: 700px;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
  padding: 20px;
  box-shadow:
    0 0 5px rgba(0,255,255,.5), 0 0 10px rgba(0,255,255,.5),
    0 0 15px rgba(0,255,255,.5), 0 0 20px rgba(0,255,255,.5),
    0 0 35px rgba(0,255,255,.5), 0 0 40px rgba(0,255,255,.5);
  border: 0 solid rgba(0,255,255,.8);
}
.slides {
  display: flex;
  transition: transform .4s ease-in-out;
  will-change: transform;
}
.slide {
  min-width: 100%;
  user-select: none;
  outline: none;
}
.slide a {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  outline: none;
}
.slide img {
  width: 100%;
  height: 200px;
  max-width: 300px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 16px;
}
.slider-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: #00ffff;
  border: none;
  color: #000;
  font-size: 1.5rem;
  padding: 10px 14px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
  transition: all .3s ease;
  user-select: none;
}
.slider-button:hover, .slider-button:focus {
  background-color: #00cccc;
  outline: 3px solid #fff;
  outline-offset: 2px;
  transform: translateY(-50%) scale(1.1);
}
.slider-button.prev { left: 16px; }
.slider-button.next { right: 16px; }

.slider-nav-info {
  position: absolute;
  bottom: 10px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.back-link {
  color: #000;
  background: rgba(0,255,255,.8);
  padding: 4px 10px;
  border-radius: 10px;
  font-weight: bold;
  text-decoration: none;
}
.slider-info {
  color: #000;
  background: rgba(0,255,255,.8);
  font-size: .9rem;
  padding: 4px 10px;
  border-radius: 10px;
  user-select: none;
  font-weight: bold;
}

/* ---------- FOOTER ---------- */
.footer {
  width: 100%;
  height: 40px;
  min-height: 40px;
  background: linear-gradient(to right, #191970 0%, #8B0000 50%, #c04306 100%);
  background-image: linear-gradient(to right, #191970 0%, #8B0000 50%, #c04306 100%),
                    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><polygon points="50,5 90,25 90,75 50,95 10,75 10,25" fill="none" stroke="rgba(255,255,255,.05)" stroke-width="2"/></svg>');
  box-shadow: 0 -4px 8px rgba(0,0,0,.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
  margin-top: auto;
}
.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,.5);
}
.footer-logo {
  height: 35px;
  margin-right: 10px;
  object-fit: contain;
}

/* ========== CONTENEDOR DE FICHAS ========== */
.contenedor-fichas {
  display: flex;
  flex-direction: column; /* Fichas una debajo de otra */
  gap: 20px; /* Separación vertical entre fichas */
  width: auto; 
  /* La clave para que no haya scroll horizontal y tener márgenes: */
  margin: 20px 30px; 
  padding: 0;
  background: transparent; /* Quitamos fondo al contenedor general */
  box-shadow: none;
  box-sizing: border-box;
}

/* ========== FICHA - Grid de 3 Columnas ========== */
.ficha {
  /* Definimos la rejilla: 
     1ª Columna (Imagen): 140px fijos
     2ª Columna (Título): 1 fracción (flexible)
     3ª Columna (Descripción): 2 fracciones (flexible y más ancha) */
  display: grid;
  grid-template-columns: 140px 1fr 2fr; 
  align-items: center; /* Centra todo verticalmente */
  gap: 20px; /* Espacio entre columnas */

  background: linear-gradient(145deg, #f9fbfd, #f0f4f8);
  border: 2.5px solid #aaa;
  border-radius: 20px;
  padding: 15px 20px; /* Padding interno cómodo */
  
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  position: relative;
  box-sizing: border-box; /* Evita que el padding sume ancho extra */
  width: 100%;
}

/* Efectos Hover / Focus */
.ficha:hover,
.ficha:focus {
  border-color: #ff6f61;
  transform: translateY(-4px);
  background: #fff7f4;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  outline: none;
  z-index: 10;
}

.ficha:focus-visible {
  outline: 3px solid #2266cc;
  outline-offset: 4px;
}

/* === LA MAGIA: Romper el Figure === */
/* display: contents hace que el navegador ignore la etiqueta <figure> 
   para efectos de layout, permitiendo que <img> y <figcaption> se 
   comporten como hijos directos del grid .ficha */
.ficha figure {
  display: contents; 
}

/* 1ª Columna: La Imagen */
.ficha img {
  width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: contain; /* Asegura que la imagen se vea completa */
  border-radius: 12px;
  display: block;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* 2ª Columna: El Título (figcaption) */
.ficha figcaption {
  font-weight: 800;
  font-size: 1.3rem;
  color: #12213c;
  text-align: center; /* Centrado como pediste */
  text-transform: uppercase;
  line-height: 1.3;
  padding: 0 10px;
}

/* 3ª Columna: La Descripción */
.ficha p {
  text-align: justify;
  line-height: 1.6;
  margin: 0;
  font-size: 1.05rem;
  padding-left: 20px;
  border-left: 3px solid #ff6f61; /* Mantenemos tu detalle estético */
}

/* ========== RESPONSIVE (Móviles y Tablets pequeñas) ========== */
/* Cuando la pantalla sea menor a 900px, cambiamos el diseño a vertical 
   para que no se vea todo aplastado */
@media (max-width: 900px) {
  .contenedor-fichas {
    margin: 20px 15px; /* Reducimos márgenes laterales en móvil */
  }

  .ficha {
    display: flex;
    flex-direction: column; /* Pasa a vertical: Imagen arriba, texto abajo */
    text-align: center;
    padding: 30px 20px;
  }
  
  /* Restauramos el comportamiento normal del figure en móvil */
  .ficha figure {
    display: block;
    margin: 0 0 20px 0;
  }

  .ficha img {
    max-width: 150px;
    margin: 0 auto; /* Centrar imagen */
  }

  .ficha figcaption {
    margin-top: 15px;
    font-size: 1.2rem;
  }

  .ficha p {
    border-left: none; /* Quitamos la línea lateral en móvil */
    padding-left: 0;
    margin-top: 10px;
  }
}

/* ---- Tabla de resultados sin cambios ---- */
table.res {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 20px;
}
table.res th, table.res td {
  border: 1px solid #555;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
table.res th {
  background: #e0e0e0;
  color: #000;
}
table.res tr.error td { background: #ffe6e6; }
img.impact-icon { width: 48px; height: 48px; }
@media (prefers-contrast: high) {
  table.res th { background: #000; color: #fff; }
  table.res td { border-color: #fff; }
}

/* ===========================================================
   TABLA LEYENDA – versión mini
   =========================================================== */
table.leyenda {
  width: 420px;
  margin: 30px auto;
  border-collapse: collapse;
  font-size: 10px;
  background: #fafafa;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
table.leyenda th,
table.leyenda td {
  border: 1px solid #999;
  padding: 2px 4px;
  text-align: left;
  vertical-align: middle;
}
table.leyenda th {
  background: #e0e0e0;
  color: #000;
  font-weight: bold;
}
table.leyenda img.impact-icon {
  width: 18px;
  height: 18px;
  display: block;
  margin: 0 auto;
}
@media (prefers-contrast: high) {
  table.leyenda th { background: #000; color: #fff; }
  table.leyenda td { border-color: #fff; }
}
