:root {
    --ewdf-ink: #161616;
    --ewdf-muted: #666;
    --ewdf-line: #e7e1d7;
    --ewdf-soft: #f7f3ed;
    --ewdf-soft-2: #fbfaf7;
    --ewdf-gold: #b08d57;
    --ewdf-green: #264f3e;
}

/* Main shell */
.ew-search-feed-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 34px 18px 54px;
}

.ew-search-feed-header {
    margin: 0 0 20px;
    padding: 26px 0 8px;
    border-bottom: 1px solid var(--ewdf-line);
}

.ew-search-eyebrow,
.ew-module-eyebrow {
    display: block;
    text-transform: uppercase;
    letter-spacing: .09em;
    font-size: 11px;
    font-weight: 700;
    color: var(--ewdf-gold);
    margin-bottom: 9px;
}

.ew-search-feed-header h1 {
    max-width: 820px;
    font-size: clamp(36px, 5.5vw, 68px);
    line-height: .94;
    letter-spacing: -0.055em;
    margin: 0 0 13px;
    color: var(--ewdf-ink);
    text-transform: capitalize;
}

.ew-search-intro {
    font-size: 18px;
    line-height: 1.42;
    max-width: 600px;
    margin: 0 0 20px;
    color: var(--ewdf-muted);
}

/* Intent buttons */
.ew-search-intents,
.ew-module-buttons {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.ew-search-intents {
    overflow-x: auto;
    padding: 6px 0 16px;
    -webkit-overflow-scrolling: touch;
}

.ew-search-intent {
    appearance: none;
    border: 1px solid var(--ewdf-line);
    background: #fff;
    color: var(--ewdf-ink);
    border-radius: 999px;
    padding: 10px 14px;
    white-space: nowrap;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

.ew-search-intent:hover {
    border-color: var(--ewdf-ink);
    transform: translateY(-1px);
}

.ew-search-intent.is-active {
    background: var(--ewdf-ink);
    color: #fff;
    border-color: var(--ewdf-ink);
}

/* Feed grid: archive/search = denser than homepage, still editorial */
.ew-search-feed-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 30px 22px;
    transition: opacity .18s ease, transform .18s ease;
}

.ew-search-feed-grid.is-updating {
    opacity: .35;
    transform: translateY(4px);
}

.ew-search-card {
    min-width: 0;
    grid-column: span 2;
}

/* Article rhythm. nth-of-type ignores section modules, so the pattern survives in-feed modules. */
.ew-search-card:nth-of-type(1) {
    grid-column: 1 / -1;
}

.ew-search-card:nth-of-type(2),
.ew-search-card:nth-of-type(3) {
    grid-column: span 3;
}

.ew-search-card:nth-of-type(8n+6) {
    grid-column: span 3;
}

.ew-search-card:nth-of-type(8n+9) {
    grid-column: span 3;
}

.ew-search-card a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.ew-search-card img {
    width: 100%;
    aspect-ratio: 1 / 1.16;
    object-fit: cover;
    border-radius: 18px;
    display: block;
    background: #f3f3f3;
}

.ew-search-card:nth-of-type(1) img {
    aspect-ratio: 1.72 / 1;
    border-radius: 26px;
}

.ew-search-card:nth-of-type(2) img,
.ew-search-card:nth-of-type(3) img,
.ew-search-card:nth-of-type(8n+6) img,
.ew-search-card:nth-of-type(8n+9) img {
    aspect-ratio: 1.28 / 1;
    border-radius: 22px;
}

.ew-card-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 11px 0 8px;
}

.ew-card-meta span {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    background: #f4f1ec;
    border-radius: 999px;
    padding: 6px 8px;
    color: #5d574e;
}

.ew-search-card h2 {
    font-size: 18px;
    line-height: 1.14;
    letter-spacing: -0.025em;
    margin: 0 0 7px;
    color: var(--ewdf-ink);
}

.ew-search-card:nth-of-type(1) h2 {
    font-size: clamp(34px, 4.6vw, 54px);
    line-height: .98;
    letter-spacing: -0.055em;
    max-width: 840px;
}

.ew-search-card:nth-of-type(2) h2,
.ew-search-card:nth-of-type(3) h2,
.ew-search-card:nth-of-type(8n+6) h2,
.ew-search-card:nth-of-type(8n+9) h2 {
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.04;
    letter-spacing: -0.04em;
}

