/*
    Blog de Jazui (Fase 16.9): listado (bl-), tarjeta (bc-) y artículo (ar-). Global porque el listado, la tarjeta y el
    artículo comparten piezas (aurora, rejilla, «Sigue leyendo»). Minimalista, con el morado de AstrolUI.
*/

/* ---------- Comunes ---------- */
.bl-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.bl-aurora {
    position: absolute;
    inset: -20% -10% auto;
    height: 140%;
    pointer-events: none;
    filter: blur(70px);
    opacity: .55;
    z-index: -1;
}

    .bl-aurora span {
        position: absolute;
        width: 38vmax;
        height: 38vmax;
        border-radius: 50%;
        background: radial-gradient(circle, color-mix(in srgb, var(--aui-brand) 50%, transparent), transparent 65%);
        animation: bl-drift 24s ease-in-out infinite alternate;
    }

        .bl-aurora span:nth-child(1) {
            top: -18%;
            left: 4%;
        }

        .bl-aurora span:nth-child(2) {
            top: -6%;
            right: -4%;
            background: radial-gradient(circle, color-mix(in srgb, #d946ef 36%, transparent), transparent 65%);
            animation-direction: alternate-reverse;
            animation-duration: 30s;
        }

@keyframes bl-drift {
    to {
        transform: translate(6vmax, 4vmax) scale(1.08);
    }
}

@keyframes bl-shine {
    to {
        background-position: -220% 0;
    }
}

@keyframes bl-up {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
}

@keyframes bl-pulse {
    50% {
        opacity: .45;
    }
}

/* ---------- Listado ---------- */
.bl-hero {
    position: relative;
    isolation: isolate;
    overflow: clip;
    padding: clamp(56px, 10vw, 112px) 0 28px;
    text-align: center;
}

.bl-title {
    margin: 0 auto;
    max-width: 820px;
    font-size: clamp(34px, 6vw, 58px);
    font-weight: 800;
    line-height: 1.06;
    letter-spacing: -.035em;
}

    .bl-title em {
        font-style: normal;
        background: linear-gradient(110deg, var(--aui-brand) 20%, #f0abfc 45%, var(--aui-brand) 70%);
        background-size: 220% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: bl-shine 5s linear infinite;
        padding: 0 .12em;
        margin: 0 -.12em;
    }

.bl-lead {
    max-width: 560px;
    margin: 18px auto 0;
    color: var(--aui-text-2);
    font-size: clamp(15px, 2vw, 18px);
    line-height: 1.55;
}

.bl-search {
    position: relative;
    max-width: 460px;
    margin: 32px auto 0;
}

    .bl-search i {
        position: absolute;
        left: 18px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--aui-text-3);
        pointer-events: none;
    }

    .bl-search input {
        width: 100%;
        height: 50px;
        padding: 0 20px 0 46px;
        box-sizing: border-box;
        border: 1px solid var(--aui-border);
        border-radius: var(--aui-radius-pill);
        background: color-mix(in srgb, var(--aui-surface) 80%, transparent);
        backdrop-filter: blur(10px);
        color: var(--aui-text);
        font: inherit;
        font-size: 16px;
        outline: none;
        transition: border-color .2s, box-shadow .2s;
    }

        .bl-search input:focus {
            border-color: var(--aui-brand);
            box-shadow: 0 0 0 4px color-mix(in srgb, var(--aui-brand) 18%, transparent);
        }

.bl-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
}

    .bl-chips a {
        padding: 7px 15px;
        border: 1px solid var(--aui-border);
        border-radius: var(--aui-radius-pill);
        color: var(--aui-text-2);
        font-size: var(--aui-text-sm);
        font-weight: 600;
        text-decoration: none;
        transition: color .2s, border-color .2s, background .2s;
    }

        .bl-chips a:hover {
            color: var(--aui-brand);
            border-color: var(--aui-brand);
        }

        .bl-chips a.is-active {
            background: var(--aui-brand);
            border-color: var(--aui-brand);
            color: var(--aui-on-brand);
        }

.bl-list {
    padding: 24px 0 96px;
}

.bl-list--related {
    padding-top: 0;
}

.bl-subtitle {
    margin: 0 0 22px;
    font-size: var(--aui-text-xl);
    font-weight: 800;
    letter-spacing: -.02em;
}

.bl-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 0 28px;
    color: var(--aui-text-2);
}

    .bl-filter a {
        color: var(--aui-brand);
        font-weight: 600;
        text-decoration: none;
    }

