
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
video,
iframe,
svg,
canvas:not(#stars-canvas) {
  max-width: 100%;
  height: auto;
}

iframe {
  display: block;
}


p,
h1,
h2,
h3,
h4,
li,
a,
span,
label,
button {
  overflow-wrap: break-word;
  word-break: normal;
}

/* ============================================================
   MOBILE — hasta 768px
   ============================================================ */
@media (max-width: 768px) {

  /* NAV */
  nav {
    padding: 0.5rem 0.85rem;
    height: auto;
    min-height: 56px;
    column-gap: 0.5rem;
  }

  /* HERO */
  .hero {
    padding: 1.5rem 1rem 2rem;
    min-height: auto;
  }

  .hero-tagline,
  .home-hero-title {
    font-size: clamp(1.5rem, 8vw, 2.6rem);
    line-height: 1.15;
  }

  .hero-sub,
  .home-hero-desc {
    font-size: 0.92rem;
    line-height: 1.65;
    max-width: 100%;
    padding: 0 0.25rem;
  }

  /* Hero específicas de páginas */
  .videos-hero,
  .glosario-hero {
    padding: 1.25rem 1rem 1.5rem;
  }

  .videos-hero-desc,
  .glosario-hero-desc {
    font-size: 0.92rem;
    line-height: 1.6;
    padding: 0.9rem 1rem;
  }

  /* NAV ICONS */
  .nav-icons-wrapper {
    margin-top: 1.25rem;
    max-width: 100%;
  }

  .nav-icons {
    gap: 8px;
    padding: 10px 8px;
  }

  .nav-icon-item {
    gap: 4px;
  }

  .nav-icon-item .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.35rem;
  }

  .nav-icon-item span {
    font-size: 0.65rem;
    letter-spacing: 0;
  }

  /* SECTIONS */
  section {
    padding-left: clamp(0.75rem, 4vw, 1.25rem);
    padding-right: clamp(0.75rem, 4vw, 1.25rem);
  }

  .map-section,
  .articles-section,
  .videos-section,
  .games-section,
  .gallery-section,
  .glossary-section {
    width: 100%;
  }

  .section-title {
    font-size: clamp(1.2rem, 5.5vw, 1.8rem);
    margin-bottom: 1rem;
    line-height: 1.2;
  }

  .section-desc,
  .articles-text-box {
    font-size: 0.92rem;
    line-height: 1.6;
    padding: 0.85rem 1rem;
  }

  /* MAPA */
  .map-container {
    height: clamp(280px, 60vh, 460px);
  }

  /* GRIDS A 1 COLUMNA */
  .articles-grid,
  .videos-grid,
  .games-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  /* MODAL DE REGISTRO */
  .modal {
    padding: 1.5rem 1rem;
    max-height: 92vh;
    border-radius: 18px;
  }

  .modal-title {
    font-size: 1.2rem;
    margin-bottom: 1.1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-group label {
    font-size: 0.78rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 0.95rem;
    padding: 10px 12px;
  }

  .btn-submit {
    padding: 13px;
    font-size: 0.95rem;
  }

  /* TOUCH TARGETS — accesibilidad táctil */
  button,
  .nav-icon-item,
  .btn-submit,
  .modal-close,
  .scroll-top,
  .video-modal-btn {
    min-height: 44px;
  }

  /* FOOTER */
  footer {
    padding: 2rem 1rem 1.5rem;
    margin-top: 2.5rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .footer-col h4 {
    font-size: 0.92rem;
    text-align: center;
  }

  .footer-bottom {
    font-size: 0.7rem;
    line-height: 1.6;
    word-break: break-word;
  }

  /* SCROLL-TOP */
  .scroll-top {
    bottom: 1.2rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  /* VIDEO MODAL */
  .video-modal {
    padding: 8px;
  }

  .video-modal-container {
    border-radius: 12px;
  }

  .video-modal-title {
    font-size: 0.88rem;
    padding: 10px 12px 12px;
  }
}

/* ---------- MOBILE PEQUEÑO — hasta 480px ---------- */
@media (max-width: 480px) {

  nav {
    padding: 0.4rem 0.65rem;
  }

  .nav-icons {
    gap: 6px;
    padding: 8px 6px;
  }

  .nav-icon-item .icon-box {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    border-radius: 10px;
  }

  .nav-icon-item span {
    font-size: 0.6rem;
  }

  .hero-tagline,
  .home-hero-title {
    font-size: clamp(1.35rem, 9vw, 2rem);
  }

  .section-title {
    font-size: clamp(1.1rem, 6vw, 1.55rem);
  }

  .modal {
    padding: 1.2rem 0.85rem;
  }

  .video-modal-btn {
    width: 36px;
    height: 36px;
  }
}

/* ---------- MOBILE MUY PEQUEÑO — hasta 360px ---------- */
@media (max-width: 360px) {

  .nav-icon-item .icon-box {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .nav-icon-item span {
    font-size: 0.55rem;
  }
}

/* ============================================================
   TABLET — 769px a 1024px
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {

  nav {
    padding: 0 1.25rem;
  }

  .hero {
    padding: 2.5rem 2rem 2rem;
  }

  .nav-icons-wrapper {
    max-width: 100%;
  }

  .nav-icons {
    gap: 14px;
    padding: 16px 18px;
  }

  /* Sections con padding cómodo */
  section {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  /* Grids: 2 columnas balanceadas */
  .articles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Modal registro: aprovecha más ancho */
  .modal {
    max-width: 88%;
  }

  /* Form-grid: mantiene 2 columnas */
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Video modal: ancho confortable */
  .video-modal-container {
    width: min(900px, 100%);
  }

  /* Footer: layout horizontal pero con holgura */
  .footer-grid {
    gap: 1.5rem;
  }
}

/* ============================================================
   DESKTOP — 1025px en adelante
   Refuerzos discretos; las reglas base ya cubren el desktop.
   ============================================================ */
@media (min-width: 1025px) {

  .hero {
    padding: 3rem clamp(2rem, 5vw, 4rem) 2rem;
  }

  .nav-icons {
    gap: clamp(14px, 2vw, 22px);
  }

  /* Asegurar que las secciones tengan un máximo legible */
  .map-section .section-desc,
  .articles-text-box,
  .home-hero-desc,
  .videos-hero-desc,
  .glosario-hero-desc {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ============================================================
   ORIENTACIÓN HORIZONTAL EN MÓVIL
   Pantallas pequeñas en landscape suelen ser muy bajas;
   reducimos un poco el padding vertical del hero.
   ============================================================ */
@media (max-width: 900px) and (orientation: landscape) {

  .hero {
    min-height: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}