.ew-search-card p {
    font-size: 14px;
    line-height: 1.42;
    color: var(--ewdf-muted);
    max-width: 640px;
    margin: 0;
}

.ew-search-card:nth-of-type(1) p,
.ew-search-card:nth-of-type(2) p,
.ew-search-card:nth-of-type(3) p {
    font-size: 15px;
}

/* Feed modules */
.ew-search-feed-module,
.ew-archive-intro-infeed {
    grid-column: 1 / -1;
}

.ew-search-feed-module {
    background: var(--ewdf-soft);
    border-radius: 28px;
    padding: 28px 30px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    border: 1px solid rgba(176, 141, 87, .16);
}

.ew-search-feed-module-dark {
    background: var(--ewdf-green);
    color: #fff;
    border-color: transparent;
}

.ew-search-feed-module h3 {
    font-size: clamp(26px, 4vw, 42px);
    line-height: .98;
    letter-spacing: -0.045em;
    margin: 0 0 8px;
}

.ew-search-feed-module p {
    max-width: 520px;
    margin: 0;
    color: inherit;
    opacity: .72;
    font-size: 15px;
    line-height: 1.42;
}

.ew-module-buttons {
    justify-content: flex-end;
    align-items: center;
}

.ew-search-feed-module-dark .ew-module-eyebrow {
    color: rgba(255,255,255,.7);
}

.ew-search-feed-module-dark .ew-search-intent {
    background: transparent;
    border-color: rgba(255,255,255,.35);
    color: #fff;
}

.ew-search-feed-module-dark .ew-search-intent:hover,
.ew-search-feed-module-dark .ew-search-intent.is-active {
    background: #fff;
    color: var(--ewdf-ink);
    border-color: #fff;
}


/* Magazine shelf: homepage-inspired browse block for below-the-fold discovery */
.ew-magazine-shelf {
    grid-column: 1 / -1;
    background: var(--ewdf-soft);
    border: 1px solid rgba(176, 141, 87, .16);
    border-radius: 30px;
    padding: 26px;
    margin: 0;
}

.ew-magazine-shelf-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 18px;
}

.ew-magazine-shelf-header h3 {
    margin: 0;
    max-width: 680px;
    font-size: clamp(28px, 4vw, 44px);
    line-height: .98;
    letter-spacing: -0.05em;
    color: var(--ewdf-ink);
}

.ew-magazine-shelf-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px 18px;
}

/* Reset feed-wide hero rhythm inside the shelf */
.ew-magazine-shelf .ew-search-card,
.ew-magazine-shelf .ew-search-card:nth-of-type(1),
.ew-magazine-shelf .ew-search-card:nth-of-type(2),
.ew-magazine-shelf .ew-search-card:nth-of-type(3),
.ew-magazine-shelf .ew-search-card:nth-of-type(8n+6),
.ew-magazine-shelf .ew-search-card:nth-of-type(8n+9) {
    grid-column: auto;
}

.ew-magazine-shelf .ew-search-card img,
.ew-magazine-shelf .ew-search-card:nth-of-type(1) img,
.ew-magazine-shelf .ew-search-card:nth-of-type(2) img,
.ew-magazine-shelf .ew-search-card:nth-of-type(3) img,
.ew-magazine-shelf .ew-search-card:nth-of-type(8n+6) img,
.ew-magazine-shelf .ew-search-card:nth-of-type(8n+9) img {
    aspect-ratio: 1 / 1;
    border-radius: 17px;
}

.ew-magazine-shelf .ew-card-meta {
    margin: 9px 0 7px;
}

.ew-magazine-shelf .ew-card-meta span {
    font-size: 10px;
    padding: 5px 7px;
}

.ew-magazine-shelf .ew-search-card h2,
.ew-magazine-shelf .ew-search-card:nth-of-type(1) h2,
.ew-magazine-shelf .ew-search-card:nth-of-type(2) h2,
.ew-magazine-shelf .ew-search-card:nth-of-type(3) h2,
.ew-magazine-shelf .ew-search-card:nth-of-type(8n+6) h2,
.ew-magazine-shelf .ew-search-card:nth-of-type(8n+9) h2 {
    font-size: 17px;
    line-height: 1.13;
    letter-spacing: -0.025em;
    margin-bottom: 0;
}

.ew-magazine-shelf .ew-search-card p {
    display: none;
}

