/* ==========================================================================
   TOILE DIGITALE - Pages projet (projets/*.html, générées par tools/gen_projets.py)
   S'appuie sur home.css (couleurs, typographie, en-tête, galerie, pied de page).
   ========================================================================== */

/* ---------- Tête : titre + lecteur sur fond de salle obscure ---------- */
.p-hero {
    padding: clamp(7.5rem, 12vw, 10rem) 0 clamp(3rem, 6vw, 5rem);
    background: var(--nuit);
    color: var(--alabaster);
}

.p-back {
    display: inline-block;
    margin-bottom: 2rem;
    font-size: .9rem;
    color: var(--vanilla);
    text-decoration: none;
}

.p-back:hover {
    color: var(--alabaster);
    text-decoration: underline;
    text-underline-offset: .25em;
}

.p-cat a {
    display: inline-block;
    padding: .4rem .9rem;
    border: 1px solid var(--line-dark);
    border-radius: 999px;
    font-size: .85rem;
    color: var(--taupe);
    text-decoration: none;
    transition: border-color .3s var(--ease), color .3s var(--ease);
}

.p-cat a:hover {
    border-color: var(--taupe);
    color: var(--alabaster);
}

.p-hero h1 {
    max-width: 18em;
    margin-top: 1.25rem;
    font-size: clamp(2.6rem, 6vw, 5.5rem);
    line-height: .98;
}

.p-sub {
    margin-top: 1rem;
    font-size: 1.05rem;
    color: var(--vanilla);
}

.p-player {
    margin-top: clamp(2.5rem, 5vw, 4rem);
}

.p-player video {
    display: block;
    background: #000;
    border-radius: 4px;
}

.p-player.is-horizontal video {
    width: 100%;
    aspect-ratio: 16 / 9;
}

/* Vidéo verticale : centrée, à hauteur d'écran, jamais plus large que la colonne */
.p-player.is-vertical video {
    height: min(82vh, 60rem);
    max-width: 100%;
    aspect-ratio: 9 / 16;
    margin-inline: auto;
    object-fit: contain;
}

/* ---------- Fiche + description ---------- */
.p-info {
    padding-block: clamp(4rem, 8vw, 6.5rem);
}

.p-info-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    gap: clamp(2.5rem, 6vw, 6rem);
    align-items: start;
}

.p-fiche {
    display: grid;
}

.p-fiche div {
    padding: .95rem 0;
    border-top: 1px solid var(--line-light);
}

.p-fiche div:last-child {
    border-bottom: 1px solid var(--line-light);
}

.p-fiche dt {
    font-size: .8rem;
    font-weight: 500;
    color: var(--cinereous);
}

.p-fiche dd {
    margin-top: .15rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--nuit);
}

.p-desc {
    display: grid;
    gap: 1.25rem;
    max-width: 38rem;
}

.p-desc > p:first-child {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.4vw, 2.1rem);
    line-height: 1.25;
    color: var(--nuit);
}

.p-quote {
    margin-top: 1.5rem;
    padding: 1.75rem 0 0;
    border-top: 1px solid var(--line-light);
}

.p-quote blockquote {
    font-family: var(--font-display);
    font-size: 1.3rem;
    line-height: 1.45;
    color: var(--liver);
}

.p-quote blockquote::before {
    content: '« ';
    color: var(--taupe);
}

.p-quote blockquote::after {
    content: ' »';
    color: var(--taupe);
}

.p-quote figcaption {
    margin-top: .9rem;
    font-size: .9rem;
    font-weight: 500;
}

.p-quote figcaption a {
    text-decoration: none;
}

.p-quote figcaption span {
    margin-left: .4rem;
    font-weight: 400;
    color: var(--cinereous);
}

/* ---------- Images du projet ---------- */
.p-stills {
    padding-bottom: clamp(4rem, 8vw, 6.5rem);
}

.p-stills-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(.75rem, 1.5vw, 1.25rem);
}

.p-stills-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    background: var(--nuit);
}

.p-stills.is-horizontal img {
    aspect-ratio: 16 / 9;
}

.p-stills.is-vertical img {
    aspect-ratio: 9 / 16;
}

.p-stills-grid.n1 {
    grid-template-columns: minmax(0, 1fr);
    max-width: 60rem;
}

/* ---------- Appel au contact ---------- */
.p-cta {
    padding-block: clamp(3.5rem, 7vw, 5.5rem);
    background: var(--nuit-2);
    color: var(--alabaster);
}

.p-cta-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.75rem 3rem;
}

.p-cta h2 {
    max-width: 16em;
    font-size: clamp(1.9rem, 3.6vw, 3rem);
}

.p-cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
}

/* ---------- Autres réalisations + projet précédent / suivant ---------- */
.p-others .gallery .work-cta {
    opacity: 1;
    transform: none;
}

.p-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: clamp(3rem, 5vw, 4rem);
    padding-top: 2rem;
    border-top: 1px solid var(--line-dark);
}

.p-pager a {
    display: grid;
    gap: .25rem;
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    line-height: 1.2;
    color: var(--alabaster);
    text-decoration: none;
}

.p-pager a[rel="next"] {
    text-align: right;
}

.p-pager small {
    font-family: var(--font-body);
    font-size: .82rem;
    color: var(--taupe);
}

.p-pager a[rel="prev"] small::before {
    content: '← ';
}

.p-pager a[rel="next"] small::after {
    content: ' →';
}