.bl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 28px;
}

.bl-empty {
    max-width: 460px;
    margin: 32px auto;
    color: var(--aui-text-2);
    text-align: center;
    line-height: 1.55;
}

    .bl-empty > i {
        display: block;
        margin-bottom: 10px;
        color: var(--aui-brand);
        font-size: 34px;
    }

.bl-skeleton {
    display: grid;
    gap: 12px;
}

    .bl-skeleton span {
        height: 14px;
        border-radius: 8px;
        background: var(--aui-surface-2);
        animation: bl-pulse 1.4s ease-in-out infinite;
    }

        .bl-skeleton span:first-child {
            height: auto;
            aspect-ratio: 16 / 9;
            border-radius: 18px;
        }

        .bl-skeleton span:last-child {
            width: 60%;
        }

.bl-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 48px;
    color: var(--aui-text-3);
    font-size: var(--aui-text-sm);
}

    .bl-pages a {
        color: var(--aui-brand);
        font-weight: 700;
        text-decoration: none;
    }

/* ---------- Tarjeta ---------- */
.bc {
    animation: bl-up .5s ease both;
}

.bc__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.bc__cover {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: 18px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--aui-brand) 75%, #000), color-mix(in srgb, #d946ef 70%, var(--aui-brand)));
    box-shadow: 0 1px 0 var(--aui-border);
}

    .bc__cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform .6s cubic-bezier(.2, .7, .2, 1);
    }

    /* Un brillo que cruza la portada al pasar por encima */
    .bc__cover::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%);
        transform: translateX(-100%);
        transition: transform .8s ease;
        pointer-events: none;
    }

.bc__initial {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, .9);
    font-size: 64px;
    font-weight: 800;
}

.bc__link:hover .bc__cover img {
    transform: scale(1.045);
}

.bc__link:hover .bc__cover::after {
    transform: translateX(100%);
}

.bc__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 16px 2px 0;
}

.bc__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    color: var(--aui-text-3);
    font-size: var(--aui-text-xs);
}

.bc__category {
    margin-right: 4px;
    color: var(--aui-brand);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.bc__title {
    margin: 0;
    font-size: 20px;
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -.015em;
    transition: color .2s;
}

.bc__link:hover .bc__title {
    color: var(--aui-brand);
}

.bc__summary {
    display: -webkit-box;
    margin: 8px 0 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    color: var(--aui-text-2);
    font-size: 15px;
    line-height: 1.55;
}

.bc__more {
    margin-top: auto;
    padding-top: 12px;
    color: var(--aui-brand);
    font-size: var(--aui-text-sm);
    font-weight: 700;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .2s, transform .2s;
}

.bc__link:hover .bc__more,
.bc__link:focus-visible .bc__more {
    opacity: 1;
    transform: none;
}

/* Destacado: portada y texto lado a lado */
.bc--featured {
    margin-bottom: 48px;
}

    .bc--featured .bc__link {
        display: grid;
        grid-template-columns: 1.25fr 1fr;
        align-items: center;
        gap: clamp(24px, 4vw, 48px);
    }

    .bc--featured .bc__cover {
        border-radius: 24px;
        box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--aui-brand) 55%, transparent);
    }

    .bc--featured .bc__body {
        padding: 0;
    }

    .bc--featured .bc__title {
        font-size: clamp(26px, 3.4vw, 38px);
        letter-spacing: -.025em;
    }

    .bc--featured .bc__summary {
        font-size: 17px;
        -webkit-line-clamp: 4;
    }

    .bc--featured .bc__more {
        opacity: 1;
        transform: none;
    }

@media (max-width: 760px) {
    .bc--featured .bc__link {
        grid-template-columns: 1fr;
    }
}

