/* =========================================================
   Le Café des Mots - EDITORIAL PAGES
   Used by: pages/atelier.html  (and next: spectacles.html, lecture-bilingue.html)

   Self-contained: needs only css/header.css (menu + fonts), loaded on every page.
   Written with "start / end" (logical) properties instead of left / right,
   so the same page flips correctly when it is shown in Arabic (dir="rtl").

   Colour themes (one class next to .ed-page, the layout stays the same):
     (none)             Ateliers: light opening, beige band, green final band
     .ed-page--slate    Ateliers: dark blue-grey band (like Qui sommes-nous)
     .ed-page--scene    Spectacles: dark green band
     .ed-page--lecture  Lecture bilingue: dark petrol band
     All three share the rest: logo-red title, white highlights strip, grey-green sections,
     white cards, final band in the same colour as the top band.

   Building blocks, top to bottom:
     .ed-opening      kicker + big title (+ red line) | intro text, then 3 highlights
     .ed-facts        small labels for practical info (age, places...)
     .ed-section      a group of cards with its heading   (--cream for the beige background)
     .ed-grid         cards side by side; --wide for 2 bigger cards per row
     .ed-card         photo on top, text below;  --side: photo beside the text
     .ed-feature      one big photo + text per item, alternating sides (--reverse)
     .ed-cta          dark green band with a button
   ========================================================= */

.ed-page {
    --ed-cream: #f7f3ec;
    --ed-paper: #fffdf9;
    --ed-ink: #18201d;
    --ed-green: #18362c;
    --ed-terra: #b9482d;
    --ed-line: #ded6ca;
    --ed-muted: #66645e;
    --ed-serif: 'Playfair Display', Georgia, serif;
    --ed-sans: 'DM Sans', Arial, sans-serif;

    /* what the themes change */
    --ed-opening-bg: var(--ed-paper);
    --ed-opening-ink: var(--ed-ink);
    --ed-opening-muted: var(--ed-muted);
    --ed-opening-accent: var(--ed-terra);
    --ed-opening-line: var(--ed-line);
    --ed-band-bg: var(--ed-cream);          /* .ed-section--cream */
    --ed-cta-bg: var(--ed-green);
    --ed-cta-kicker: #d7a08e;
    --ed-cta-text: #d8ddd9;
    --ed-cta-button: var(--ed-terra);
    --ed-cta-button-hover: #963a24;

    color: var(--ed-ink);
    font-family: var(--ed-sans);
}

.ed-container {
    width: min(1180px, calc(100% - 48px));
    margin-inline: auto;
}

/* small uppercase line above titles (write it in normal case in the HTML) */
.ed-kicker {
    margin: 0 0 14px;
    color: var(--ed-terra);
    font: 700 13px/1.4 var(--ed-sans);
    letter-spacing: .16em;
    text-transform: uppercase;
}

/* ---------- 1. Opening ---------- */

.ed-opening {
    padding: clamp(34px, 4.5vw, 58px) 0 clamp(30px, 4vw, 46px);
    background: var(--ed-opening-bg);
    border-bottom: 1px solid var(--ed-opening-line);
    color: var(--ed-opening-ink);
}

.ed-opening .ed-kicker {
    color: var(--ed-opening-accent);
}

/* title (on one line on computers and tablets), intro text under it */
.ed-opening__main {
    display: grid;
    gap: 22px;
}

.ed-title {
    margin: 0;
    color: var(--ed-opening-ink);
    font: 600 clamp(36px, 4.6vw, 58px)/1.08 var(--ed-serif);
    letter-spacing: -.015em;
}

.ed-title span {
    color: var(--ed-opening-accent);
}

/* title in two lines, the coloured part on the second one */
.ed-title--stacked span {
    display: block;
}

/* the short red line under the title */
.ed-title::after {
    content: "";
    display: block;
    width: 46px;
    height: 3px;
    margin-top: 18px;
    background: var(--ed-opening-accent);
}

.ed-opening__text {
    margin: 0;
    max-width: 780px;
    color: var(--ed-opening-muted);
    font-size: 17px;
    line-height: 1.72;
}

/* the 3 highlights under the opening */
.ed-highlights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: clamp(26px, 3.5vw, 38px) 0 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--ed-opening-line);
}

/* number, name and text on one line ("01 Découvrir une culture…"), wrapping only if needed */
.ed-highlight {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
    row-gap: 2px;
    padding-block: 14px 0;
    padding-inline: 0 20px;
}

.ed-highlight + .ed-highlight {
    padding-inline-start: 24px;
    border-inline-start: 1px solid var(--ed-opening-line);
}

