/* style.css - Livret de Messe A5 */

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --livret-bg: #f7f4ee;
    --livret-card: #ffffff;
    --livret-border: #e6ded2;
    --livret-accent: #8a6d45;
    --livret-muted: #6f5d4c;
    --livret-text: #2a241c;
}

/* Configuration pour impression A5 */
@page {
    size: 148mm 210mm;
    margin: 4mm 10mm;
    bleed: 3mm;
    marks: crop cross;
}

@page :left {
    margin: 4mm 10mm 4mm 14mm;
}

@page :right {
    margin: 4mm 14mm 4mm 10mm;
}

/* Corps du document */
body {
    font-family: 'Montserrat', sans-serif;
    font-size: 13pt;
    line-height: 1.6;
    font-weight: 300;
    letter-spacing: 0.01em;
    color: #2c2c2c;
    background: white;
}

@media screen {
    body.livret-web {
        background: var(--livret-bg);
        color: var(--livret-text);
        font-size: clamp(16px, 1.15vw, 18px);
        line-height: 1.8;
        letter-spacing: 0.01em;
        min-height: 100vh;
        width: 100%;
        overflow-x: hidden;
        scroll-behavior: smooth;
        scroll-padding-top: 40px;
    }

    .livret-shell {
        width: 100%;
        max-width: 900px;
        margin: 0 auto;
        padding: clamp(1rem, 3vw, 3rem) clamp(1rem, 5vw, 3rem) clamp(2rem, 6vw, 4rem);
        display: flex;
        flex-direction: column;
        gap: clamp(1.25rem, 3vw, 2.5rem);
    }

    .livret-content {
        display: flex;
        flex-direction: column;
        gap: clamp(1.5rem, 2.5vw, 3rem);
    }

    body.livret-web .couverture,
    body.livret-web .nouvelle-page,
    body.livret-web .quatrieme-couverture {
        background: var(--livret-card);
        border-radius: 1.75rem;
        padding: clamp(1.8rem, 3vw, 3rem);
        box-shadow: 0 24px 80px rgba(24, 21, 16, 0.08);
        margin: 0;
        width: 100%;
    }

    body.livret-web .couverture,
    body.livret-web .quatrieme-couverture {
        min-height: auto;
    }

    body.livret-web .nouvelle-page {
        padding-top: clamp(1.2rem, 2vw, 2rem);
    }

    body.livret-web .couverture .photo-couverture {
        max-width: min(320px, 100%);
    }

    body.livret-web h1 {
        font-size: clamp(2.4rem, 3.4vw, 3.6rem);
        margin: 0 0 1rem 0;
        letter-spacing: 0.35em;
    }

    body.livret-web h2 {
        font-size: clamp(1.4rem, 2.4vw, 2rem);
        margin-bottom: 0.8rem;
        letter-spacing: 0.18em;
    }

    body.livret-web h3 {
        font-size: clamp(1.05rem, 1.7vw, 1.3rem);
        margin: 1.6rem 0 0.6rem;
        letter-spacing: 0.18em;
    }

    body.livret-web .section-liturgique {
        margin: 1.2rem 0 0;
        padding-top: 1rem;
    }

    body.livret-web .section-liturgique ~ .section-liturgique {
        border-top: 1px solid rgba(138, 109, 69, 0.12);
    }

    body.livret-web .lecture,
    body.livret-web .chant {
        margin: 1rem 0 0;
        font-size: 1rem;
        line-height: 1.8;
    }

    body.livret-web .lecture p,
    body.livret-web .chant p {
        margin-bottom: 0.9rem;
    }

    body.livret-web .refrain,
    body.livret-web .versets-encadres {
        background: rgba(138, 109, 69, 0.08);
        border-radius: 1rem;
        padding: 1rem 1.25rem;
        border-left: 4px solid rgba(138, 109, 69, 0.25);
    }

    body.livret-web .couplet {
        padding-left: 0;
        margin-left: 0;
    }

    body.livret-web .numero-couplet {
        width: auto;
        margin-left: 0;
        margin-right: 0.5rem;
    }

    body.livret-web .reference-biblique {
        text-align: left;
        font-size: 0.95rem;
        color: var(--livret-muted);
    }

    body.livret-web .texte-remerciements {
        max-width: none;
        padding-top: 0.5rem;
    }

    body.livret-web .quatrieme-couverture {
        text-align: center;
    }
}

