/* Build de secours (scripts/build-fallback.py) — remplacé par « npm run build ». */
@layer base, components, utilities;
@layer base {
  *, ::after, ::before, ::backdrop, ::file-selector-button { box-sizing: border-box; margin: 0; padding: 0; border: 0 solid; }
  html, :host { line-height: 1.5; -webkit-text-size-adjust: 100%; tab-size: 4; font-family: var(--font-sans); -webkit-tap-highlight-color: transparent; }
  hr { height: 0; color: inherit; border-top-width: 1px; }
  h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
  a { color: inherit; -webkit-text-decoration: inherit; text-decoration: inherit; }
  b, strong { font-weight: bolder; }
  ol, ul, menu { list-style: none; }
  img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; }
  img, video { max-width: 100%; height: auto; }
  button, input, select, optgroup, textarea, ::file-selector-button {
    font: inherit; font-feature-settings: inherit; font-variation-settings: inherit; letter-spacing: inherit;
    color: inherit; border-radius: 0; background-color: transparent; opacity: 1;
  }
  [hidden]:where(:not([hidden="until-found"])) { display: none !important; }
}
/* Les classes Tailwind sont détectées dans les gabarits PHP et les modules JS. */



/*
 * Identité visuelle : papier chaud, encre, un seul accent grenat.
 * Contrastes calculés (WCAG) : encre/papier ≈ 14:1, muted/papier ≥ 6:1, grenat/papier ≈ 7,7:1.
 */
