/* Page d'un projet (single.php).
   La base (fond, titre, bloc de fin, bouton, entrée) sert aussi à la liste des projets : voir css/projets.css */

.lc-projet{
    /* Trois largeurs : le texte, les images (plus larges), l'en-tête (toute la grille du site) */
    --texte: 42rem;
    --large: 64rem;

    position: relative;
    isolation: isolate;
    padding-top: calc(var(--nav-h) + clamp(2.5rem, 6vw, 4.5rem));
    padding-bottom: clamp(4rem, 9vw, 7rem);
    overflow-x: clip;
    color: var(--c-ink);
    font-size: 1rem;
    line-height: 1.6;
}

/* Une touche de couleur : un halo vert (et un soupçon de magenta) derrière l'en-tête,
   le même esprit que le hero de l'accueil, en très léger */
.lc-projet::before{
    content: "";
    position: absolute;
    inset: 0 0 auto;
    z-index: -1;
    height: min(48rem, 100%);
    background:
        radial-gradient(ellipse 55% 70% at 85% 10%, color-mix(in srgb, var(--c-green) 38%, transparent), transparent 70%),
        radial-gradient(ellipse 40% 55% at 5% 0%, color-mix(in srgb, var(--c-green) 20%, transparent), transparent 70%),
        radial-gradient(ellipse 30% 40% at 55% 0%, color-mix(in srgb, var(--c-magenta) 9%, transparent), transparent 70%);
    pointer-events: none;
}

/* Remises à zéro en :where() pour ne pas peser sur la spécificité */
:where(.lc-projet) :is(ul, ol, dl, dd, figure, p){
    margin: 0;
}

:where(.lc-projet) img{
    max-width: 100%;
    height: auto;
}

