/* ==========================================================================
   RESPONSIVE — ADAPTABILIDAD TOTAL EN MÓVIL, TABLET Y ESCRITORIO
   Día Internacional de la Alfabetización 2026 · UNESCO & Gobierno de México
   ========================================================================== */

/* ──────────────────────────────────────────────────────────
   1. PANTALLAS GRANDES Y TABLETS EN HORIZONTAL (Hasta 1024px)
   ────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --nav-h: 70px;
  }

  .container {
    padding: 0 1.5rem;
  }

  .hero-split-text {
    padding: calc(var(--nav-h) + 2rem) 2.5rem 3rem 2.5rem;
  }

  .hero-inner-text {
    padding: calc(var(--nav-h) + 1.5rem) 2rem 2.5rem;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .stat-item:nth-child(2)::after {
    display: none;
  }

  .objectives-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .hub-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .showcase-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .gastro-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .form-shell {
    padding: 2.2rem 2rem;
  }

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

/* ──────────────────────────────────────────────────────────
   2. TABLETS EN VERTICAL Y MÓVILES GRANDES (Hasta 900px)
      Activación de Menú Hamburguesa y Navegación Móvil
   ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --nav-h: 64px;
  }

  .nav .container,
  .nav .container.nav-inner,
  .nav-inner {
    gap: 0.5rem;
    padding: 0 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .logo {
    gap: 0.5rem;
    flex-shrink: 1;
    min-width: 0;
  }

  .logo-sep,
  .logo-text {
    display: none !important;
  }

  .logo-brand-img {
    height: 34px !important;
    max-height: 36px !important;
    width: auto !important;
    max-width: 145px !important;
    object-fit: contain !important;
    display: block !important;
  }

  .nav-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex-shrink: 0 !important;
  }

  .btn-nav-login {
    padding: 0.45rem 0.8rem !important;
    font-size: 0.76rem !important;
    gap: 0.35rem !important;
    white-space: nowrap !important;
  }

  .hamburger {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    padding: 7px !important;
    background: rgba(25, 116, 169, 0.08) !important;
    border: 1.5px solid rgba(25, 116, 169, 0.25) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    z-index: 1002 !important;
    gap: 4px !important;
  }

  .hamburger span {
    display: block !important;
    width: 22px !important;
    height: 2px !important;
    background: var(--blue-primary, #1974A9) !important;
    border-radius: 2px !important;
    transition: all 0.25s ease !important;
  }

  .hamburger.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg) !important;
  }

  .hamburger.open span:nth-child(2) {
    opacity: 0 !important;
  }

  .hamburger.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg) !important;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-bottom: 3px solid var(--yellow-primary);
    flex-direction: column;
    align-items: stretch;
    padding: 1.2rem 1.6rem 2rem;
    gap: 0;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    box-shadow: 0 16px 40px rgba(16, 83, 122, 0.16);
    z-index: 999;
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links li {
    border-bottom: 1px solid rgba(25, 116, 169, 0.08);
    width: 100%;
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-link {
    padding: 0.95rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--ink);
  }

  .nav-link::after {
    display: none;
  }

  .nav-link.active {
    color: var(--blue-primary);
    font-weight: 700;
    background: rgba(25, 116, 169, 0.05);
    border-radius: 6px;
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .nav-link.active::before {
    content: '•';
    color: var(--yellow-primary);
    font-size: 1.4rem;
    line-height: 0;
    margin-right: 0.5rem;
  }
}

/* ──────────────────────────────────────────────────────────
   3. MÓVILES Y DISPOSITIVOS COMPACTOS (Hasta 768px)
   ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }

  /* Héroes Apilados Verticalmente */
  .hero-split {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-split-text {
    padding: calc(var(--nav-h) + 1.5rem) 1.25rem 2rem;
    order: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-split-photo {
    height: 65vw;
    min-height: 240px;
    max-height: 380px;
    order: 2;
    position: relative;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-inner-text {
    padding: calc(var(--nav-h) + 1.2rem) 1.25rem 1.8rem;
    order: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-inner-photo {
    height: 52vw;
    min-height: 210px;
    max-height: 320px;
    order: 2;
    position: relative;
  }

  /* Etiquetas de foto en Héroes ajustadas a móvil sin corte */
  .hero-photo-label {
    position: absolute;
    bottom: 0.75rem !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: 90% !important;
    white-space: normal !important;
    text-align: center !important;
    font-size: 0.62rem !important;
    padding: 0.35rem 0.75rem !important;
    line-height: 1.3 !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
  }

  /* Countdown en móvil */
  .countdown {
    display: inline-flex;
    width: 100%;
    max-width: 320px;
    margin: 1rem auto;
    justify-content: space-between;
  }

  .countdown-item {
    flex: 1;
    padding: 0.5rem 0.35rem;
  }

  .countdown-num {
    font-size: 1.3rem;
  }

  .countdown-label {
    font-size: 0.58rem;
  }

  .hero-inner-photo {
    height: 48vw;
    min-height: 200px;
    max-height: 300px;
    order: 2;
  }

  /* Métricas y Estadísticas */
  .stats-row {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    padding: 1.5rem 0;
  }

  .stat-item {
    padding: 0.8rem 1rem;
    background: #FFFFFF;
    border-radius: 8px;
    border: 1px solid rgba(25, 116, 169, 0.1);
    box-shadow: var(--shadow-sm);
  }

  .stat-item::after {
    display: none !important;
  }

  /* Grids de Contenido */
  .objectives-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

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

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

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

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

  /* Timeline de Programa */
  .timeline {
    padding-left: 2rem;
  }

  .timeline::before {
    left: 8px;
  }

  .tl-marker {
    left: -2rem;
    width: 16px;
    height: 16px;
    top: 1.2rem;
  }

  .tl-body {
    padding: 1.4rem 1.2rem;
  }

  .tl-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  /* Tabs Responsivas sin recortes ni desbordamiento */
  .tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    justify-content: center !important;
    padding: 0 !important;
    margin-bottom: 2rem !important;
    gap: 0.55rem !important;
  }

  .tabs::-webkit-scrollbar {
    display: none !important;
  }

  .tab-btn {
    flex: 1 1 calc(50% - 0.55rem) !important;
    min-width: 130px !important;
    max-width: 100% !important;
    white-space: normal !important;
    padding: 0.65rem 0.75rem !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.04em !important;
    line-height: 1.25 !important;
    text-align: center !important;
    min-height: 44px !important; /* WCAG touch target */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .tab-btn:nth-child(5):last-child {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }

  /* Tarjeta de Pase Oficial */
  .pass-details {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .form-shell {
    padding: 1.8rem 1.2rem;
  }

  /* Usuario / Login en Header */
  .user-pill {
    padding: 0.32rem 0.7rem;
    max-width: 140px;
  }

  .user-pill .user-name-text {
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-nav-login span {
    font-size: 0.72rem;
  }

  .btn-nav-logout, .btn-nav-login {
    min-height: 38px;
    min-width: 38px;
  }
}

/* ──────────────────────────────────────────────────────────
   4. MÓVILES ESTÁNDAR Y PEQUEÑOS (Hasta 480px)
   ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --nav-h: 64px;
  }

  body {
    font-size: 0.95rem;
  }

  h1 {
    font-size: clamp(2rem, 8vw, 2.5rem);
    line-height: 1.1;
  }

  h2 {
    font-size: clamp(1.5rem, 6vw, 1.85rem);
    line-height: 1.15;
  }

  h3 {
    font-size: clamp(1.2rem, 5vw, 1.4rem);
  }

  .section {
    padding: 3rem 0;
  }

  .section--sm {
    padding: 2rem 0;
  }

  .hero-photo-label {
    font-size: 0.65rem;
    padding: 0.4rem 0.8rem;
    width: calc(100% - 2rem);
    bottom: 0.8rem;
    left: 1rem;
    text-align: center;
  }

  .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    font-size: 0.85rem;
  }

  .countdown {
    width: 100%;
    justify-content: space-between;
    gap: 0.4rem;
  }

  .countdown-item {
    flex: 1;
    min-width: 60px;
    padding: 0.5rem 0.35rem;
  }

  .countdown-num {
    font-size: 1.35rem;
  }

  .countdown-lbl {
    font-size: 0.56rem;
  }

  .objective-card {
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.25rem 1rem;
  }

  .objective-icon-box {
    width: 38px;
    height: 38px;
  }

  /* Formulario e inputs con 16px para evitar auto-zoom en iOS Safari */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Adaptación de logo en pantallas ultra estrechas */
  .logo-sep {
    display: none;
  }

  .logo-text .logo-sub {
    display: none;
  }

  .logo-brand-img {
    height: 30px;
    max-width: 110px;
  }

  .logo-text .logo-name {
    font-size: 0.88rem;
    line-height: 1.1;
  }

  /* Card and Showcase Media */
  .sc-img-wrap {
    height: 190px;
  }

  .sc-body {
    padding: 1.25rem 1rem;
  }

  .card {
    padding: 1.25rem 1rem;
  }

  .quote-box-gastro {
    padding: 1.8rem 1.2rem;
  }

  /* Footer */
  .footer-inner {
    text-align: center;
    gap: 1rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
  }
}

/* ──────────────────────────────────────────────────────────
   5. MÓVILES ULTRA PEQUEÑOS (Hasta 360px - e.g. iPhone SE / Galaxy Fold)
   ────────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .container {
    padding: 0 0.85rem;
  }

  .countdown-num {
    font-size: 1.15rem;
  }

  .user-pill {
    max-width: 105px;
    padding: 0.25rem 0.5rem;
  }

  .user-pill .user-name-text {
    max-width: 60px;
  }

  .logo-brand-img {
    max-width: 90px;
    height: 26px;
  }
}

/* ──────────────────────────────────────────────────────────
   6. ESTILOS DE IMPRESIÓN (Print Optimization)
   ────────────────────────────────────────────────────────── */
@media print {
  .nav, .site-footer, .btn, .tabs, .hamburger, .toast-wrap {
    display: none !important;
  }

  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  .page-header, .page-header--with-photo {
    padding-top: 1rem !important;
  }

  .timeline::before {
    background: #CCCCCC !important;
  }
}