:root {
    --color-paper: #f8f4ed;
    --color-mat: #ede3d6;
    --color-ink: #231d19;
    --color-muted: #5e524a;
    --color-garnet: #941d3a;
    --color-garnet-deep: #681329;

    --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@layer base {
    html {
        background: var(--color-paper);
        color-scheme: light;
        scroll-behavior: smooth;
        scroll-padding-top: 1rem;
        -webkit-text-size-adjust: 100%;
    }
    body {
        background: var(--color-paper);
        color: var(--color-ink);
        font-size: 1rem;
        line-height: 1.65;
    }
    body.dialog-open { overflow: hidden; }

    /* Hauteur du logo du bandeau : téléphone / à partir de 640 px / à partir de 1024 px. */
    :root { --logo-h: 3.25rem; }
    @media (min-width: 40rem) { :root { --logo-h: 4rem; } }
    @media (min-width: 64rem) { :root { --logo-h: 5rem; } }
    picture { display: block; }
    ::selection { background: var(--color-garnet); color: var(--color-paper); }

    /* Focus visible partout : grenat sur papier = 7,7:1 (minimum requis : 3:1). */
    :focus-visible {
        outline: 3px solid var(--color-garnet);
        outline-offset: 3px;
    }
    /* Décalage des ancres = hauteur de l'en-tête collant (logo + marges), pour qu'il ne masque pas les titres. */
    @media (min-width: 40rem) and (min-height: 40rem) {
        html { scroll-padding-top: calc(max(var(--logo-h), 2.75rem) + 1.75rem); }
    }
}

@layer components {
    .shell {
        width: 100%;
        max-width: 96rem;
        margin-inline: auto;
        padding-inline: clamp(1.25rem, 5vw, 4.5rem);
    }

    .skip-link {
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        z-index: 100;
        padding: 0.75rem 1rem;
        background: var(--color-ink);
        color: var(--color-paper);
        transform: translateY(-200%);
    }
    .skip-link:focus { transform: none; }

    /* En-tête collant seulement si l'écran est assez grand : sur téléphone, la place revient aux œuvres. */
    .site-header {
        position: relative;
        z-index: 30;
        background: var(--color-paper);
        border-bottom: 1px solid rgb(35 29 25 / 0.12);
    }
    @media (min-width: 40rem) and (min-height: 40rem) {
        .site-header { position: sticky; top: 0; }
    }
    @supports (backdrop-filter: blur(1px)) {
        @media (min-width: 40rem) and (min-height: 40rem) {
            .site-header { background: rgb(248 244 237 / 0.88); backdrop-filter: blur(12px); }
        }
    }
    @media (prefers-reduced-transparency: reduce) {
        .site-header { background: var(--color-paper); backdrop-filter: none; }
    }

    /* Le soulignement ne touche que le libellé (.nav-label) : jamais le compteur d'œuvres ni les flèches. */
    .nav-link {
        display: inline-flex;
        align-items: center;
        gap: 0.35em;
        min-height: 2.75rem;
    }
    .nav-label {
        text-decoration-color: var(--color-garnet);
        text-decoration-thickness: 2px;
        text-underline-offset: 0.45rem;
    }
    .nav-link:hover .nav-label { text-decoration-line: underline; }

    /* Logo du bandeau : la taille se règle avec --logo-h (voir :root dans « base »). */
    .site-logo {
        display: block;
        width: auto;
        height: var(--logo-h);
        max-width: min(18rem, 62vw);
        object-fit: contain;
    }

    .btn-link,
    .btn-solid {
        display: inline-flex;
        align-items: center;
        min-height: 2.75rem;
        font-weight: 600;
    }
    /* Lien d'action : seul le libellé (.btn-label) est souligné et réagit au survol ; les flèches restent fixes. */
    .btn-link { gap: 0.5rem; color: var(--color-garnet); }
    .btn-link .btn-label {
        text-decoration: underline;
        text-decoration-thickness: 2px;
        text-underline-offset: 0.35rem;
    }
    .btn-link:hover .btn-label { color: var(--color-garnet-deep); }
    .btn-solid {
        padding: 0 1.25rem;
        background: var(--color-garnet);
        color: var(--color-paper);
    }
    .btn-solid:hover { background: var(--color-garnet-deep); }

    .display-title {
        margin: 0;
        font-family: var(--font-serif);
        font-size: clamp(2.25rem, 5.2vw, 4.5rem);
        font-weight: 400;
        line-height: 1.05;
        letter-spacing: -0.02em;
        text-wrap: balance;
    }
    .section-title {
        margin: 0;
        font-family: var(--font-serif);
        font-size: clamp(2rem, 4.2vw, 3.25rem);
        font-weight: 400;
        line-height: 1.1;
        letter-spacing: -0.015em;
        text-wrap: balance;
    }

    /* Passe-partout : le fond sur lequel les toiles sont posées. */
    .mat {
        --mat-pad: clamp(0.5rem, 1.3vw, 1rem);
        position: relative;
        padding: var(--mat-pad);
        background: var(--color-mat);
        box-shadow: inset 0 0 0 1px rgb(35 29 25 / 0.08);
    }
    @media (prefers-contrast: more) {
        .mat { box-shadow: inset 0 0 0 2px var(--color-ink); }
    }

    /* Image entière, jamais recadrée : la hauteur est plafonnée, l'image reste centrée. */
    .fit-image {
        display: block;
        width: 100%;
        height: auto;
        max-height: var(--fit-max, min(75svh, 56rem));
        object-fit: contain;
    }
    .fit-image--portrait { --fit-max: 34rem; }

    /* Galerie : cadres réguliers 4:5 (défaut) ou proportions réelles (gallery_layout = natural). */
    .artwork-frame { display: block; }
    [data-layout="uniform"] .artwork-frame { aspect-ratio: 4 / 5; }
    [data-layout="uniform"] .artwork-frame picture {
        position: absolute;
        inset: var(--mat-pad);
    }
    [data-layout="uniform"] .artwork-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    [data-layout="natural"] .artwork-image { display: block; width: 100%; height: auto; }

    .recent-badge {
        position: absolute;
        top: calc(var(--mat-pad) + 0.5rem);
        left: calc(var(--mat-pad) + 0.5rem);
        padding: 0.35rem 0.55rem;
        background: var(--color-garnet);
        color: var(--color-paper);
        font-size: 0.8125rem;
        font-weight: 600;
        line-height: 1.1;
    }

    /* Apparition douce des œuvres situées hors de l'écran initial (activée par reveal.js uniquement). */
    [data-reveal] { transition: opacity 0.45s ease-out; }
    [data-reveal].is-pending { opacity: 0; }

    /* ---- Lightbox : <dialog> natif, disposition mobile d'abord ---- */
    .lightbox {
        width: 100%;
        max-width: none;
        height: 100dvh;
        max-height: none;
        margin: 0;
        padding: 0;
        border: 0;
        background: var(--color-ink);
        color: var(--color-paper);
        overflow: hidden;
    }
    .lightbox[open] {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    }
    .lightbox::backdrop { background: rgb(35 29 25 / 0.92); }
    .lightbox :focus-visible { outline-color: var(--color-paper); }
    .lightbox [hidden] { display: none !important; }

    .lightbox-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        min-height: 2.75rem;
    }
    .lightbox-figure {
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        gap: 0.75rem;
        min-width: 0;
        min-height: 0;
        margin: 0;
    }
    .lightbox-stage { position: relative; min-height: 0; min-width: 0; }
    .lightbox-image {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    .lightbox-caption { max-height: 38svh; overflow-y: auto; }
    .lightbox-link { color: inherit; text-decoration: underline; text-underline-offset: 0.3rem; }
    .lightbox-nav { display: flex; justify-content: space-between; }
    .lightbox-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 2.75rem;
        min-height: 2.75rem;
        padding: 0 1rem;
        border: 1px solid rgb(248 244 237 / 0.5);
        background: transparent;
        color: inherit;
        font: inherit;
        cursor: pointer;
    }
    .lightbox-btn:hover { background: var(--color-paper); color: var(--color-ink); }
    .lightbox-arrow { padding: 0; width: 2.75rem; font-size: 1.25rem; }

    @media (min-width: 48rem) {
        .lightbox[open] {
            grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem;
            grid-template-rows: auto minmax(0, 1fr);
            column-gap: 0.75rem;
            padding: 0.75rem 1rem 1rem;
        }
        .lightbox-bar { grid-column: 1 / -1; }
        .lightbox-nav { display: contents; }
        .lightbox-figure { grid-column: 2; grid-row: 2; }
        .lightbox-prev { grid-column: 1; grid-row: 2; align-self: center; justify-self: center; }
        .lightbox-next { grid-column: 3; grid-row: 2; align-self: center; justify-self: center; }
        .lightbox-caption { max-height: none; }
    }

    /*
     * Écran peu haut (téléphone en paysage) : flèches rangées dans la barre du haut, légende à droite de l'œuvre,
     * pour laisser le maximum de place à la peinture. L'ordre visuel reste l'ordre du DOM.
     */
    @media (min-width: 40rem) and (max-height: 32rem) {
        .lightbox[open] {
            grid-template-columns: minmax(0, 1fr) auto;
            grid-template-rows: auto minmax(0, 1fr);
            column-gap: 0.5rem;
            padding: 0.25rem 0.75rem 0.5rem;
        }
        .lightbox-bar { grid-column: 1; grid-row: 1; }
        .lightbox-nav { display: flex; gap: 0.5rem; grid-column: 2; grid-row: 1; }
        .lightbox-prev, .lightbox-next { grid-column: auto; grid-row: auto; align-self: auto; justify-self: auto; }
        .lightbox-figure {
            grid-column: 1 / -1;
            grid-row: 2;
            grid-template-rows: minmax(0, 1fr);
            grid-template-columns: minmax(0, 1fr) minmax(12rem, 17rem);
            gap: 1rem;
        }
        .lightbox-caption { align-self: end; max-height: 100%; }
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    [data-reveal] { transition: none; }
}
@layer utilities {
.block{display:block}
.flex{display:flex}
.grid{display:grid}
.inline-flex{display:inline-flex}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}
.flex-col{flex-direction:column}
.flex-wrap{flex-wrap:wrap}
.flex-1{flex:1}
.shrink-0{flex-shrink:0}
.items-baseline{align-items:baseline}
.items-center{align-items:center}
.items-end{align-items:flex-end}
.items-start{align-items:flex-start}
.justify-between{justify-content:space-between}
.justify-center{justify-content:center}
.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}
.mb-5{margin-bottom:1.25rem}
.mb-8{margin-bottom:2rem}
.min-h-11{min-height:2.75rem}
.min-h-12{min-height:3rem}
.min-h-72{min-height:18rem}
.ml-auto{margin-left:auto}
.mt-1{margin-top:0.25rem}
.mt-12{margin-top:3rem}
.mt-2{margin-top:0.5rem}
.mt-3{margin-top:0.75rem}
.mt-4{margin-top:1rem}
.mt-6{margin-top:1.5rem}
.mt-8{margin-top:2rem}
.pb-14{padding-bottom:3.5rem}
.pb-16{padding-bottom:4rem}
.pt-4{padding-top:1rem}
.pt-8{padding-top:2rem}
.py-16{padding-block:4rem}
.py-2{padding-block:0.5rem}
.py-20{padding-block:5rem}
.py-3{padding-block:0.75rem}
.py-8{padding-block:2rem}
.gap-10{gap:2.5rem}
.gap-4{gap:1rem}
.gap-6{gap:1.5rem}
.gap-8{gap:2rem}
.gap-x-3{column-gap:0.75rem}
.gap-x-4{column-gap:1rem}
.gap-x-6{column-gap:1.5rem}
.gap-x-8{column-gap:2rem}
.gap-y-0{row-gap:0rem}
.gap-y-1{row-gap:0.25rem}
.gap-y-12{row-gap:3rem}
.min-w-0{min-width:0}
.size-11{width:2.75rem;height:2.75rem}
.size-6{width:1.5rem;height:1.5rem}
.min-h-svh{min-height:100svh}
.max-w-\[34ch\]{max-width:34ch}
.max-w-\[40ch\]{max-width:40ch}
.max-w-\[48ch\]{max-width:48ch}
.max-w-\[60ch\]{max-width:60ch}
.max-w-\[62ch\]{max-width:62ch}
.max-w-\[70ch\]{max-width:70ch}
.font-serif{font-family:var(--font-serif)}
.font-semibold{font-weight:600}
.italic{font-style:italic}
.text-right{text-align:right}
.break-words{overflow-wrap:break-word}
.text-2xl{font-size:1.5rem;line-height:1.3333}
.text-3xl{font-size:1.875rem;line-height:1.2}
.text-\[0\.9375rem\]{font-size:0.9375rem}
.text-lg{font-size:1.125rem;line-height:1.5556}
.text-xl{font-size:1.25rem;line-height:1.4}
.leading-relaxed{line-height:1.625}
.leading-snug{line-height:1.375}
.leading-tight{line-height:1.25}
.tracking-wide{letter-spacing:.025em}
.underline-offset-4{text-underline-offset:4px}
.text-garnet{color:var(--color-garnet)}
.text-ink{color:var(--color-ink)}
.text-muted{color:var(--color-muted)}
.bg-mat{background-color:var(--color-mat)}
.bg-paper{background-color:var(--color-paper)}
.border-b{border-bottom-width:1px}
.border-b-2{border-bottom-width:2px}
.border-t{border-top-width:1px}
.border-garnet{border-color:var(--color-garnet)}
.border-ink\/15{border-color:rgb(35 29 25 / 0.15)}
@media (hover:hover){.hover\:underline:hover{text-decoration-line:underline}.hover\:text-garnet:hover{color:var(--color-garnet)}.hover\:text-garnet-deep:hover{color:var(--color-garnet-deep)}}
@media (hover:hover){.group:hover .group-hover\:underline{text-decoration-line:underline}}
@media (min-width:40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:text-2xl{font-size:1.5rem;line-height:1.3333}}
@media (min-width:48rem){.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:mb-12{margin-bottom:3rem}.md\:pb-20{padding-bottom:5rem}.md\:pb-24{padding-bottom:6rem}.md\:pt-14{padding-top:3.5rem}.md\:pt-8{padding-top:2rem}.md\:py-24{padding-block:6rem}.md\:py-32{padding-block:8rem}.md\:text-xl{font-size:1.25rem;line-height:1.4}}
@media (min-width:64rem){.lg\:items-center{align-items:center}.lg\:items-end{align-items:flex-end}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[minmax\(0\,5fr\)_minmax\(0\,6fr\)\]{grid-template-columns:minmax(0,5fr) minmax(0,6fr)}.lg\:grid-cols-\[minmax\(0\,6fr\)_minmax\(0\,4fr\)\]{grid-template-columns:minmax(0,6fr) minmax(0,4fr)}.lg\:grid-cols-\[minmax\(0\,7fr\)_minmax\(16rem\,4fr\)\]{grid-template-columns:minmax(0,7fr) minmax(16rem,4fr)}.lg\:pt-4{padding-top:1rem}.lg\:gap-14{gap:3.5rem}.lg\:gap-16{gap:4rem}.lg\:gap-20{gap:5rem}}
@media (min-width:96rem){.\32 xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}
}
