/* ===== VARIABLES GLOBALES Y ESTILOS BASE ===== */
:root {
  --primary-color: #285e3a;
  --secondary-color: #4caf50;
  --accent-color: #4e9b54ff;
  --light-color: #f8f9fa;
  --text-color: #333;
  --font-primary: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --font-secondary: "Lora", serif;
  --font-content: "Prompt", sans-serif;
  /* --primary-color: #2b7e1a;
    --secondary-color: #3a9328;
    --accent-color: #FFC107; */
  --dark-color: #0d1538;
  --font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.3s ease;
  --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 15px 35px rgba(0, 0, 0, 0.1);
}
* {
  box-sizing: border-box;
  font-family: var(--font-family);
}

body {
  font-family: var(--font-primary);
  color: var(--text-color);
  line-height: 1.6;
}
/* ===== CONTENEDOR DE MENÚ (TUS 5 BOTONES) ===== */
.contenedor-menu2 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
  max-width: 1300px;
  margin: 30px auto;
  padding: 15px;
  will-change: transform;
}

.boton-menu {
  display: block;
  position: relative;
  height: 260px;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  background: #fff;
  box-shadow: var(--shadow-light);
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.boton-menu:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-medium);
  z-index: 5;
}

.imagen-fondo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform var(--transition-slow);
  z-index: 1;
}

.imagen-fondo::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.4) 70%,
    rgba(0, 0, 0, 0.8) 100%
  );
}

.boton-menu:hover .imagen-fondo {
  transform: scale(1.08);
}

.contenido-boton {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 2;
}

.texto-boton {
  text-align: center;
  transition: transform var(--transition-normal);
  width: 100%;
}

.boton-menu:hover .texto-boton {
  transform: translateY(-15px);
}

.titulo {
  font-family: var(--font-family);
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
  margin: 0 0 5px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  transition: font-size var(--transition-normal);
}

.boton-menu:hover .titulo {
  font-size: 1.6rem;
}

/* .subtitulo {
    font-family: var(--font-family);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
} */

.boton-menu:hover .subtitulo {
  /* opacity: 1; */
  /*  transform: translateY(0); */
}

.logo-colegio {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 3;
  width: 28px;
  height: 28px;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

.logo-colegio img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(1.2) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.boton-menu:hover .logo-colegio {
  opacity: 1;
}

.info-extra {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(90deg, var(--btn-color), var(--btn-color-dark));
  color: white;
  text-align: center;
  padding: 10px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0;
  transform: translateY(100%);
  transition:
    transform var(--transition-slow),
    opacity var(--transition-slow);
  z-index: 4;
}

.boton-menu:hover .info-extra {
  opacity: 1;
  transform: translateY(0);
}

/* Colores para botones */
.boton-menu[data-color="#4CAF50"] {
  --btn-color: #4caf50;
  --btn-color-dark: #388e3c;
}

.boton-menu[data-color="#2196F3"] {
  --btn-color: #2196f3;
  --btn-color-dark: #1976d2;
}

.boton-menu[data-color="#FF5722"] {
  --btn-color: #ff5722;
  --btn-color-dark: #e64a19;
}

.boton-menu[data-color="#9C27B0"] {
  --btn-color: #9c27b0;
  --btn-color-dark: #7b1fa2;
}

.boton-menu[data-color="#607D8B"] {
  --btn-color: #607d8b;
  --btn-color-dark: #455a64;
}

/* ===== GALERÍA FLIP (EFECTOS COMPARTIDOS) ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

.titulo-galeria {
  text-align: center;
  margin-bottom: 50px;
}

.titulo-galeria h1 {
  color: white;
  font-size: 2.8em;
  margin-bottom: 15px;
  position: relative;
  display: inline-block;
  font-weight: 700;
}

.titulo-galeria h1:after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 25%;
  width: 50%;
  height: 3px;
  background: var(--accent-color);
  border-radius: 2px;
}

.titulo-galeria p {
  color: #666;
  font-size: 1.2em;
  max-width: 600px;
  margin: 0 auto;
  font-weight: 400;
}

/* Grid de galería optimizado */
.galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  padding: 20px;
}

/* Card flip optimizado - sin perspective 3D pesada */
.card-flip {
  height: 320px;
  cursor: pointer;
  position: relative;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  border-radius: 16px;
  box-shadow: var(--shadow-heavy);
  overflow: hidden;
}

.card-flip:hover .card-inner {
  transform: rotateY(180deg);
}

/* Caras del flip */
.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
}

.card-front {
  background: white;
}

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.card-flip:hover .card-front img {
  transform: scale(1.05);
}

.overlay-front {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(26, 35, 126, 0.9), transparent);
  color: white;
  padding: 20px;
  transition: transform var(--transition-normal);
}

.card-flip:hover .overlay-front {
  transform: translateY(0);
}

.numero-foto {
  background: var(--accent-color);
  color: var(--dark-color);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2em;
  position: absolute;
  top: 12px;
  right: 12px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.card-back {
  background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
  color: white;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  text-align: center;
}

.icono-genio {
  font-size: 3em;
  margin-bottom: 15px;
  color: var(--accent-color);
}

.frase-genio {
  font-size: 1.2em;
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 15px;
}

.autor-frase {
  font-size: 1.1em;
  color: var(--accent-color);
  font-weight: 600;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 193, 7, 0.3);
  width: 80%;
}

.campo-genio {
  background: rgba(255, 193, 7, 0.1);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 1em;
  margin-top: 12px;
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.2);
}

/* Botón compartido */
.btn-ver-mas {
  display: block;
  width: 180px;
  margin: 40px auto;
  padding: 12px 25px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: center;
  text-decoration: none;
  box-shadow: 0 8px 16px rgba(26, 35, 126, 0.2);
}

.btn-ver-mas:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 20px rgba(26, 35, 126, 0.3);
}

/* ===== RESPONSIVE COMPARTIDO ===== */
@media (max-width: 1200px) {
  .contenedor-menu {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .galeria-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .contenedor-menu {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 20px auto;
  }

  .boton-menu {
    height: 200px;
  }

  .titulo {
    font-size: 1.2rem;
  }

  .boton-menu:hover .titulo {
    font-size: 1.3rem;
  }

  .galeria-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    padding: 10px;
  }

  .card-flip {
    height: 280px;
  }

  .titulo-galeria h1 {
    font-size: 2.2em;
  }
}

@media (max-width: 480px) {
  .contenedor-menu {
    grid-template-columns: 1fr;
    max-width: 280px;
    gap: 10px;
  }

  .boton-menu {
    height: 180px;
  }

  .galeria-grid {
    grid-template-columns: 1fr;
    max-width: 300px;
    margin: 0 auto;
  }

  .titulo-galeria h1 {
    font-size: 1.8em;
  }
}

/* ===== OPTIMIZACIONES PARA RENDIMIENTO ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Evitar flashes en dispositivos táctiles */
@media (hover: none) {
  .boton-menu:hover,
  .card-flip:hover {
    transform: none;
    box-shadow: var(--shadow-light);
  }

  .boton-menu:hover .imagen-fondo,
  .boton-menu:hover .texto-boton,
  .boton-menu:hover .titulo,
  .boton-menu:hover .subtitulo,
  .boton-menu:hover .info-extra,
  .card-flip:hover .card-inner,
  .card-flip:hover .card-front img,
  .card-flip:hover .overlay-front {
    transform: none;
    /*  opacity: inherit; */
    font-size: inherit;
  }

  /* .subtitulo {
        opacity: 0.8;
        transform: translateY(0);
    } */

  .info-extra {
    opacity: 1;
    transform: translateY(0);
  }
}
