/* ==============================================================
   IERI | Ajustes específicos de Inicio para pantallas pequeñas
   Se carga al final para que las reglas de laptop de style.css
   NO prevalezcan sobre las reglas de celular.
   No altera la versión de escritorio ni el diseño del navbar.
   ============================================================== */

@media (max-width: 900px) {
  /* Los contenedores flex/grid pueden crecer por encima del viewport
     si sus hijos conservan tamaños mínimos implícitos. */
  .hero-content,
  .hero-links,
  .hero-link,
  .stats-section,
  .stats,
  .stat-box,
  .values-content,
  .values-modern-grid,
  .value-modern-card,
  .academic-section,
  .academic-container,
  .academic-card {
    min-width: 0;
    max-width: 100%;
  }

  .hero-links {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: 0;
    padding: 22px clamp(16px, 5vw, 32px) 10px;
  }

  .hero-links .hero-link,
  .hero-links .hero-link:first-child,
  .hero-links .hero-link:last-child {
    border-radius: 22px;
    border-right: 0;
  }

  .hero-links .hero-link {
    justify-content: flex-start;
    padding: 16px 22px;
    min-height: 92px;
  }
  .hero-link-icon { flex-shrink: 0; }
  .hero-link-text { min-width: 0; }

  .values-modern-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  .value-modern-card {
    width: 100%;
    max-width: none;
    padding: 28px 14px;
    border-radius: 24px;
  }
  .value-modern-icon { width: 92px; height: 92px; font-size: 2.2rem; }
  .value-modern-card h2 { font-size: clamp(1.05rem, 2.6vw, 1.4rem); overflow-wrap: anywhere; }

  .academic-card {
    margin-top: 0;
  }
  .academic-title h2 {
    font-size: clamp(2rem, 5.5vw, 3rem);
    overflow-wrap: break-word;
  }
}

