/* ========================================
   BLOG — listado, single, breadcrumbs, paginación
   Usa los tokens globales (:root) del tema oscuro
   ======================================== */

/* ---------- Layout general de página ---------- */
.blog-page {
    padding: 9rem 0 7rem;
}
@media (max-width: 991px) {
    .blog-page {
        padding: 7rem 0 5rem;
    }
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    font-family: var(--fb);
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 2rem;
}
.breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
    transition: color .25s ease;
}
.breadcrumbs a:hover {
    color: var(--a);
}
.breadcrumbs .sep {
    color: var(--muted);
    opacity: .5;
}
.breadcrumbs .current {
    color: var(--text);
    max-width: 38ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Cabecera del blog ---------- */
.blog-header {
    margin-bottom: 3.5rem;
    max-width: 760px;
}
.blog-header .txl {
    margin-bottom: 1rem;
}
.blog-header-desc {
    font-family: var(--fb);
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

/* ---------- Grid de tarjetas ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}
@media (max-width: 991px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}
@media (max-width: 600px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
}

.post-card {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    border-radius: var(--r);
    overflow: hidden;
    position: relative; /* necesario para el stretched link */
    transition: transform .4s cubic-bezier(.16, 1, .3, 1), border-color .4s ease;
}
.post-card:hover {
    transform: translateY(-6px);
    border-color: rgb(233 160 0 / 35%);
}
/* Stretched link: ocupa toda la card sin romper el anidamiento de otros links */
.post-card-link {
    position: absolute;
    inset: 0;
    z-index: 0;
    text-decoration: none;
}
.post-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg3);
}
.post-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity .5s ease, transform .6s cubic-bezier(.16, 1, .3, 1);
}
.post-card-media img.img-loaded {
    opacity: 1;
}
.post-card:hover .post-card-media img {
    transform: scale(1.05);
}
.post-card-media--empty {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg3), var(--bg2));
}
.post-card-body {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    padding: 1.5rem;
    flex: 1;
}
/* Categoría clicable: por encima del stretched link */
.post-card-cat {
    font-family: var(--fb);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--a);
    text-decoration: none;
    position: relative;
    z-index: 1;
    width: fit-content;
}
.post-card-cat:hover {
    color: var(--text);
}
/* Reutiliza el efecto .ul del nav pero con color blanco */
.post-card-cat.ul::after {
    background: var(--text);
}
.post-card-title {
    font-family: var(--fd);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.02em;
    color: var(--text);
}
.post-card-excerpt {
    font-family: var(--fb);
    font-size: .92rem;
    line-height: 1.55;
    color: var(--muted);
    margin: 0;
}
.post-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: auto;
    padding-top: .5rem;
}
.post-card-date,
.post-card-read {
    font-family: var(--fb);
    font-size: .8rem;
    color: var(--muted);
    opacity: .8;
}
.post-card-read {
    display: flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}

.blog-empty {
    font-family: var(--fb);
    color: var(--muted);
    padding: 3rem 0;
}

/* ---------- Paginación ---------- */
.blog-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 4.5rem;
}
.page-btn {
    font-family: var(--fb);
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    padding: .65rem 1.25rem;
    border: 1px solid var(--bdr);
    border-radius: 8px;
    transition: border-color .3s ease, color .3s ease;
}
.page-btn:hover {
    border-color: var(--a);
    color: var(--a);
}
.page-btn.is-disabled {
    opacity: .35;
    pointer-events: none;
}
.page-numbers {
    display: flex;
    align-items: center;
    gap: .35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.page-numbers li {
    margin: 0;
}
.page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    height: 2.4rem;
    padding: 0 .5rem;
    font-family: var(--fb);
    font-size: .9rem;
    text-decoration: none;
    color: var(--muted);
    border-radius: 8px;
    transition: background .3s ease, color .3s ease;
}
.page-num:hover {
    color: var(--text);
    background: var(--bg3);
}
.page-num.is-current {
    background: var(--a);
    color: #060605;
    font-weight: 600;
}

/* ========================================
   SINGLE — entrada individual
   ======================================== */
.blog-single {
    padding-bottom: 6rem;
    /* El nav es fixed con height: 68px — empujar el contenido para que quede debajo */
    margin-top: 68px;
}
.single-hero {
    width: 100%;
    height: clamp(280px, 48vh, 560px);
    overflow: hidden;
    background: var(--bg3);
}
.single-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity .6s ease;
}
.single-hero img.img-loaded {
    opacity: 1;
}
.single-wrap {
    max-width: 820px;
}
.blog-single .breadcrumbs {
    margin-top: 2.5rem;
}

.single-header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--bdr);
}
.single-cat {
    display: inline-block;
    font-family: var(--fb);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--a);
    text-decoration: none;
    margin-bottom: 1rem;
    transition: color .25s ease;
}
.single-cat:hover {
    color: var(--text);
}
.single-cat.ul::after {
    background: var(--text);
}
.single-title {
    font-family: var(--fd);
    font-size: clamp(2rem, 3.5vw, 2.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.025em;
    color: var(--text);
    margin-bottom: 1.5rem;
}
.single-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    font-family: var(--fb);
    font-size: .9rem;
    color: var(--muted);
}
.single-meta strong {
    color: var(--text);
    font-weight: 600;
}
.single-meta .dot {
    opacity: .5;
}

