/* ========================================
   ÉDITION POÏMEN — SYSTÈME DE DESIGN « GALERIE »
   Minimaliste : blanc (ou noir), graphite, gris.
   Une seule famille : Hanken Grotesk.
   Mode clair et mode sombre (réglage de l'appareil
   ou bouton dans l'en-tête).
======================================== */


/* ========================================
   RESET
======================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* ========================================
   COULEURS — MODE CLAIR (par défaut)
======================================== */

:root {
    color-scheme: light;

    --bg: #FFFFFF;          /* fond */
    --band: #F5F5F4;        /* bandeaux (citation) */
    --fg: #1A1A1A;          /* texte principal, boutons */
    --body: #4A4A4A;        /* paragraphes (9:1) */
    --muted: #6E6E6E;       /* légendes, navigation (5:1) */
    --control: #8A8A8A;     /* contour des champs (3.5:1) */
    --line: #E4E4E2;        /* filets */
    --error: #B42318;       /* erreurs (6.5:1) */
    --success: #2F6B3A;

    --shadow-book: 0 30px 50px -24px rgba(0, 0, 0, 0.35);
    --shadow-book-front: 0 44px 70px -26px rgba(0, 0, 0, 0.45);
    --shadow-book-hover: 0 70px 80px -46px rgba(0, 0, 0, 0.4);

    /* Police */
    --font: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;

    /* Mise en page */
    --container: 1360px;
    --gutter: clamp(20px, 3.4vw, 48px);
    --section: clamp(96px, 11vw, 160px);

    /* Mouvement */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-book: cubic-bezier(0.16, 1, 0.3, 1);
}


/* ========================================
   COULEURS — MODE SOMBRE
   1) réglage de l'appareil (sauf si l'utilisateur a choisi « clair »)
   2) choix explicite avec le bouton (data-theme="dark")
======================================== */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --bg: #121212;
        --band: #1A1A19;
        --fg: #EDEDEB;
        --body: #C4C4C1;
        --muted: #9A9A97;
        --control: #6F6F6B;
        --line: #2A2A28;
        --error: #F28B82;
        --success: #8FD19E;

        --shadow-book: 0 30px 50px -20px rgba(0, 0, 0, 0.8);
        --shadow-book-front: 0 44px 70px -22px rgba(0, 0, 0, 0.9);
        --shadow-book-hover: 0 70px 80px -40px rgba(0, 0, 0, 0.9);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #121212;
    --band: #1A1A19;
    --fg: #EDEDEB;
    --body: #C4C4C1;
    --muted: #9A9A97;
    --control: #6F6F6B;
    --line: #2A2A28;
    --error: #F28B82;
    --success: #8FD19E;

    --shadow-book: 0 30px 50px -20px rgba(0, 0, 0, 0.8);
    --shadow-book-front: 0 44px 70px -22px rgba(0, 0, 0, 0.9);
    --shadow-book-hover: 0 70px 80px -40px rgba(0, 0, 0, 0.9);
}


/* ========================================
   BASE
======================================== */

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.4s ease, color 0.4s ease;
}

::selection {
    background: var(--fg);
    color: var(--bg);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

cite {
    font-style: italic;
}

h1,
h2,
h3 {
    font-weight: 300;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

/* Lien d'évitement (clavier) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 12px;
    z-index: 200;
    padding: 12px 18px;
    background: var(--fg);
    color: var(--bg);
    font-size: 15px;
    border-radius: 999px;
}

.skip-link:focus {
    left: 12px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}


/* ========================================
   TYPOGRAPHIE
======================================== */

/* Titre de page (hero) */
.display {
    font-size: clamp(2.6rem, 5.2vw, 4.9rem);
    font-weight: 300;
    line-height: 1.08;
    letter-spacing: -0.035em;
}

/* Titre de section */
.h2 {
    font-size: clamp(2rem, 3vw, 2.5rem);
    line-height: 1.15;
}

.h3 {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
}

/* Petit texte gris au-dessus d'un titre */
.kicker {
    font-size: 15px;
    color: var(--muted);
}

.lead {
    max-width: 44ch;
    font-size: 17px;
    line-height: 1.75;
    color: var(--body);
}

.muted {
    color: var(--muted);
}


/* ========================================
   BOUTONS ET LIENS
======================================== */

/* Bouton arrondi plein */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 52px;
    padding: 15px 30px;
    background: var(--fg);
    color: var(--bg);
    border: 1px solid var(--fg);
    border-radius: 999px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.5s var(--ease),
        color 0.5s var(--ease),
        transform 0.2s var(--ease);
    -webkit-tap-highlight-color: transparent;
}

/* Au survol, le bouton se vide */
.btn:hover {
    background: transparent;
    color: var(--fg);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}

/* Bouton contour */
.btn-outline {
    background: transparent;
    color: var(--fg);
}

.btn-outline:hover {
    background: var(--fg);
    color: var(--bg);
}

/* Lien souligné dont le trait s'écarte au survol */
.link {
    display: inline-block;
    padding-bottom: 4px;
    border-bottom: 1px solid currentColor;
    color: var(--fg);
    transition: padding-bottom 0.5s var(--ease);
}

.link:hover {
    padding-bottom: 8px;
}

/* Lien dans un texte courant */
.prose-link {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    transition: text-underline-offset 0.4s var(--ease);
}

.prose-link:hover {
    text-underline-offset: 7px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 40px;
    margin-top: 48px;
}


/* ========================================
   BLOCS PARTAGÉS
======================================== */

.section {
    padding-block: var(--section);
}

.section + .section-line,
.section-line {
    border-top: 1px solid var(--line);
}

/* Éventail de couvertures (accueil et page du livre) */
.fan {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-top: 48px;
}

.fan img {
    aspect-ratio: 2 / 3;
    object-fit: cover;
    box-shadow: var(--shadow-book);
}

.fan .fan-left {
    width: 33%;
    margin-right: -5%;
    transform: rotate(-6deg);
}

.fan .fan-center {
    position: relative;
    z-index: 1;
    width: 37%;
    transform: translateY(-28px);
    box-shadow: var(--shadow-book-front);
}

.fan .fan-right {
    width: 33%;
    margin-left: -5%;
    transform: rotate(6deg);
}

/* Deux couvertures seulement */
.fan--two .fan-left {
    width: 42%;
    margin-right: -6%;
    transform: rotate(-5deg);
}

.fan--two .fan-right {
    position: relative;
    z-index: 1;
    width: 46%;
    margin-left: 0;
    transform: translateY(-24px) rotate(3deg);
    box-shadow: var(--shadow-book-front);
}

/* Couverture posée seule, sans fond */
.cover {
    display: block;
    perspective: 1200px;
}

/* La couverture bouge en bloc : elle se soulève et s'incline
   légèrement vers la souris (--rx et --ry viennent de js/animations.js) */
.cover picture {
    position: relative;
    display: block;
    transform-style: preserve-3d;
    transition: transform 1.1s var(--ease);
}

.cover img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    box-shadow: var(--shadow-book);
    transition: box-shadow 1.1s var(--ease);
}

