/* =========================
   RÉALISATIONS (page publique)
========================= */

/* L'encadré blanc : 1124 px laissent exactement 1064 px à la grille, soit deux cartes de 520 px et l'écart */
.showcase-page {
    flex: none;
    width: calc(100% - 32px);
    max-width: 1124px;
    margin: 10px auto 40px;
    padding: 24px 30px 30px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.showcase-page h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #000;
}

.showcase-empty {
    color: #555;
}

/* width : le <main> du site est un flex centré, qui réduirait sinon la grille à la taille de son contenu */
.showcase-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: 32px 24px;
}

.showcase-card {
    justify-self: center;
    width: 100%;
    max-width: 520px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #c9ced6;
    border-radius: 16px;
    background: #eef0f3;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

/* Médias bien séparés : un clic sur une vignette l'affiche en grand (assets/js/realisations.js) */
.showcase-media {
    display: grid;
    gap: 10px;
    padding: 10px 10px 0;
}

.showcase-media.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Trois médias ou plus : la première image en grand, deux petites empilées à droite */
.showcase-media.count-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.showcase-media.count-3 .showcase-tile { aspect-ratio: auto; }
.showcase-media.count-3 .showcase-tile:first-child { grid-row: span 2; aspect-ratio: 1 / 1; }

.showcase-tile {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    background: #111;
    cursor: zoom-in;
}

/* Au-delà de trois, les autres médias se voient en grand, avec les flèches */
.showcase-tile:nth-child(n+4) { display: none; }

.showcase-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 600;
}

.showcase-tile img,
.showcase-tile video {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    transition: transform 0.15s ease;
}

.showcase-tile:hover img,
.showcase-tile:hover video {
    transform: scale(1.03);
}

.showcase-tile:focus-visible {
    outline: 3px solid #000;
    outline-offset: 2px;
}

.showcase-play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 38px;
    height: 38px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
}

/* Triangle dessiné en CSS : le caractère ▶ devient un emoji sur téléphone */
.showcase-play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-35%, -50%);
    border-style: solid;
    border-width: 8px 0 8px 13px;
    border-color: transparent transparent transparent #fff;
}

/* Affichage en grand */
.showcase-viewer-open { overflow: hidden; }

.showcase-viewer {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.92);
}

.showcase-viewer::backdrop { background: rgba(0, 0, 0, 0.92); }

.showcase-viewer-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
}

.showcase-viewer-stage img,
.showcase-viewer-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.showcase-viewer button {
    position: absolute;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.showcase-viewer button:hover { background: rgba(255, 255, 255, 0.3); }
.showcase-viewer button[hidden] { display: none; }
.showcase-viewer-close { top: 14px; right: 14px; }
.showcase-viewer-nav { top: 50%; transform: translateY(-50%); }
.showcase-viewer-nav.prev { left: 14px; }
.showcase-viewer-nav.next { right: 14px; }

.showcase-text {
    flex: none;
    padding: 12px 16px 14px;
    color: #222;
    overflow-wrap: anywhere;
}

.showcase-text h2 {
    font-size: 1.15rem;
    color: #000;
}

.showcase-date {
    margin: 2px 0 10px;
    color: #555;
    font-size: 0.85rem;
}

.showcase-link {
    display: inline-block;
    margin-top: 10px;
    font-weight: 600;
}

@media (max-width: 600px) {
    .showcase-page { padding: 18px 14px 20px; }
}