/* Archive intro as an in-feed editorial card */
.ew-archive-intro-infeed {
    background: var(--ewdf-soft-2);
    border: 1px solid var(--ewdf-line);
    border-radius: 24px;
    padding: 34px 42px 38px;
    margin: 2px 0 8px;
    position: relative;
    overflow: hidden;
}

.ew-archive-intro-infeed:before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--ewdf-gold);
}

.ew-archive-intro-infeed h1,
.ew-archive-intro-infeed h2 {
    margin: 0 0 14px;
    font-size: clamp(27px, 4vw, 42px);
    line-height: 1.02;
    letter-spacing: -0.045em;
    color: var(--ewdf-ink);
}

.ew-archive-intro-infeed p {
    max-width: 860px;
    font-size: 16px;
    line-height: 1.62;
    color: #555;
}

.ew-archive-intro-infeed p:last-child {
    margin-bottom: 0;
}

/* Debug */
.ew-debug {
    display: inline-flex;
    gap: 5px;
    margin: 8px 0;
    padding: 5px 8px;
    border-radius: 999px;
    background: #fff4c2;
    color: #4b3b00;
    font-size: 11px;
    line-height: 1.2;
    flex-wrap: wrap;
}

/* Load more / pagination */
.ew-load-more-wrap,
.ew-feed-pagination {
    text-align: center;
    margin: 38px 0 10px;
}

.ew-load-more-btn,
.ew-feed-pagination a,
.ew-feed-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    border: 1px solid var(--ewdf-ink);
    border-radius: 999px;
    padding: 0 16px;
    margin: 3px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

.ew-load-more-btn,
.ew-feed-pagination .current {
    background: var(--ewdf-ink);
    color: #fff;
}

.ew-load-more-btn {
    cursor: pointer;
}

.ew-load-more-btn:hover {
    transform: translateY(-1px);
}

.ew-search-card.is-hidden-by-load-more {
    display: none;
}

/* Tablet */
@media (max-width: 900px) {
    .ew-search-feed-wrap {
        max-width: none;
        padding: 28px 16px 46px;
    }

    .ew-search-feed-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 26px 16px;
    }

    .ew-search-card,
    .ew-search-card:nth-of-type(2),
    .ew-search-card:nth-of-type(3),
    .ew-search-card:nth-of-type(8n+6),
    .ew-search-card:nth-of-type(8n+9) {
        grid-column: span 1;
    }

    .ew-search-card:nth-of-type(1) {
        grid-column: 1 / -1;
    }

    .ew-search-card:nth-of-type(1) img {
        aspect-ratio: 1.32 / 1;
    }

    .ew-search-card:nth-of-type(2) img,
    .ew-search-card:nth-of-type(3) img,
    .ew-search-card:nth-of-type(8n+6) img,
    .ew-search-card:nth-of-type(8n+9) img {
        aspect-ratio: 1 / 1.12;
        border-radius: 18px;
    }

    .ew-search-card:nth-of-type(2) h2,
    .ew-search-card:nth-of-type(3) h2,
    .ew-search-card:nth-of-type(8n+6) h2,
    .ew-search-card:nth-of-type(8n+9) h2 {
        font-size: 20px;
        line-height: 1.12;
        letter-spacing: -0.025em;
    }

    .ew-search-feed-module {
        grid-template-columns: 1fr;
        padding: 25px;
    }

    .ew-magazine-shelf {
        padding: 22px;
    }

    .ew-magazine-shelf-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 16px;
    }

    .ew-module-buttons {
        justify-content: flex-start;
    }
}