@media screen and (max-width: 1024px) {
    .livret-shell {
        padding: clamp(1rem, 4vw, 2.5rem);
    }
}

@media screen and (max-width: 640px) {
    .livret-shell {
        padding: clamp(0.75rem, 4vw, 1.5rem);
        gap: 1.25rem;
    }

    body.livret-web .couverture,
    body.livret-web .nouvelle-page,
    body.livret-web .quatrieme-couverture {
        border-radius: 1.25rem;
        padding: 1.4rem;
        box-shadow: 0 18px 50px rgba(24, 21, 16, 0.08);
    }

    body.livret-web h1 {
        letter-spacing: 0.25em;
    }

    body.livret-web h2 {
        letter-spacing: 0.12em;
    }

    body.livret-web .couverture .photo-couverture {
        max-width: 220px;
    }
}

@media screen and (max-width: 480px) {
    .livret-shell {
        padding: 1rem;
    }

    body.livret-web .couverture,
    body.livret-web .nouvelle-page,
    body.livret-web .quatrieme-couverture {
        padding: 1.2rem;
        box-shadow: 0 12px 30px rgba(24, 21, 16, 0.08);
    }

    body.livret-web .lecture,
    body.livret-web .chant {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    body.livret-web h1 {
        letter-spacing: 0.12em;
        font-size: clamp(1.8rem, 8vw, 2.4rem);
    }

    body.livret-web h2 {
        letter-spacing: 0.1em;
    }

    body.livret-web h3 {
        letter-spacing: 0.08em;
    }
}

body.livret-web .couverture,
body.livret-web .nouvelle-page,
body.livret-web .quatrieme-couverture {
    background: var(--livret-card);
    border-radius: 1.75rem;
    padding: clamp(1.8rem, 3vw, 3rem);
    box-shadow: 0 24px 80px rgba(24, 21, 16, 0.08);
    margin: 0;
    width: 100%;
}

body.livret-web .couverture,
body.livret-web .quatrieme-couverture {
    min-height: auto;
}

body.livret-web .nouvelle-page {
    padding-top: clamp(1.2rem, 2vw, 2rem);
}

body.livret-web .couverture .photo-couverture {
    max-width: min(320px, 100%);
}

body.livret-web h1 {
    font-size: clamp(2.4rem, 3.4vw, 3.6rem);
    margin: 0 0 1rem 0;
    letter-spacing: 0.35em;
}

body.livret-web h2 {
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    margin-bottom: 0.8rem;
    letter-spacing: 0.18em;
}

body.livret-web h3 {
    font-size: clamp(1.05rem, 1.7vw, 1.3rem);
    margin: 1.6rem 0 0.6rem;
    letter-spacing: 0.18em;
}

body.livret-web .section-liturgique {
    margin: 1.2rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(138, 109, 69, 0.12);
}

body.livret-web .section-liturgique:first-of-type {
    border-top: none;
    padding-top: 0;
}

body.livret-web .lecture,
body.livret-web .chant {
    margin: 1rem 0 0;
    font-size: 1rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

body.livret-web .lecture p,
body.livret-web .chant p {
    margin-bottom: 0.9rem;
    overflow-wrap: anywhere;
}

body.livret-web .refrain,
body.livret-web .versets-encadres {
    background: rgba(138, 109, 69, 0.08);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    border-left: 4px solid rgba(138, 109, 69, 0.25);
    overflow-wrap: anywhere;
}

body.livret-web .couplet {
    padding-left: 0;
    margin-left: 0;
    overflow-wrap: anywhere;
}

body.livret-web .numero-couplet {
    width: auto;
    margin-left: 0;
    margin-right: 0.5rem;
}

body.livret-web .reference-biblique {
    text-align: left;
    font-size: 0.95rem;
    color: var(--livret-muted);
}

body.livret-web .texte-remerciements {
    max-width: none;
    padding-top: 0.5rem;
}

body.livret-web .quatrieme-couverture {
    text-align: center;
}

/* Page de couverture */
.couverture {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 210mm;
    padding: 6mm 15mm 4mm;
    gap: 4mm;
}

.couverture h1 {
    margin: 3mm 0 2mm 0;
}

.dates-couverture {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13pt;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #4a4a4a;
}

.photo-couverture {
    width: 100%;
    margin: 0 auto;
    border-radius: 2mm;
    overflow: hidden;
}

.photo-couverture img {
    width: 100%;
    height: auto;
    display: block;
}

.couverture .photo-couverture {
    max-width: 75mm;
    margin-bottom: 7mm;
}

.quatrieme-couverture .photo-couverture {
    max-width: 120mm;
    width: 100%;
    margin-bottom: 16mm;
    overflow: visible;
}

.quatrieme-couverture .photo-couverture img {
    display: block;
    margin: 0 auto;
    width: 100%;
    height: auto;
}

.citation-couverture {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 13pt;
    line-height: 1.55;
    font-weight: 300;
    letter-spacing: 0.04em;
    color: #3d3d3d;
    margin-top: 2mm;
    padding: 0 8mm;
    text-align: left;
}

.quatrieme-couverture .citation-couverture {
    margin-top: 18mm;
}

.auteur-citation {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-size: 9.5pt;
    text-align: right;
    margin-top: 2mm;
    color: #6f6f6f;
    letter-spacing: 0.05em;
}

/* Titres principaux */
h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26pt;
    color: #1f1f1f;
    text-align: center;
    margin: 8mm 0 4mm 0;
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
}

h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 16pt;
    color: #2c2c2c;
    text-align: center;
    margin: 7mm 0 2mm 0;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 300;
}