.ed-highlight__number {
    color: var(--ed-opening-accent);
    font: 700 13px var(--ed-sans);
    letter-spacing: .08em;
}

.ed-highlight__title {
    font: 600 20px/1.2 var(--ed-serif);
}

.ed-highlight__text {
    color: var(--ed-opening-muted);
    font-size: 14px;
    line-height: 1.45;
}

/* ---------- 2. Sections of cards ---------- */

.ed-section {
    padding: clamp(54px, 7vw, 82px) 0;
    background: var(--ed-paper);
}

.ed-section--cream {
    background: var(--ed-band-bg);
}

.ed-section__head {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: clamp(20px, 6vw, 70px);
    align-items: end;
    margin-bottom: 34px;
}

.ed-section__head h2 {
    margin: 0;
    font: 600 clamp(32px, 3.6vw, 48px)/1.04 var(--ed-serif);
    letter-spacing: -.015em;
}

.ed-section__head > p {
    max-width: 620px;
    margin: 0;
    color: var(--ed-muted);
    font-size: 16px;
    line-height: 1.7;
}

/* as many cards per row as fit: 3 on a computer, 2 on a tablet, 1 on a phone */
.ed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
    gap: 20px;
}

/* bigger cards: 2 per row on a computer, 1 below ~1000px */
.ed-grid--wide {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
    gap: 22px;
}

/* ---------- 3. Cards ---------- */

.ed-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ed-paper);
    border: 1px solid #e1d9ce;
}

.ed-section--cream .ed-card { background: var(--ed-paper); }
.ed-section:not(.ed-section--cream) .ed-card { background: var(--ed-cream); }

.ed-card__photo {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--ed-cream);
}

.ed-card__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s ease;
}

.ed-card:hover .ed-card__photo img {
    transform: scale(1.035);
}

.ed-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 24px 24px 26px;
}

.ed-tag {
    margin: 0 0 9px;
    color: var(--ed-terra);
    font: 700 12px var(--ed-sans);
    letter-spacing: .12em;
    text-transform: uppercase;
}

.ed-card h3 {
    margin: 0 0 12px;
    font: 600 clamp(24px, 2.3vw, 28px)/1.1 var(--ed-serif);
}

.ed-card__text {
    margin: 0 0 18px;
    color: var(--ed-muted);
    font-size: 15px;
    line-height: 1.68;
}

.ed-link {
    margin-top: auto;                 /* links line up at the bottom of the cards */
    color: var(--ed-terra);
    font: 700 14px var(--ed-sans);
    text-decoration: none;
}

.ed-link:hover {
    text-decoration: underline;
}

/* info labels in a card: some space before the "Voir les photos" link */
.ed-card .ed-facts {
    margin-bottom: 16px;
}

/* photo beside the text (when there is room) */
.ed-card--side {
    display: grid;
    grid-template-columns: 43% 1fr;
    min-height: 300px;
}

.ed-card--side .ed-card__photo {
    aspect-ratio: auto;
    min-height: 100%;
}

.ed-card--side .ed-card__body {
    justify-content: center;
    padding: 30px;
}

.ed-card--side .ed-link {
    margin-top: 0;
}

/* ---------- 4. Call to action ---------- */

.ed-cta {
    padding: clamp(50px, 6vw, 66px) 0;
    background: var(--ed-cta-bg);
    color: #fff;
}

.ed-cta__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}

.ed-cta .ed-kicker {
    color: var(--ed-cta-kicker);
}

.ed-cta h2 {
    margin: 0 0 12px;
    font: 600 clamp(32px, 3.8vw, 50px)/1.04 var(--ed-serif);
}

.ed-cta p {
    max-width: 720px;
    margin: 0;
    color: var(--ed-cta-text);
    font-size: 16px;
    line-height: 1.65;
}

.ed-button {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    padding: 14px 22px;
    border: 1px solid var(--ed-cta-button);
    border-radius: 5px;
    background: var(--ed-cta-button);
    color: #fff;
    font: 700 15px var(--ed-sans);
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s;
}

.ed-button:hover {
    border-color: var(--ed-cta-button-hover);
    background: var(--ed-cta-button-hover);
}

/* ---------- 5. Big features (one per show) ---------- */

.ed-features {
    display: grid;
    gap: clamp(34px, 5vw, 64px);
}

.ed-feature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 500px;
    overflow: hidden;
    background: var(--ed-paper);
    border: 1px solid #e1d9ce;
}

.ed-feature__photo {
    min-height: 100%;
    overflow: hidden;
    background: var(--ed-cream);
}