/* ---------- Artículo ---------- */
/* Barra de lectura: avanza con el scroll de la página (solo donde el navegador lo admite) */
.ar-progress {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: 3px;
    background: linear-gradient(90deg, var(--aui-brand), #d946ef);
    transform-origin: 0 50%;
    transform: scaleX(0);
    animation: ar-read linear both;
    animation-timeline: scroll(root);
}

@supports (animation-timeline: scroll()) {
    .ar-progress {
        display: block;
    }
}

@keyframes ar-read {
    to {
        transform: scaleX(1);
    }
}

.ar-narrow {
    max-width: 780px;
}

.ar-head {
    position: relative;
    isolation: isolate;
    overflow: clip;
    padding: clamp(40px, 7vw, 80px) 0 0;
}

.ar-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: var(--aui-text-sm);
    font-weight: 600;
}

    .ar-crumbs a {
        color: var(--aui-brand);
        text-decoration: none;
    }

    .ar-crumbs i {
        color: var(--aui-text-3);
        font-size: 11px;
    }

.ar-title {
    margin: 0;
    font-size: clamp(32px, 5.2vw, 52px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.03em;
    animation: bl-up .5s ease both;
}

.ar-lead {
    margin: 18px 0 0;
    color: var(--aui-text-2);
    font-size: clamp(17px, 2.1vw, 20px);
    line-height: 1.55;
}

.ar-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 22px 0 0;
    color: var(--aui-text-3);
    font-size: var(--aui-text-sm);
}

.ar-author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 6px;
    color: var(--aui-text);
    font-weight: 600;
}

.ar-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aui-brand), #d946ef);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.ar-cover {
    max-width: 1040px;
    margin-top: 36px;
}

    .ar-cover img {
        display: block;
        width: 100%;
        max-height: 520px;
        object-fit: cover;
        border-radius: 24px;
        box-shadow: 0 40px 80px -40px color-mix(in srgb, var(--aui-brand) 60%, transparent);
        animation: bl-up .7s .1s ease both;
    }

.ar-layout {
    max-width: 780px;
    padding-top: 44px;
    padding-bottom: 72px;
}

.ar-layout--toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    grid-template-areas: "body toc";
    gap: 56px;
    max-width: 1060px;
}

    .ar-layout--toc .ar-body {
        grid-area: body;
        min-width: 0;
    }

.ar-toc {
    grid-area: toc;
    position: sticky;
    top: 96px;
    align-self: start;
    font-size: var(--aui-text-sm);
}

    .ar-toc p {
        margin: 0 0 10px;
        color: var(--aui-text-3);
        font-size: var(--aui-text-xs);
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .ar-toc ol {
        margin: 0;
        padding: 0 0 0 14px;
        border-left: 1px solid var(--aui-border);
        list-style: none;
    }

    .ar-toc li {
        margin: 0 0 9px;
        line-height: 1.35;
    }

    .ar-toc .ar-toc__l3 {
        padding-left: 12px;
        font-size: var(--aui-text-xs);
    }

    .ar-toc a {
        color: var(--aui-text-2);
        text-decoration: none;
        transition: color .2s;
    }

        .ar-toc a:hover {
            color: var(--aui-brand);
        }

@media (max-width: 980px) {
    .ar-layout--toc {
        display: block;
        max-width: 780px;
    }

    .ar-toc {
        display: none;
    }
}

/* El contenido del artículo (HTML saneado de la API) */
.ar-prose {
    color: var(--aui-text);
    font-size: 18px;
    line-height: 1.75;
    overflow-wrap: break-word;
}

    .ar-prose > :first-child {
        margin-top: 0;
    }

    .ar-prose h2,
    .ar-prose h3,
    .ar-prose h4 {
        scroll-margin-top: 90px;
        margin: 2em 0 .6em;
        line-height: 1.25;
        letter-spacing: -.02em;
    }

    .ar-prose h2 {
        font-size: 28px;
    }

    .ar-prose h3 {
        font-size: 22px;
    }

    .ar-prose p,
    .ar-prose ul,
    .ar-prose ol {
        margin: 0 0 1.2em;
    }

    .ar-prose li {
        margin-bottom: .4em;
    }

        .ar-prose li::marker {
            color: var(--aui-brand);
        }

    .ar-prose a {
        color: var(--aui-brand);
        text-decoration: underline;
        text-decoration-thickness: 1px;
        text-underline-offset: 3px;
    }

    .ar-prose img {
        max-width: 100%;
        height: auto;
        border-radius: 16px;
    }

    .ar-prose blockquote {
        margin: 1.6em 0;
        padding: 4px 0 4px 22px;
        border-left: 3px solid var(--aui-brand);
        color: var(--aui-text-2);
        font-size: 20px;
        font-style: italic;
    }

    .ar-prose code {
        padding: .12em .4em;
        border-radius: 6px;
        background: var(--aui-brand-soft);
        font-size: .88em;
    }

    .ar-prose pre {
        margin: 1.6em 0;
        padding: 18px 20px;
        overflow-x: auto;
        border-radius: 14px;
        background: #1b1430;
        color: #ede9fe;
        font-size: 14px;
        line-height: 1.6;
    }

        .ar-prose pre code {
            padding: 0;
            background: none;
            font-size: inherit;
        }

    .ar-prose table {
        display: block;
        width: 100%;
        margin: 1.6em 0;
        overflow-x: auto;
        border-collapse: collapse;
        font-size: 15px;
    }

    .ar-prose th,
    .ar-prose td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--aui-border);
        text-align: left;
    }

    .ar-prose hr {
        margin: 2.4em 0;
        border: 0;
        border-top: 1px solid var(--aui-border);
    }