/* Mobile */
@media (max-width: 700px) {
    .ew-search-feed-wrap {
        padding: 24px 15px 42px;
    }

    .ew-search-feed-header {
        padding-top: 12px;
        margin-bottom: 18px;
    }

    .ew-search-feed-header h1 {
        font-size: clamp(36px, 12vw, 52px);
        line-height: .95;
    }

    .ew-search-intro {
        font-size: 16px;
    }

    .ew-search-intents {
        flex-wrap: nowrap;
        padding-bottom: 18px;
    }

    .ew-search-intent {
        font-size: 13px;
        padding: 10px 13px;
    }

    .ew-search-feed-grid {
        display: block;
    }

    .ew-search-card {
        margin-bottom: 30px;
    }

    .ew-search-card img,
    .ew-search-card:nth-of-type(1) img,
    .ew-search-card:nth-of-type(2) img,
    .ew-search-card:nth-of-type(3) img,
    .ew-search-card:nth-of-type(8n+6) img,
    .ew-search-card:nth-of-type(8n+9) img {
        aspect-ratio: 1 / 1.08;
        border-radius: 20px;
    }

    .ew-search-card h2,
    .ew-search-card:nth-of-type(1) h2,
    .ew-search-card:nth-of-type(2) h2,
    .ew-search-card:nth-of-type(3) h2,
    .ew-search-card:nth-of-type(8n+6) h2,
    .ew-search-card:nth-of-type(8n+9) h2 {
        font-size: 24px;
        line-height: 1.08;
        letter-spacing: -0.035em;
    }

    .ew-search-card p,
    .ew-search-card:nth-of-type(1) p,
    .ew-search-card:nth-of-type(2) p,
    .ew-search-card:nth-of-type(3) p {
        font-size: 15px;
    }

    .ew-search-feed-module {
        display: block;
        padding: 24px;
        margin-bottom: 30px;
        border-radius: 22px;
    }

    .ew-magazine-shelf {
        padding: 22px;
        border-radius: 22px;
        margin-bottom: 30px;
    }

    .ew-magazine-shelf-header {
        display: block;
        margin-bottom: 16px;
    }

    .ew-magazine-shelf-header h3 {
        font-size: 30px;
    }

    .ew-magazine-shelf-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 14px;
    }

    .ew-magazine-shelf .ew-search-card {
        margin-bottom: 0;
    }

    .ew-magazine-shelf .ew-search-card img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(1) img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(2) img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(3) img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(8n+6) img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(8n+9) img {
        aspect-ratio: 1 / 1;
        border-radius: 16px;
    }

    .ew-magazine-shelf .ew-search-card h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(1) h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(2) h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(3) h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(8n+6) h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(8n+9) h2 {
        font-size: 16px;
        line-height: 1.14;
        letter-spacing: -0.02em;
    }

    .ew-search-feed-module h3 {
        font-size: 30px;
    }

    .ew-module-buttons {
        justify-content: flex-start;
        margin-top: 18px;
    }

    .ew-archive-intro-infeed {
        padding: 28px 24px 32px;
        border-radius: 18px;
        margin-bottom: 30px;
    }

    .ew-archive-intro-infeed h1,
    .ew-archive-intro-infeed h2 {
        font-size: 30px;
    }
}

/* Explicit archive feed rhythm: top cards + shelf + alternating large/compact cards.
   These class-based rules override the older nth-of-type rhythm so modules and re-sorting
   do not break the layout pattern. */
