/**
 * 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: 22px;
}

@media (min-width: 768px) {
    .pifmag-listing__stack {
        gap: clamp(28px, 3vw, 44px);
    }
}

/* ---- Article row (mobile-first) ----
 *
 * Base (mobile ≤767px): each row is a 2-slide scroll-snap swipe card —
 * slide 1 photo with kicker+title overlaid, slide 2 excerpt+meta over the
 * darkened photo, with indicator dots.
 * @768px  (min-width): single-column stacked rows.
 * @992px  (min-width): image left (280px) / text right grid.
 */

.pifmag-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;
    align-items: start;
    text-decoration: none;
    color: inherit;
    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;
    transition: transform .25s ease;
}

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

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

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

.pifmag-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;
}

.pifmag-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);
}

.pifmag-article-row__overlay .pifmag-article-row__kicker {
    opacity: .92;
}

/* Overlay title (mobile slide 1): font-size 28px has no utility on the fixed
   scale — kept here. color(on-dark)/margin(m-0)/line-height(lh-105) moved to
   utilities on the <p> in content-listing.php. */
.pifmag-article-row__overlay .pifmag-article-row__title {
    font-size: 28px;
}

/* color stays in CSS so the :hover accent override below can win (utility
   !important would defeat it). ff/fst/fw/fs(fs-h4b)/lh(lh-112)/ls(ls-tight)/
   tw(tw-balance) moved to utilities in content-listing.php.
   margin 2px 0 4px kept (asymmetric, 2px top off the spacing scale). */
.pifmag-article-row__title {
    color: var(--ink);
    margin: 2px 0 4px;
    transition: color .2s ease;
}

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

/* Slide 2: excerpt + meta over the darkened photo. */
.pifmag-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;
}

.pifmag-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%);
}

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

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

/* ff-reading + margin(m-0) → utilities in content-listing.php.
   font-size/line-height/color kept: the @768 rule overrides all three
   (16/1.55/muted vs 18/1.5/#fff) and utility !important would leak into
   the desktop breakpoint. */
.pifmag-article-row__chap {
    font-size: 18px;
    line-height: 1.5;
    color: #fff;
    max-width: none;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}

/* ff-body → utility in content-listing.php. color(rgba)/margin-top kept:
   the @768 rule overrides both (faint / 6px) and margin-top 4px is off scale. */
.pifmag-article-row__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    color: rgba(255, 255, 255, .85);
}

.pifmag-article-row__meta .pifmag-article-row__separator {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .4);
}

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

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

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

/* ---- Tablet (≥768px): single-column stacked rows ---- */

@media (min-width: 768px) {
    .pifmag-article-row {
        display: grid;
        grid-template-columns: 1fr;
        grid-auto-flow: row;
        gap: 18px;
        overflow-x: visible;
        border-radius: 0;
        padding-bottom: clamp(28px, 3vw, 44px);
        margin-bottom: 0;
        border-bottom: 1px solid var(--rule);
        background: none;
        box-shadow: none;
    }

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

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

    .pifmag-article-row__media {
        aspect-ratio: 16 / 10;
        border-radius: 12px;
        scroll-snap-align: none;
    }

    .pifmag-article-row__media::after {
        background: none;
        border-radius: inherit;
        box-shadow: inset 0 0 0 1px rgba(7, 18, 38, .06);
    }

    .pifmag-article-row__overlay {
        display: none;
    }

    .pifmag-article-row__body {
        aspect-ratio: auto;
        padding: 0;
        gap: 10px;
        justify-content: flex-start;
        background-image: none;
        background-color: transparent;
        scroll-snap-align: none;
    }

    .pifmag-article-row__body::before {
        display: none;
    }

    .pifmag-article-row__body > .pifmag-article-row__kicker {
        display: inline-flex;
    }

    .pifmag-article-row__body > .pifmag-article-row__title {
        display: block;
    }

    .pifmag-article-row__chap {
        font-size: 16px;
        line-height: 1.55;
        color: var(--muted);
        max-width: 60ch;
        text-shadow: none;
    }

    .pifmag-article-row__meta {
        margin-top: 6px;
        color: var(--faint);
    }

    .pifmag-article-row__meta .pifmag-article-row__separator {
        background: var(--faint);
    }

    .pifmag-article-row__dots {
        display: none;
    }
}

/* ---- Desktop (≥992px): image left / text right ---- */

@media (min-width: 992px) {
    .pifmag-article-row {
        grid-template-columns: 280px 1fr;
        gap: clamp(22px, 3vw, 40px);
    }

    .pifmag-article-row__media {
        aspect-ratio: 4 / 3;
    }
}

/* ---- 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);
}