h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14pt;
    color: #2f2f2f;
    margin: 4mm 0 2mm 0;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    page-break-after: avoid;
}

/* Sections liturgiques */
.section-liturgique {
    margin: 3mm 0;
}

.temps-liturgique {
    font-family: 'Cormorant Garamond', serif;
    padding: 2mm 6mm;
    margin: 3mm 0 3mm 0;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* Textes et lectures */
.lecture {
    margin: 8mm 0;
    text-align: justify;
    font-size: 13pt;
    font-weight: 300;
    letter-spacing: 0.01em;
    page-break-inside: avoid;
    break-inside: avoid;
}

.lecture p {
    page-break-inside: avoid;
    break-inside: avoid;
}

.reference-biblique {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    text-align: right;
    font-size: 11pt;
    color: #5c5c5c;
    margin: 5mm 0;
    letter-spacing: 0.08em;
}

/* Chants */
.chant {
    margin: 8mm 0;
    page-break-inside: avoid;
    break-inside: avoid;
}

.titre-chant {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 14pt;
    color: #2c2c2c;
    margin-bottom: 5mm;
    text-align: center;
    letter-spacing: 0.08em;
}

.refrain {
    font-size: 13pt;
    font-style: italic;
    padding: 4mm 8mm;
    margin: 6mm 0;
    letter-spacing: 0.03em;
    page-break-inside: avoid;
    break-inside: avoid;
}

.couplet {
    margin: 4mm 0;
    padding-left: 10mm;
    page-break-inside: avoid;
    break-inside: avoid;
}

.numero-couplet {
    font-weight: 400;
    display: inline-block;
    width: 9mm;
    margin-left: -9mm;
    font-family: 'Cormorant Garamond', serif;
    letter-spacing: 0.08em;
}

/* Prière universelle */
.priere-universelle {
    margin: 12mm 0;
}

.intention {
    margin: 6mm 0;
    padding-left: 0;
    min-height: 15mm;
}

.reponse-assemblee {
    font-size: 13pt;
    font-weight: 600;
    text-align: left;
    font-style: italic;
    color: #6a6a6a;
    margin: 8mm 0;
}

/* Textes spéciaux */
.accueil, .evocation {
    margin: 10mm 0;
    padding: 6mm;
}

.credo, .profession-foi {
    font-size: 13pt;
    line-height: 1.7;
    margin: 10mm 0;
}

/* Page de remerciements */
.remerciements {
    padding: 16mm 15mm;
    text-align: center;
}

.remerciements h2 {
    margin-bottom: 15mm;
}

.texte-remerciements {
    text-align: left;
    font-size: 11pt;
    line-height: 1.65;
    max-width: 110mm;
    margin: 0 auto;
}

.texte-remerciements p {
    position: relative;
    margin: 4mm 0;
    padding-left: 10mm;
    page-break-inside: avoid;
    break-inside: avoid;
}

.texte-remerciements p::before {
    content: "—";
    position: absolute;
    left: 0;
    top: 0;
    color: #6a6a6a;
}

/* Quatrième de couverture */
.quatrieme-couverture {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    padding: 12mm 12mm 10mm;
    gap: 10mm;
}

.couverture-interieure {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 16mm 12mm;
}

.info-couverture-interieure {
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 13pt;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2a2a2a;
    line-height: 1.8;
}

.info-couverture-interieure p {
    margin: 3mm 0;
}

.lieu-secondaire {
    text-transform: none;
    letter-spacing: 0.08em;
    font-size: 12pt;
}

/* Ornements */
.ornement {
    text-align: center;
    font-size: 18pt;
    color: #b3b3b3;
    margin: 8mm 0;
}

.croix {
    text-align: center;
    font-size: 20pt;
    color: #666666;
    margin: 10mm 0;
}

/* Informations pratiques */
.info-messe {
    font-family: 'Cormorant Garamond', serif;
    text-align: center;
    margin: 12mm 0;
    font-size: 13pt;
    color: #2e2e2e;
    letter-spacing: 0.08em;
}

.date-lieu {
    font-weight: 400;
    margin: 2mm 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Transitions et sauts de page */
.nouvelle-page {
    padding-top: 0mm;
}

/* Classe .garder-ensemble laissée volontairement vide pour gestion manuelle des sauts */
.garder-ensemble {}

/* Mise en évidence */
.important {
    font-weight: 500;
    color: #1f1f1f;
    letter-spacing: 0.04em;
}

.discret {
    font-size: 9pt;
    color: #7a7a7a;
    letter-spacing: 0.05em;
}

.print-only {
    display: none;
}

.print-hidden {
    display: block;
}

.page-blanche {
    min-height: 210mm;
}

/* Utilitaires de mise en forme */
.dedicace {
    font-style: italic;
    color: #555555;
}

.note-air {
    text-align: center;
    margin: 8mm 0;
    font-size: 0.8em;
    color: #666666;
    font-style: italic;
}

.note-titre {
    font-size: 0.7em;
    color: #666666;
    font-weight: 400;
}

.note-titre.espace {
    margin-left: 8px;
}

.allelia-encart {
    border-left: 3px solid #dddddd;
    padding-left: 8px;
    margin-bottom: 6mm;
}

.sans-marge {
    margin: 0;
}

.note-repetition {
    text-align: right;
    margin: 2px 0 0 0;
    font-size: 0.8em;
    color: #666666;
}

.versets-encadres {
    border-right: 3px solid #dddddd;
    padding-right: 8px;
    display: inline-block;
    margin-bottom: 4px;
}

.note-bis {
    font-size: 0.8em;
    color: #666666;
    font-style: italic;
    margin-left: 4px;
}

.page-break-always {
    page-break-before: always;
}

.mention-reponse {
    font-style: italic;
    font-weight: 400;
    margin-right: 5mm;
}

.citation-couverture.marge-supp {
    margin-top: 10mm;
}

/* Page web - Recueil des chants */
body.chants-page {
    background: #f2efea;
    min-height: 100vh;
    margin: 0;
    font-size: 1rem;
}

.chants-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 50px 20px 80px;
}

.chants-hero {
    text-align: center;
    margin-bottom: 28px;
}

.chants-hero h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.3rem;
    letter-spacing: 0.24em;
    margin: 10px 0;
    text-transform: uppercase;
}

