/* ================================================================
   RESPONSIVE — FLCH UNMSM
   Complementa los estilos inline de header.php y main.css
   Mobile-first: breakpoints 640 / 768 / 1024 / 1280
   ================================================================ */

/* ── Overflow horizontal global ── */
html, body {
    overflow-x: hidden;
}

/* ================================================================
   MENÚ MÓVIL — correcciones de visualización
   ================================================================ */

/* Ítem con hijos: el botón toggle es absoluto sobre el <a> */
.mobile-menu .menu-item-has-children {
    position: relative;
}

/* Link del ítem padre — deja espacio para el botón toggle */
.mobile-menu .menu-item-has-children > a {
    padding-right: 3rem;
    display: block;
    color: rgba(255, 255, 255, 0.92);
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    padding-left: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}

.mobile-menu .menu-item-has-children > a:hover {
    background: #1E4A7A;
    color: #A88F1D;
    padding-left: 1.5rem;
}

/* Sub-menú: oculto por defecto, visible con .open */
.mobile-menu ul.sub-menu {
    display: none;
    margin: 0;
    padding: 0 0 0 1rem;
    list-style: none;
    background: rgba(0, 0, 0, 0.25);
    border-left: 2px solid #A88F1D;
}

.mobile-menu ul.sub-menu.open {
    display: block;
}

.mobile-menu ul.sub-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.mobile-menu ul.sub-menu li:last-child {
    border-bottom: none;
}

.mobile-menu ul.sub-menu a {
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    display: block;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease, padding-left 0.2s ease;
}

.mobile-menu ul.sub-menu a:hover {
    color: #A88F1D;
    background: rgba(168, 143, 29, 0.08);
    padding-left: 1.5rem;
}

/* Sub-sub-menú */
.mobile-menu ul.sub-menu ul.sub-menu {
    margin-left: 0.5rem;
    border-left: 1px solid rgba(168, 143, 29, 0.4);
    padding-left: 0.75rem;
}

/* Botón toggle — absolutamente posicionado sobre el link */
.mobile-submenu-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 36px;
    height: 36px;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
    font-size: 0.75rem;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-submenu-toggle:hover,
.mobile-submenu-toggle:focus-visible {
    background: #A88F1D;
    color: #fff;
    outline: none;
}

.mobile-submenu-toggle i {
    transition: transform 0.25s ease;
    pointer-events: none;
}

.mobile-submenu-toggle i.rotate-180 {
    transform: rotate(180deg);
}

/* ================================================================
   TIPOGRAFÍA RESPONSIVE
   ================================================================ */

@media (max-width: 640px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.15rem; }
    h4 { font-size: 1rem; }

    p  { font-size: 0.925rem; }
}

/* ================================================================
   LAYOUT — CONTENIDO PRINCIPAL
   ================================================================ */

@media (max-width: 768px) {
    /* Sidebars debajo del contenido en mobile */
    .archive-layout,
    .single-layout {
        display: block !important;
    }

    .archive-layout > *,
    .single-layout > * {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Sidebar al final */
    .sidebar-area {
        margin-top: 2rem;
        border-top: 1px solid #E5E9F0;
        padding-top: 1.5rem;
    }
}

/* ================================================================
   GRID DE TARJETAS
   ================================================================ */

@media (max-width: 640px) {
    .grid-cards {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    .grid-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ================================================================
   CARD NOTICIA — MOBILE
   ================================================================ */

@media (max-width: 640px) {
    .card-noticia {
        border-radius: 10px;
    }

    .card-noticia__img-wrap {
        height: 180px;
    }

    .card-noticia__body {
        padding: 1rem;
    }

    .card-noticia__title {
        font-size: 0.95rem;
    }
}

/* ================================================================
   ARCHIVE FEATURED — MOBILE
   ================================================================ */

@media (max-width: 768px) {
    .archive-featured {
        flex-direction: column !important;
    }

    .archive-featured__img {
        width: 100% !important;
        height: 220px !important;
        border-radius: 10px 10px 0 0 !important;
    }

    .archive-featured__body {
        padding: 1.25rem !important;
    }
}

/* ================================================================
   BARRA DE BÚSQUEDA — MOBILE
   ================================================================ */

@media (max-width: 640px) {
    .search-input {
        font-size: 0.875rem !important;
        padding: 0.75rem 5rem 0.75rem 1rem !important;
    }

    .search-submit-btn {
        padding: 0.45rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    .search-clear-btn {
        right: 4rem !important;
    }

    .suggestion-link {
        font-size: 0.72rem;
        padding: 0.28rem 0.7rem;
    }
}

/* ================================================================
   IMÁGENES RESPONSIVE
   ================================================================ */

img {
    max-width: 100%;
    height: auto;
}

.wp-post-image,
.attachment-full,
.size-full {
    max-width: 100%;
    height: auto;
}

/* ================================================================
   TABLAS — SCROLL HORIZONTAL EN MOBILE
   ================================================================ */

.entry-content table,
.post-content table,
article table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

/* ================================================================
   BOTONES — MOBILE
   ================================================================ */

@media (max-width: 640px) {
    .btn,
    .btn-primary,
    .btn-card {
        padding: 0.6rem 1.2rem;
        font-size: 0.875rem;
    }

    /* Botones de ancho completo en pantallas muy pequeñas */
    .btn-full-mobile {
        width: 100%;
        justify-content: center;
    }
}

/* ================================================================
   PAGINACIÓN — MOBILE
   ================================================================ */

@media (max-width: 480px) {
    .pagination {
        flex-wrap: wrap;
        gap: 0.35rem;
        justify-content: center;
    }

    .pagination .page-numbers {
        min-width: 36px;
        min-height: 36px;
        font-size: 0.8rem;
    }
}

/* ================================================================
   WIDGETS / SIDEBAR — MOBILE
   ================================================================ */

@media (max-width: 768px) {
    .widget {
        margin-bottom: 1.5rem;
    }

    .widget-title {
        font-size: 0.95rem;
    }
}

/* ================================================================
   FOOTER — MOBILE
   ================================================================ */

@media (max-width: 768px) {
    /* Stack columnas de footer */
    footer .grid,
    footer [class*="grid-"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    footer {
        text-align: center;
    }

    footer .flex {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 640px) {
    footer {
        padding-bottom: 1rem;
    }
}

/* ================================================================
   HERO / SLIDER — MOBILE
   (El componente .flch-hero tiene sus propios estilos en hero.php)
   ================================================================ */

/* ================================================================
   ACCESIBILIDAD — TOUCH TARGETS
   ================================================================ */

@media (max-width: 1024px) {
    /* Garantiza targets táctiles mínimos (WCAG 2.5.5) */
    a,
    button,
    input[type="submit"],
    input[type="button"],
    select,
    [role="button"] {
        min-height: 44px;
    }

    /* Excluir links de texto corridos */
    p a,
    .entry-content a,
    .post-content a,
    .widget a {
        min-height: unset;
    }
}

/* ================================================================
   CONTENEDOR CUSTOM — MOBILE
   ================================================================ */

@media (max-width: 480px) {
    .container-custom,
    .container {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
    }
}

/* ================================================================
   PAGE HEADER — MOBILE
   ================================================================ */

@media (max-width: 640px) {
    .page-header {
        padding: 2rem 0 1.5rem;
    }

    .page-title {
        font-size: 1.5rem;
    }
}
