/* ==============================
   DOCUMENTS — pages /doc/{slug}
============================== */

/* ── Fond de page ── */
.home-container { background: var(--fond-page); min-height: 100vh; }

/* ── Conteneur document — feuille de papier ── */
.doc-wrap {
    max-width: 780px;
    margin: 1.5rem auto 2rem;
    padding: 2.5rem 3rem 3rem;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08), 0 8px 32px rgba(0,0,0,.06);
    position: relative;
    overflow: hidden;
}
.doc-wrap.has-filigrane::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('/images/filigrane.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 60%;
    opacity: .07;
    pointer-events: none;
    z-index: 0;
}
.doc-wrap.has-filigrane > * { position: relative; z-index: 1; }

/* ── Paragraphes ── */
.doc-para {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    margin-bottom: .5rem;
}
.doc-pfx {
    flex-shrink: 0;
    font-size: .875rem;
    color: #111827;
    line-height: 1.6;
    white-space: nowrap;
    user-select: none;
}
.doc-contenu {
    flex: 1;
    font-size: .875rem;
    color: #111827;
    line-height: 1.6;
}

/* ── Styles par type ── */
.doc-type-titre_document  .doc-contenu { font-size: 1.1rem;  font-weight: 700; border: #000000;}
.doc-type-titre_annexe    .doc-contenu { font-size: .98rem;  font-weight: 700; color: #4b5563; }
.doc-type-partie          .doc-contenu { font-size: .9rem;   font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #1d4ed8; }
.doc-type-titre0          .doc-contenu { font-size: .98rem;  font-weight: 700; }
.doc-type-titre1 .doc-contenu, .doc-type-titre1 .doc-pfx { font-size: .98rem; font-weight: 700; }
.doc-type-titre2 .doc-contenu, .doc-type-titre2 .doc-pfx { font-size: .93rem; font-weight: 600; }
.doc-type-titre3 .doc-contenu, .doc-type-titre3 .doc-pfx { font-size: .88rem; font-weight: 600; color: #374151; }
.doc-type-titre4 .doc-contenu, .doc-type-titre4 .doc-pfx { font-size: .85rem; font-weight: 600; color: #6b7280; }
.doc-type-titre5 .doc-contenu, .doc-type-titre5 .doc-pfx { font-size: .83rem; font-weight: 500; color: #6b7280; }
.doc-type-alinea .doc-pfx    { min-width: 2.4rem; text-align: right; }
.doc-type-alinea .doc-contenu{ padding-left: 0; text-align: justify; }
.doc-type-puce .doc-para                { padding-left: 4rem; gap: 2.4rem; }
.doc-type-puce              .doc-contenu{ padding-left: 0rem; }
.doc-type-puce              .doc-pfx    { font-size: 1.1rem; line-height: 1.2; }
.doc-type-tiret .doc-para               { padding-left: 1.2rem; }
.doc-type-tiret .doc-pfx                { font-size: .72rem; color: #000000; }
.doc-type-liste_numero      .doc-contenu{ padding-left: 1.2rem; }
.doc-type-puce {margin-left: 1.0rem;}
.doc-type-puce {margin-top: 0; margin-bottom: 0;}


.doc-type-normal .doc-contenu,
.doc-type-normal .doc-pfx    { font-family: "Times New Roman", Times, serif; font-size: 12pt; text-align: justify; }
.doc-type-normal             { margin-top: 3pt; margin-bottom: 3pt; }


.doc-type-alinea {
margin-left: 0rem;
    gap: .0rem;
    text-align: justify;
}

    
/* ── Tableau ── */
.doc-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: .75rem 0 1rem;
    font-size: .72rem;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
}
.doc-table th {
    background: #dbeab8;
    color: #000000;
    font-weight: 700;
    text-transform: uppercase;
    font-size: .65rem;
    letter-spacing: .03em;
    padding: .4rem .5rem;
    border: 1px solid #ffffff;
    text-align: center;
    vertical-align: middle;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.doc-table td {
    padding: .35rem .5rem;
    border: 1px solid #d1d5db;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.doc-table tbody tr:nth-child(even) td { background: #f9fafb; }

/* ── Lien externe ── */
.doc-lien-externe {
    color: #1d4ed8;
    text-decoration: underline;
    text-decoration-color: #93c5fd;
    font-weight: 500;
}
.doc-lien-externe:hover { text-decoration-color: #1d4ed8; }

/* ── Saut de page ── */
.doc-saut-page {
    border: none;
    border-top: 2px dashed #d1d5db;
    margin: 1.5rem 0;
    position: relative;
}
.doc-saut-page::after {
    content: 'Saut de page';
    position: absolute;
    left: 50%;
    top: -0.65rem;
    transform: translateX(-50%);
    background: #fff;
    padding: 0 .6rem;
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #d1d5db;
}

/* ── Footer dédié impression (masqué à l'écran) ── */
.print-footer { display: none; }

/* ── Impression ── */
@media print {
    .doc-saut-page {
        break-after: page;
        border: none;
        margin: 0;
        height: 0;
    }
    .doc-saut-page::after { display: none; }
    .doc-para, .doc-table tr { break-inside: avoid; }
    .doc-wrap { box-shadow: none; }
    .card-text.section { display: none !important; }

    @page { margin-bottom: 1.8cm; }

    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid #d1d5db;
        padding: 4px 1.5cm;
        font-size: .65rem;
        color: #6b7280;
        font-family: sans-serif;
    }
    .print-footer-pages::after {
        content: "Page " counter(page) " / " counter(pages);
    }
}
