/* =========================================================
   LE CAFÉ DES MOTS - ACTIVITY PAGES + PHOTO GALLERY
   ---------------------------------------------------------
   Used by:  pages/atelier.html, pages/spectacles.html,
             pages/galerie.html (+ js/gallery.js)
   Meant to be reused by pages/lecture-bilingue.html
   (same "photo + title + text" list).

   Load it AFTER css/style.css - it relies on style.css for
   the design variables (--cream, --line, --terra, --serif) and
   for .container, .underline, .link, .btn and .support-box.
   ========================================================= */

/* ---------------------------------------------------------
   1. PAGE INTRO BAND (title + underline + one-line intro)
   --------------------------------------------------------- */
.link:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------
   2. ACTIVITY LIST  (photo on the left, text on the right)
   To add one: copy an <article class="activity"> block.
   Photo: replace the file in images/ateliers/ or images/spectacles/ (any size,
   it is cropped to fill; 4:3 landscape works best).
   --------------------------------------------------------- */
.activities {
    padding: clamp(34px, 5vw, 64px) 0;
}

.activity-list {
    display: grid;
    gap: clamp(16px, 2.2vw, 24px);
    max-width: 980px;
    margin: 0 auto;
}

.activity {
    position: relative; /* anchor for the stretched link below */
    display: grid;
    grid-template-columns: minmax(180px, 290px) 1fr;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* The whole card is clickable: the "Voir les photos" link is stretched over it
   (still ONE link per card for keyboard and screen-reader users). */
.activity__link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.activity:hover {
    border-color: var(--terra);
    box-shadow: 0 6px 18px rgba(23, 32, 28, 0.08);
}

.activity:hover .activity__link {
    text-decoration: underline;
}

.activity__link:focus-visible {
    outline: none;
}

.activity__link:focus-visible::after {
    outline: 2px solid var(--terra);
    outline-offset: -2px;
}

.activity__photo {
    min-height: 218px; /* fills the card's full height, even when the text is long */
    overflow: hidden;
    background: var(--cream);
}

.activity__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.activity:hover .activity__photo img {
    transform: scale(1.04);
}

.activity__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: clamp(18px, 2.6vw, 30px);
}

.activity__tag {
    margin: 0;
    color: var(--terra);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.activity__body h2 {
    font-size: clamp(24px, 2.8vw, 31px);
}

.activity__subtitle {
    margin: -2px 0 2px;
    font-family: var(--serif);
    font-size: clamp(17px, 1.9vw, 20px);
    font-style: italic;
    color: var(--green);
}

.activity__text {
    margin: 0;
    color: #555;
    font-size: 15px;
    line-height: 1.6;
}

.activity__body .link {
    align-self: flex-start;
    margin-top: 6px;
}

@media (max-width: 640px) {
    .activity {
        grid-template-columns: 1fr;
    }

    .activity__photo {
        aspect-ratio: 16 / 10;
    }
}

/* ---------------------------------------------------------
   3. PHOTO GALLERY  (pages/galerie.html + js/gallery.js)
   One group per photo folder (Ateliers, Spectacles), then one section
   per atelier / spectacle. The session cards and the popup are
   built by js/gallery.js from each folder's manifest.php (lists the folders live).
   --------------------------------------------------------- */
.gallery {
    padding: clamp(24px, 4vw, 48px) 0 clamp(36px, 5vw, 64px);
}

.gallery + .gallery {
    border-top: 1px solid var(--line);
    background: var(--cream);
}

.gallery__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 20px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--ink);
}

.gallery__head h2 {
    font-size: clamp(32px, 4vw, 44px);
}

.gallery-section {
    padding: clamp(22px, 3vw, 36px) 0;
    border-bottom: 1px solid var(--line);
}

.gallery-section:last-child {
    border-bottom: 0;
}

.gallery-section h3 {
    margin-bottom: 14px;
    font-size: clamp(22px, 2.6vw, 30px);
}

/* the atelier the visitor came for (galerie.html#houmous) gets a terracotta bar */
.gallery-section:target h3 {
    padding-left: 14px;
    box-shadow: inset 4px 0 0 var(--terra);
}

.sessions__hint,
.sessions__empty {
    margin: 0 0 12px;
    color: #666;
    font-size: 14px;
}

.sessions__empty {
    margin: 0;
    font-style: italic;
}

/* session cards, latest first: first photo + title / date · place / sponsors (info.txt) */
.session-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.session {
    display: flex;
    align-items: stretch;
    gap: 14px;
    width: 100%;
    height: 100%;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
}

.session:hover,
.session:focus-visible {
    border-color: var(--terra);
    transform: translateY(-1px);
}

.session:focus-visible {
    outline: 2px solid var(--terra);
    outline-offset: 2px;
}

.session__thumb {
    flex: none;
    width: 104px;
    height: 104px;
    object-fit: cover;
    background: var(--cream);
}

.session__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 2px 0;
}

.session__title {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--ink);
}

.session__meta,
.session__sponsors {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.session__sponsors {
    font-style: italic;
}

.session__count {
    margin-top: auto;
    padding-top: 4px;
    color: var(--terra);
    font-size: 13px;
    font-weight: 600;
}

/* ---------------------------------------------------------
   4. PHOTO POPUP  (native <dialog>: Esc closes it, focus is trapped)
   The panel fills the dialog so only the dark backdrop counts
   as "outside" for click-to-close.
   --------------------------------------------------------- */
html.has-lightbox {
    overflow: hidden;
}

.lightbox {
    width: min(1000px, calc(100% - 24px));
    max-width: none;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    overflow: hidden;
}

.lightbox__panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 26px);
    max-height: calc(100dvh - 26px);
}

.lightbox::backdrop {
    background: rgba(23, 32, 28, 0.72);
}

.lightbox__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.lightbox__title {
    font-size: clamp(20px, 2.4vw, 26px);
}

.lightbox__sub {
    margin: 4px 0 0;
    color: #666;
    font-size: 13px;
}

.lightbox__info {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.lightbox__info p {
    margin: 0 0 4px;
}

.lightbox__sponsors {
    color: #666;
    font-style: italic;
}

.lightbox__desc {
    white-space: pre-line; /* keeps the line breaks written in info.txt */
}

.lightbox__close {
    flex: none;
    width: 38px;
    height: 38px;
    background: #fff;
    border: 1px solid var(--line);
    color: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
    border-color: var(--terra);
    color: var(--terra);
}

.lightbox__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
    grid-auto-rows: max-content; /* rows keep the photo's height and the grid scrolls, instead of squashing the photos */
    align-content: start;
    gap: 10px;
    padding: 18px 22px 22px;
    min-height: 0;
    overflow: auto;
}

.lightbox__grid a {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--cream);
    border: 1px solid var(--line);
}

.lightbox__grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.lightbox__grid a:hover img {
    transform: scale(1.04);
}

@media (max-width: 640px) {
    .lightbox__head,
    .lightbox__grid {
        padding-inline: 14px;
    }
}
