/* ====================================================
   Blog — lista, tarjetas y artículo
   Se usa en /blog, /blog/{slug} y en la sección de blogs del Home.
   ==================================================== */

/* ---------- Hero de la lista ---------- */
.blog-hero {
    position: relative;
    min-height: 420px;
    display: flex;
    align-items: flex-end;
    background: var(--rma-dark);
    color: #fff;
    overflow: hidden;
}

.blog-hero__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .45;
}

.blog-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16, 34, 27, .55) 0%, rgba(16, 34, 27, .2) 40%, rgba(16, 34, 27, .9) 100%);
}

.blog-hero__content {
    position: relative;
    z-index: 1;
    padding-top: calc(var(--height-header) + 3rem);
    padding-bottom: 3.5rem;
}

.blog-hero__eyebrow {
    font-family: Mansalva, cursive;
    color: var(--rma-yellow);
    font-size: 1.75rem;
    margin: 0;
}

.blog-hero__title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1;
    margin: .25rem 0 1rem;
    color: #fff;
}

.blog-hero__sub {
    max-width: 560px;
    font-size: 1.15rem;
    color: rgba(255, 255, 255, .85);
    margin: 0;
}

/* ---------- Filtros ---------- */
.blog-filters {
    position: relative;
    z-index: 2;
    margin-top: -5.5rem;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 18px 40px rgba(16, 34, 27, .12);
    padding: 1.25rem;
    margin-bottom: 2.5rem;
}

.blog-filters__row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.blog-search {
    flex: 1 1 280px;
    position: relative;
    margin: 0;
}

.blog-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rma-muted);
    font-size: 1.15rem;
}

.blog-search input {
    width: 100%;
    height: 48px;
    border: 1px solid #e3e7e5;
    border-radius: 999px;
    padding: 0 1rem 0 2.75rem;
    font-size: 1rem;
    background: var(--rma-light);
    transition: border-color .2s, box-shadow .2s;
}

.blog-search input:focus {
    outline: none;
    border-color: var(--rma-teal);
    box-shadow: 0 0 0 4px rgba(104, 195, 196, .2);
    background: #fff;
}

.blog-select {
    flex: 0 1 190px;
    margin: 0;
}

.blog-select .form-select {
    height: 48px;
    border-radius: 999px;
    border-color: #e3e7e5;
    padding-left: 1.1rem;
}

.blog-chips {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid #eef1ef;
    scrollbar-width: thin;
}

.blog-chip {
    margin: 0;
    flex: 0 0 auto;
}

.blog-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.blog-chip span {
    display: inline-block;
    padding: .4rem 1rem;
    border-radius: 999px;
    border: 1px solid #dfe5e2;
    color: var(--rma-dark);
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}

.blog-chip span:hover { border-color: var(--rma-dark); }

.blog-chip input:checked + span {
    background: var(--rma-dark);
    border-color: var(--rma-dark);
    color: #fff;
}

.blog-chip input:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(104, 195, 196, .5);
}

/* ---------- Resultados ---------- */
#blogResults { transition: opacity .2s; }
#blogResults.is-loading { opacity: .45; pointer-events: none; }

.blog-results-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.blog-results-count {
    font-size: 1rem;
    font-weight: 600;
    color: var(--rma-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0;
}

.blog-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.blog-active {
    background: rgba(104, 195, 196, .15);
    color: var(--rma-dark);
    padding: .25rem .75rem;
    border-radius: 999px;
    font-size: .875rem;
}

.blog-clear {
    font-size: .875rem;
    font-weight: 600;
    color: #c0392b;
}

.blog-empty {
    text-align: center;
    padding: 4rem 1rem;
    max-width: 520px;
    margin: 0 auto;
}

.blog-empty > i {
    font-size: 3.5rem;
    color: var(--rma-teal);
}

.blog-empty h3 {
    font-size: 1.5rem;
    margin: 1rem 0 .5rem;
}

.blog-empty p {
    color: var(--rma-muted);
    margin-bottom: 1.5rem;
}

/* ---------- Tarjeta ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.75rem;
}

.blog-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(16, 34, 27, .08);
    transition: transform .25s, box-shadow .25s;
    height: 100%;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(16, 34, 27, .14);
}

.blog-card__media {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--rma-light);
}

.blog-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s;
}

.blog-card:hover .blog-card__media img { transform: scale(1.05); }

.blog-card__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-size: 3rem;
    color: var(--rma-teal);
    background: linear-gradient(135deg, var(--rma-light), #e8f4f0);
}

.blog-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.25rem 1.4rem 1.4rem;
}

.blog-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin: 0 0 .75rem;
    position: relative;
    z-index: 2; /* por encima del stretched-link */
}

.blog-tag {
    display: inline-block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #1f7a8c;
    background: rgba(104, 195, 196, .16);
    padding: .2rem .65rem;
    border-radius: 999px;
    transition: background .2s, color .2s;
}

.blog-tag:hover { background: var(--rma-teal); color: #fff; }

.blog-tag--light {
    color: #fff;
    background: rgba(255, 255, 255, .18);
    backdrop-filter: blur(4px);
}

.blog-card__title {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 .5rem;
}

.blog-card__title a { color: var(--rma-dark); }
.blog-card:hover .blog-card__title a { color: #1f7a8c; }

.blog-card__excerpt {
    color: var(--rma-muted);
    font-size: .975rem;
    line-height: 1.55;
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--rma-muted);
}

.blog-card__arrow {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--rma-light);
    color: var(--rma-dark);
    transition: background .2s, color .2s, transform .2s;
}

.blog-card:hover .blog-card__arrow {
    background: var(--rma-yellow);
    transform: translateX(3px);
}

/* Destacado (primer artículo) */
.blog-card--featured {
    margin-bottom: 1.75rem;
}

