/* ==========================================================================
   BanPre — Listado del blog (home.php), layout estilo "DaBBa".
   Hero + sidebar (buscador, categorías, top posts, instagram, todos) + grid.
   Acento de marca: #b8860b. Scope: solo /blog/ (is_home()).
   ========================================================================== */

.banpre-bloghome {
    --bbh-accent: #b8860b;
    --bbh-accent-dark: #946b08;
    --bbh-ink: #2b2b2b;
    --bbh-muted: #6f6f6f;
    --bbh-line: rgba(0, 0, 0, 0.08);
    --bbh-radius: 12px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem 4rem;
    color: var(--bbh-ink);
}

/* --------------------------------- HERO --------------------------------- */
/* Full-bleed (ancho total, como el hero del Index) + full-screen. */
.blog { overflow-x: hidden; }
.bbh-hero {
    position: relative;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    width: 100vw;
    margin-top: 0;
    margin-bottom: 2.5rem;
    /* Altura FIJA = la de Contacto/Quiénes (460/380/340) para que coincida exacto */
    height: 460px;
    min-height: 460px;
    overflow: hidden;
    display: flex;
    align-items: center;          /* contenido centrado vertical, como Contacto */
    background-size: cover;
    background-position: center 68%;
    background-color: #2b2b2b;
}
@media (max-width: 1024px) {
    .bbh-hero { height: 380px; min-height: 380px; }
}
@media (max-width: 767px) {
    .bbh-hero { height: 340px; min-height: 340px; }
}
.bbh-hero--nofoto {
    background: linear-gradient(120deg, var(--bbh-accent), var(--bbh-accent-dark));
}
.bbh-hero__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.32) 55%, rgba(0, 0, 0, 0.12) 100%);
}
.bbh-hero__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem clamp(1.25rem, 5vw, 60px);
    box-sizing: border-box;
}
.bbh-hero__inner > * { max-width: 640px; }
.bbh-hero__title {
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: clamp(39px, 5vw, 56px);
    line-height: 1.1;
    margin: 0 0 0.75rem;
}
.bbh-hero__desc {
    color: #fff;
    font-size: clamp(1rem, 1.6vw, 1.2rem);   /* mismo tamaño que la descripción de Contacto */
    line-height: 1.5;
    margin: 0;
}
/* Rayita naranja entre el H1 y la descripción (igual que Contacto/Quiénes) */
.bbh-hero__desc::before {
    content: "";
    display: block;
    width: 54px;
    height: 3px;
    background: var(--bbh-accent, #B8860B);
    margin: 0 0 16px;
    border-radius: 2px;
}

/* ----------------------- CATEGORÍAS (fila bajo hero) -------------------- */
.bbh-catsrow {
    margin: 2rem 0 2.5rem;
}
.bbh-catsrow__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bbh-ink);
    display: inline-block;
}
.bbh-catsrow__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.bbh-catsrow .bbh-cat { min-height: 96px; }
@media (max-width: 600px) {
    .bbh-catsrow__list { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .bbh-catsrow .bbh-cat { min-height: 80px; }
}

/* -------------------------------- LAYOUT -------------------------------- */
.bbh-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    align-items: start;
}
/* min-width:0 evita que el contenido (slider en móvil) infle la columna y
   desborde la pantalla. */
.bbh-main { min-width: 0; }
.bbh-sidebar { min-width: 0; }

/* ------------------------------- SIDEBAR -------------------------------- */
.bbh-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.bbh-box__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bbh-ink);
    display: inline-block;
}

/* Buscador */
.bbh-search form,
.bbh-search .search-form {
    display: flex;
    border: 1px solid var(--bbh-line);
    border-radius: 50px;
    overflow: hidden;
    background: #fff;
}
.bbh-search input[type="search"],
.bbh-search .search-field {
    flex: 1;
    border: 0;
    padding: 0.7rem 1.1rem;
    font-size: 0.9rem;
    background: transparent;
    outline: none;
    min-width: 0;
}
.bbh-search input[type="submit"],
.bbh-search .search-submit {
    border: 0;
    background: var(--bbh-accent);
    color: #fff;
    padding: 0 1.1rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.25s ease;
}
.bbh-search .search-submit:hover {
    background: var(--bbh-accent-dark);
}