.ed-feature__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .7s ease;
}

.ed-feature:hover .ed-feature__photo img {
    transform: scale(1.025);
}

/* the photo is first in the HTML (so it comes first on phones); --reverse puts it on the other side */
.ed-feature--reverse .ed-feature__photo {
    order: 2;
}

.ed-feature__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(32px, 5vw, 68px);
}

.ed-feature h2 {
    margin: 0;
    font: 600 clamp(34px, 3.8vw, 54px)/1.04 var(--ed-serif);
    letter-spacing: -.015em;
}

.ed-feature__subtitle {
    margin: 10px 0 20px;
    color: #4f4d47;
    font: italic 500 19px/1.45 var(--ed-serif);
}

.ed-feature__text {
    margin: 0 0 24px;
    color: var(--ed-muted);
    font-size: 15.5px;
    line-height: 1.75;
}

/* no subtitle: space between the title and the text */
.ed-feature h2 + .ed-feature__text {
    margin-top: 20px;
}

.ed-feature__text + .ed-feature__text {
    margin-top: -10px;
}

.ed-feature .ed-facts {
    margin-top: 4px;
}

/* labels followed by the "Voir les photos" link */
.ed-feature .ed-facts + .ed-link {
    margin-top: 22px;
}

.ed-feature .ed-link {
    margin-top: 0;
}

/* opening with a button on the side (Soutenir): text left, button bottom right */
.ed-opening__main--action {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 22px clamp(30px, 5vw, 70px);
}

.ed-opening__main--action .ed-title {
    margin-bottom: 22px;
}

.ed-opening__action {
    display: grid;
    justify-items: end;
    gap: 10px;
}

.ed-opening__note {
    margin: 0;
    max-width: 300px;
    color: var(--ed-opening-muted);
    font-size: 13px;
    line-height: 1.5;
    text-align: end;
}

@media (max-width: 900px) {
    .ed-opening__main--action {
        grid-template-columns: 1fr;
    }

    .ed-opening__action {
        justify-items: start;
    }

    .ed-opening__note {
        text-align: start;
    }
}

/* ---------- 7. Numbered points in white cards (e.g. what donations pay for) ---------- */

.ed-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ed-step {
    padding: clamp(20px, 2.6vw, 28px);
    border: 1px solid #dde3df;
    background: #fff;
}

.ed-step__number {
    display: block;
    color: #d9532f;
    font: 700 13px/1 var(--ed-sans);
    letter-spacing: .1em;
}

.ed-step h3 {
    margin: 10px 0 8px;
    font: 600 23px/1.2 var(--ed-serif);
}

.ed-step p {
    margin: 0;
    color: var(--ed-muted);
    font-size: 15px;
    line-height: 1.65;
}

/* ---------- Theme: Spectacles ("scène") ---------- */

.ed-page--scene {
    --ed-opening-bg: var(--ed-green);      /* dark green band */
    --ed-opening-ink: #fffdf9;
    --ed-opening-muted: #cdd7d1;
    --ed-opening-accent: #e8603f;          /* the red-orange of the logo */
    --ed-opening-line: rgba(255, 253, 249, .16);
    --ed-cta-bg: var(--ed-green);
    --ed-cta-kicker: #f0a58f;
    --ed-cta-text: #cdd7d1;
    --ed-cta-button: #c94a2f;
    --ed-cta-button-hover: #a83b23;
}

/* ---------- 6. Practical info labels ---------- */

.ed-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.ed-facts li {
    padding: 7px 13px;
    border: 1px solid #e1d9ce;
    border-radius: 999px;
    background: #fff;
    color: var(--ed-ink);
    font: 600 13px/1.2 var(--ed-sans);
}

/* the first label stands out (e.g. the age) */
.ed-facts li:first-child {
    border-color: var(--ed-terra);
    background: var(--ed-terra);
    color: #fff;
}

/* labels placed in the opening take the opening's colours (light or dark theme) */
.ed-opening .ed-facts li {
    border-color: var(--ed-opening-line);
    background: transparent;
    color: var(--ed-opening-ink);
}

.ed-opening .ed-facts li:first-child {
    border-color: var(--ed-opening-accent);
    background: var(--ed-opening-accent);
    color: #fff;
}

/* ---------- Theme: Lecture bilingue ---------- */