@media (max-width: 620px) {
  html { scroll-padding-top: 95px; }
  body { width: 100%; overflow-x: clip; }

  /* Portada: tamaño de texto apto para 320–620px, con espacio
     para la barra fija. El video continúa cubriendo el fondo. */
  .hero {
    height: max(715px, 100svh);
    min-height: 715px;
  }
  .hero-content {
    width: calc(100% - 40px);
    max-width: 475px;
    top: 53%;
  }
  .hero-tag {
    max-width: 100%;
    font-size: clamp(.69rem, 2.7vw, .83rem);
    line-height: 1.4;
    letter-spacing: .02em;
    padding: 10px 13px;
    margin-bottom: 19px;
    white-space: normal;
  }
  .hero-content h1 {
    font-size: clamp(2.05rem, 8.5vw, 3.1rem);
    line-height: 1.14;
    margin-bottom: 19px;
    letter-spacing: -.025em;
    overflow-wrap: break-word;
  }
  .hero-content p {
    font-size: clamp(.83rem, 3.6vw, .97rem);
    line-height: 1.6;
    max-width: 380px;
    margin: 0 auto 23px;
  }
  .hero-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 0;
  }
  .hero-buttons .hero-btn {
    max-width: 100%;
    font-size: .85rem;
    line-height: 1.25;
    padding: 13px 22px;
    white-space: normal;
  }
  .scroll-indicator { display: none; }

  /* Enlaces de acceso rápido: cada tarjeta completa y redondeada */
  .hero-links { margin-top: 0; padding: 22px 16px 12px; gap: 12px; }
  .hero-links .hero-link {
    min-height: 88px;
    gap: 14px;
    padding: 14px 16px;
  }
  .hero-link-icon { width: 54px; height: 54px; }
  .hero-link-text h3 { font-size: .98rem; }
  .hero-link-text p { font-size: .82rem; line-height: 1.45; }

  /* Estadísticas: una columna para impedir que palabras o iconos
     queden cortados; la regla de laptop se anula aquí. */
  .stats-section { padding: 76px 16px 72px; }
  .stats-header { margin-bottom: 32px; padding: 0 4px; }
  .stats-badge { font-size: .81rem; padding: 10px 16px; }
  .stats-title-small { font-size: .75rem; letter-spacing: 2px; }
  .stats-title-main { font-size: clamp(2.05rem, 8vw, 2.7rem); line-height: 1.14; }
  .stats-subtitle { font-size: .87rem; line-height: 1.7; }
  .stats {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    grid-template-columns: minmax(0, 1fr);
    padding: 22px;
    gap: 15px;
    border-radius: 27px;
  }
  .stat-box {
    width: 100%;
    padding: 27px 14px;
    border-radius: 20px;
  }
  .stat-box .stat-icon { width: 65px; height: 65px; margin-bottom: 16px; }
  .stat-box .counter { font-size: clamp(2.7rem, 11vw, 3.5rem); }
  .stat-box p {
    font-size: 1.05rem;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: break-word;
  }

  /* Valores: una tarjeta por fila, con iconos y títulos legibles. */
  .values-section { padding-bottom: 72px; }
  .values-top-shape { height: 180px; margin-bottom: 80px; }
  .values-logo { width: 122px; height: 122px; bottom: -57px; }
  .values-content {
    padding: 0 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 36px;
  }
  .values-title-modern h3 { font-size: 1.65rem; letter-spacing: 3px; }
  .values-title-modern h1 { font-size: clamp(2.65rem, 10vw, 3.5rem); }
  .values-text p { font-size: .93rem; line-height: 1.7; }
  .values-modern-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-width: 430px;
    padding: 0 18px;
    margin: 0 auto;
    gap: 14px;
  }
  .value-modern-card {
    width: 100%;
    max-width: 100%;
    padding: 27px 18px;
    border-radius: 22px;
  }
  .value-modern-icon { width: 86px; height: 86px; margin-bottom: 12px; font-size: 2rem; }
  .value-modern-card h2 { font-size: 1.35rem; line-height: 1.25; }

  /* Grados: eliminar anchos fijos y desniveles de la regla laptop. */
  .academic-section { padding: 76px 18px 84px; }
  .academic-title { margin-bottom: 35px; }
  .academic-title span { font-size: 1rem; }
  .academic-title h2 { font-size: clamp(2rem, 8vw, 2.6rem); line-height: 1.15; }
  .academic-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    max-width: 410px;
    margin: 0 auto;
  }
  .academic-card,
  .academic-container .academic-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 0;
    transform: none;
  }
  .academic-label { margin-bottom: 12px; }
  .academic-label h3 { font-size: clamp(1.55rem, 7vw, 2rem); }
  .academic-image,
  .academic-card .academic-image {
    width: 100%;
    height: 345px;
    border-radius: 25px;
  }
  .academic-info { bottom: 15px; padding: 12px 10px; }
  .academic-info p { font-size: .91rem; line-height: 1.5; }

  /* Las tarjetas no deben deformarse al tocar en pantallas táctiles. */
  .value-modern-card:hover,
  .academic-card:hover,
  .stat-box:hover,
  .hero-link:hover { transform: none; }
}