/* Categorías (botones con imagen) */
.bbh-cats__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.bbh-cat {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    border-radius: var(--bbh-radius);
    overflow: hidden;
    text-decoration: none;
    background-size: cover;
    background-position: center;
    background-color: #555;
    transition: transform 0.3s ease;
}
.bbh-cat::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    transition: background 0.3s ease;
}
.bbh-cat:hover {
    transform: translateY(-2px);
}
.bbh-cat:hover::before {
    background: rgba(0, 0, 0, 0.25);
}
.bbh-cat--nofoto {
    background: linear-gradient(120deg, var(--bbh-accent), var(--bbh-accent-dark));
}
.bbh-cat__name {
    position: relative;
    z-index: 1;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.95rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Top Posts */
.bbh-top__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: none;
}
.bbh-top__item {
    display: flex;
    gap: 0.85rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--bbh-line);
}
.bbh-top__item:last-child {
    border-bottom: 0;
}
.bbh-top__num {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    color: var(--bbh-accent);
    min-width: 1.4rem;
    text-align: center;
}
.bbh-top__body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.bbh-top__title {
    color: var(--bbh-ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.35;
}
.bbh-top__title:hover {
    color: var(--bbh-accent-dark);
}
.bbh-top__meta {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bbh-muted);
}

/* Instagram */
.bbh-ig__placeholder {
    font-size: 0.82rem;
    color: var(--bbh-muted);
    line-height: 1.5;
    background: #faf6ec;
    border: 1px dashed var(--bbh-accent);
    border-radius: var(--bbh-radius);
    padding: 0.9rem 1rem;
    margin: 0;
}

/* Todos los artículos — 10 visibles + scroll */
.bbh-all__list {
    list-style: none;
    margin: 0;
    padding: 0 0.5rem 0 0;
    /* ~10 ítems visibles; el resto con scroll vertical */
    max-height: 360px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bbh-accent) transparent;
}
.bbh-all__list::-webkit-scrollbar {
    width: 6px;
}
.bbh-all__list::-webkit-scrollbar-thumb {
    background: var(--bbh-accent);
    border-radius: 3px;
}
.bbh-all__item {
    border-bottom: 1px solid var(--bbh-line);
}
.bbh-all__item a {
    display: block;
    padding: 0.55rem 0;
    color: var(--bbh-ink);
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1.4;
    transition: color 0.2s ease, padding-left 0.2s ease;
}
.bbh-all__item a:hover {
    color: var(--bbh-accent-dark);
    padding-left: 0.35rem;
}

/* --------------------- ACORDEONES del sidebar (details) ----------------- */
details.bbh-box > summary.bbh-box__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
    user-select: none;
    margin-bottom: 0;
    width: 100%;
}
details.bbh-box > summary.bbh-box__title::-webkit-details-marker { display: none; }
details.bbh-box > summary.bbh-box__title::after {
    content: "▾";
    color: var(--bbh-accent);
    font-size: 0.8em;
    transition: transform 0.25s ease;
}
details.bbh-box[open] > summary.bbh-box__title { margin-bottom: 1rem; }
details.bbh-box[open] > summary.bbh-box__title::after { transform: rotate(180deg); }

/* Placeholder de Instagram (cuadro de referencia) */
.bbh-ig__placeholder { text-align: center; }
.bbh-ig__icon { font-size: 1.6rem; display: block; margin-bottom: 0.4rem; }
.bbh-ig__title { font-weight: 700; color: var(--bbh-ink); margin: 0 0 0.35rem; font-size: 0.95rem; }
.bbh-ig__txt { margin: 0 0 0.75rem; }
.bbh-ig__btn {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--bbh-accent-dark);
    text-decoration: none;
}
.bbh-ig__btn:hover { text-decoration: underline; }

/* ------------------------------- SLIDER --------------------------------- */
/* DESKTOP: grilla masonry de 2 columnas (como estaba: "2 y 2 abajo").
   El slider horizontal con < > es SOLO para móvil. En desktop no hay scroll
   horizontal, así que el JS oculta flechas y contador. */
.bbh-slider { position: relative; min-width: 0; }
.bbh-slider__track {
    column-count: 2;
    column-gap: 1.75rem;
}
.bbh-slider__track > .bbh-card {
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin: 0 0 1.75rem;
}
.bbh-slider__track > .bbh-card:nth-child(even) { margin-top: 2.5rem; }

/* Flechas (solo visibles en móvil, cuando el JS detecta overflow) */
.bbh-slider__nav {
    position: absolute;
    top: 42%;
    transform: translateY(-50%);
    z-index: 3;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--bbh-line);
    background: #fff;
    color: var(--bbh-ink);
    font-size: 1.4rem; line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    transition: background .2s, color .2s, opacity .2s;
}
.bbh-slider__nav:hover { background: var(--bbh-accent); color: #fff; }
.bbh-slider__nav:disabled { opacity: .35; cursor: default; }
.bbh-slider__prev { left: 2px; }
.bbh-slider__next { right: 2px; }

/* Contador */
.bbh-slider__counter {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bbh-muted);
    letter-spacing: .5px;
}