.chants-info {
    font-family: 'Cormorant Garamond', serif;
    color: #2c2c2c;
    font-size: 1rem;
    line-height: 1.5;
}

.chants-content {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.chants-section {
    background: white;
    border: 1px solid #e7dfd2;
    border-radius: 0;
    padding: 30px 26px 26px;
    position: relative;
}

.chants-section h2 {
    font-family: 'Cormorant Garamond', serif;
    text-align: left;
    margin: 0 0 18px 0;
    font-size: 1.2rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.chants-section::before {
    content: "";
    position: absolute;
    left: 0;
    top: 28px;
    bottom: 28px;
    width: 2px;
    background: #c1c1c1;
}

.chants-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.chant-card {
    background: #fbfaf7;
    border: 1px solid #efe9e0;
    border-radius: 4px;
    padding: 18px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chant-card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    margin: 0;
}

.chant-context {
    color: #4a4a4a;
    font-size: 0.96rem;
    margin: 0;
}

.chant-note {
    color: #7b654c;
    font-style: italic;
    font-size: 0.95rem;
    margin: 0;
}

.chant-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.chant-link {
    color: #8b7355;
    font-size: 0.95rem;
    text-decoration: none;
}

.chant-link:hover {
    text-decoration: underline;
}

.chants-footer {
    text-align: center;
    margin-top: 50px;
    color: #4a4a4a;
    font-size: 0.95rem;
}

.chants-footer p {
    margin-top: 10px;
}

/* Responsive pour preview écran */
@media screen {
    body:not(.chants-page):not(.livret-web) {
        max-width: 148mm;
        margin: 0 auto;
        padding: 20px;
        background: #ffffff;
    }
    
    .couverture, .quatrieme-couverture {
        min-height: 210mm;
        background: white;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
        margin-bottom: 20px;
    }
}

/* Styles d'impression */
@media print {
    body {
        background: white;
        color: #000000;
    }
    
    .no-print {
        display: none;
    }
    
    .print-only {
        display: block;
    }

    .print-hidden {
        display: none !important;
    }

    body * {
        color: #000000 !important;
    }
    
    .discret {
        color: #7a7a7a !important;
    }
    
    a {
        text-decoration: none;
        color: inherit;
    }
}

/* Structure du livret */
.livret-container {
    width: 148mm;
    height: 210mm;
    margin: 0 auto;
}

/* Pages du livret */
.page-livret {
    width: 148mm;
    height: 210mm;
    padding: 4mm 10mm;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Pagination */
.numero-page {
    position: absolute;
    bottom: 10mm;
    font-size: 9pt;
    color: #8a8a8a;
}

.page-gauche .numero-page {
    left: 15mm;
}

.page-droite .numero-page {
    right: 15mm;
}

/* Ajustements pour impression */
@media print {
    body {
        margin: 0;
        padding: 0;
        width: 148mm;
        background: white;
    }
    
    .page-livret {
        margin: 0;
        box-shadow: none;
    }
    
    .couverture .photo-couverture {
        max-width: 75mm;
    }
    
    .quatrieme-couverture .photo-couverture {
        max-width: 110mm;
    }
    
    /* Gestion orphelins et veuves */
    p {
        orphans: 3;
        widows: 3;
    }
}

/* Preview écran style livret */
@media screen {
    body:not(.chants-page):not(.livret-web) {
        background: #ffffff;
        padding: 20px;
    }
    
    .livret-container {
        background: white;
        box-shadow: 0 0 30px rgba(0,0,0,0.3);
        margin: 20px auto;
    }
    
    .page-livret {
        background: white;
        margin-bottom: 2mm;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
}
