/**
 * blog-fixes.css: blog index, tag archives and single post header.
 * Enqueued only on is_home(), is_tag() and single posts (see functions.php).
 */

/* ---------- Hero ---------- */
#hero.blog-hero {
    --blog-red: #c33;
    --blog-ink: #11111a;
    padding: 140px 0 72px;
    background-color: #1b1c21;
    background-blend-mode: multiply;
    overflow: hidden;
}
.blog-hero__row {
    align-items: center;
    row-gap: 32px;
}
.blog-hero__text .breadcrumb-cont {
    margin: 0 0 20px;
}
.blog-hero__text .breadcrumb {
    justify-content: flex-start;
    margin: 0;
    padding: 0;
}
#hero.blog-hero h1 {
    font-size: clamp(30px, 2.6vw + 14px, 52px);
    line-height: 1.1;
    text-align: start;
    text-wrap: balance;
    margin: 0 0 20px;
    max-width: 24ch;
    min-height: 2.2em; /* two lines: short and long tag names give the hero the same height */
}
.blog-hero__lead {
    font-size: 18px;
    line-height: 1.5;
    min-height: 3em; /* two lines: the index/search text and a tag blurb give the hero the same height */
    margin: 0;
    max-width: 46ch;
    color: rgba(255, 255, 255, .8);
}
#hero.blog-hero .featured {
    display: block;
    margin: 0;
    background: #eeedee;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .3);
}
#hero.blog-hero .featured img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
#hero.blog-hero .featured .cont {
    padding: 24px 28px 28px;
}
#hero.blog-hero .featured .fecha {
    color: var(--blog-red);
    font-size: 14px;
    margin-bottom: 8px;
}
#hero.blog-hero .featured .featured-title {
    font-family: "Libre Franklin", sans-serif;
    font-size: clamp(20px, 1.2vw + 14px, 28px);
    font-weight: 400;
    line-height: 1.2;
    margin: 0 0 10px;
    color: var(--blog-ink);
}
#hero.blog-hero .featured p {
    margin: 0;
    color: #626b71;
}
#hero.blog-hero .featured:hover .featured-title {
    color: var(--blog-red);
}

/* ---------- Section + filter bar ---------- */
.blog-section {
    padding: 56px 0 100px;
}
.blog-topics {
    margin: 0 0 44px;
}
.blog-topics__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 20px;
}
.blog-topics__eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    color: #c33;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.blog-topics__eyebrow::before {
    content: "";
    width: 28px;
    height: 2px;
    background: #c33;
}
.blog-topics__title {
    margin: 0;
    color: #11111a;
    font-family: "Libre Franklin", sans-serif;
    font-size: clamp(20px, 1vw + 14px, 28px);
    font-weight: 300;
    line-height: 1.2;
}
.blog-search {
    position: relative;
    width: min(100%, 340px);
}
.blog-search[hidden] {
    display: none;
}
.blog-search .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.blog-search__input {
    width: 100%;
    height: 46px;
    padding: 0 40px 0 14px;
    border: 1px solid #d9d9d9;
    border-radius: 0;
    background: #fff;
    color: #11111a;
    font-size: 15px;
    -webkit-appearance: none;
    appearance: none;
}
.blog-search__input:focus {
    outline: 0;
    border-color: #c33;
}
.blog-search__clear {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 46px;
    border: 0;
    background: none;
    color: #626b71;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.blog-search__clear[hidden] {
    display: none;
}
.blog-search__clear:hover {
    color: #c33;
}

/* Search suggestions */
.blog-search__spin {
    position: absolute;
    top: 15px;
    right: 40px;
    width: 16px;
    height: 16px;
    border: 2px solid #d9d9d9;
    border-top-color: #c33;
    border-radius: 50%;
    opacity: 0;
    animation: blog-spin .7s linear infinite;
    pointer-events: none;
}
.blog-search.is-loading .blog-search__spin {
    opacity: 1;
}
@keyframes blog-spin {
    to { transform: rotate(360deg); }
}
.blog-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    min-width: min(100vw - 32px, 420px);
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #d9d9d9;
    background: #fff;
    box-shadow: 0 18px 40px rgba(17, 17, 26, .18);
}
.blog-suggest[hidden] {
    display: none;
}
.blog-suggest__group-title {
    padding: 12px 16px 6px;
    color: #c33;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.blog-suggest__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    color: #11111a;
    font-size: 14px;
    line-height: 1.3;
    text-decoration: none;
}
.blog-suggest__item:hover,
.blog-suggest__item.is-active {
    background: #f3f3f3;
    color: #11111a;
}
.blog-suggest__item img,
.blog-suggest__thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    object-fit: cover;
    background: #1b1c21;
}
.blog-suggest__body {
    min-width: 0;
    flex: 1;
}
.blog-suggest__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 500;
}
.blog-suggest__meta {
    margin-top: 2px;
    color: #8a9196;
    font-size: 12px;
}
.blog-suggest__count {
    margin-left: auto;
    color: #8a9196;
    font-size: 12px;
}
.blog-suggest mark {
    background: rgba(204, 51, 51, .14);
    color: inherit;
    padding: 0;
}
.blog-suggest__empty {
    padding: 16px;
    color: #626b71;
    font-size: 14px;
}
.blog-suggest__all {
    border-top: 1px solid #eee;
    color: #c33;
    font-weight: 500;
}