/* MÓVIL (≤768px): una sola fila deslizable con flechas < >. min-width:0 +
   max-width:100% evitan que la fila ancha desborde la pantalla. */
@media (max-width: 768px) {
    .bbh-slider__track {
        column-count: auto;
        display: flex;
        flex-wrap: nowrap;
        gap: 1rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 4px 2px 10px;
        max-width: 100%;
    }
    .bbh-slider__track::-webkit-scrollbar { display: none; }
    .bbh-slider__track > .bbh-card {
        flex: 0 0 86%;
        width: auto;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
        break-inside: auto;
        scroll-snap-align: center;
    }
    .bbh-slider__track > .bbh-card .bbh-card__body { flex: 1; display: flex; flex-direction: column; }
    .bbh-slider__track > .bbh-card .bbh-card__more { margin-top: auto; }
}

/* -------------------------------- GRILLA -------------------------------- */
/* Escalonada ("no tan alineada"): masonry con CSS multi-columna. */
.bbh-grid {
    column-count: 2;
    column-gap: 1.75rem;
}
.bbh-card {
    break-inside: avoid;
    margin: 0 0 1.75rem;
    background: #fff;
    border-radius: var(--bbh-radius);
    overflow: hidden;
    border: 1px solid var(--bbh-line);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    display: inline-block; /* evita corte en el salto de columna */
    width: 100%;
}
.bbh-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.13);
}
/* Desfase vertical de la 2ª columna para el efecto escalonado */
.bbh-card:nth-child(even) {
    margin-top: 2.5rem;
}
.bbh-card__thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #eee;
}
.bbh-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bbh-card:hover .bbh-card__img {
    transform: scale(1.06);
}
.bbh-card__noimg {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, var(--bbh-accent), var(--bbh-accent-dark));
}
.bbh-card__body {
    padding: 1.25rem 1.4rem 1.5rem;
}
.bbh-card__meta {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bbh-muted);
    margin-bottom: 0.6rem;
}
.bbh-card__cat {
    color: var(--bbh-accent-dark);
    font-weight: 700;
    text-decoration: none;
}
.bbh-card__title {
    font-size: 1.2rem;
    line-height: 1.3;
    margin: 0 0 0.6rem;
}
.bbh-card__title a {
    color: var(--bbh-ink);
    text-decoration: none;
    transition: color 0.25s ease;
}
.bbh-card__title a:hover {
    color: var(--bbh-accent-dark);
}
.bbh-card__excerpt {
    color: var(--bbh-muted);
    font-size: 0.9rem;
    line-height: 1.65;
    margin: 0 0 1rem;
}
.bbh-card__more {
    color: var(--bbh-accent-dark);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: transform 0.25s ease;
    display: inline-block;
}
.bbh-card__more:hover {
    transform: translateX(3px);
}

/* ----------------------------- PAGINACIÓN ------------------------------- */
.bbh-pagination {
    margin-top: 1.5rem;
}
.bbh-pagination .page-numbers {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
.bbh-pagination .page-numbers li {
    margin: 0;
}
.bbh-pagination a.page-numbers,
.bbh-pagination span.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 0.6rem;
    border-radius: 10px;
    border: 1px solid var(--bbh-line);
    background: #fff;
    color: var(--bbh-ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.bbh-pagination a.page-numbers:hover {
    border-color: var(--bbh-accent);
    color: var(--bbh-accent-dark);
}
.bbh-pagination span.page-numbers.current {
    background: var(--bbh-accent);
    border-color: var(--bbh-accent);
    color: #fff;
}
.bbh-pagination .page-numbers.dots {
    border-color: transparent;
    background: transparent;
}

/* ------------------------------- VACÍO ---------------------------------- */
.bbh-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--bbh-muted);
}

/* ----------------------------- RESPONSIVE ------------------------------- */
@media (max-width: 900px) {
    .bbh-layout {
        grid-template-columns: 1fr;
    }
    /* En móvil, sidebar va al final para priorizar los artículos */
    .bbh-main {
        order: 1;
    }
    .bbh-sidebar {
        order: 2;
    }
}
@media (max-width: 560px) {
    .bbh-grid {
        column-count: 1;
    }
    .bbh-card:nth-child(even) {
        margin-top: 0;
    }
    .bbh-hero__inner {
        padding: 1.75rem 1.5rem;
    }
}

/* Respeta reduce-motion (la animación de entrada la maneja banpre-blog.js) */
@media (prefers-reduced-motion: reduce) {
    .bbh-card,
    .bbh-card__img,
    .bbh-cat {
        transition: none;
    }
}
