/* ============================================================
   Médiathèque ALIF — habillage premium
   Photos (albums + lightbox) & vidéos (galerie + théâtre).
   S'appuie sur les tokens --alif-* de app.css.
   ============================================================ */

/* ---------- Introduction / manifeste ---------- */
.media-intro {
    position: relative;
    background:
        radial-gradient(1200px 400px at 12% -10%, rgba(160, 196, 60, .12), transparent 60%),
        radial-gradient(900px 380px at 100% 0%, rgba(200, 162, 75, .12), transparent 55%),
        var(--alif-white);
    border: 1px solid var(--alif-line);
    border-radius: var(--alif-radius-lg);
    padding: clamp(1.6rem, 4vw, 3rem);
    box-shadow: var(--alif-shadow-sm);
    overflow: hidden;
}
.media-intro .lead-quote {
    font-family: var(--alif-font-display);
    font-size: clamp(1.35rem, 2.6vw, 2.1rem);
    line-height: 1.35;
    color: var(--alif-forest);
    font-weight: 500;
    max-width: 40ch;
}
.media-intro .lead-quote .accent { color: var(--alif-green-700); font-style: italic; }
.media-intro p { color: var(--alif-ink-soft); max-width: 62ch; }

/* Compteurs */
.media-stats { display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; }
.media-stat { display: flex; align-items: baseline; gap: .5rem; }
.media-stat b {
    font-family: var(--alif-font-display);
    font-size: clamp(1.7rem, 3.4vw, 2.4rem);
    line-height: 1; color: var(--alif-green-700); font-weight: 600;
}
.media-stat span { font-size: .82rem; letter-spacing: .04em; color: var(--alif-muted); text-transform: uppercase; }

/* ---------- Filtres (pilules) ---------- */
.media-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.media-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1.05rem; border-radius: 999px;
    font-size: .9rem; font-weight: 600; text-decoration: none;
    color: var(--alif-ink-soft); background: var(--alif-white);
    border: 1px solid var(--alif-line); transition: all .2s ease;
}
.media-pill:hover { border-color: var(--alif-green); color: var(--alif-green-700); transform: translateY(-1px); }
.media-pill.is-active {
    background: linear-gradient(135deg, var(--alif-green), var(--alif-green-600));
    color: #fff; border-color: transparent; box-shadow: 0 10px 22px -12px rgba(139, 176, 47, .9);
}
.media-pill .n { font-size: .74rem; opacity: .75; }

