/**
 * Blog index ("Tous les articles") — article rows.
 *
 * Adapted from the design (phileas.css .listing/.article-row):
 * desktop rows, mobile 2-slide swipe cards with scroll-snap.
 * Design fonts mapped to theme vars: font-display → --font-reading,
 * font-ui → --font-body.
 *
 * @package PIF_Magazine
 */

.pifmag-listing {
    padding-bottom: clamp(28px, 4vw, 56px);
}

.pifmag-listing__stack article {
    position: relative;
}


.pifmag-listing__head {
    max-width: 980px;
    margin-bottom: clamp(28px, 4vw, 52px);
}

.pifmag-listing__stack {
    display: flex;
    flex-direction: column;
    gap: clamp(28px, 3vw, 44px);
}

/* ---- Article row (desktop-first) ---- */

.article-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: clamp(22px, 3vw, 40px);
    align-items: start;
    text-decoration: none;
    color: inherit;
    padding-bottom: clamp(28px, 3vw, 44px);
    border-bottom: 1px solid var(--rule);
    transition: transform .25s ease;
}

/* Rows are wrapped in <article>, so target the last wrapper in the stack. */
.pifmag-listing__stack > :last-child .article-row,
.pifmag-listing__stack > article:last-of-type .article-row {
    border-bottom: 0;
}

.article-row:hover {
    transform: translateY(-2px);
}

.article-row__media {
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--rule);
    position: relative;
}

.article-row__media picture,
.article-row__media .article-row__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-row__media::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(7, 18, 38, .06);
}

.article-row__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.article-row__kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
}

.article-row__kicker .pin {
    font-size: 13px;
    line-height: 1;
}

.article-row__title {
    font-family: var(--font-reading);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(22px, 2.2vw, 30px);
    line-height: 1.12;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 2px 0 4px;
    text-wrap: balance;
    transition: color .2s ease;
}

.article-row:hover .article-row__title {
    color: var(--accent);
}

.article-row__chap {
    font-family: var(--font-reading);
    font-size: 16px;
    line-height: 1.55;
    color: var(--muted);
    margin: 0;
    max-width: 60ch;
}

.article-row__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-family: var(--font-body);
    font-size: 12.5px;
    color: var(--faint);
}

.article-row__meta .sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--faint);
}

/* Overlay only exists on mobile slides. */
.article-row__overlay {
    display: none;
}

.article-row__dots {
    display: none;
}

/* ---- Newsletter band between rows ----
 *
 * Base card + form styling comes from the two-columns block CSS
 * (.pifmag-column-form — blue card, pill inputs, flattened GF grid).
 * Here: the design's band shape (radius 14, accent bottom bar) and the
 * 2-column layout — GF intro text left, email + button + legal right.
 * Bootstrap breakpoints: lg (992px) side-by-side, below stacked.
 */

.pifmag-listing__news {
    margin: clamp(8px, 1.5vw, 18px) 0;
    border-radius: 14px;
    padding: clamp(26px, 3vw, 40px);
    position: relative;
    overflow: hidden;
}

.pifmag-listing__news::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5px;
    background: var(--accent);
    z-index: 1;
}

@media (min-width: 992px) {
    .pifmag-listing__news #gform_1 {
        grid-template-columns: auto 225px auto;
        column-gap: clamp(18px, 2.5vw, 36px);
    }

    /* Intro (GF HTML field): left column, spans both rows. */
    .pifmag-listing__news #gform_1 .gfield--type-html:not(.after-submit) {
        grid-column: 1;
        grid-row: 1 / span 2;
        padding-right: clamp(10px, 2vw, 30px);
        align-self: center;
    }

    /* Email + button: right, first row. */
    .pifmag-listing__news #gform_1 .gfield--type-email {
        grid-column: 2;
        grid-row: 1;
        align-self: end;
    }

    .pifmag-listing__news #gform_1 .gform_footer {
        grid-column: 3;
        grid-row: 1;
        align-self: end;
    }

    /* Legal text: right, under the input. */
    .pifmag-listing__news #gform_1 .after-submit {
        grid-column: 2 / -1;
        grid-row: 2;
    }
}

/* md and below: stacked (base two-columns grid), a bit of breathing room. */
@media (max-width: 991.98px) {
    .pifmag-listing__news #gform_1 {
        row-gap: 15px;
    }
}