/* Reflet de lumière qui traverse la couverture */
.cover picture::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg,
        transparent 38%,
        rgba(255, 255, 255, 0.32) 50%,
        transparent 62%);
    background-size: 260% 100%;
    background-position: 130% 0;
    opacity: 0;
    pointer-events: none;
    transition:
        background-position 1.3s var(--ease),
        opacity 0.5s ease;
}


/* Couvertures de l'éventail : mouvements prêts pour le survol */
.fan img {
    position: relative;
    transition:
        transform 1.1s var(--ease-book),
        box-shadow 1.1s var(--ease-book);
}


/* ===== SURVOL (souris uniquement) ===== */

@media (hover: hover) and (pointer: fine) {

    /* Catalogue et volumes : survoler la carte entière anime le livre */
    :is(.book, .volume):hover .cover picture {
        transform:
            translateY(-14px)
            rotateX(var(--rx, 0deg))
            rotateY(var(--ry, 0deg));
    }

    :is(.book, .volume):hover .cover img {
        box-shadow: var(--shadow-book-hover);
    }

    :is(.book, .volume):hover .cover picture::after {
        background-position: -30% 0;
        opacity: 1;
    }

    /* Éventail : les livres s'écartent quand on approche */
    .fan:hover .fan-left   { transform: translateX(-10%) rotate(-10deg); }
    .fan:hover .fan-center { transform: translateY(-48px); }
    .fan:hover .fan-right  { transform: translateX(10%) rotate(10deg); }

    .fan--two:hover .fan-left  { transform: translateX(-8%) rotate(-8deg); }
    .fan--two:hover .fan-right { transform: translateX(6%) translateY(-36px) rotate(5deg); }

    /* … et celui qu'on survole passe devant et monte */
    .fan img:hover {
        z-index: 2;
        box-shadow: var(--shadow-book-hover);
    }

    .fan:hover .fan-left:hover   { transform: translateX(-10%) translateY(-24px) rotate(-7deg); }
    .fan:hover .fan-center:hover { transform: translateY(-64px); }
    .fan:hover .fan-right:hover  { transform: translateX(10%) translateY(-24px) rotate(7deg); }

    .fan--two:hover .fan-left:hover  { transform: translateX(-8%) translateY(-28px) rotate(-5deg); }
    .fan--two:hover .fan-right:hover { transform: translateX(6%) translateY(-52px) rotate(3deg); }
}

/* Bandeau de citation */
.quote-band {
    padding-block: var(--section);
    background: var(--band);
    transition: background-color 0.4s ease;
}

.big-quote {
    max-width: 22ch;
    font-size: clamp(2.3rem, 5vw, 4.75rem);
    font-weight: 300;
    font-style: italic;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.quote-cap {
    margin-top: 40px;
    font-size: 15px;
    color: var(--muted);
}

/* Auteur */
.author {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 64px 96px;
}

.author-photo {
    flex: 0 1 460px;
    min-width: 0;
    width: 460px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: 50% 18%;
}

.author-text {
    flex: 1 1 400px;
    min-width: 0;
}

.author-text .lead {
    max-width: 40ch;
    margin-top: 24px;
}

.author-text .link {
    margin-top: 32px;
}


/* ========================================
   ACCESSIBILITÉ
======================================== */

:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 4px;
}

[hidden] {
    display: none !important;
}


/* ========================================
   MOBILE
======================================== */

@media (max-width: 800px) {

    body {
        font-size: 16px;
    }

    .actions {
        margin-top: 36px;
    }

    .author-photo {
        flex-basis: 100%;
        width: 100%;
    }
}

@media (max-width: 480px) {

    .actions .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    body,
    .btn,
    .link,
    .prose-link,
    .cover img,
    .cover picture,
    .cover picture::after,
    .fan img,
    .quote-band {
        transition: none;
    }

    :is(.book, .volume):hover .cover picture,
    .fan:hover img {
        transform: none !important;
    }
}