@media (max-width: 365px) {
  .hero-content { width: calc(100% - 26px); }
  .hero-content h1 { font-size: 2rem; }
  .hero-buttons .hero-btn { padding: 11px 17px; }
  .hero-links { padding-inline: 12px; }
  .hero-link-icon { width: 48px; height: 48px; }
  .academic-section { padding-inline: 12px; }
  .values-modern-grid { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-content, .hero-content p, .hero-buttons,
  .stat-box, .academic-card, .value-modern-card {
    animation-duration: .01ms;
  }
}

/* Ajuste final: prioridad sobre estilos de escritorio y animaciones. */
.stats-section { isolation: isolate; }
.stats-section::before, .stats-section::after, .stats::before, .stats::after { animation: none; pointer-events: none; }
@media (max-width: 768px) {
  *, *::before, *::after { box-sizing: border-box; }
  .hero { height: auto !important; min-height: 100svh !important; display: flex !important; align-items: center; justify-content: center; padding: 110px 16px 70px !important; }
  .hero .hero-content { position: relative !important; inset: auto !important; transform: none !important; width: 100% !important; max-width: 480px !important; margin: auto !important; }
  .hero-content h1 { font-size: clamp(1.85rem, 7.8vw, 3rem) !important; line-height: 1.15 !important; }
  .hero-content p { font-size: clamp(.92rem, 3.7vw, 1.05rem) !important; }
  .hero-links { display: grid !important; grid-template-columns: minmax(0,1fr) !important; background: #003f7d !important; padding: 20px 16px 24px !important; }
  .hero-links .hero-link { border-radius: 22px !important; min-width: 0; width: 100%; }
  .stats { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)) !important; width: 100% !important; max-width: 540px !important; padding: 12px !important; gap: 10px !important; }
  .stat-box { min-width: 0 !important; width: 100% !important; padding: 20px 8px !important; }
  .stat-box .stat-icon { width: 60px !important; height: 60px !important; max-width: 100%; }
  .stat-box .counter { font-size: clamp(1.8rem, 8vw, 2.7rem) !important; }
  .stat-box p { font-size: clamp(.8rem,3.4vw,1rem) !important; overflow-wrap: anywhere; }
  .values-modern-grid { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)) !important; padding: 0 14px !important; gap: 12px !important; max-width: 540px !important; }
  .value-modern-card { width: 100% !important; min-width: 0 !important; padding: 20px 8px !important; }
  .value-modern-icon { width: 65px !important; height: 65px !important; max-width: 100%; font-size: 1.65rem !important; }
  .value-modern-card h2 { font-size: clamp(.87rem, 3.7vw, 1.25rem) !important; overflow-wrap: anywhere; }
  .academic-title h2 { font-size: clamp(1.85rem,7vw,2.6rem) !important; max-width: 100%; }
  .academic-container { display: grid !important; grid-template-columns: minmax(0,1fr) !important; max-width: 420px !important; margin: auto !important; }
  .academic-container .academic-card { width: 100% !important; min-width: 0 !important; margin-top: 0 !important; }
  .academic-card .academic-image { width: 100% !important; height: clamp(300px,100vw,420px) !important; }
  .academic-image img { width: 100%; height: 100%; object-fit: cover; }
  .calendar-toggle { width: 44px !important; height: 44px !important; }
  .landbot-button { padding: 5px !important; }
  body { padding-bottom: 55px; }
}

/* IERI: corrección de visibilidad y continuidad de color */
@media (max-width: 900px) {
 body > section.hero-links, section.hero-links {
   background: #003f7d !important; background-image: none !important;
   margin: 0 !important; padding: 20px 16px 24px !important;
   position: relative; width: 100% !important; max-width: none !important;
 }
 section.stats-section { background: linear-gradient(180deg,#003f7d 0%,#00356b 45%,#002b57 100%) !important; margin-top: 0 !important; }
 section.stats-section::before, section.stats-section::after, .stats::before, .stats::after { display:none !important; }
 html.ieri-motion-ready body section.ieri-section-enter,
 html.ieri-motion-ready body section .ieri-heading-enter,
 html.ieri-motion-ready body section .ieri-card-enter,
 html.ieri-motion-ready body section .ieri-image-enter {
   opacity:1 !important; visibility:visible !important; clip-path:none !important;
   translate:none !important; scale:1 !important; filter:none !important;
 }
 .value-modern-card h2, .academic-title h2, .stats-title-main {
   display:block !important; opacity:1 !important; visibility:visible !important;
   clip-path:none !important; transform:none !important; filter:none !important;
 }
 .value-modern-card h2 { color:var(--color,#003B73) !important; -webkit-text-fill-color: currentColor !important; }
 .academic-title h2 { color:#003B73 !important; -webkit-text-fill-color:currentColor !important; }
 .stats-title-main { color:white !important; }
 .stats .stat-box { min-height:0 !important; height:auto !important; }
 .stats .stat-box .counter { visibility:visible !important; opacity:1 !important; }
 .stats .stat-box p { white-space:normal !important; }
}