/* ---- Pagination ---- */

.pifmag-listing__pagination {
    margin-top: clamp(32px, 4vw, 56px);
}

.pifmag-listing__pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 14px;
}

.pifmag-listing__pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 38px;
    height: 38px;
    padding: 0 14px;
    justify-content: center;
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    transition: color .2s, border-color .2s, background .2s;
}

.pifmag-listing__pagination .page-numbers:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pifmag-listing__pagination .page-numbers.current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pifmag-listing__pagination .page-numbers.dots {
    border: 0;
    min-width: auto;
    padding: 0 2px;
    color: var(--faint);
}

/* ---- Tablet: single column rows ---- */

@media (max-width: 991.8px) and (min-width: 767.8px) {
    .article-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .article-row__media {
        aspect-ratio: 16 / 10;
    }
}

/* ---- Mobile: each row becomes a 2-slide swipe card ---- */

@media (max-width: 767.8px) {
    .pifmag-listing__stack {
        gap: 22px;
    }

    .article-row {
        display: grid;
        grid-template-columns: 100% 100%;
        grid-auto-flow: column;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        border-radius: 18px;
        gap: 0;
        padding: 0;
        margin-bottom: 4px;
        border-bottom: 0;
        background: #0b2545;
        box-shadow: 0 1px 2px rgba(10, 30, 60, .08), 0 28px 44px -24px rgba(10, 30, 60, .5);
        scrollbar-width: none;
        position: relative;
    }

    .article-row::-webkit-scrollbar {
        display: none;
    }

    .article-row:hover {
        transform: none;
    }

    /* Slide 1: photo with kicker + title overlaid. */
    .article-row__media {
        aspect-ratio: 9 / 14;
        min-height: 0;
        scroll-snap-align: start;
        flex: none;
        width: 100%;
        border-radius: 0;
        position: relative;
    }

    .article-row__media::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(7, 18, 38, .95) 0%, rgba(7, 18, 38, .55) 32%, rgba(7, 18, 38, .05) 62%, transparent 80%);
        box-shadow: none;
    }

    .article-row__overlay {
        display: flex;
        flex-direction: column;
        gap: 8px;
        position: absolute;
        left: 22px;
        right: 22px;
        bottom: 26px;
        z-index: 2;
        text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
    }

    .article-row__overlay .article-row__kicker {
        color: #fff;
        opacity: .92;
    }

    .article-row__overlay .article-row__title {
        color: #fff;
        margin: 0;
        font-size: 28px;
        line-height: 1.06;
    }

    /* Slide 2: excerpt + meta over the darkened photo. */
    .article-row__body {
        width: 100%;
        flex: none;
        scroll-snap-align: start;
        padding: 28px 22px 30px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        aspect-ratio: 9 / 14;
        justify-content: flex-end;
        border-radius: 0;
        background-image: var(--card-photo);
        background-size: cover;
        background-position: center;
        background-color: var(--surface);
        position: relative;
    }

    .article-row__body::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background: linear-gradient(to top, rgba(7, 18, 38, .92) 0%, rgba(7, 18, 38, .78) 30%, rgba(7, 18, 38, .32) 60%, rgba(7, 18, 38, .12) 100%);
    }

    .article-row__body > * {
        position: relative;
        z-index: 1;
    }

    .article-row__body > .article-row__kicker,
    .article-row__body > .article-row__title {
        display: none;
    }

    .article-row__chap {
        font-size: 18px;
        line-height: 1.5;
        color: #fff;
        margin: 0;
        max-width: none;
        text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
    }

    .article-row__meta {
        color: rgba(255, 255, 255, .85);
        margin-top: 4px;
    }

    .article-row__meta .sep {
        background: rgba(255, 255, 255, .4);
    }

    /* Slide indicator dots. */
    .article-row__dots {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 10px;
        z-index: 3;
        display: flex;
        justify-content: center;
        gap: 6px;
        pointer-events: none;
    }

    .article-row__dots span {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(255, 255, 255, .45);
        transition: width .25s ease, background .25s ease;
    }

    .article-row__dots span.is-active {
        width: 18px;
        border-radius: 999px;
        background: #fff;
    }
}