/* Topic cards carousel */
.blog-topics__wrap {
    position: relative;
}
.blog-topics__track {
    display: flex;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}
.blog-topics__track::-webkit-scrollbar {
    display: none;
}
.blog-topics__wrap.has-prev .blog-topics__track {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 56px);
    mask-image: linear-gradient(to right, transparent, #000 56px);
}
.blog-topics__wrap.has-next .blog-topics__track {
    -webkit-mask-image: linear-gradient(to left, transparent, #000 56px);
    mask-image: linear-gradient(to left, transparent, #000 56px);
}
.blog-topics__wrap.has-prev.has-next .blog-topics__track {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent);
}
.blog-topics__track li {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    scroll-snap-align: start;
}
.blog-topic {
    position: relative;
    display: block;
    width: 220px;
    aspect-ratio: 220 / 130;
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
    /* skeleton shimmer while the image loads */
    background: linear-gradient(100deg, #1b1c21 30%, #2a2c33 50%, #1b1c21 70%) 0 0 / 200% 100%;
    animation: blog-shimmer 1.6s linear infinite;
}
@keyframes blog-shimmer {
    to { background-position: -200% 0; }
}
.blog-topic.is-noimg,
.blog-topic.is-all {
    animation: none;
}
.blog-topic.is-noimg {
    background: linear-gradient(135deg, #1b1c21 40%, #3b2a2d);
}
.blog-topic.is-all {
    background: linear-gradient(135deg, #1b1c21 35%, #c33);
}
.blog-topic::before { /* legibility gradient (shifts up on hover) */
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0) 45%),
        linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, .35) 60%, rgba(0, 0, 0, .25));
    transition: opacity .35s;
}
.blog-topic img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(.5) brightness(.75);
    transition: transform .6s cubic-bezier(.2, .7, .2, 1), filter .35s;
}
.blog-topic__index {
    position: absolute;
    top: 12px;
    left: 14px;
    z-index: 2;
    font-family: "Libre Franklin", sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1.5px;
    opacity: .8;
}
.blog-topic__count {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 2;
    font-size: 11px;
    letter-spacing: .4px;
    opacity: 1;
}
.blog-topic__name {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 15px;
    z-index: 2;
    font-family: "Libre Franklin", sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.15;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
    transition: transform .35s ease;
}
.blog-topic::after { /* active bar */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    height: 3px;
    background: #c33;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s ease;
}
.blog-topic:hover img,
.blog-topic:focus-visible img,
.blog-topic.is-active img {
    filter: saturate(1) brightness(.72);
}
.blog-topic:hover img,
.blog-topic:focus-visible img {
    transform: scale(1.04);
}
.blog-topic:hover .blog-topic__name,
.blog-topic:focus-visible .blog-topic__name {
    transform: translateY(-4px);
}
.blog-topic:hover::after,
.blog-topic:focus-visible::after {
    transform: scaleX(.3);
}
.blog-topic.is-active::after {
    transform: scaleX(1);
}
.blog-topic.is-active .blog-topic__index {
    padding: 1px 6px;
    margin: -1px 0 0 -6px;
    background: #c33;
    text-shadow: none;
}
.blog-topic.is-active { /* selected (several can be active at once) */
    outline: 2px solid #c33;
    outline-offset: -2px;
}
.blog-topic:focus-visible {
    outline: 2px solid #c33;
    outline-offset: 2px;
}
.blog-topic.is-active:focus-visible {
    outline-offset: 2px;
}
.blog-topics__arrow {
    position: absolute;
    top: 50%;
    z-index: 4;
    width: 40px;
    height: 40px;
    margin-top: -26px;
    border: 1px solid #d9d9d9;
    border-radius: 0;
    background: #fff;
    color: #11111a;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(17, 17, 26, .15);
    transition: background-color .2s, border-color .2s, color .2s;
}
.blog-topics__arrow[hidden] {
    display: none;
}
.blog-topics__arrow:hover:not(:disabled) {
    background: #c33;
    border-color: #c33;
    color: #fff;
}
.blog-topics__arrow:disabled {
    opacity: .35;
    cursor: default;
}
.blog-topics__arrow.is-prev {
    left: -12px;
}
.blog-topics__arrow.is-next {
    right: -12px;
}
.blog-topics__progress {
    height: 2px;
    margin-top: 14px;
    background: #e3e4e7;
}
.blog-topics__progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: #c33;
    transform-origin: left;
    transition: transform .15s linear;
}
@media (prefers-reduced-motion: reduce) {
    .blog-topic,
    .blog-topic img,
    .blog-topic::after,
    .blog-topic__name,
    .blog-search__spin {
        animation: none;
        transition: none;
    }
    .blog-topic:hover img,
    .blog-topic:focus-visible img,
    .blog-topic:hover .blog-topic__name {
        transform: none;
    }
}
@media (max-width: 767.98px) {
    .blog-topic {
        width: min(72vw, 280px);
    }
    .blog-topics__track {
        scroll-snap-type: x mandatory;
        scroll-padding-left: 0;
    }
    .blog-topics__arrow {
        display: none !important;
    }
}