.ew-search-feed-grid > .ew-search-card.ew-card-top-primary {
    grid-column: 1 / -1;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-secondary {
    grid-column: span 3;
}

.ew-search-feed-grid > .ew-search-card.ew-card-large-compo {
    grid-column: 1 / -1;
}

.ew-search-feed-grid > .ew-search-card.ew-card-compact {
    grid-column: span 2;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary img,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo img {
    aspect-ratio: 1.62 / 1;
    border-radius: 26px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-secondary img {
    aspect-ratio: 1.22 / 1;
    border-radius: 22px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-compact img {
    aspect-ratio: 1 / 1;
    border-radius: 18px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary h2,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo h2 {
    font-size: clamp(32px, 4.4vw, 52px);
    line-height: .98;
    letter-spacing: -0.055em;
    max-width: 840px;
    text-align:left;
    text-transform: capitalize;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-secondary h2 {
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.04;
    letter-spacing: -0.04em;
    text-align:left;
    text-transform: capitalize;
}

.ew-search-feed-grid > .ew-search-card.ew-card-compact h2 {
    font-size: 18px;
    line-height: 1.14;
    letter-spacing: -0.025em;
    text-align:left;
    text-transform: capitalize;
}

.ew-search-feed-grid > .ew-search-card.ew-card-large-compo p {
    font-size: 16px;
    max-width: 700px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-compact p {
    font-size: 14px;
    max-width: 620px;
}

.ew-magazine-shelf .ew-search-card.ew-card-shelf {
    grid-column: auto;
}

.ew-magazine-shelf .ew-search-card.ew-card-shelf img {
    aspect-ratio: 1 / 1;
    border-radius: 18px;
}

.ew-magazine-shelf .ew-search-card.ew-card-shelf h2 {
    font-size: 17px;
    line-height: 1.15;
    letter-spacing: -0.025em;
    text-align:left;
    text-transform: capitalize;
}

.ew-magazine-shelf .ew-search-card.ew-card-shelf p {
    display: none;
}

@media (max-width: 700px) {
    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-secondary,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo,
    .ew-search-feed-grid > .ew-search-card.ew-card-compact {
        grid-column: auto;
    }

    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary img,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-secondary img,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo img,
    .ew-search-feed-grid > .ew-search-card.ew-card-compact img {
        aspect-ratio: 1 / 1.08;
        border-radius: 20px;
    }

    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary h2,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-secondary h2,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo h2,
    .ew-search-feed-grid > .ew-search-card.ew-card-compact h2 {
        font-size: 24px;
        line-height: 1.08;
        letter-spacing: -0.035em;
    }
}


/* ========================================
   Card image composition
   Large archive cards can use a homepage-inspired composition:
   main image + two secondary thumbnails underneath when image_2/image_3 exist.
======================================== */

.ew-search-card .ew-card-image-frame,
.ew-search-card .ew-card-compo-main,
.ew-search-card .ew-card-compo-secondary > div {
    position: relative;
    overflow: hidden;
    background: #f3f3f3;
}

.ew-search-card .ew-card-image-frame img,
.ew-search-card .ew-card-image-compo img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    display: block;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
}

.ew-search-card .ew-card-image-compo {
    display: grid;
    gap: 8px;
}

.ew-search-card .ew-card-compo-secondary {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ew-search-card.ew-card-top-primary .ew-card-compo-secondary,
.ew-search-card.ew-card-large-compo .ew-card-compo-secondary {
    display: grid;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-image-frame,
.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-main,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-image-frame,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-main {
    aspect-ratio: 1.62 / 1;
    border-radius: 26px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-main,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-main {
    border-radius: 26px 26px 16px 16px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-secondary > div,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-secondary > div {
    aspect-ratio: 1.45 / 1;
    border-radius: 16px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-secondary .ew-card-image-frame,
.ew-search-feed-grid > .ew-search-card.ew-card-top-secondary .ew-card-compo-main {
    aspect-ratio: 1.22 / 1;
    border-radius: 22px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-compact .ew-card-image-frame,
.ew-search-feed-grid > .ew-search-card.ew-card-compact .ew-card-compo-main,
.ew-magazine-shelf .ew-search-card.ew-card-shelf .ew-card-image-frame,
.ew-magazine-shelf .ew-search-card.ew-card-shelf .ew-card-compo-main {
    aspect-ratio: 1 / 1;
    border-radius: 18px;
}

/* Override old image-based rhythm now that aspect ratios live on wrappers. */
.ew-search-feed-grid > .ew-search-card.ew-card-top-primary img,
.ew-search-feed-grid > .ew-search-card.ew-card-top-secondary img,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo img,
.ew-search-feed-grid > .ew-search-card.ew-card-compact img,
.ew-magazine-shelf .ew-search-card.ew-card-shelf img {
    aspect-ratio: auto !important;
    
}

/* Keep refinement modules on clean full-width breaks after completed card groups. */
.ew-search-feed-grid > .ew-search-feed-module,
.ew-search-feed-grid > .ew-magazine-shelf,
.ew-search-feed-grid > .ew-archive-intro-infeed {
    grid-column: 1 / -1;
}

@media (max-width: 700px) {
    .ew-search-card .ew-card-image-compo {
        gap: 6px;
    }

    .ew-search-card.ew-card-top-primary .ew-card-compo-secondary,
    .ew-search-card.ew-card-large-compo .ew-card-compo-secondary {
        display: none;
    }

    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-image-frame,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-main,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-secondary .ew-card-image-frame,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-secondary .ew-card-compo-main,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-image-frame,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-main,
    .ew-search-feed-grid > .ew-search-card.ew-card-compact .ew-card-image-frame,
    .ew-search-feed-grid > .ew-search-card.ew-card-compact .ew-card-compo-main {
        aspect-ratio: 1 / 1.08;
        border-radius: 20px;
    }
}


/* ========================================
   V2 compo rhythm: right-side secondary images + 3 compact cards per row
   Applies after the magazine shelf while keeping top/shelf logic intact.
======================================== */

.ew-search-feed-grid > .ew-search-card.ew-card-compact {
    grid-column: span 2; /* 3 compact cards per row on the 6-col grid */
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-image-compo,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-image-compo {
    display: grid;
    grid-template-columns: minmax(0, 2.15fr) minmax(120px, .85fr);
    gap: 10px;
    align-items: stretch;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-main,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-main {
    aspect-ratio: 1.42 / 1;
    border-radius: 26px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-secondary,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-secondary {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-height: 0;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-secondary > div,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-secondary > div {
    /* aspect-ratio: auto; */
    aspect-ratio: 5/4.35;
    min-height: 0;
    border-radius: 18px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-secondary img,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-secondary img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-main,
.ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-main {
    border-radius: 26px;
}

.ew-search-feed-grid > .ew-search-card.ew-card-compact .ew-card-image-compo .ew-card-compo-secondary,
.ew-magazine-shelf .ew-search-card.ew-card-shelf .ew-card-image-compo .ew-card-compo-secondary,
.ew-search-feed-grid > .ew-search-card.ew-card-top-secondary .ew-card-image-compo .ew-card-compo-secondary {
    display: none;
}

@media (max-width: 700px) {
    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-image-compo,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-image-compo {
        display: block;
    }

    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-secondary,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-secondary {
        display: none;
    }
}

/* ========================================
   Mobile width + image consistency pass
   Keeps desktop/tablet untouched; reduces mobile chrome so cards feel larger.
======================================== */
@media (max-width: 700px) {
    .ew-search-feed-wrap {
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 18px;
        padding-bottom: 36px;
    }

    .ew-search-feed-header {
        padding-top: 8px;
        margin-bottom: 16px;
    }

    .ew-search-intents {
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .ew-search-card {
        margin-bottom: 24px;
    }

    .ew-card-meta {
        margin: 9px 0 7px;
    }

    .ew-search-card p {
        max-width: none;
    }

    .ew-search-feed-module {
        padding: 20px 18px;
        margin-bottom: 24px;
        border-radius: 18px;
    }

    .ew-search-feed-module h3 {
        font-size: 28px;
    }

    .ew-module-buttons {
        gap: 8px;
        margin-top: 16px;
    }

    .ew-magazine-shelf {
        margin-left: -4px;
        margin-right: -4px;
        padding: 18px 14px;
        border-radius: 18px;
        margin-bottom: 24px;
    }

    .ew-magazine-shelf-header {
        margin-bottom: 14px;
    }

    .ew-magazine-shelf-header h3 {
        font-size: 27px;
    }

    .ew-magazine-shelf-grid {
        gap: 16px 10px;
    }

    .ew-magazine-shelf .ew-card-meta {
        display: none;
    }

    .ew-archive-intro-infeed {
        padding: 24px 18px 28px;
        border-radius: 18px;
        margin-bottom: 24px;
    }

    .ew-load-more-wrap,
    .ew-feed-pagination {
        margin-top: 28px;
    }

    /* Uniform mobile image format: all feed images use the same 4:3 crop. */
    .ew-search-card .ew-card-image-frame,
    .ew-search-card .ew-card-compo-main,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-image-frame,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary .ew-card-compo-main,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-secondary .ew-card-image-frame,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-secondary .ew-card-compo-main,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-image-frame,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo .ew-card-compo-main,
    .ew-search-feed-grid > .ew-search-card.ew-card-compact .ew-card-image-frame,
    .ew-search-feed-grid > .ew-search-card.ew-card-compact .ew-card-compo-main,
    .ew-magazine-shelf .ew-search-card.ew-card-shelf .ew-card-image-frame,
    .ew-magazine-shelf .ew-search-card.ew-card-shelf .ew-card-compo-main {
        aspect-ratio: 4 / 3;
        border-radius: 16px;
    }

    .ew-search-card img,
    .ew-search-card:nth-of-type(1) img,
    .ew-search-card:nth-of-type(2) img,
    .ew-search-card:nth-of-type(3) img,
    .ew-search-card:nth-of-type(8n+6) img,
    .ew-search-card:nth-of-type(8n+9) img,
    .ew-magazine-shelf .ew-search-card img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(1) img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(2) img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(3) img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(8n+6) img,
    .ew-magazine-shelf .ew-search-card:nth-of-type(8n+9) img {
        aspect-ratio: auto !important;
        border-radius: 0 !important;
    }

    .ew-search-feed-grid > .ew-search-card.ew-card-top-primary h2,
    .ew-search-feed-grid > .ew-search-card.ew-card-top-secondary h2,
    .ew-search-feed-grid > .ew-search-card.ew-card-large-compo h2,
    .ew-search-feed-grid > .ew-search-card.ew-card-compact h2,
    .ew-search-card h2,
    .ew-search-card:nth-of-type(1) h2,
    .ew-search-card:nth-of-type(2) h2,
    .ew-search-card:nth-of-type(3) h2,
    .ew-search-card:nth-of-type(8n+6) h2,
    .ew-search-card:nth-of-type(8n+9) h2 {
        font-size: 22px;
        line-height: 1.08;
    }

    .ew-magazine-shelf .ew-search-card.ew-card-shelf h2,
    .ew-magazine-shelf .ew-search-card h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(1) h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(2) h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(3) h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(8n+6) h2,
    .ew-magazine-shelf .ew-search-card:nth-of-type(8n+9) h2 {
        font-size: 15px;
        line-height: 1.12;
    }
}

@media (max-width: 420px) {
    .ew-search-feed-wrap {
        padding-left: 8px;
        padding-right: 8px;
    }

    .ew-magazine-shelf {
        margin-left: -2px;
        margin-right: -2px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .ew-magazine-shelf-grid {
        gap: 14px 8px;
    }
}


/* In-feed ad slots for discovery archive feeds */
.ew-feed-ad-slot {
    grid-column: 1 / -1;
    min-height: 250px;
    text-align: center;
    margin: 10px 0 22px;
    width: 100%;
}

.ew-feed-ad-slot.is-hidden-by-load-more {
    display: none !important;
}

.ew-feed-ad-slot .ad-slot {
    margin-left: auto;
    margin-right: auto;
}


/* Save to recipe box */
.ew-search-card .ew-card-image-frame,
.ew-search-card .ew-card-image-compo {
    position: relative;
}

.ew-card-save {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.7);
    color: #161616;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
    cursor: pointer;
}

.ew-card-save i {
    font-size: 14px;
}

.ew-card-save:hover {
    background: #fff;
    transform: translateY(-1px);
}

@media (max-width: 700px) {
    .ew-card-save {
        top: 9px;
        right: 9px;
        min-height: 32px;
        padding: 0 9px;
        font-size: 12px;
    }
}



/* ==========================
   Category term refiners
========================== */

.ewdf-term-refiners-wrap {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--ewdf-line);
}

.ewdf-term-refiners-wrap .ew101-refiners,
.ewdf-term-refiners-wrap .ew101-refiners__group {
    margin: 0;
    padding: 0;
}

.ewdf-term-refiners-wrap .ew101-refiners__title,
.ewdf-term-refiners-wrap .ew101-refiners__label {
    display: none;
}

.ewdf-term-refiners-wrap .ew101-refiners__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ewdf-term-refiners-wrap .ew101-refiners__pill {
    display: block;
    width: 112px;
    padding: 0;
    border: 1px solid var(--ewdf-line);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    color: var(--ewdf-ink);
    text-decoration: none;
}

.ewdf-term-refiners-wrap .ew101-refiners__card {
    display: block;
}

.ewdf-term-refiners-wrap .ew101-refiners__thumb {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f3f3;
}

.ewdf-term-refiners-wrap .ew101-refiners__thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ewdf-term-refiners-wrap .ew101-refiners__name {
    display: block;
    padding: 8px 9px 9px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.1;
    text-transform: capitalize;
}

.ewdf-term-refiners-wrap .ew101-refiners__pill:hover,
.ewdf-term-refiners-wrap .ew101-refiners__pill.is-active {
    border-color: var(--ewdf-green);
    box-shadow: 0 8px 18px rgba(0,0,0,.08);
}

.ewdf-term-refiners-wrap .ew101-refiners__pill.is-active .ew101-refiners__name {
    background: var(--ewdf-green);
    color: #fff;
}

@media (max-width: 700px) {
    .ewdf-term-refiners-wrap {
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ewdf-term-refiners-wrap .ew101-refiners__links {
        flex-wrap: nowrap;
        gap: 9px;
    }

    .ewdf-term-refiners-wrap .ew101-refiners__pill {
        flex: 0 0 104px;
        width: 104px;
    }
}


.ewdf-term-refiners-intro {
    margin: 0 0 14px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ewdf-muted);
}

@media (max-width: 700px) {
    .ewdf-term-refiners-intro {
        margin-bottom: 12px;
        font-size: 14px;
    }
}