/* ---------- Grille d'albums (magazine) ---------- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.4rem; }
.album-grid .feature { grid-column: span 2; }
.album-card {
    position: relative; display: block; text-decoration: none; color: inherit;
    border-radius: var(--alif-radius-lg); overflow: hidden;
    background: var(--alif-forest); box-shadow: var(--alif-shadow);
    aspect-ratio: 4 / 3; isolation: isolate;
}
.album-card.tall { aspect-ratio: 3 / 4; }
.album-card img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; transition: transform .9s cubic-bezier(.2, .7, .2, 1); z-index: -2;
}
.album-card::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(to top, rgba(12, 30, 20, .92) 0%, rgba(12, 30, 20, .45) 42%, rgba(12, 30, 20, .05) 72%);
}
.album-card:hover img { transform: scale(1.07); }
.album-card .body { position: absolute; inset-inline: 0; bottom: 0; padding: clamp(1rem, 2.4vw, 1.6rem); }
.album-card .kicker {
    display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .55rem;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em;
    color: var(--alif-forest); background: var(--alif-gold-200);
    padding: .25rem .7rem; border-radius: 999px;
}
.album-card h3 {
    font-family: var(--alif-font-display); color: #fff; font-weight: 600;
    font-size: clamp(1.25rem, 2.4vw, 1.75rem); line-height: 1.15; margin: 0 0 .4rem;
}
.album-card .desc {
    color: rgba(255, 255, 255, .82); font-size: .92rem; margin: 0 0 .7rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.album-card .meta {
    display: flex; align-items: center; gap: 1rem;
    color: rgba(255, 255, 255, .78); font-size: .82rem; font-weight: 500;
}
.album-card .go {
    margin-inline-start: auto; width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center; background: rgba(255, 255, 255, .16);
    color: #fff; transition: all .25s ease; backdrop-filter: blur(3px);
}
.album-card:hover .go { background: var(--alif-gold); color: var(--alif-forest); transform: translateX(3px); }
[dir="rtl"] .album-card .go i { transform: scaleX(-1); }

/* ---------- Grille vidéos ---------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.3rem; }
.video-card {
    position: relative; border: none; cursor: pointer; text-align: start; padding: 0;
    background: var(--alif-forest); color: #fff;
    border-radius: var(--alif-radius); overflow: hidden;
    box-shadow: var(--alif-shadow-sm); transition: transform .3s ease, box-shadow .3s ease;
    display: flex; flex-direction: column;
}
.video-card:hover { transform: translateY(-6px); box-shadow: var(--alif-shadow); }
.video-card:focus-visible { outline: 3px solid var(--alif-gold); outline-offset: 2px; }
.video-poster { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.video-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-poster::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(10, 26, 18, .55), transparent 55%);
}
.play-badge {
    position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; z-index: 2;
    display: grid; place-items: center; border-radius: 50%;
    background: rgba(255, 255, 255, .18); backdrop-filter: blur(4px);
    border: 1.5px solid rgba(255, 255, 255, .6); color: #fff; font-size: 1.5rem;
    transition: all .3s ease;
}
.video-card:hover .play-badge {
    background: var(--alif-gold); border-color: var(--alif-gold); color: var(--alif-forest);
    transform: scale(1.08); box-shadow: 0 12px 30px -8px rgba(200, 162, 75, .8);
}
[dir="rtl"] .play-badge i { transform: scaleX(-1); }
.video-card .caption { padding: .85rem 1rem 1rem; }
.video-card .caption h3 {
    font-family: var(--alif-font-display); font-size: 1.02rem; font-weight: 600;
    color: #fff; margin: 0 0 .2rem; line-height: 1.25;
}
.video-card .caption p {
    margin: 0; font-size: .8rem; color: rgba(255, 255, 255, .68);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-card .dur {
    position: absolute; inset-block-start: .6rem; inset-inline-end: .6rem; z-index: 2;
    font-size: .7rem; font-weight: 700; letter-spacing: .05em;
    padding: .18rem .5rem; border-radius: 999px;
    background: rgba(10, 26, 18, .7); color: var(--alif-gold-200);
}

/* Bandeau vidéo à la une */
.video-hero {
    display: grid; grid-template-columns: 1.5fr 1fr; gap: 0;
    border-radius: var(--alif-radius-lg); overflow: hidden;
    background: var(--alif-forest); box-shadow: var(--alif-shadow); color: #fff;
}
.video-hero .stage { position: relative; cursor: pointer; aspect-ratio: 16 / 9; }
.video-hero .stage img { width: 100%; height: 100%; object-fit: cover; }
.video-hero .stage .play-badge { width: 84px; height: 84px; font-size: 2rem; }
.video-hero .side { padding: clamp(1.3rem, 3vw, 2.4rem); display: flex; flex-direction: column; justify-content: center; }
.video-hero .side .eyebrow { color: var(--alif-gold-200); }
.video-hero .side h2 { font-family: var(--alif-font-display); font-weight: 600; font-size: clamp(1.4rem, 2.6vw, 2rem); margin: .3rem 0 .6rem; }
.video-hero .side p { color: rgba(255, 255, 255, .78); margin: 0; }
@media (max-width: 800px) { .video-hero { grid-template-columns: 1fr; } }