.ed-page--lecture {
    --ed-opening-bg: #1d3f44;              /* dark petrol: between the blue and the green of the other pages */
    --ed-opening-ink: #ffffff;
    --ed-opening-muted: #cbdadb;
    --ed-opening-accent: #e8603f;
    --ed-opening-line: rgba(255, 255, 255, .14);
    --ed-cta-bg: #1d3f44;
    --ed-cta-kicker: #f0a58f;
    --ed-cta-text: #cbdadb;
    --ed-cta-button: #c94a2f;
    --ed-cta-button-hover: #a83b23;
}

/* ---------- Theme: Ateliers ("slate", same colours as Qui sommes-nous) ---------- */

.ed-page--slate {
    --ed-opening-bg: #263238;              /* dark blue-grey band */
    --ed-opening-ink: #ffffff;
    --ed-opening-muted: #cfd8dc;
    --ed-opening-accent: #e8603f;          /* the red-orange of the logo, bright enough on the dark band */
    --ed-opening-line: rgba(255, 255, 255, .14);
    --ed-cta-bg: #263238;
    --ed-cta-kicker: #f0a58f;
    --ed-cta-text: #cfd8dc;
    --ed-cta-button: #c94a2f;
    --ed-cta-button-hover: #a83b23;
}

/* ---------- The family: Ateliers, Spectacles, Lecture bilingue ----------
   Same base everywhere, only the dark band colour changes (set in each theme above/below):
   grey-green sections, white cards, white highlights strip with logo-orange numbers. */

:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) {
    --ed-band-bg: #eef1ee;
    background: #eef1ee;
}

/* the second kind of section: a very light grey-green */
:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-section:not(.ed-section--cream) {
    background: #f6f8f6;
}

/* cards and big blocks: white with a soft grey-green edge */
:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-section :is(.ed-card, .ed-feature) {
    background: #fff;
    border-color: #dde3df;
}

/* the 3 highlights: a white strip under the title, numbers in the logo colour */
:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-highlights {
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    background: #fff;
}

:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-highlight {
    padding-block: 14px;
}

:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-highlight + .ed-highlight {
    border-inline-start-color: #e3e8e5;
}

:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-highlight__number {
    color: #d9532f;
}

:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-highlight__title {
    color: var(--ed-ink);
}

:is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-highlight__text {
    color: #5f6b66;
}

/* ---------- Tablet ---------- */

@media (max-width: 900px) {
    .ed-section__head {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 18px;
    }

    .ed-cta__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 26px;
    }

    .ed-feature {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .ed-feature__photo {
        aspect-ratio: 16 / 10;
        min-height: 0;
    }

    .ed-feature--reverse .ed-feature__photo {
        order: 0;
    }
}

/* tablet only: one card per row, photo beside the text (no lonely half-width card) */
@media (min-width: 651px) and (max-width: 900px) {
    .ed-grid,
    .ed-grid--wide {
        grid-template-columns: 1fr;
    }

    .ed-card {
        display: grid;
        grid-template-columns: 40% 1fr;
        min-height: 260px;
    }

    .ed-card .ed-card__photo {
        aspect-ratio: auto;
        min-height: 100%;
    }

    .ed-card .ed-card__body {
        justify-content: center;
        padding: 26px;
    }

    .ed-card .ed-link {
        margin-top: 0;
    }
}

/* ---------- Phone ---------- */

@media (max-width: 650px) {
    .ed-container {
        width: calc(100% - 32px);
    }

    .ed-title {
        font-size: clamp(36px, 10.5vw, 46px);
    }

    .ed-opening__text {
        font-size: 16px;
    }

    /* highlights: stacked, one short line each */
    .ed-highlights {
        grid-template-columns: 1fr;
    }

    .ed-highlight,
    .ed-highlight + .ed-highlight {
        padding: 9px 0;
        border-inline-start: 0;
    }

    .ed-highlight + .ed-highlight {
        border-top: 1px solid var(--ed-opening-line);
    }

    :is(.ed-page--slate, .ed-page--scene, .ed-page--lecture) .ed-highlight + .ed-highlight {
        border-top-color: #e3e8e5;
    }

    .ed-highlight__title {
        font-size: 18px;
    }

    .ed-highlight__text {
        font-size: 13px;
    }

    .ed-card__body,
    .ed-card--side .ed-card__body {
        padding: 22px;
    }

    .ed-card--side {
        display: flex;
        min-height: 0;
    }

    .ed-card--side .ed-card__photo {
        aspect-ratio: 16 / 10;
        min-height: 0;
    }

    .ed-cta .ed-button {
        width: 100%;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ed-card__photo img,
    .ed-feature__photo img { transition: none; }
    .ed-card:hover .ed-card__photo img,
    .ed-feature:hover .ed-feature__photo img { transform: none; }
}
