/* ==========================================================================
   Afluex blog pages (Blog, Blog Details) — listing and reading layouts.
   Loaded after assets/css/afluex.css by those pages only.
   ========================================================================== */

.blog-hero {
    padding: calc(var(--header-h) + clamp(40px, 6vw, 80px)) 0 clamp(40px, 5vw, 64px);
    text-align: center;
}

.blog-hero .crumbs,
.blog-hero .actions {
    justify-content: center;
}

.blog-hero .page-hero__lead {
    margin-inline: auto;
}

.blog-hero .actions {
    margin-top: 30px;
}

/* floating topic tiles under the listing hero */
.topics {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: clamp(28px, 4vw, 48px);
}

.topics li {
    --d: 0s;
    width: clamp(92px, 11vw, 140px);
    aspect-ratio: 356 / 177;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line-2);
    background: #050b10;
    box-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.9), 0 0 30px -16px rgba(107, 199, 209, 0.5);
    animation: topic-float 6s var(--d) ease-in-out infinite;
}

.topics img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes topic-float {
    50% {
        transform: translateY(-8px);
    }
}

/* listing */
.feed {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.feed .post--featured {
    grid-column: 1 / -1;
}

.post {
    position: relative;
    transition: border-color 0.3s, box-shadow 0.4s var(--ease), transform 0.5s var(--ease);
}

a.post:hover,
a.post:focus-visible {
    transform: translateY(-3px);
}

.post__media {
    position: relative;
}

/* a light sweep across the thumbnail on hover */
.post__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(156, 240, 246, 0.18) 50%, transparent 65%);
    transform: translateX(-100%);
    transition: transform 0.9s var(--ease);
}

.post:hover .post__media::after,
.post:focus-within .post__media::after {
    transform: translateX(100%);
}

.post__label {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--aqua);
}

.post__related {
    margin-top: auto;
    padding-top: 8px;
}

.post--featured .post__media img {
    object-fit: contain;
    background: #050b10;
}

/* ------------------------------------------------------------ article */

.read-progress {
    position: fixed;
    /* sits just under the header (main is its own stacking layer) */
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    z-index: 60;
    height: 3px;
    background: var(--grad);
    transform-origin: left;
    transform: scaleX(var(--read, 0));
    pointer-events: none;
}

html:not(.enhanced) .read-progress {
    display: none;
}

.article-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 760px);
    justify-content: center;
    gap: clamp(28px, 5vw, 72px);
    align-items: start;
}

.toc {
    position: sticky;
    top: calc(var(--header-h) + 28px);
    padding: 18px;
}

.toc ol {
    display: grid;
    gap: 2px;
    margin-top: 10px;
}

.toc a {
    display: block;
    padding: 7px 10px;
    border-radius: 9px;
    border-left: 2px solid transparent;
    font-size: 14px;
    line-height: 1.35;
    color: var(--text-2);
    transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

.toc a:hover {
    color: var(--text);
}

.toc a[aria-current="true"] {
    color: var(--text);
    border-left-color: var(--aqua);
    background: rgba(107, 199, 209, 0.08);
}

.toc__back {
    display: inline-block;
    margin-top: 14px;
    font-size: 14px;
}

.article {
    max-width: none;
    margin: 0;
}

.article__media {
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--line);
    background: radial-gradient(circle at 50% 45%, rgba(107, 199, 209, 0.14), #050b10 70%);
}

.article__media img {
    width: 100%;
}

.article h2,
.article h3 {
    scroll-margin-top: calc(var(--header-h) + 24px);
}

.points-grid {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.points-grid .card {
    padding: 20px 22px;
}

.points-grid h3 {
    margin: 0 0 8px;
    font-size: 1.08rem;
}

.points-grid p {
    font-size: 15.5px;
    line-height: 1.7;
}

.trend-list {
    margin-top: 18px;
    display: grid;
    gap: 14px;
    counter-reset: t;
}

.trend-list li {
    counter-increment: t;
    position: relative;
    padding: 20px 22px 20px 70px;
}

.trend-list li::before {
    content: counter(t, decimal-leading-zero);
    position: absolute;
    left: 20px;
    top: 20px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--line-2);
    font-family: var(--mono);
    font-size: 12px;
    color: var(--aqua);
}

.trend-list h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.trend-list p {
    font-size: 15.5px;
    line-height: 1.7;
}

.article__end {
    margin-top: 36px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 960px) {

    .article-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .toc {
        position: static;
    }

    .feed .post--featured {
        grid-template-columns: minmax(0, 1fr);
    }

    .feed .post--featured .post__media {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        aspect-ratio: 870 / 630;
    }
}

@media (max-width: 640px) {

    .feed,
    .points-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .topics li:nth-child(n+4) {
        display: none;
    }

    .article p {
        font-size: 1.02rem;
    }

    .trend-list li {
        padding: 64px 18px 18px;
    }

    .trend-list li::before {
        left: 18px;
        top: 18px;
    }
}

/* ---------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {

    .topics li {
        animation: none;
    }

    .post,
    .post__media::after {
        transition: none;
    }

    .read-progress {
        display: none;
    }
}

/* the 356px article thumbnails are shown at their own size, not upscaled */
.feed .post:not(.post--featured) .post__media {
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 50% 50%, rgba(107, 199, 209, 0.1), #050b10 70%);
}

.feed .post:not(.post--featured) .post__media img {
    max-width: 356px;
    object-fit: contain;
}