.ar-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 36px 0 0;
}

    .ar-tags a {
        padding: 5px 12px;
        border-radius: var(--aui-radius-pill);
        background: var(--aui-brand-soft);
        color: var(--aui-brand);
        font-size: var(--aui-text-sm);
        font-weight: 600;
        text-decoration: none;
    }

.ar-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--aui-border);
    font-size: var(--aui-text-sm);
}

    .ar-share span {
        margin-right: 6px;
        color: var(--aui-text-3);
        font-weight: 700;
    }

    .ar-share a {
        padding: 6px 12px;
        border: 1px solid var(--aui-border);
        border-radius: var(--aui-radius-pill);
        color: var(--aui-text-2);
        text-decoration: none;
        transition: color .2s, border-color .2s;
    }

        .ar-share a:hover {
            color: var(--aui-brand);
            border-color: var(--aui-brand);
        }

.ar-cta {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 48px;
    padding: 28px 30px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--aui-brand) 35%, transparent);
    border-radius: 24px;
    background: radial-gradient(120% 140% at 100% 0, color-mix(in srgb, var(--aui-brand) 18%, transparent), transparent 60%), var(--aui-surface);
}

    .ar-cta h2 {
        margin: 0 0 6px;
        font-size: 22px;
        letter-spacing: -.02em;
    }

    .ar-cta p {
        margin: 0;
        color: var(--aui-text-2);
    }

.ar-loading {
    display: grid;
    gap: 16px;
    padding-top: 80px;
    padding-bottom: 120px;
}

    .ar-loading span {
        height: 18px;
        border-radius: 8px;
        background: var(--aui-surface-2);
        animation: bl-pulse 1.4s ease-in-out infinite;
    }

        .ar-loading span:first-child {
            width: 70%;
            height: 44px;
        }

        .ar-loading span:last-child {
            width: 50%;
        }

.ar-missing {
    padding-top: 96px;
    padding-bottom: 120px;
    text-align: center;
}

    .ar-missing > i {
        color: var(--aui-brand);
        font-size: 40px;
    }

    .ar-missing p {
        margin: 0 0 28px;
        color: var(--aui-text-2);
    }

@media (prefers-reduced-motion: reduce) {
    .bl-aurora span,
    .bl-title em,
    .bc,
    .ar-title,
    .ar-cover img,
    .bl-skeleton span,
    .ar-loading span {
        animation: none;
    }

    .bc__cover img,
    .bc__cover::after {
        transition: none;
    }
}
