/*
 * ============================================================
 *  responsive-fix.css
 *  Archivo: /wp-content/themes/simplest/responsive-fix.css
 *
 *  NO depende de otros archivos. Usa !important donde hace
 *  falta para garantizar que las reglas se apliquen.
 * ============================================================
 */

/* ──────────────────────────────────────────────────────────
   GLOBAL — evitar scroll horizontal
   ────────────────────────────────────────────────────────── */
html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

* { box-sizing: border-box; }

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

/* ══════════════════════════════════════════════════════════
   TABLET  ≤ 1023px
═══════════════════════════════════════════════════════════ */
@media screen and (max-width: 1023px) {

    /* Blog wrapper */
    .blog-wrapper {
        padding: 32px 20px 48px !important;
    }

    /* Grid: 2 columnas */
    .blog-main {
        grid-template-columns: repeat(1, 1fr) !important;
        gap: 18px !important;
    }

    /* Featured card: columna */
    .blog-card--featured {
        flex-direction: column !important;
        grid-column: 1 / -1 !important;
    }

    .blog-card--featured .blog-card__thumb {
        flex: unset !important;
        max-width: 100% !important;
        width: 100% !important;
        height: 240px !important;
    }

    .blog-card--featured .blog-card__body {
        padding: 20px 22px 22px !important;
    }

    /* Single post layout: 1 columna */
    .sp-layout {
        grid-template-columns: 1fr !important;
        padding: 32px 20px 48px !important;
    }

    .sp-sidebar {
        position: static !important;
        max-height: none !important;
        overflow: visible !important;
        top: auto !important;
    }

    .sp-related__grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .sp-postnav {
        grid-template-columns: 1fr 1fr !important;
        max-width: 100% !important;
    }

    /* Most viewed: 2 columnas */
    .sp-mv-list {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ══════════════════════════════════════════════════════════
   MOBILE  ≤ 640px
═══════════════════════════════════════════════════════════ */
@media screen and (max-width: 640px) {

    /* ── BLOG HERO ── */
    .blog-hero {
        padding: 48px 16px 40px !important;
    }

    .blog-hero__title {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }

    .blog-hero__sub {
        font-size: .85rem !important;
    }

    .blog-hero__eyebrow {
        font-size: .62rem !important;
    }

    /* ── BLOG WRAPPER & GRID ── */
    .blog-wrapper {
        padding: 20px 14px 40px !important;
        gap: 20px !important;
    }

    .blog-main {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* ── BLOG CARD ── */
    .blog-card {
        border-radius: 14px !important;
    }

    .blog-card--featured {
        flex-direction: column !important;
        grid-column: 1 !important;
    }

    .blog-card--featured .blog-card__thumb {
        flex: unset !important;
        max-width: 100% !important;
        width: 100% !important;
        height: 200px !important;
    }

    .blog-card__thumb {
        aspect-ratio: 16 / 9 !important;
        height: auto !important;
    }

    .blog-card__body {
        padding: 14px 16px 16px !important;
        gap: 8px !important;
    }

    .blog-card__title {
        font-size: .98rem !important;
        line-height: 1.35 !important;
    }

    .blog-card--featured .blog-card__title {
        font-size: 1.05rem !important;
    }

    .blog-card__excerpt {
        font-size: .84rem !important;
        -webkit-line-clamp: 2 !important;
    }

    .blog-card__btn {
        font-size: .74rem !important;
        padding: 8px 14px !important;
    }

    .blog-card__category {
        font-size: .62rem !important;
    }

    .blog-card__date {
        font-size: .70rem !important;
    }

    .blog-card__footer {
        padding-top: 12px !important;
    }

    /* ── SINGLE POST — HERO ── */
    .sp-hero {
        min-height: 320px !important;
    }

    .sp-hero__content {
        padding: 68px 16px 28px !important;
    }

    .sp-hero__title {
        font-size: 1.45rem !important;
        line-height: 1.2 !important;
        margin-bottom: 14px !important;
    }

    .sp-hero__cat {
        font-size: .60rem !important;
        padding: 3px 10px !important;
    }

    .sp-breadcrumb {
        font-size: .60rem !important;
        margin-bottom: 10px !important;
    }

    .sp-hero__meta-text {
        font-size: .70rem !important;
        gap: 5px !important;
    }

    /* ── SINGLE — LAYOUT ── */
    .sp-layout {
        padding: 20px 14px 40px !important;
        gap: 28px !important;
        grid-template-columns: 1fr !important;
    }

    /* ── SHARE BAR ── */
    .sp-share {
        padding: 10px 12px !important;
        gap: 6px !important;
        margin-bottom: 20px !important;
        flex-wrap: wrap !important;
    }

    /* ── ARTICLE CONTENT ── */
    .sp-article,
    .sp-author-box,
    .sp-postnav {
        max-width: 100% !important;
    }

    .sp-content p {
        font-size: .92rem !important;
        line-height: 1.78 !important;
    }

    .sp-content h2 {
        font-size: 1.15rem !important;
    }

    .sp-content h3 {
        font-size: 1rem !important;
    }

    .sp-content .alignleft,
    .sp-content .alignright {
        float: none !important;
        max-width: 100% !important;
        margin: 1.2em 0 !important;
    }

    .sp-content table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        font-size: .8rem !important;
    }

    /* ── TAGS ── */
    .sp-tags {
        gap: 6px !important;
    }

    .sp-tag {
        font-size: .68rem !important;
    }

    /* ── AUTHOR BOX ── */
    .sp-author-box {
        padding: 16px !important;
        border-radius: 12px !important;
    }

    .sp-author-box__inner {
        flex-direction: row !important;
        gap: 12px !important;
    }

    .sp-author-box__avatar {
        width: 52px !important;
        height: 52px !important;
    }

    .sp-author-box__bio {
        font-size: .80rem !important;
    }

    /* ── POST NAV ── */
    .sp-postnav {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .sp-postnav__item--next {
        flex-direction: row !important;
        justify-content: flex-start !important;
        text-align: left !important;
    }

    .sp-postnav__title {
        font-size: .82rem !important;
    }

    /* ── RELATED ── */
    .sp-related {
        margin-top: 28px !important;
        padding-top: 24px !important;
    }

    .sp-related__grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Cards related horizontales */
    .sp-rcard {
        flex-direction: row !important;
        border-radius: 12px !important;
    }

    .sp-rcard__thumb-link {
        flex: 0 0 100px !important;
        display: block !important;
    }

    .sp-rcard__thumb {
        width: 100px !important;
        height: 100% !important;
        aspect-ratio: unset !important;
        border-radius: 12px 0 0 12px !important;
    }

    .sp-rcard__body {
        padding: 12px 14px !important;
    }

    .sp-rcard__title {
        font-size: .82rem !important;
    }

    /* ── MOST VIEWED ── */
    .sp-mv-list {
        display: block !important;
    }

    .sp-mv-item {
        border-right: none !important;
    }

    .sp-mv-link {
        padding: 10px 14px !important;
        gap: 10px !important;
    }

    .sp-mv-post-title {
        font-size: .78rem !important;
    }

    /* ── COMMENTS FORM ── */
    .comment-respond {
        padding: 18px 16px !important;
    }

    .comment-form input[type="text"],
    .comment-form input[type="email"],
    .comment-form input[type="url"] {
        width: 100% !important;
        float: none !important;
        margin-right: 0 !important;
    }
}

/* ══════════════════════════════════════════════════════════
   MOBILE SMALL  ≤ 390px
═══════════════════════════════════════════════════════════ */
@media screen and (max-width: 390px) {

    .blog-hero {
        padding: 40px 12px 32px !important;
    }

    .blog-hero__title {
        font-size: 1.5rem !important;
    }

    .blog-wrapper {
        padding: 16px 12px 36px !important;
    }

    .sp-hero__title {
        font-size: 1.25rem !important;
    }

    .sp-layout {
        padding: 16px 12px 36px !important;
    }

    .sp-content p {
        font-size: .88rem !important;
    }
}

/* ══════════════════════════════════════════════════════════
   TOUCH DEVICES — tap targets mínimos 44px
═══════════════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {

    .blog-card__btn,
    .sp-share__btn,
    .sp-postnav__item,
    .sp-mv-link,
    .sp-tag,
    .comment-form .submit {
        min-height: 44px !important;
    }

    .blog-card__btn {
        padding: 10px 18px !important;
    }

    /* Sin hover transforms en touch */
    .blog-card:hover,
    .sp-rcard:hover,
    .blog-card--featured:hover {
        transform: none !important;
        box-shadow: 0 2px 8px rgba(0,0,0,.07), 0 8px 24px rgba(0,0,0,.09) !important;
    }
}

/* ══════════════════════════════════════════════════════════
   DESKTOP ≥ 1024px — 3 columnas uniformes, sin featured
═══════════════════════════════════════════════════════════ */
@media screen and (min-width: 1024px) {
    .blog-main {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Eliminar cualquier comportamiento de featured card */
    .blog-card--featured {
        grid-column: 1 !important;
        flex-direction: column !important;
    }

    .blog-card--featured .blog-card__thumb {
        flex: unset !important;
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 10 !important;
    }

    .blog-card--featured .blog-card__body {
        padding: 24px 26px 26px !important;
    }

    .blog-card--featured .blog-card__title {
        font-size: 1.15rem !important;
    }
}

/* ══════════════════════════════════════════════════════════
   FIX: Restaurar sticky sidebar en desktop
═══════════════════════════════════════════════════════════ */
@media screen and (min-width: 1024px) {
    .sp-sidebar {
        position: sticky !important;
        top: 32px !important;
        max-height: calc(100vh - 64px) !important;
        overflow-y: auto !important;
        align-self: flex-start !important;
    }

    /* Asegurar que el layout sea grid de 2 columnas */
    .sp-layout {
        display: grid !important;
        grid-template-columns: 1fr 300px !important;
        align-items: start !important;
        gap: 48px !important;
    }
}