.p-pager a:hover {
    color: var(--vanilla);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .p-info-grid {
        grid-template-columns: 1fr;
    }

    .p-desc {
        order: -1;
    }
}

@media (max-width: 560px) {
    .p-player.is-vertical video {
        height: auto;
        width: 100%;
    }

    .p-stills.is-vertical .p-stills-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .p-stills.is-vertical .p-stills-grid img:nth-child(3) {
        display: none;
    }

    .p-stills.is-horizontal .p-stills-grid {
        grid-template-columns: 1fr;
    }

    .p-pager {
        grid-template-columns: 1fr;
    }

    .p-pager a[rel="next"] {
        text-align: left;
    }
}

/* ==========================================================================
   Collection « Tableaux animés » : grille de grandes cartes (façon artgp.fr)
   et lecteur en surimpression avec la fiche de l'œuvre
   ========================================================================== */
.tb-intro {
    max-width: 40rem;
    margin-top: 1.5rem;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.2vw, 1.8rem);
    line-height: 1.3;
    color: var(--alabaster);
}

.tb-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(.75rem, 1.5vw, 1.25rem);
    margin-top: clamp(2.5rem, 5vw, 4rem);
}

.tb-card {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 4px;
    background: var(--nuit-2);
    color: var(--alabaster);
    text-align: left;
    cursor: pointer;
    isolation: isolate;
}

.tb-card video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--pos, center 35%);
    z-index: -2;
    transition: transform 1.2s var(--ease);
}

.tb-card::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(0deg, rgba(43, 35, 39, .88) 0%, rgba(43, 35, 39, .35) 32%, rgba(43, 35, 39, 0) 55%);
}

.tb-card-text {
    position: absolute;
    left: clamp(1.25rem, 2.5vw, 2rem);
    right: 5rem;
    bottom: clamp(1.1rem, 2.2vw, 1.75rem);
    display: grid;
    gap: .3rem;
}

.tb-card-meta {
    font-size: .85rem;
    color: var(--vanilla);
}

.tb-card-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.6vw, 2.2rem);
    line-height: 1.1;
}

.tb-card-play {
    position: absolute;
    right: clamp(1.25rem, 2.5vw, 2rem);
    bottom: clamp(1.1rem, 2.2vw, 1.75rem);
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border: 1px solid rgba(242, 236, 224, .6);
    border-radius: 50%;
    transition: background-color .3s var(--ease), color .3s var(--ease);
}

.tb-card-play svg {
    width: 18px;
    height: 18px;
    margin-left: 2px;
}

.tb-card:hover video,
.tb-card:focus-visible video {
    transform: scale(1.04);
}

.tb-card:hover .tb-card-play,
.tb-card:focus-visible .tb-card-play {
    background: var(--alabaster);
    color: var(--nuit);
}

/* ---------- Lecteur ---------- */
.tb-viewer {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 3vw, 2.5rem);
    background: rgba(28, 22, 25, .96);
    opacity: 0;
    transition: opacity .3s var(--ease);
}

.tb-viewer[hidden] {
    display: none;
}

.tb-viewer.is-open {
    opacity: 1;
}

.tb-v-inner {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(18rem, 26rem);
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: center;
    max-width: 100%;
    max-height: 100%;
}

.tb-viewer.is-horizontal .tb-v-inner {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
    width: min(100%, 90rem);
}

.tb-v-stage video {
    display: block;
    height: min(86vh, 58rem);
    aspect-ratio: 9 / 16;
    max-width: 100%;
    background: #000;
    border-radius: 4px;
}

.tb-viewer.is-horizontal .tb-v-stage video {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
}

.tb-v-info {
    color: var(--alabaster);
}

.tb-v-count {
    font-size: .85rem;
    color: var(--taupe);
}

.tb-v-info h2 {
    margin-top: .6rem;
    font-size: clamp(1.9rem, 3vw, 2.8rem);
    line-height: 1.05;
}

.tb-v-scene {
    margin-top: 1rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    line-height: 1.4;
    color: var(--vanilla);
}

.tb-v-fiche {
    margin-top: 1.5rem;
}

.tb-v-fiche div {
    border-top-color: var(--line-dark);
}

.tb-v-fiche div:last-child {
    border-bottom-color: var(--line-dark);
}

.tb-v-fiche dt {
    color: var(--taupe);
}

.tb-v-fiche dd {
    color: var(--alabaster);
}

.tb-v-nav {
    display: flex;
    gap: .6rem;
    margin-top: 1.75rem;
}

.tb-v-nav button,
.tb-v-close {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(242, 236, 224, .45);
    border-radius: 50%;
    background: transparent;
    color: var(--alabaster);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color .3s var(--ease), color .3s var(--ease);
}

.tb-v-nav button:hover,
.tb-v-close:hover {
    background: var(--alabaster);
    color: var(--nuit);
}

.tb-v-close {
    position: fixed;
    top: clamp(.75rem, 2vw, 1.5rem);
    right: clamp(.75rem, 2vw, 1.5rem);
    font-size: 1.8rem;
    line-height: 1;
}

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

    .tb-viewer {
        place-items: start center;
        overflow-y: auto;
        padding-top: 4.5rem;
    }

    .tb-v-inner,
    .tb-viewer.is-horizontal .tb-v-inner {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .tb-v-stage video {
        width: 100%;
        height: auto;
        max-height: 70vh;
        margin-inline: auto;
    }
}