.lc-projet a{
    color: var(--c-green-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.lc-projet a:hover{
    color: var(--c-ink-deep);
}

/* ---------- En-tête ---------- */

.lc-fin,
.lc-voisins{
    width: 100%;
    max-width: calc(var(--container) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* La carte du projet : titre, fiche, bannière et contenu sur un fond blanc à 50 %,
   avec une ombre à peine perceptible, pour les détacher du fond de la page */
.lc-projet__article{
    --marge: clamp(1.25rem, 4vw, 4rem);

    width: min(100% - 2 * var(--gutter), var(--container));
    margin-inline: auto;
    padding: var(--marge);
    background: color-mix(in srgb, var(--c-white) 50%, transparent);
    box-shadow: 0 1.5rem 4rem color-mix(in srgb, var(--c-ink-deep) 5%, transparent);
}

.lc-projet .lc-projet__retour{
    display: block;
    width: min(100% - 2 * var(--gutter), var(--container));
    margin: 0 auto clamp(1.25rem, 3vw, 2rem);
    color: var(--c-ink);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
}

.lc-projet .lc-projet__retour:hover{
    text-decoration: underline;
}

.lc-projet .lc-projet__titre{
    max-width: 52rem;
    margin: 0;
    color: var(--c-ink-deep);
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 5vw, 4rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: 0;
    text-wrap: balance;
}

/* Fiche du projet : quelques repères alignés sous un filet */
.lc-fiche{
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem clamp(2rem, 6vw, 5rem);
    margin-top: clamp(2rem, 5vw, 3.5rem);
    padding-top: 1.25rem;
    border-top: 1px solid color-mix(in srgb, var(--c-ink) 25%, transparent);
}

.lc-fiche dt{
    margin-bottom: 0.25rem;
    color: color-mix(in srgb, var(--c-ink) 70%, transparent);
    font-size: 0.875rem;
    font-weight: 400;
}

.lc-fiche dd{
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.3;
}

.lc-fiche time{
    display: inline-block;
}

.lc-fiche time::first-letter{
    text-transform: uppercase;
}

.lc-fiche__liste{
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    padding: 0;
    list-style: none;
}

.lc-projet .lc-fiche a{
    color: inherit;
}

.lc-projet .lc-fiche a:hover{
    color: var(--c-green-text);
}

/* ---------- Rappel de l'en-tête pendant la lecture ---------- */

/* Une bande en haut de l'écran : le titre en petit à gauche, la date et les prestations à droite.
   Sur grand écran la navigation (centrée) se pose au milieu, entre les deux. */
.lc-barre{
    position: fixed;
    inset: 0 0 auto;
    z-index: 9998; /* juste sous la navigation */
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34rem minmax(0, 1fr);
    align-items: center;
    height: calc(var(--nav-h) + 1.5rem);
    padding-inline: var(--gutter);
    border-bottom: 1px solid color-mix(in srgb, var(--c-ink) 15%, transparent);
    background: color-mix(in srgb, var(--c-cream) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--c-ink-deep);
    visibility: hidden;
    opacity: 0;
    translate: 0 -100%;
    transition: translate 400ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 300ms ease, visibility 400ms;
}

.lc-barre.is-visible{
    visibility: visible;
    opacity: 1;
    translate: 0;
}

.lc-barre p{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lc-barre__titre{
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.3;
}

.lc-barre__meta{
    grid-column: 3;
    color: color-mix(in srgb, var(--c-ink) 75%, transparent);
    font-size: 0.875rem;
    text-align: right;
}

.lc-barre__meta span:first-child::first-letter{
    text-transform: uppercase;
}

.lc-barre__meta span:first-child{
    display: inline-block;
}

.lc-barre__cats::before{
    content: "·";
    margin-inline: 0.5rem;
}

/* Bannière : les miniatures sont des bandeaux, on garde leur format au lieu de les étirer.
   Sur petit écran le bandeau deviendrait un trait : on impose une hauteur minimale et on recadre. */
.lc-projet__banniere{
    margin-top: clamp(2rem, 5vw, 3.5rem);
}

.lc-projet .lc-projet__banniere img{
    display: block;
    width: 100%;
    min-height: 9rem;
    aspect-ratio: 6.5 / 1;
    border-radius: var(--r-md);
    object-fit: cover;
}

/* ---------- Corps de l'article (blocs WordPress) ---------- */

/* Deux pistes : le texte reste étroit pour la lecture, les images sont plus larges */
.lc-prose{
    display: grid;
    grid-template-columns:
        [large-start] minmax(0, 1fr)
        [texte-start] min(var(--texte), 100%) [texte-end]
        minmax(0, 1fr) [large-end];
    width: min(100%, var(--large));
    margin: clamp(3rem, 7vw, 5rem) auto 0;
    font-size: 1.125rem;
    line-height: 1.7;
}

.lc-prose > *{
    grid-column: texte;
    min-width: 0;
    margin-block: 1.25rem 0;
}

.lc-prose > :first-child{
    margin-top: 0;
}

/* Le premier paragraphe sert de chapeau */
.lc-prose > p:first-child{
    font-size: 1.375rem;
    line-height: 1.5;
}

.lc-projet .lc-prose :is(h2, h3, h4){
    color: var(--c-ink-deep);
    font-weight: 400;
    letter-spacing: 0;
    text-wrap: balance;
}

.lc-projet .lc-prose h2{
    margin-top: clamp(3rem, 7vw, 4.5rem);
    font-family: var(--font-display);
    font-size: clamp(1.875rem, 4vw, 2.75rem);
    line-height: 1.1;
}

.lc-projet .lc-prose h3{
    margin-top: 2.5rem;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    line-height: 1.2;
}

.lc-projet .lc-prose h4{
    margin-top: 2rem;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.3;
}

/* Un titre et ce qui le suit restent proches */
.lc-prose > :is(h2, h3, h4) + *{
    margin-top: 0.75rem;
}

.lc-prose strong{
    font-weight: 700;
}

.lc-projet .lc-prose :is(ul, ol){
    display: grid;
    gap: 0.5rem;
    padding-left: 1.25rem;
}

.lc-prose li::marker{
    color: var(--c-green-text);
}

/* Images et galeries : sur la piste large */
.lc-prose > :is(figure, .wp-block-gallery, .wp-block-image, .wp-block-embed, .wp-block-video){
    grid-column: large;
    margin-top: 2.5rem;
}

.lc-prose > :is(figure, .wp-block-gallery, .wp-block-image) + *{
    margin-top: 2.5rem;
}

.lc-prose .wp-block-image img{
    display: block;
    width: 100%;
    border-radius: var(--r-md);
}

.lc-prose .wp-block-gallery{
    --wp--style--unstable-gallery-gap: 1rem;
}

.lc-prose figcaption{
    margin-top: 0.75rem;
    color: color-mix(in srgb, var(--c-ink) 70%, transparent);
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: center;
}

.lc-projet .lc-prose blockquote{
    margin-inline: 0;
    padding: 0 0 0 1.5rem;
    border: 0;
    border-left: 3px solid var(--c-green);
    font-family: var(--font-serif);
    font-size: 1.375rem;
    font-style: normal;
    line-height: 1.4;
}

.lc-prose hr{
    width: 100%;
    height: 1px;
    margin-top: 3rem;
    border: 0;
    background: color-mix(in srgb, var(--c-ink) 25%, transparent);
}

/* ---------- Fin de page : appel au contact ---------- */

.lc-fin{
    display: grid;
    justify-items: center;
    gap: 1rem;
    margin-top: clamp(4rem, 10vw, 8rem);
    text-align: center;
}

.lc-projet .lc-fin__titre{
    margin: 0;
    color: var(--c-ink-deep);
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: 0;
    text-wrap: balance;
}

.lc-fin p{
    font-size: 1.125rem;
}

.lc-projet .lc-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    margin-top: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--r-sm);
    background: var(--c-ink);
    color: var(--c-cream-light);
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    transition: transform 200ms ease, background-color 200ms ease;
}

.lc-projet .lc-btn:hover{
    transform: scale(0.97);
    background: var(--c-ink-deep);
    color: var(--c-cream-light);
}

/* ---------- Projet précédent / suivant ---------- */

.lc-voisins{
    margin-top: clamp(4rem, 10vw, 8rem);
}

.lc-voisins ul{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 0 0;
    border-top: 1px solid color-mix(in srgb, var(--c-ink) 25%, transparent);
    list-style: none;
}

/* Le projet suivant reste à droite même quand il est seul */
.lc-voisin--suivant{
    grid-column: 2;
    text-align: right;
}

.lc-projet .lc-voisin a{
    display: grid;
    gap: 0.5rem;
    color: var(--c-ink-deep);
    text-decoration: none;
}

.lc-voisin__sens{
    color: color-mix(in srgb, var(--c-ink) 70%, transparent);
    font-size: 0.875rem;
}

.lc-voisin__titre{
    font-family: var(--font-serif);
    font-size: clamp(1.25rem, 2.2vw, 1.75rem);
    line-height: 1.2;
    text-wrap: balance;
}

.lc-voisin a:hover .lc-voisin__titre{
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

/* Le bandeau du projet, à son format, sous le titre */
.lc-projet .lc-voisin__img{
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    aspect-ratio: 4 / 1;
    border-radius: var(--r-md);
    object-fit: cover;
    transition: scale 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lc-voisin a:hover .lc-voisin__img{
    scale: 1.02;
}

/* ---------- Entrée à l'arrivée sur la page ---------- */

/* La carte arrive, puis le titre, la fiche, la bannière et le contenu montent l'un après l'autre.
   En CSS pur : rien ne reste caché si le script ne se charge pas. */
.lc-projet__retour,
.lc-projet__article,
.lc-projet__titre,
.lc-fiche,
.lc-projet__banniere,
.lc-prose{
    animation: lc-entree 800ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.lc-projet__titre{ animation-delay: 80ms; }
.lc-fiche{ animation-delay: 180ms; }
.lc-projet__banniere{ animation-delay: 280ms; }
.lc-prose{ animation-delay: 400ms; }

/* Le halo de couleur arrive en fondu, un peu plus lentement */
.lc-projet::before{
    animation: lc-fondu 1400ms ease both;
}

@keyframes lc-entree{
    from{ opacity: 0; translate: 0 2rem; }
}

@keyframes lc-fondu{
    from{ opacity: 0; }
}

/* ---------- Apparitions au défilement (js/single.js) ---------- */

.lc-apparait{
    transition: opacity 700ms ease, translate 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lc-apparait.is-cache{
    opacity: 0;
    translate: 0 2rem;
}

/* ---------- Responsive ---------- */

/* 1100 px, le seuil du menu burger (css/header.css) : la navigation est une barre pleine largeur,
   le rappel se colle dessous */
@media (max-width: 68.75rem){
    .lc-barre{
        display: flex;
        justify-content: space-between;
        gap: 1.5rem;
        height: auto;
        padding-top: calc(var(--nav-h) + 0.625rem);
        padding-bottom: 0.625rem;
    }

    .lc-barre__meta{
        flex: none;
    }
}

@media (max-width: 48rem){
    /* Le rappel se passe des prestations */
    .lc-barre__titre{
        font-size: 1rem;
    }

    .lc-barre__cats{
        display: none;
    }

    .lc-prose{
        font-size: 1.0625rem;
    }

    .lc-prose > p:first-child{
        font-size: 1.1875rem;
    }

    .lc-voisins ul{
        grid-template-columns: minmax(0, 1fr);
        gap: 2.5rem;
    }

    .lc-voisin--suivant{
        grid-column: auto;
        text-align: left;
    }

    .lc-projet .lc-btn{
        width: 100%;
    }
}

/* Écrans tactiles : les liens isolés sont assez hauts pour être touchés du doigt (44 px) */
@media (pointer: coarse){
    .lc-projet .lc-projet__retour{
        padding-block: 0.625rem;
    }

    .lc-projet .lc-fiche a{
        display: inline-flex;
        align-items: center;
        gap: 0.3em; /* l'espace entre le texte et la flèche, que la mise en ligne flexible supprime */
        min-height: 2.75rem;
    }

    .lc-fiche dt{
        margin-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce){
    .lc-projet::before,
    .lc-projet__retour,
    .lc-projet__article,
    .lc-projet__titre,
    .lc-fiche,
    .lc-projet__banniere,
    .lc-prose{
        animation: none;
    }

    .lc-apparait,
    .lc-barre,
    .lc-projet .lc-btn,
    .lc-projet .lc-voisin__img{
        transition: none;
    }
}