#blog-app {
    transition: opacity .2s;
}
#blog-app.is-loading {
    opacity: .45;
    pointer-events: none;
}

/* ---------- Grid + cards ---------- */
.blog-grid {
    --bs-gutter-x: 24px;
    --bs-gutter-y: 24px;
}
.blog-grid .card {
    border: 0;
    border-radius: 0;
    background: #f3f3f3;
    transition: box-shadow .25s, transform .25s;
}
.blog-grid .card:hover {
    box-shadow: 0 12px 28px rgba(17, 17, 26, .12);
    transform: translateY(-3px);
}
.blog-grid .card-img-top {
    display: block;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    background: #e4e5e8; /* placeholder while loading; hides alt text */
    color: transparent;
    font-size: 0;
}
.blog-grid .card {
    display: flex;
    flex-direction: column;
}
.blog-grid .card-body {
    flex: 1 1 auto;
}
.blog-grid .card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-grid .card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-grid .card-body {
    padding: 22px 24px 8px;
}
.blog-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-bottom: 12px;
}
.blog-card__meta .fecha {
    color: #626b71;
}
.blog-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(204, 51, 51, .1);
    color: #c33;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
}
.blog-tag:hover {
    background: #c33;
    color: #fff;
}
.blog-grid .card-title {
    margin: 0 0 12px;
}
.blog-grid .card-title a {
    color: #11111a;
    text-decoration: none;
}
.blog-grid .card-title a:hover {
    color: #c33;
}
.blog-grid .card-footer {
    justify-content: flex-start;
    padding: 8px 24px 24px;
}

/* ---------- Pagination ---------- */
.blog-pagination {
    margin-top: 56px;
}
.blog-pagination ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.blog-pagination .page-numbers {
    padding: 10px 18px;
    border: 1px solid #d5d7da;
    color: #11111a;
    text-decoration: none;
    transition: background-color .2s, border-color .2s, color .2s;
}
.blog-pagination .page-numbers.current,
.blog-pagination a.page-numbers:hover {
    background: #c33;
    border-color: #c33;
    color: #fff;
}
.blog-pagination .page-numbers.dots {
    border-color: transparent;
}

/* ---------- Empty state ---------- */
.blog-empty {
    text-align: center;
    padding: 56px 0;
}
.blog-empty p {
    font-size: 20px;
    margin-bottom: 24px;
}

/* ---------- Single post header tags ---------- */
.blog-single-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}
.blog-single-tags .blog-tag {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}
.blog-single-tags .blog-tag:hover {
    background: #c33;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    #hero.blog-hero {
        padding: 110px 0 48px;
    }
    #hero.blog-hero h1 {
        max-width: none;
    }
}
@media (max-width: 767.98px) {
    .blog-section {
        padding: 32px 0 64px;
    }
    .blog-hero__lead {
        font-size: 16px;
    }
}

/* Topic cards: keep every label pure white and legible on bright photos, including on hover and when active. */
.blog-topic__name,
.blog-topic__count,
.blog-topic__index {
    color: #fff;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.blog-topic:hover,
.blog-topic:focus-visible,
.blog-topic.is-active {
    color: #fff;
}

/* ---------- Active filters (chips) ---------- */
#blog-app {
    overflow-anchor: none; /* blog-filter.js pins the topic bar itself when the fragment is swapped */
}
.blog-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 18px;
}
.blog-filters__label {
    color: #11111a;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.blog-filters__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.blog-filters__list li {
    margin: 0;
    padding: 0;
}
.blog-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 6px 12px 6px 14px;
    border: 1px solid #c33;
    background: #fff;
    color: #11111a;
    font-size: 14px;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .2s, color .2s;
}
.blog-chip__x {
    color: #c33;
    font-size: 20px;
    line-height: 1;
    transition: color .2s;
}
.blog-chip:hover,
.blog-chip:focus-visible {
    background: #c33;
    color: #fff;
}
.blog-chip:hover .blog-chip__x,
.blog-chip:focus-visible .blog-chip__x {
    color: #fff;
}
.blog-chip:focus-visible,
.blog-filters__clear:focus-visible {
    outline: 2px solid #11111a;
    outline-offset: 2px;
}
.blog-filters__clear {
    color: #c33;
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.blog-filters__clear:hover {
    color: #11111a;
}
@media (prefers-reduced-motion: reduce) {
    .blog-chip,
    .blog-chip__x {
        transition: none;
    }
}