/* ---------- Masonry album (surcharge fine) ---------- */
.album-masonry { columns: 3 300px; column-gap: 1rem; }
.album-masonry .m-item {
    display: block; break-inside: avoid; margin-bottom: 1rem; position: relative;
    border-radius: var(--alif-radius); overflow: hidden; box-shadow: var(--alif-shadow-sm);
    cursor: zoom-in; background: var(--alif-paper);
}
.album-masonry .m-item img { width: 100%; display: block; transition: transform .6s ease; }
.album-masonry .m-item:hover img { transform: scale(1.05); }
.album-masonry .m-item figcaption {
    position: absolute; inset-inline: 0; bottom: 0; margin: 0; padding: 1.4rem .9rem .8rem;
    font-size: .82rem; color: #fff; opacity: 0; transform: translateY(8px);
    background: linear-gradient(to top, rgba(12, 30, 20, .9), transparent);
    transition: opacity .3s ease, transform .3s ease;
}
.album-masonry .m-item:hover figcaption { opacity: 1; transform: translateY(0); }
.album-masonry .m-item .zoom-ico {
    position: absolute; top: .7rem; inset-inline-end: .7rem; width: 34px; height: 34px;
    display: grid; place-items: center; border-radius: 50%; color: #fff;
    background: rgba(10, 26, 18, .45); backdrop-filter: blur(3px);
    opacity: 0; transition: opacity .3s ease;
}
.album-masonry .m-item:hover .zoom-ico { opacity: 1; }
@media (max-width: 900px) { .album-masonry { columns: 2 200px; } }
@media (max-width: 560px) { .album-masonry { columns: 1; } }

/* ---------- Lightbox / Théâtre (partagé photos + vidéos) ---------- */
.alif-stage {
    position: fixed; inset: 0; z-index: 1080; display: none;
    background: rgba(6, 16, 11, .94); backdrop-filter: blur(6px);
}
.alif-stage.open { display: grid; grid-template-rows: 1fr auto; }
body.stage-open { overflow: hidden; }
.alif-stage .stage-close {
    position: absolute; top: 1rem; inset-inline-end: 1rem; z-index: 5;
    width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.4rem;
    display: grid; place-items: center; transition: background .2s ease;
}
.alif-stage .stage-close:hover { background: rgba(255, 255, 255, .25); }
.alif-stage .stage-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
    width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.5rem;
    display: grid; place-items: center; transition: background .2s ease;
}
.alif-stage .stage-nav:hover { background: var(--alif-gold); color: var(--alif-forest); }
.alif-stage .stage-nav.prev { inset-inline-start: clamp(.5rem, 3vw, 2rem); }
.alif-stage .stage-nav.next { inset-inline-end: clamp(.5rem, 3vw, 2rem); }
[dir="rtl"] .alif-stage .stage-nav i { transform: scaleX(-1); }
.alif-stage .stage-body {
    display: grid; place-items: center; padding: clamp(1rem, 4vw, 3rem);
    min-height: 0; overflow: hidden;
}
.alif-stage .stage-body img,
.alif-stage .stage-body video {
    max-width: min(94vw, 1280px); max-height: 100%; width: auto; height: auto;
    border-radius: 12px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
    background: #000;
}
.alif-stage .stage-caption {
    padding: 1rem clamp(1rem, 4vw, 3rem) 1.6rem; text-align: center; color: #fff;
}
.alif-stage .stage-caption .idx { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--alif-gold-200); }
.alif-stage .stage-caption h3 { font-family: var(--alif-font-display); font-weight: 500; font-size: 1.15rem; margin: .25rem 0 .1rem; }
.alif-stage .stage-caption p { margin: 0; color: rgba(255, 255, 255, .7); font-size: .88rem; }
.alif-stage .stage-body img { animation: stageIn .4s cubic-bezier(.2, .7, .2, 1); }
@keyframes stageIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .album-card img, .album-masonry .m-item img, .video-card, .alif-stage .stage-body img { transition: none; animation: none; }
}