@media (min-width: 992px) {
    .blog-card--featured {
        flex-direction: row;
        min-height: 420px;
    }

    .blog-card--featured .blog-card__media {
        flex: 0 0 58%;
        aspect-ratio: auto;
    }

    .blog-card--featured .blog-card__body {
        padding: 2.5rem;
        justify-content: center;
    }

    .blog-card--featured .blog-card__title {
        font-size: 2.1rem;
    }

    .blog-card--featured .blog-card__excerpt {
        font-size: 1.1rem;
        -webkit-line-clamp: 5;
    }

    .blog-card--featured .blog-card__meta { margin-top: 1rem; }
}

/* ---------- Paginación ---------- */
.blog-pagination { margin-top: 3rem; }

.blog-pagination .page-link {
    border-radius: 999px !important;
    min-width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    margin: 0 .2rem;
}

.blog-pagination .page-item.active .page-link {
    background: var(--rma-dark);
    border-color: var(--rma-dark);
}

/* ---------- Artículo ---------- */
.post-hero {
    position: relative;
    min-height: min(78vh, 680px);
    display: flex;
    align-items: flex-end;
    background: var(--rma-dark);
    overflow: hidden;
}

.post-hero__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16, 34, 27, .5) 0%, rgba(16, 34, 27, 0) 35%, rgba(16, 34, 27, .92) 100%);
}

.post-hero__content {
    position: relative;
    z-index: 1;
    padding-top: calc(var(--height-header) + 4rem);
    padding-bottom: 3rem;
    color: #fff;
}

.post-hero__tags {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0 0 1rem;
}

.post-hero__title {
    font-size: clamp(2rem, 5vw, 3.75rem);
    font-weight: 800;
    line-height: 1.08;
    max-width: 900px;
    color: #fff;
    margin: 0 0 1.25rem;
}

.post-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.5rem;
    color: rgba(255, 255, 255, .85);
}

.post-hero__meta i { color: var(--rma-yellow); margin-right: .25rem; }

.post-lead {
    font-size: 1.4rem;
    line-height: 1.55;
    color: var(--rma-dark);
    font-weight: 500;
    border-left: 4px solid var(--rma-yellow);
    padding-left: 1.25rem;
    margin-bottom: 2rem;
}

.post-content {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--rma-text);
}

.post-content > * + * { margin-top: 1.25rem; }
.post-content h2 { font-size: 1.9rem; font-weight: 700; margin-top: 2.5rem; color: var(--rma-dark); }
.post-content h3 { font-size: 1.45rem; font-weight: 700; margin-top: 2rem; color: var(--rma-dark); }
.post-content a { color: #1f7a8c; text-decoration: underline; text-underline-offset: 3px; }
.post-content img { border-radius: .75rem; margin: 1rem 0; }
.post-content ul, .post-content ol { padding-left: 1.5rem; }
.post-content li + li { margin-top: .4rem; }

.post-content blockquote {
    font-size: 1.35rem;
    font-style: italic;
    color: var(--rma-dark);
    border-left: 4px solid var(--rma-teal);
    padding: .5rem 0 .5rem 1.25rem;
    margin: 2rem 0;
}

.post-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 3rem 0 1rem;
}

.post-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .75rem;
}

.post-gallery__item {
    border: 0;
    padding: 0;
    border-radius: .75rem;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: zoom-in;
    background: var(--rma-light);
}

.post-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}

.post-gallery__item:hover img { transform: scale(1.06); }

.post-share {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 3rem 0 2rem;
    padding: 1.25rem 0;
    border-top: 1px solid #eef1ef;
    border-bottom: 1px solid #eef1ef;
}

.post-share__label { font-weight: 600; margin-right: .5rem; }

.post-share__btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #dfe5e2;
    background: #fff;
    display: grid;
    place-items: center;
    color: var(--rma-dark);
    font-size: 1.2rem;
    transition: all .2s;
}

.post-share__btn:hover { background: var(--rma-dark); color: #fff; border-color: var(--rma-dark); }
.post-share__copied { font-size: .875rem; color: #2f9e44; }

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.post-nav__link {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 1rem 1.25rem;
    border-radius: .75rem;
    background: var(--rma-light);
    color: var(--rma-dark);
    font-weight: 600;
    transition: background .2s;
}

.post-nav__link small { color: var(--rma-muted); font-weight: 500; }
.post-nav__link:hover { background: #ecf6f3; color: var(--rma-dark); }
.post-nav__link--next { text-align: right; grid-column: 2; }

.post-aside {
    position: sticky;
    top: calc(var(--height-header) + 4rem);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-cta {
    background: var(--rma-dark) url(/assets/backgrounds/home_section.png) center / cover;
    background-blend-mode: soft-light;
    color: #fff;
    border-radius: 1rem;
    padding: 2rem 1.75rem;
}

.post-cta__eyebrow {
    font-family: Mansalva, cursive;
    color: var(--rma-yellow);
    font-size: 1.35rem;
    margin: 0;
}

.post-cta__title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    margin: .25rem 0 .75rem;
}

.post-cta p { color: rgba(255, 255, 255, .85); }

.post-aside__block {
    border: 1px solid #eef1ef;
    border-radius: 1rem;
    padding: 1.5rem;
}

.post-aside__title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 1rem;
}

.post-back { font-weight: 600; color: var(--rma-dark); }
.post-back:hover { color: #1f7a8c; }

/* ---------- Sección del Home ---------- */
.home-blog .home-blog__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.home-blog .rma-section-title { margin: 0; }

@media (max-width: 575.98px) {
    .blog-filters { margin-top: -3rem; padding: 1rem; }
    .blog-select { flex: 1 1 calc(50% - .5rem); }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav__link--next { grid-column: 1; }
}