/* ---------- Tipografía del contenido ---------- */
.single-content {
    font-family: var(--fb);
    font-size: 1.075rem;
    line-height: 1.75;
    color: #d8d7cf;
}
.single-content > *:first-child {
    margin-top: 0;
}
.single-content p {
    margin: 0 0 1.5rem;
}
.single-content h2 {
    font-family: var(--fd);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.02em;
    color: var(--text);
    margin: 2.75rem 0 1rem;
}
.single-content h3 {
    font-family: var(--fd);
    font-size: clamp(1.25rem, 2.4vw, 1.6rem);
    font-weight: 700;
    color: var(--text);
    margin: 2.25rem 0 .85rem;
}
.single-content h4 {
    font-family: var(--fd);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin: 2rem 0 .75rem;
}
.single-content a {
    color: var(--a);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color .25s ease;
}
.single-content a:hover {
    color: var(--a2);
}
.single-content ul,
.single-content ol {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
}
.single-content li {
    margin: 0 0 .6rem;
}
.single-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--r);
    margin: 2rem 0;
    opacity: 0;
    transition: opacity .5s ease;
}
.single-content img.img-loaded {
    opacity: 1;
}
.single-content figure {
    margin: 2rem 0;
}
.single-content figcaption {
    font-size: .85rem;
    color: var(--muted);
    text-align: center;
    margin-top: .6rem;
}
.single-content blockquote {
    margin: 2rem 0;
    padding: .5rem 0 .5rem 1.5rem;
    border-left: 3px solid var(--a);
    color: var(--text);
    font-style: italic;
}
.single-content pre {
    background: var(--bg3);
    border: 1px solid var(--bdr);
    border-radius: var(--r);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 2rem 0;
    font-size: .9rem;
}
.single-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .9em;
}
.single-content :not(pre) > code {
    background: var(--bg3);
    padding: .15em .4em;
    border-radius: 5px;
}
.single-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: .95rem;
}
.single-content th,
.single-content td {
    border: 1px solid var(--bdr);
    padding: .75rem 1rem;
    text-align: left;
}
.single-content th {
    background: var(--bg3);
    color: var(--text);
}

/* ---------- Pie del artículo ---------- */
.single-footer {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--bdr);
}
.single-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 1.5rem;
}
.single-tag {
    font-family: var(--fb);
    font-size: .82rem;
    color: var(--text);
    text-decoration: none;
    padding: .4rem .9rem;
    border: 1px solid var(--bdr);
    border-radius: 100px;
    transition: border-color .3s ease, color .3s ease;
}
.single-tag:hover {
    border-color: var(--a);
    color: var(--a);
}
.single-updated {
    font-family: var(--fb);
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 1.75rem;
}
/* ========================================
   ARTÍCULOS RELACIONADOS (single)
   ======================================== */
.single-related {
    padding: 5rem 0 4rem;
    border-top: 1px solid var(--bdr);
    margin-top: 2rem;
}
.single-related-title {
    margin-bottom: 2.5rem;
}

/* Skeletons de tarjeta (para la espera async) */
.post-card-skeleton {
    border-radius: var(--r);
    border: 1px solid var(--bdr);
    aspect-ratio: 3 / 4;
    background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
    background-size: 200% 100%;
    animation: post-card-shimmer 1.4s infinite;
}
@keyframes post-card-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   OTRAS CATEGORÍAS (single)
   ======================================== */
.single-categories-section {
    padding: 3.5rem 0 5rem;
    border-top: 1px solid var(--bdr);
}
.single-categories-section .tlg {
    margin-bottom: 2rem;
}
.single-cat-list {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

/* Pill de categoría */
.cat-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--fb);
    font-size: .88rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    padding: .55rem 1.1rem;
    border: 1px solid var(--bdr);
    border-radius: 100px;
    transition: border-color .3s ease, color .3s ease, background .3s ease;
}
.cat-pill:hover {
    border-color: var(--a);
    color: var(--a);
}
.cat-pill-count {
    font-size: .75rem;
    background: var(--bg3);
    color: var(--muted);
    padding: .15rem .45rem;
    border-radius: 100px;
    line-height: 1.4;
}

/* Skeleton pills */
.cat-pill-skeleton {
    display: inline-block;
    width: 100px;
    height: 36px;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
    background-size: 200% 100%;
    animation: post-card-shimmer 1.4s infinite;
}

@media (prefers-reduced-motion: reduce) {
    .post-card-media img,
    .single-hero img,
    .single-content img {
        opacity: 1;
        transition: none;
    }
}

@media (max-width: 600px) {
    .single-related-grid { grid-template-columns: 1fr; }
}

/* ── Author box ── */
.author-box {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    margin-top: 3rem;
    padding: 1.75rem 2rem;
    background: var(--bg2);
    border: 1px solid var(--bg3);
    border-left: 3px solid var(--a);
    border-radius: 12px;
}

.author-box__avatar {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10px;
}

.author-box__avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.author-box__body {
    flex: 1;
    min-width: 0;
}

.author-box__label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin: 0 0 .2rem;
}

.author-box__name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--fg);
    margin: 0 0 .5rem;
}

.author-box__bio {
    font-size: .9rem;
    color: var(--muted);
    line-height: 1.55;
    margin: 0 0 .85rem;
}

.author-box__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
}

.author-box__date,
.author-box__read {
    font-size: .8rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: .35rem;
}

.author-box__date i,
.author-box__read i {
    color: var(--a);
    font-size: .8rem;
}

@media (max-width: 600px) {
    .author-box {
        flex-direction: column;
        padding: 1.25rem;
    }
    .author-box__avatar {
        width: 48px;
        height: 48px;
    }
}
