/* Container principal */
.poem-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 2rem;
    text-align: left;
    display: flex;
    flex-direction: column;
}

/* Titre du poème */
.poem-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.poem-title {
    font-size: 2.2rem;
    font-family: 'Crimson Pro', serif;
    font-weight: 500;
    color: var(--text-night);
    margin-bottom: 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
    flex: 1;
}

/* Container pour le bouton like */
.poem-like-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Cœur en haut - visible par défaut */
.poem-like-container {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Cœur en haut - caché quand on scroll vers le bas */
.poem-like-container.hidden {
    opacity: 0;
    transform: translateY(-10px) scale(0.9);
    pointer-events: none;
}

/* Container pour le bouton like en bas */
.poem-like-container-bottom {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.9);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 680px;
    width: 100%;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

/* Cœur en bas - visible quand on scroll vers le bas */
.poem-like-container-bottom.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

/* Animation d'apparition du cœur en bas - seulement au premier affichage */
.poem-like-container-bottom.visible:not(.heart-clicked) .poem-heart-bottom {
    animation: heartAppearBottom 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heartAppearBottom {
    0% {
        transform: scale(0.8) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* S'assurer que l'animation heartAnim a la priorité sur heartAppearBottom */
.poem-heart-bottom.on {
    animation: heartAnim 1s steps(28) forwards !important;
}

/* Animation d'apparition du cœur en haut - seulement quand il réapparaît */
.poem-like-container.appearing .poem-heart {
    animation: heartAppearTop 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heartAppearTop {
    0% {
        transform: scale(0.8) rotate(10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Bouton cœur avec animation */
.poem-heart,
.poem-heart-bottom {
    background-image: url(/img/web_heart_animation.png);
    background-position: left top;
    background-repeat: no-repeat;
    background-size: 2900%;
    cursor: pointer;
    display: block;
    width: 50px;
    height: 50px;
    border: none;
    padding: 0;
    background-color: transparent;
    position: relative;
    transition: transform 0.2s ease;
}

.poem-heart:hover,
.poem-heart-bottom:hover {
    background-position: right top;
    transform: scale(1.1);
}

.poem-heart.on {
    animation: heartAnim 1s steps(28) forwards;
}

/* L'animation pour le cœur en bas est déjà définie plus haut avec !important */

@keyframes heartAnim {
    from {
        background-position: left top;
    }
    to {
        background-position: right top;
    }
}

/* État "liked" pour maintenir le cœur rempli après l'animation */
.poem-heart.liked,
.poem-heart-bottom.liked {
    background-position: right top;
}

.poem-likes-count {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Lora', serif;
    font-size: 0.75rem;
    color: rgba(231, 231, 231, 0.8);
    font-weight: 400;
    white-space: nowrap;
    pointer-events: none;
}

html.day-mode .poem-likes-count {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .poem-title-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .poem-like-container {
        align-self: flex-end;
    }

    .poem-heart {
        width: 45px;
        height: 45px;
    }

    .poem-like-container-bottom {
        bottom: 1.5rem;
        padding: 0 1.5rem;
    }

    .poem-heart-bottom {
        width: 45px;
        height: 45px;
    }
}

html.day-mode .poem-title {
    color: var(--text-primary);
}

.poem-title::selection {
    background: rgba(139, 116, 169, 0.4);
    color: #E7E7E7;
}

.poem-title::-moz-selection {
    background: rgba(139, 116, 169, 0.4);
    color: #E7E7E7;
}

html.day-mode .poem-title::selection {
    background: rgba(200, 162, 200, 0.35);
    color: #1A1A1A;
}

html.day-mode .poem-title::-moz-selection {
    background: rgba(200, 162, 200, 0.35);
    color: #1A1A1A;
}

/* Auteur */
.poem-author {
    font-size: 1rem;
    color: rgba(231, 231, 231, 0.7);
    margin-bottom: 1rem;
    font-family: 'Lora', serif;
}

html.day-mode .poem-author {
    color: var(--text-secondary);
}

.poem-author a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
}

.poem-author a:hover {
    opacity: 0.8;
}

/* Design tokens pour le footer */
:root {
    --color-text-main: rgba(231, 231, 231, 0.85);
    --color-ui-muted: rgba(231, 231, 231, 0.6);
    --color-border-soft: rgba(224, 214, 202, 0.3);
    --color-chip-bg: rgba(231, 231, 231, 0.05);
    --color-chip-border: rgba(224, 214, 202, 0.25);
    --color-chip-text: rgba(231, 231, 231, 0.8);
    --color-button-bg: rgba(231, 231, 231, 0.08);
    --color-button-hover: rgba(231, 231, 231, 0.12);
    --color-action-text: rgba(231, 231, 231, 0.65);
    --color-divider: rgba(230, 224, 215, 0.4);
}

html.day-mode {
    --color-text-main: rgba(90, 82, 73, 0.9);
    --color-ui-muted: rgba(90, 82, 73, 0.6);
    --color-border-soft: rgba(224, 214, 202, 0.4);
    --color-chip-bg: rgb(247, 243, 236);
    --color-chip-border: rgba(224, 214, 202, 0.4);
    --color-chip-text: rgba(90, 82, 73, 0.9);
    --color-button-bg: #f7f3ec;
    --color-button-hover: #f3eee6;
    --color-action-text: rgba(180, 175, 167, 0.8);
    --color-divider: rgba(230, 224, 215, 0.7);
}

/* Texte du poème */
.poem-text-section {
    margin: 0;
}

.poem-body {
    display: block;
    font-family: 'Lora', 'Georgia', 'Times New Roman', serif;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
    white-space: pre-wrap;
    font-size: 18px;
    line-height: 1.75;
    color: var(--text-night);
    margin: 0;
    padding: 0;
    font-weight: 400;
    text-indent: 0;
    letter-spacing: 0;
    word-spacing: 0;
    word-break: break-word;
    max-width: 680px;
    text-align: left;
}

html.day-mode .poem-body {
    color: var(--text-primary);
}

.poem-body::selection {
    background: rgba(139, 116, 169, 0.4);
    color: #E7E7E7;
}

.poem-body::-moz-selection {
    background: rgba(139, 116, 169, 0.4);
    color: #E7E7E7;
}

html.day-mode .poem-body::selection {
    background: rgba(200, 162, 200, 0.35);
    color: #1A1A1A;
}

html.day-mode .poem-body::-moz-selection {
    background: rgba(200, 162, 200, 0.35);
    color: #1A1A1A;
}

/* .section-separator est défini dans common.css */

/* Article avec flex pour pousser le footer en bas */
.poem-container > article {
    flex: 1;
}

/* Séparateur et footer groupés pour rester en bas */
.poem-container .section-separator {
    margin-top: auto; /* Pousse le séparateur et le footer en bas */
}

/* Bas de page - Footer */
.poem-footer {
    max-width: 680px;
    padding: 0 1.5rem;
    text-align: center;
}

/* Métadonnées (chips) */
.poem-footer__meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 18px;
}

.poem-footer__meta-label {
    font-size: 0.875rem;
    color: rgba(231, 231, 231, 0.7);
    font-family: 'Lora', serif;
    font-style: italic;
    margin: 0;
    text-align: center;
}

html.day-mode .poem-footer__meta-label {
    color: var(--text-secondary);
}

.poem-footer__meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 10px;
    justify-content: center;
    align-items: center;
}

.poem-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(224, 214, 202, 0.35);
    background: transparent;
    font-size: 12px;
    letter-spacing: 0.03em;
    color: var(--text-night);
    text-decoration: none;
    font-family: 'Lora', serif;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    opacity: 0.75;
    box-shadow: none;
}

html.day-mode .poem-chip {
    color: var(--text-primary);
    background: transparent;
    border: 1px solid var(--border-button);
}

.poem-chip:hover {
    background: rgba(231, 231, 231, 0.08);
    border-color: rgba(224, 214, 202, 0.5);
    color: rgba(231, 231, 231, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    opacity: 1;
}

html.day-mode .poem-chip:hover {
    background: var(--bg-button-hover);
    border-color: var(--border-button);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Hover spécifiques pour chaque type */
.poem-chip--major:hover {
    background: rgba(231, 231, 231, 0.12);
    border-color: rgba(224, 214, 202, 0.6);
    opacity: 1;
}

html.day-mode .poem-chip--major:hover {
    background: rgba(247, 243, 236, 0.6);
    border-color: rgba(207, 196, 186, 0.7);
}

.poem-chip--emotion:hover {
    background: rgba(231, 231, 231, 0.06);
    border-color: rgba(224, 214, 202, 0.4);
    opacity: 0.85;
}

html.day-mode .poem-chip--emotion:hover {
    background: rgba(247, 243, 236, 0.3);
    border-color: rgba(207, 196, 186, 0.5);
}

.poem-chip--form:hover {
    background: rgba(231, 231, 231, 0.06);
    border-color: rgba(224, 214, 202, 0.5);
    border-style: dashed;
    opacity: 0.9;
}

html.day-mode .poem-chip--form:hover {
    background: rgba(247, 243, 236, 0.3);
    border-color: rgba(207, 196, 186, 0.6);
}

/* Effet hover sur le footer pour mettre tous les chips à opacité 1 */
.poem-footer.at-bottom:hover .poem-chip {
    opacity: 1 !important;
    color: rgba(90, 82, 73, 0.95);
}

html.day-mode .poem-footer.at-bottom:hover .poem-chip {
    color: rgba(90, 82, 73, 1);
}

/* Effet hover général sur le footer (même sans at-bottom) */
.poem-footer:hover .poem-chip {
    opacity: 1;
}

.poem-chip:focus {
    outline: none;
}

.poem-chip:active {
    transform: none;
    background: rgba(231, 231, 231, 0.08);
    outline: none;
}

html.day-mode .poem-chip:active {
    background: var(--bg-button-hover);
}

.poem-footer__separator {
    color: var(--color-border-soft);
    padding: 0 2px;
}

/* Bouton aléatoire */
.poem-random {
    margin: 8px auto 20px auto;
    min-height: 44px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-family: 'Lora', serif;
    font-weight: 400;
    color: var(--text-night);
    /* Contour fin (pas de fond plein) - couleur neutre */
    background: transparent;
    border: 1px solid rgba(224, 214, 202, 0.35);
    /* Forme arrondie douce */
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Pas d'ombre */
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none;
    text-decoration: none;
}

/* Sur mobile : styliser comme signet/carte papier */
@media (max-width: 768px) {
    .poem-random {
        margin: 12px auto 24px auto;
        padding: 12px 24px;
        border: 1px solid rgba(224, 214, 202, 0.25);
        border-radius: 8px;
        background: rgba(231, 231, 231, 0.02);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        transition: opacity 0.4s ease, transform 0.4s ease;
        transform: translateY(0);
    }

    html.day-mode .poem-random {
        background: rgba(247, 243, 236, 0.3);
        border-color: rgba(207, 196, 186, 0.3);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    }

    .poem-random:active {
        opacity: 0.7;
        transform: translateY(1px);
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .poem-random__label {
        font-size: 0.875rem;
    }
}

html.day-mode .poem-random {
    color: var(--text-primary);
    background: transparent;
    border: 1px solid var(--border-button);
}

/* Hover : effet doux avec variation de fond, bordure et couleur du texte */
.poem-random:hover:not(:disabled) {
    background: rgba(231, 231, 231, 0.08);
    border-color: rgba(224, 214, 202, 0.5);
    color: rgba(231, 231, 231, 0.95);
    transform: translateY(-1px);
}

html.day-mode .poem-random:hover:not(:disabled) {
    background: var(--bg-button-hover);
    border-color: var(--border-button);
    color: var(--text-primary);
}

.poem-random:active:not(:disabled) {
    transform: none;
    background: rgba(231, 231, 231, 0.08);
}

html.day-mode .poem-random:active:not(:disabled) {
    background: var(--bg-button-hover);
}

.poem-random__icon {
    width: 40px;
    object-fit: contain;
    opacity: 0.7;
}

/* Icône de parchemin spécifique */
.poem-random__icon[src*="parchment"] {
    width: 27px;
}

.poem-random:hover .poem-random__icon {
    opacity: 0.85;
}

.poem-random.loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

.poem-random:focus {
    outline: none;
}

.poem-random:focus-visible {
    outline: none;
}

/* Séparateur */
.poem-footer__divider {
    border: 0;
    border-top: 1px solid var(--color-divider);
    margin: 10px 0 10px 0;
    width: 100%;
}

/* Actions */
.poem-footer__actions,
.poem-footer__explore {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-auto-flow: row;
    justify-items: stretch;
    align-items: center;
    gap: 0;
    max-width: 100%;
    width: 100%;
}

.poem-footer__action {
    font-size: 12px;
    letter-spacing: 0.04em;
    color: #8d817a;
    text-decoration: none;
    font-family: 'Lora', serif;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    outline: none;
    white-space: nowrap;
}

/* Alignement des actions : texte à droite du point central (colonne 1) */
.poem-footer__action:has(+ .poem-footer__dot) {
    grid-column: 1;
    justify-self: end;
    padding-right: 8px;
    text-align: right;
}

/* Alignement des actions : texte à gauche du point central (colonne 3) */
.poem-footer__dot + .poem-footer__action {
    grid-column: 3;
    justify-self: start;
    padding-left: 15px;
    text-align: left;
}

/* Action seule (sans point) : centrée sur toute la largeur */
.poem-footer__action:only-child,
.poem-footer__action:first-child:last-child {
    grid-column: 1 / -1;
    justify-self: center;
    text-align: center;
    padding: 0;
}

.poem-footer__action:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
}

.poem-footer__action:focus,
.poem-footer__action:active {
    outline: none;
}

/* Alignement des séparateurs sur un axe vertical unique (colonne 2) */
.poem-footer__dot {
    color: var(--color-ui-muted);
    line-height: 1;
    vertical-align: baseline;
    grid-column: 2 !important;
    justify-self: center;
    width: 0;
    text-align: center;
    flex-shrink: 0;
    /* Tous les points sont forcés dans la colonne centrale (2), formant un axe vertical unique */
    /* Le !important garantit que cette règle est toujours appliquée, même sur plusieurs lignes */
}

/* Micro-texte "Poursuivre la lecture" sur mobile */
@media (max-width: 768px) {

    .poem-footer__actions,
    .poem-footer__explore {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 24px;
    }

    .poem-footer__action {
        font-size: 11px;
        padding: 8px 12px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(224, 214, 202, 0.2);
        border-radius: 4px;
        background: transparent;
        width: 100%;
        max-width: 280px;
    }

    .poem-footer__action:hover {
        background: rgba(231, 231, 231, 0.04);
        border-color: rgba(224, 214, 202, 0.3);
        text-decoration: none;
    }

    html.day-mode .poem-footer__action:hover {
        background: var(--bg-button-hover);
        border: 1px solid var(--border-button);
    }

    .poem-footer__dot {
        display: none;
    }
}

/* Bloc auteur */
.poem-author {
    margin-top: 2rem; /* 32px après le séparateur */
}

.poem-author .author-link {
    display: inline-block;
    color: rgba(231, 231, 231, 0.7);
    text-decoration: none;
    font-size: 0.9em;
    font-family: 'Lora', serif;
    transition: all 0.2s ease;
    outline: none;
}

html.day-mode .poem-author .author-link {
    color: var(--text-secondary);
}

.poem-author .author-link:focus,
.poem-author .author-link:active {
    outline: none;
}

.poem-author .author-link:hover {
    color: rgba(231, 231, 231, 0.9);
    text-decoration: underline;
}

html.day-mode .poem-author .author-link:hover {
    color: var(--text-primary);
}

.nav-arrow-horizontal {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(231, 231, 231, 0.05);
    border: 1px solid rgba(231, 231, 231, 0.1);
    border-radius: 50%;
    color: rgba(231, 231, 231, 0.4);
    text-decoration: none;
    font-size: 18px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
}

html.day-mode .nav-arrow-horizontal {
    background: rgba(26, 26, 26, 0.05);
    border-color: rgba(26, 26, 26, 0.1);
    color: rgba(26, 26, 26, 0.4);
}

.nav-arrow-horizontal.visible {
    opacity: 1;
    pointer-events: all;
}

.nav-arrow-horizontal:hover {
    background: rgba(231, 231, 231, 0.1);
    border-color: rgba(231, 231, 231, 0.2);
    color: rgba(231, 231, 231, 0.7);
}

html.day-mode .nav-arrow-horizontal:hover {
    background: rgba(26, 26, 26, 0.1);
    border-color: rgba(26, 26, 26, 0.2);
    color: rgba(26, 26, 26, 0.7);
}

.nav-arrow-prev {
    left: 2rem;
}

.nav-arrow-next {
    right: 2rem;
}

/* Masquer les flèches de navigation sur mobile */
@media (max-width: 768px) {
    .nav-arrow-horizontal {
        display: none !important;
    }
}

.nav-link {
    color: rgba(231, 231, 231, 0.6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
    font-family: 'Lora', serif;
}

html.day-mode .nav-link {
    color: var(--text-secondary);
}

.nav-link:hover {
    color: rgba(231, 231, 231, 0.9);
    border-bottom-color: rgba(231, 231, 231, 0.3);
}

html.day-mode .nav-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--border-button);
}

.nav-separator {
    color: rgba(231, 231, 231, 0.3);
    font-size: 14px;
}

html.day-mode .nav-separator {
    color: rgba(26, 26, 26, 0.3);
}

.print-button {
    color: rgba(231, 231, 231, 0.6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
    font-family: 'Lora', serif;
    cursor: pointer;
    background: none;
    border: none;
}

html.day-mode .print-button {
    color: var(--text-secondary);
}

.print-button:hover {
    color: rgba(231, 231, 231, 0.9);
    border-bottom-color: rgba(231, 231, 231, 0.3);
}

html.day-mode .print-button:hover {
    color: var(--text-primary);
    border-bottom-color: var(--border-button);
}


/* Mode Lecture Profonde */
.deep-reading-mode .musevia-home-link,
.deep-reading-mode .musevia-header,
.deep-reading-mode .musevia-divider {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.deep-reading-mode .theme-toggle {
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.deep-reading-mode .poem-footer {
    opacity: 0.2;
    transition: opacity 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
    .deep-reading-mode .musevia-home-link,
    .deep-reading-mode .musevia-header,
    .deep-reading-mode .musevia-divider {
        transform: none;
        transition: opacity 0.2s ease;
    }
}

@media (max-width: 768px) {
    .deep-reading-mode .musevia-home-link,
    .deep-reading-mode .musevia-header,
    .deep-reading-mode .musevia-divider {
        display: none;
    }

    .deep-reading-mode .theme-toggle {
        opacity: 0.2;
    }

    .deep-reading-mode .poem-footer {
        opacity: 0.15;
    }
}

.deep-reading-mode .poem-footer.at-bottom {
    opacity: 0.6;
}

/* ============================================
   Menu burger mobile - Design élégant
   ============================================ */

/* Bouton toggle du menu burger */
.poem-mobile-menu-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(231, 231, 231, 0.08);
    border: 1px solid rgba(224, 214, 202, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.poem-mobile-menu-toggle.is-visible {
    opacity: 0.5;
    transform: translateY(0);
    pointer-events: all;
}

html.day-mode .poem-mobile-menu-toggle {
    background: rgba(247, 243, 236, 0.85);
    border-color: rgba(224, 214, 202, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.poem-mobile-menu-toggle:hover {
    background: rgba(231, 231, 231, 0.12);
    border-color: rgba(224, 214, 202, 0.35);
    transform: scale(1.05);
}

.poem-mobile-menu-toggle:active {
    transform: scale(0.95);
}

.poem-mobile-menu-toggle:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .poem-mobile-menu-toggle:focus-visible {
    outline-color: rgba(90, 82, 73, 0.4);
}

.menu-toggle-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    height: 18px;
    position: relative;
}

.menu-toggle-line {
    width: 100%;
    height: 2px;
    background: rgba(231, 231, 231, 0.75);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

html.day-mode .menu-toggle-line {
    background: rgba(90, 82, 73, 0.75);
}

.poem-mobile-menu-toggle[aria-expanded="true"] .menu-toggle-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.poem-mobile-menu-toggle[aria-expanded="true"] .menu-toggle-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.poem-mobile-menu-toggle[aria-expanded="true"] .menu-toggle-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Menu mobile */
.poem-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.poem-mobile-menu.is-open {
    opacity: 1;
    pointer-events: all;
}

.poem-mobile-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 14, 17, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

html.day-mode .poem-mobile-menu-overlay {
    background: rgba(250, 246, 238, 0.85);
}

.poem-mobile-menu-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: rgba(11, 14, 17, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

html.day-mode .poem-mobile-menu-content {
    background: rgba(250, 247, 242, 0.98);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.poem-mobile-menu.is-open .poem-mobile-menu-content {
    transform: translateY(0);
}

.poem-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(231, 231, 231, 0.08);
}

html.day-mode .poem-mobile-menu-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.poem-mobile-menu-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: rgba(231, 231, 231, 0.9);
    margin: 0;
    letter-spacing: -0.01em;
}

html.day-mode .poem-mobile-menu-title {
    color: rgba(74, 66, 58, 0.95);
}

.poem-mobile-menu-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: rgba(231, 231, 231, 0.7);
    font-size: 1.75rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    line-height: 1;
    font-weight: 300;
}

html.day-mode .poem-mobile-menu-close {
    color: rgba(74, 66, 58, 0.7);
}

.poem-mobile-menu-close:hover {
    background: rgba(231, 231, 231, 0.08);
    color: rgba(231, 231, 231, 0.95);
}

html.day-mode .poem-mobile-menu-close:hover {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(74, 66, 58, 0.95);
}

.poem-mobile-menu-close:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .poem-mobile-menu-close:focus-visible {
    outline-color: rgba(74, 66, 58, 0.4);
}

.poem-mobile-menu-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.5rem 2rem;
}

.poem-mobile-menu-section {
    margin-bottom: 2rem;
}

.poem-mobile-menu-section:last-child {
    margin-bottom: 0;
}

.poem-mobile-menu-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.poem-mobile-chip {
    font-size: 11px;
    padding: 6px 12px;
}

.poem-mobile-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
    background: rgba(231, 231, 231, 0.05);
    border: 1px solid rgba(224, 214, 202, 0.15);
    border-radius: 12px;
    color: rgba(231, 231, 231, 0.85);
    text-decoration: none;
    font-family: 'Lora', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    text-align: left;
}

html.day-mode .poem-mobile-menu-item {
    background: rgba(247, 243, 236, 0.6);
    border-color: rgba(224, 214, 202, 0.3);
    color: rgba(90, 82, 73, 0.9);
}

.poem-mobile-menu-item:hover {
    background: rgba(231, 231, 231, 0.1);
    border-color: rgba(224, 214, 202, 0.25);
    color: rgba(231, 231, 231, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

html.day-mode .poem-mobile-menu-item:hover {
    background: rgba(247, 243, 236, 0.85);
    border-color: rgba(224, 214, 202, 0.4);
    color: rgba(90, 82, 73, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.poem-mobile-menu-item:active {
    transform: translateY(0);
}

.poem-mobile-menu-item:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .poem-mobile-menu-item:focus-visible {
    outline-color: rgba(74, 66, 58, 0.4);
}

.poem-mobile-menu-item-text {
    width: 100%;
    line-height: 1.4;
}

/* Masquer le menu burger en desktop */
@media (min-width: 769px) {
    .poem-mobile-menu-toggle,
    .poem-mobile-menu {
        display: none !important;
    }
}

/* Media queries - Responsive */
/* ============================================
   Menu burger mobile - Design élégant
   ============================================ */

/* Bouton toggle du menu burger */
.poem-mobile-menu-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(231, 231, 231, 0.08);
    border: 1px solid rgba(224, 214, 202, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.poem-mobile-menu-toggle.is-visible {
    opacity: 0.5;
    transform: translateY(0);
    pointer-events: all;
}

html.day-mode .poem-mobile-menu-toggle {
    background: rgba(247, 243, 236, 0.85);
    border-color: rgba(224, 214, 202, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.poem-mobile-menu-toggle:hover {
    background: rgba(231, 231, 231, 0.12);
    border-color: rgba(224, 214, 202, 0.35);
    transform: scale(1.05);
}

.poem-mobile-menu-toggle:active {
    transform: scale(0.95);
}

.poem-mobile-menu-toggle:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .poem-mobile-menu-toggle:focus-visible {
    outline-color: rgba(90, 82, 73, 0.4);
}

.menu-toggle-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    height: 18px;
    position: relative;
}

.menu-toggle-line {
    width: 100%;
    height: 2px;
    background: rgba(231, 231, 231, 0.75);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

html.day-mode .menu-toggle-line {
    background: rgba(90, 82, 73, 0.75);
}

.poem-mobile-menu-toggle[aria-expanded="true"] .menu-toggle-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.poem-mobile-menu-toggle[aria-expanded="true"] .menu-toggle-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.poem-mobile-menu-toggle[aria-expanded="true"] .menu-toggle-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Menu mobile */
.poem-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.poem-mobile-menu.is-open {
    opacity: 1;
    pointer-events: all;
}

.poem-mobile-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 14, 17, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

html.day-mode .poem-mobile-menu-overlay {
    background: rgba(250, 246, 238, 0.85);
}

.poem-mobile-menu-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: rgba(11, 14, 17, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

html.day-mode .poem-mobile-menu-content {
    background: rgba(250, 247, 242, 0.98);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.poem-mobile-menu.is-open .poem-mobile-menu-content {
    transform: translateY(0);
}

.poem-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(231, 231, 231, 0.08);
}

html.day-mode .poem-mobile-menu-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.poem-mobile-menu-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: rgba(231, 231, 231, 0.9);
    margin: 0;
    letter-spacing: -0.01em;
}

html.day-mode .poem-mobile-menu-title {
    color: rgba(74, 66, 58, 0.95);
}

.poem-mobile-menu-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: rgba(231, 231, 231, 0.7);
    font-size: 1.75rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    line-height: 1;
    font-weight: 300;
}

html.day-mode .poem-mobile-menu-close {
    color: rgba(74, 66, 58, 0.7);
}

.poem-mobile-menu-close:hover {
    background: rgba(231, 231, 231, 0.08);
    color: rgba(231, 231, 231, 0.95);
}

html.day-mode .poem-mobile-menu-close:hover {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(74, 66, 58, 0.95);
}

.poem-mobile-menu-close:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .poem-mobile-menu-close:focus-visible {
    outline-color: rgba(74, 66, 58, 0.4);
}

.poem-mobile-menu-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.5rem 2rem;
}

.poem-mobile-menu-section {
    margin-bottom: 2rem;
}

.poem-mobile-menu-section:last-child {
    margin-bottom: 0;
}

.poem-mobile-menu-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.poem-mobile-chip {
    font-size: 11px;
    padding: 6px 12px;
}

.poem-mobile-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
    background: rgba(231, 231, 231, 0.05);
    border: 1px solid rgba(224, 214, 202, 0.15);
    border-radius: 12px;
    color: rgba(231, 231, 231, 0.85);
    text-decoration: none;
    font-family: 'Lora', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    text-align: left;
}

html.day-mode .poem-mobile-menu-item {
    background: rgba(247, 243, 236, 0.6);
    border-color: rgba(224, 214, 202, 0.3);
    color: rgba(90, 82, 73, 0.9);
}

.poem-mobile-menu-item:hover {
    background: rgba(231, 231, 231, 0.1);
    border-color: rgba(224, 214, 202, 0.25);
    color: rgba(231, 231, 231, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

html.day-mode .poem-mobile-menu-item:hover {
    background: rgba(247, 243, 236, 0.85);
    border-color: rgba(224, 214, 202, 0.4);
    color: rgba(90, 82, 73, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.poem-mobile-menu-item:active {
    transform: translateY(0);
}

.poem-mobile-menu-item:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .poem-mobile-menu-item:focus-visible {
    outline-color: rgba(74, 66, 58, 0.4);
}

.poem-mobile-menu-item-text {
    width: 100%;
    line-height: 1.4;
}

/* Masquer le menu burger en desktop */
@media (min-width: 769px) {
    .poem-mobile-menu-toggle,
    .poem-mobile-menu {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Scroll fluide sans inertie excessive */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    /* Aucun sticky element pendant la lecture */
    .musevia-home-link,
    .theme-toggle {
        position: absolute;
    }

    .poem-container {
        padding: 0 1.5rem;
        max-width: 100%;
        margin-top: 0.5rem;
    }

    /* Afficher le menu burger en mobile */
    .poem-mobile-menu-toggle {
        display: flex;
    }

    /* Masquer le footer en mobile */
    .poem-footer {
        display: none !important;
    }

    /* Afficher le menu burger en mobile */
    .poem-mobile-menu-toggle {
        display: flex;
    }

    /* Masquer le footer en mobile */
    .poem-footer {
        display: none !important;
    }

    /* Titre : légèrement plus grand, plus d'espace avant le premier vers */
    .poem-title {
        font-size: 1.65rem;
        text-align: left;
        margin-bottom: 2.5rem;
        margin-top: 2.75rem;
        line-height: 1.3;
    }

    /* Bloc poème = zone sacrée : interlignage 1.65, marges latérales augmentées */
    .poem-text-section {
        margin: 0;
        padding: 0;
    }

    .poem-body {
        font-size: 0.9rem;
        line-height: 1.65;
        margin: 0;
        padding: 0;
        /* Zone sacrée : pas de rupture visuelle */
    }

    /* Auteur : remonté, traitement éditorial, zone cliquable large */
    .poem-author {
        text-align: left;
        margin-top: 2.5rem;
        margin-bottom: 0;
        font-size: 0.975rem;
        font-variant: small-caps;
        letter-spacing: 0.03em;
        padding: 0.5rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .poem-author a {
        display: block;
        width: 100%;
        padding: 0.25rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Footer : actions moins visibles */
    .poem-footer {
        padding: 0 1.5rem;
        margin-top: 3rem;
    }

    .poem-footer__meta {
        gap: 4px 6px;
        margin-top: 14px;
        margin-bottom: 16px;
    }

    /* Séparateur masqué sur mobile (zone sacrée) */
    .section-separator {
        display: none;
    }

    /* Tap zones généreuses (minimum 44px) */
    .poem-footer__action,
    .poem-random,
    .poem-author a {
        min-height: 44px;
        min-width: 44px;
    }
}

@media (max-width: 480px) {
    .poem-container {
        padding: 0 1.25rem;
    }

    .poem-title {
        font-size: 1.9rem;
        margin-bottom: 2rem;
        margin-top: 2.5rem;
    }

    .poem-body {
        font-size: 0.9rem;
        line-height: 1.65;
    }

    .poem-author {
        font-size: .95rem;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    .poem-footer {
        padding: 0 1.25rem;
        margin-top: 2.5rem;
    }

    .poem-random {
        width: 100%;
        justify-content: center;
    }

    .poem-footer__actions,
    .poem-footer__explore {
        flex-direction: column;
        gap: 8px;
    }

    .poem-footer__dot {
        display: none;
    }

    .section-separator {
        display: none;
    }
}

@media (min-width: 40em) {
    .poem-container {
        max-width: 680px;
        padding: 1.75rem 2rem;
    }

    .poem-body {
        font-size: 19px;
    }
}

@media (min-width: 55em) {
    .poem-container {
        max-width: 680px;
        padding: 2rem 2rem;
    }

    .poem-body {
        font-size: 20px;
    }
}

@media (min-width: 75em) {
    .poem-container {
        padding: 2.5rem 3rem;
    }
}

/* Styles d'impression */
@media print {
    body {
        background: white;
        color: black;
    }

    .theme-toggle,
    .poem-footer,
    .musevia-header,
    .musevia-divider,
    .nav-arrow-horizontal,
    .poem-footer__meta,
    .poem-scans-action,
    .poem-mobile-menu-toggle,
    .poem-mobile-menu {
        display: none !important;
    }

    .poem-container {
        max-width: 100%;
        padding: 2rem 2rem 0 2rem;
        margin: 0;
    }

    .poem-title {
        color: black;
        font-size: 24px;
        margin-bottom: 2rem;
    }

    .poem-author {
        color: rgba(0, 0, 0, 0.7);
        font-size: 16px;
        margin-bottom: 1.5rem;
        margin-top: 1rem;
    }

    .poem-body {
        color: black;
        font-size: 16px;
        line-height: 1.6;
        margin: 0;
        max-width: 100%;
    }
}

/* ============================================
   Visionneuse de scans - Design repensé
   ============================================ */
   
.scan-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scan-viewer-modal[style*="flex"] {
    opacity: 1;
    pointer-events: all;
}

.scan-viewer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 14, 17, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

html.day-mode .scan-viewer-overlay {
    background: rgba(250, 246, 238, 0.92);
}

.scan-viewer-container {
    position: relative;
    width: 95vw;
    max-width: 1600px;
    height: 95vh;
    max-height: 1000px;
    background: rgba(11, 14, 17, 0.98);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
    transform: scale(0.96);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scan-viewer-modal[style*="flex"] .scan-viewer-container {
    transform: scale(1);
}

html.day-mode .scan-viewer-container {
    background: rgba(250, 247, 242, 0.98);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
}

/* En-tête minimaliste */
.scan-viewer-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(231, 231, 231, 0.08);
    background: transparent;
    flex-shrink: 0;
}

html.day-mode .scan-viewer-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.scan-viewer-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scan-viewer-title-group {
    flex: 1;
}

.scan-viewer-title {
    font-size: 1.15rem;
    font-weight: 500;
    color: rgba(231, 231, 231, 0.92);
    margin: 0 0 0.3rem 0;
    font-family: 'Crimson Pro', serif;
    letter-spacing: -0.01em;
}

html.day-mode .scan-viewer-title {
    color: rgba(74, 66, 58, 0.95);
}

.scan-viewer-subtitle {
    font-size: 0.875rem;
    color: rgba(231, 231, 231, 0.65);
    margin: 0;
    font-family: 'Lora', serif;
    font-style: italic;
    font-weight: 400;
}

html.day-mode .scan-viewer-subtitle {
    color: rgba(142, 131, 123, 0.85);
}

.scan-viewer-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: rgba(231, 231, 231, 0.75);
    font-size: 1.75rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    line-height: 1;
    font-weight: 300;
}

html.day-mode .scan-viewer-close {
    color: rgba(74, 66, 58, 0.75);
}

.scan-viewer-close:hover {
    background: rgba(231, 231, 231, 0.08);
    color: rgba(231, 231, 231, 0.95);
    transform: scale(1.05);
}

html.day-mode .scan-viewer-close:hover {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(74, 66, 58, 0.95);
}

.scan-viewer-close:active {
    transform: scale(0.95);
}

.scan-viewer-close:focus {
    outline: none;
}

.scan-viewer-close:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .scan-viewer-close:focus-visible {
    outline-color: rgba(74, 66, 58, 0.4);
}

/* Zone d'affichage principale */
.scan-viewer-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: rgba(11, 14, 17, 1);
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

html.day-mode .scan-viewer-viewport {
    background: rgba(245, 240, 232, 1);
}

.scan-viewer-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}

.scan-viewer-image-wrapper:active {
    cursor: grabbing;
}

.scan-viewer-image {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center center;
    display: block;
}

/* État de chargement */
.scan-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    z-index: 10;
}

.scan-viewer-spinner {
    width: 44px;
    height: 44px;
    border: 2.5px solid rgba(231, 231, 231, 0.15);
    border-top-color: rgba(231, 231, 231, 0.6);
    border-radius: 50%;
    animation: scan-viewer-spin 0.9s linear infinite;
}

html.day-mode .scan-viewer-spinner {
    border-color: rgba(142, 131, 123, 0.15);
    border-top-color: rgba(142, 131, 123, 0.6);
}

@keyframes scan-viewer-spin {
    to { transform: rotate(360deg); }
}

.scan-viewer-loading-text {
    color: rgba(231, 231, 231, 0.65);
    font-family: 'Lora', serif;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 400;
}

html.day-mode .scan-viewer-loading-text {
    color: rgba(142, 131, 123, 0.75);
}

/* État d'erreur */
.scan-viewer-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 2rem;
    text-align: center;
    z-index: 10;
}

.scan-viewer-error-text {
    color: rgba(231, 231, 231, 0.65);
    font-family: 'Lora', serif;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 400;
}

html.day-mode .scan-viewer-error-text {
    color: rgba(142, 131, 123, 0.75);
}

.scan-viewer-error-button {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-family: 'Lora', serif;
    color: rgba(231, 231, 231, 0.9);
    background: rgba(231, 231, 231, 0.08);
    border: 1px solid rgba(231, 231, 231, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-weight: 400;
}

html.day-mode .scan-viewer-error-button {
    color: rgba(74, 66, 58, 0.9);
    background: rgba(74, 66, 58, 0.08);
    border-color: rgba(74, 66, 58, 0.15);
}

.scan-viewer-error-button:hover {
    background: rgba(231, 231, 231, 0.12);
    border-color: rgba(231, 231, 231, 0.2);
}

html.day-mode .scan-viewer-error-button:hover {
    background: rgba(74, 66, 58, 0.12);
    border-color: rgba(74, 66, 58, 0.2);
}

.scan-viewer-error-button:focus {
    outline: none;
}

.scan-viewer-error-button:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .scan-viewer-error-button:focus-visible {
    outline-color: rgba(74, 66, 58, 0.4);
}

/* Contrôles flottants */
.scan-viewer-controls-wrapper {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.scan-viewer-modal:hover .scan-viewer-controls-wrapper,
.scan-viewer-controls-wrapper:focus-within {
    opacity: 1;
    pointer-events: all;
}

/* Navigation entre pages */
.scan-viewer-nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(11, 14, 17, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(231, 231, 231, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

html.day-mode .scan-viewer-nav-controls {
    background: rgba(250, 247, 242, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.scan-viewer-nav-btn {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(231, 231, 231, 0.15);
    background: rgba(231, 231, 231, 0.06);
    color: rgba(231, 231, 231, 0.85);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    font-weight: 300;
    line-height: 1;
}

html.day-mode .scan-viewer-nav-btn {
    border-color: rgba(74, 66, 58, 0.15);
    background: rgba(74, 66, 58, 0.06);
    color: rgba(74, 66, 58, 0.85);
}

.scan-viewer-nav-btn:hover:not(:disabled) {
    background: rgba(231, 231, 231, 0.12);
    border-color: rgba(231, 231, 231, 0.25);
    color: rgba(231, 231, 231, 1);
    transform: translateY(-1px);
}

html.day-mode .scan-viewer-nav-btn:hover:not(:disabled) {
    background: rgba(74, 66, 58, 0.12);
    border-color: rgba(74, 66, 58, 0.25);
    color: rgba(74, 66, 58, 1);
}

.scan-viewer-nav-btn:active:not(:disabled) {
    transform: translateY(0);
}

.scan-viewer-nav-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.scan-viewer-nav-btn:focus {
    outline: none;
}

.scan-viewer-nav-btn:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .scan-viewer-nav-btn:focus-visible {
    outline-color: rgba(74, 66, 58, 0.4);
}

.scan-viewer-page-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Lora', serif;
    font-size: 0.875rem;
    color: rgba(231, 231, 231, 0.75);
    font-weight: 400;
    min-width: 60px;
    justify-content: center;
}

html.day-mode .scan-viewer-page-indicator {
    color: rgba(74, 66, 58, 0.75);
}

.scan-viewer-page-current {
    font-weight: 500;
    color: rgba(231, 231, 231, 0.9);
}

html.day-mode .scan-viewer-page-current {
    color: rgba(74, 66, 58, 0.9);
}

.scan-viewer-page-separator {
    opacity: 0.5;
}

.scan-viewer-page-total {
    opacity: 0.7;
}

/* Contrôles de zoom */
.scan-viewer-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(11, 14, 17, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.625rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(231, 231, 231, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

html.day-mode .scan-viewer-zoom-controls {
    background: rgba(250, 247, 242, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.scan-viewer-zoom-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(231, 231, 231, 0.15);
    background: rgba(231, 231, 231, 0.06);
    color: rgba(231, 231, 231, 0.85);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    font-weight: 300;
    line-height: 1;
}

html.day-mode .scan-viewer-zoom-btn {
    border-color: rgba(74, 66, 58, 0.15);
    background: rgba(74, 66, 58, 0.06);
    color: rgba(74, 66, 58, 0.85);
}

.scan-viewer-zoom-btn:hover {
    background: rgba(231, 231, 231, 0.12);
    border-color: rgba(231, 231, 231, 0.25);
    color: rgba(231, 231, 231, 1);
    transform: translateY(-1px);
}

html.day-mode .scan-viewer-zoom-btn:hover {
    background: rgba(74, 66, 58, 0.12);
    border-color: rgba(74, 66, 58, 0.25);
    color: rgba(74, 66, 58, 1);
}

.scan-viewer-zoom-btn:active {
    transform: translateY(0);
}

.scan-viewer-zoom-btn:focus {
    outline: none;
}

.scan-viewer-zoom-btn:focus-visible {
    outline: 2px solid rgba(231, 231, 231, 0.4);
    outline-offset: 2px;
}

html.day-mode .scan-viewer-zoom-btn:focus-visible {
    outline-color: rgba(74, 66, 58, 0.4);
}

.scan-viewer-zoom-level {
    font-family: 'Lora', serif;
    font-size: 0.8125rem;
    color: rgba(231, 231, 231, 0.7);
    font-weight: 400;
    min-width: 48px;
    text-align: center;
}

html.day-mode .scan-viewer-zoom-level {
    color: rgba(74, 66, 58, 0.7);
}

/* Responsive */
@media (max-width: 768px) {
    .scan-viewer-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .scan-viewer-header {
        padding: 1.25rem 1.5rem;
    }

    .scan-viewer-title {
        font-size: 1rem;
    }

    .scan-viewer-subtitle {
        font-size: 0.8125rem;
    }

    .scan-viewer-controls-wrapper {
        bottom: 1.5rem;
        left: 1rem;
        right: 1rem;
        transform: none;
        width: auto;
    }

    .scan-viewer-nav-controls,
    .scan-viewer-zoom-controls {
        width: 100%;
        justify-content: space-between;
    }

    .scan-viewer-nav-btn {
        width: 48px;
        height: 48px;
        flex: 1;
    }

    .scan-viewer-zoom-btn {
        width: 44px;
        height: 44px;
    }

    .scan-viewer-controls-wrapper {
        opacity: 1;
        pointer-events: all;
    }
}

@media (max-width: 480px) {
    .scan-viewer-header {
        padding: 1rem 1.25rem;
    }

    .scan-viewer-controls-wrapper {
        bottom: 1rem;
        left: 0.75rem;
        right: 0.75rem;
        gap: 0.75rem;
    }

    .scan-viewer-nav-controls,
    .scan-viewer-zoom-controls {
        padding: 0.625rem 0.875rem;
    }
}

/* Animations d'apparition douces */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* État initial : éléments cachés */
.poem-title {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.1s forwards;
}

.poem-body {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.3s forwards;
}

.poem-author {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.5s forwards;
}

/* Premier séparateur (après l'article) */
.poem-container > .section-separator {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.6s forwards;
}

.poem-footer__meta {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.8s forwards;
}

/* Deuxième séparateur (après les métadonnées) */
.poem-footer .section-separator {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 1s forwards;
}

.poem-footer__explore {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 1.2s forwards;
}

.poem-footer__divider {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 1.3s forwards;
}

.poem-footer__actions {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 1.4s forwards;
}

/* Le poem-footer lui-même n'a plus besoin d'animation car ses enfants sont animés */
.poem-footer {
    opacity: 1;
}

/* Respect de prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .scan-viewer-modal,
    .scan-viewer-container,
    .scan-viewer-image,
    .scan-viewer-controls-wrapper,
    .scan-viewer-nav-btn,
    .scan-viewer-zoom-btn,
    .scan-viewer-close {
        transition: none;
    }

    .scan-viewer-spinner {
        animation: none;
    }

    .poem-title,
    .poem-body,
    .poem-author,
    .section-separator,
    .poem-footer__meta,
    .poem-footer__explore,
    .poem-footer__divider,
    .poem-footer__actions,
    .poem-footer {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

