/* ============================================================
   1. BASES & TYPOGRAPHIE
   ============================================================ */
body {
    font-family: 'Verdana', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #E3D3B0; 
    color: #333;
    line-height: 1.5;
}

body.accueil, body.page-article {
    background-image: url('images-nouvelles/fond-nouvelles.png');
    background-attachment: fixed;
    background-size: cover;
}

a { color: #81573d; text-decoration: none; transition: 0.3s; }
a:hover { text-decoration: underline; }

/* ============================================================
   2. STRUCTURE GÉNÉRALE
   ============================================================ */
main {
    width: 90%;
    max-width: 800px;
    margin: 20px auto 40px auto;
    background-color: rgba(255, 250, 240, 0.96); 
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    overflow: hidden;
    padding-bottom: 30px;
}

.bandeau-principal img, .image-de-fin img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   3. L'ENTÊTE (Navigation et Titres) - CORRIGÉ
   ============================================================ */
.entete-accueil {
    padding: 20px 25px;
}

.titre-accueil {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 0 0 15px 0;
    border-bottom: 1px solid #d2b48c;
    margin-bottom: 20px;
}

.intro-section {
    text-align: center;
    margin-bottom: 25px;
}

.intro-section h2 {
    color: #5d3a1a;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

/* ============================================================
   4. LE REGISTRE COMPACT (index-ecriture.html)
   ============================================================ */
/* --- Correction pour le conteneur principal --- */
.registre-ecole {
    max-width: 1100px;
    margin: 0 auto;
    background-color: #fdf5e6;
    min-height: 100vh; /* Utiliser min-height au lieu de height */
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0,0,0,0.2);
    /* Safari fix : on s'assure que le contenu ne déborde pas mal */
    overflow: visible !important; 
}

/* --- Correction spécifique pour l'image de fin --- */
.image-de-fin {
    margin-top: auto; /* Pousse l'image vers le bas si le texte est court */
    width: 100%;
    line-height: 0; /* Évite un espace blanc inutile sous l'image */
}

.image-de-fin img {
    display: block; /* INDISPENSABLE pour Safari */
    width: 100%;
    height: auto;
    /* On s'assure que l'image n'est pas masquée */
    position: relative;
    z-index: 10;
}

.grille-lettres-compacte {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 10px 20px;
    padding: 10px 40px 30px 40px;
}

.lien-eleve {
    display: block;
    padding: 10px 15px;
    background-color: rgba(129, 87, 61, 0.05);
    border-bottom: 1px solid #d2b48c;
    color: #3e2b1d !important;
    font-size: 1.1rem;
    text-decoration: none;
}

.lien-eleve .numero {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    color: #81573d;
    margin-right: 10px;
}


.cadre-bois-ancien {
    display: inline-block; /* Pour que le cadre épouse la taille de l'image */
    padding: 1px;         /* Espace blanc/crème entre l'image et le bois (le passe-partout) */
    background-color: #f4eee1; /* Couleur papier vieilli pour le passe-partout */
    
    /* La bordure simulant le bois */
    border: 5px solid #5d3a1a; 
    border-image: linear-gradient(45deg, #3e2711, #5d3a1a, #3e2711) 1;
    
    /* Effets de relief et d'ombre */
    box-shadow: 
        10px 10px 20px rgba(0,0,0,0.5),        /* Ombre sur le mur */
        inset 2px 2px 5px rgba(0,0,0,0.7),     /* Profondeur intérieure du bois */
        0 0 0 2px #2a1b0c;                     /* Fine ligne de finition extérieure */
        
    margin: 30px auto;
    max-width: 95%;        /* Pour que ça reste fluide sur mobile */
}

.cadre-bois-ancien img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #d2b48c; /* Petit liseré autour de l'image elle-même */
}


/* ============================================================
   5. LA GRILLE DES NOUVELLES (index-nouvelles.html)
   ============================================================ */
.grille-nouvelles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 0 25px;
}

.carte-vignette {
    display: flex;
    flex-direction: column;
    background-color: #fdf5e6;
    background-image: url('https://www.transparenttextures.com/patterns/parchment.png');
    border: 1px solid #81573d;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(129, 87, 61, 0.1);
}

.image-cadre { width: 100%; height: 130px; overflow: hidden; border-bottom: 1px solid #81573d; }
.image-cadre img { width: 100%; height: 100%; object-fit: cover; }

.legende-carte { padding: 12px; text-align: center; }
.legende-carte h3 { font-size: 0.95rem; color: #5d3a1a; text-transform: uppercase; margin: 0; }
.legende-carte p { font-size: 0.8rem; color: #81573d; font-style: italic; margin-top: 4px; }

/* ============================================================
   6. LA LETTRE ET LE DOCUMENT ANCIEN
   ============================================================ */
.document-ancien {
    position: relative;
    background-color: #fdf5e6;
    background-image: url('https://www.transparenttextures.com/patterns/parchment.png');
    padding: 50px;
    margin: 0 20px;
    border: 1px solid #d2b48c;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.titre-chronique {
    text-align: center;
    color: #81573d;
    font-size: 1.5rem;
    text-transform: uppercase;
    border-bottom: 2px double #d2b48c;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.contenu-lettre p {
    font-family: 'Dancing Script', cursive !important;
    font-size: 1.4rem !important;
    line-height: 1.4;
    color: #2c1e14;
    text-align: center; /* Centré comme demandé */
}

.signature-manuscrite {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    color: #1a237e;
    text-align: right;
}

.cachet-cire {
    position: absolute;
    bottom: 30px;
    left: 40px;
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    filter: drop-shadow(2px 4px 5px rgba(0,0,0,0.3));
}

/* ============================================================
   7. NAVIGATION & RESPONSIVE
   ============================================================ */
.bouton-retour {
    display: inline-block;
    padding: 8px 20px;
    background-color: #81573d;
    color: white !important;
    border-radius: 20px;
    margin-top: 20px;
}

@media (max-width: 700px) {
    .grille-nouvelles, .grille-lettres-compacte { grid-template-columns: 1fr; }
    .document-ancien { padding: 30px 20px; }
    .contenu-lettre p { font-size: 1.2rem !important; }
}