/* Polices locales – uniquement les 4 essentielles */
@font-face {
  font-family: 'Cormorant';
  src: url('fonts/Cormorant-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant';
  src: url('fonts/Cormorant-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Crimson Text';
  src: url('fonts/CrimsonText-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Crimson Text';
  src: url('fonts/CrimsonText-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

*{margin:0;padding:0;box-sizing:border-box;}
body{font-family:'Crimson Text',serif;background:#f8f6f2;color:#333;line-height:1.6;}

header{text-align:center;padding:4rem 1rem 3rem;background:#111;color:#fff;}

h1{font-family:'Cormorant',serif;font-size:3.5rem;font-weight:400;letter-spacing:4px;margin-bottom:0.5rem;}
.subtitle{font-size:1.1rem;opacity:0.9;letter-spacing:2px;}

/* Section Bio – occultable */
/* Nouveaux liens bio : badge avec flèche et underline animé */
.bio-link-badge {
    display: inline-block;
    background: #F5F5DC; /* Beige clair, comme du papier ancien */
    border: 1px solid #D2B48C; /* Bordure marron clair */
    border-radius: 4px;
    padding: 0px 4px; /* Réduit pour moins d'espacement */
    margin: 0 2px; /* Réduit pour serrer les lignes */
    font-size: 0.90em;
    position: relative;
    transition: background 0.3s ease;
    color: #8B4513; /* Marron élégant */
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease, background 0.3s ease;
}
.bio-link-badge:hover {
    background: #E8E4D8; /* Beige légèrement plus foncé au hover */
    color: #D2691E; /* Couleur hover */
}
.bio-link-badge::after {
    content: ' →'; /* Petite flèche droite pour lien externe */
    font-size: 0.8em;
    opacity: 0.7;
}
.bio-link-badge::before {
    content: '';
    position: absolute;
    bottom: -2px; /* Juste en dessous du texte */
    left: 0;
    width: 0;
    height: 2px;
    background: #D2691E; /* Marron plus clair pour l'underline */
    transition: width 0.3s ease;
}
.bio-link-badge:hover::before {
    width: 100%; /* Underline qui s'anime au hover */
}

.bio-toggle-wrapper {
    max-width: 800px;
    margin: 2rem auto 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 2rem; /* ← padding latéral pour compenser le padding du content et éviter débordement */
    box-sizing: border-box;
}
.bio-toggle {
    width: 100%; /* ← pleine largeur du wrapper */
    background: #111;
    color: #fff;
    border: none;
    padding: 1.2rem 2rem;
    font-size: 1.3rem;
    font-family: 'Cormorant', serif;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bio-toggle:hover {
    background: #222;
}
.bio-toggle .arrow {
    transition: transform 0.3s ease;
}
.bio-toggle[aria-expanded="true"] .arrow {
    transform: rotate(180deg);
}
.bio-content {
    display: none; /* ← fermé par défaut */
    background: rgba(255,255,255,0.9);
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
/* Flex activé seulement quand ouvert */
.bio-content.open {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5rem; /* un peu plus d’air entre texte et photo */
}
.bio-content,
.bio-content.open {
    width: 100%;
    max-width: 900px; /* plus large que le toggle en desktop */
    margin: 1rem auto 0;
    padding: 2rem;
    box-sizing: border-box;
}
/* Photo à droite, bien visible, plus large pour éviter le hors-champ */
.bio-content img.bio-photo {
    flex: 0 0 320px; /* ← un poil plus large */
    max-width: 320px;
    border: 8px solid #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 4px;
}
/* Paragraphes normaux, plus de flex sur les <p> pour éviter les colonnes */
.bio-content p {
    margin-bottom: 1.2rem;
    line-height: 1.7;
    font-size: 1.05rem;
}
.bio-content p:last-child {margin-bottom: 0;}
/* Le bloc texte prend toute la place disponible, une seule colonne */
.bio-text {
    flex: 1;
}

.geneanet-link {
    font-size: 0.9em;
    color: #666;
    text-decoration: none;
    margin-left: 0.5em;
}
.geneanet-link:hover {
    text-decoration: underline;
    color: #333;
}

/* Galerie en colonnes */
.gallery{
    max-width:1200px;margin:0 auto;padding:2rem 1rem;
    columns:3 320px;column-gap:2rem;
}

/* Miniatures */
figure.item{break-inside:avoid;margin-bottom:3rem;}
figure.item .thumb{display:block;}
figure.item img{
    width:100%;border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,0.12);
    transition:transform .3s ease;cursor:pointer;
}
figure.item img.oval {
    border-radius: 50%;
}
figure.item:hover img{transform:scale(1.04);} /* zoom uniquement sur miniature */

figure.item .caption{
    padding:1.2rem 0.5rem 0;text-align:center;font-size:0.98rem;opacity:0.9;
}
.missing{color:#999;font-style:italic;font-size:0.9rem!important;}

/* Messages d’état */
#gallery > .empty-state{
    width:100%;text-align:center;padding:6rem 2rem;
    column-span:all;break-inside:avoid;
}
#gallery > .empty-state .big{
    font-size:2.6rem;font-weight:600;margin-bottom:1.2rem;color:#c33;
}
#gallery > .empty-state .small{
    font-size:1.4rem;opacity:0.85;color:#c33;
}
#gallery > .empty-state:not(.error) .big,
#gallery > .empty-state:not(.error) .small{color:#666;}

/* Lightbox – image respecte le ratio, jamais déformée */
.lightbox{
    display:none;position:fixed;inset:0;background:rgba(0,0,0,0.94);
    align-items:center;justify-content:center;z-index:999;
    padding:4vh 4vw;                     /* ← marge autour du contenu */
    background:transparent;              /* ← fond transparent */
}
.lightbox:target{display:flex;}
/* Fond noir réel, derrière le contenu */
.lightbox::before{
    content:'';
    position:fixed;inset:0;
    background:rgba(0,0,0,0.94);
    z-index:-2;
}
.lightbox .big-img{
    max-width:88vw;
    max-height:85vh;
    object-fit:contain;           /* ← clé magique : ratio préservé */
    border:12px solid #fff;
    box-shadow:0 0 50px rgba(0,0,0,0.9);
}
.lightbox .big-img.oval {
    border-radius: 50%;
}
/* Légende lightbox */
.lightbox .caption{
    position:absolute;bottom:2rem;left:2rem;
    background:rgba(0,0,0,0.85);color:#fff;padding:1.6rem;
    border-radius:12px;text-align:center;max-width:800px;
}
.lightbox .caption h3{font-size:2rem;margin-bottom:0.6rem;}
.lightbox .caption .note{font-style:italic;font-size:1.1rem;opacity:0.9;margin-top:1.2rem;}

/* Croix toujours visible + clic fond ferme */
.close{
    position:absolute;top:1rem;right:2rem;
    font-size:5rem;font-weight:100;color:#fff;text-decoration:none;z-index:1000;
    text-shadow:0 0 10px rgba(0,0,0,0.8); /* ← ombre douce pour visibilité max */
}
.overlay-close{
    position:fixed;inset:0;cursor:pointer;z-index:-1;
}

/* Footer */
footer{
    text-align:center;
    padding:3rem 1rem;
    font-size:1rem;
    opacity:0.7;
    background:#111;
    color:#ccc;
    font-family:'Cormorant', 'Crimson Text', serif; /* ← Cormorant en priorité, comme le header */
    letter-spacing:1px;
}
footer a{
    color:#fff;
    text-decoration:none;
    font-weight:600;
}
footer a:hover{
    text-decoration:underline;
}

/* Liens sociaux footer – discrets et classes */
.social-links {
    margin-top: 1rem;
    font-size: 0.95rem;
    opacity: 0.8;
}
.social-links a {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem; /* espace icône/texte */
    transition: opacity 0.3s ease;
}
.social-links a:hover {
    opacity: 0.7;
}
.social-icon {
    width: 22px;
    height: 22px;
}

/* Bloc navigation flottant */
.scroll-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 998; /* juste en dessous de la lightbox */
    background: rgba(17,17,17,0.8); /* même gris que footer, semi-transparent */
    padding: 0.8rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.scroll-btn {
    width: 44px;
    height: 44px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.scroll-btn:hover {
    background: #333;
    transform: scale(1.1);
}

@media(max-width:860px){
    header{padding:1rem 1rem 2rem;}
    footer{
        padding: 1rem 1rem;
        font-size:0.9rem;
    }

    .bio-toggle-wrapper {
        max-width: 95vw; /* ← un poil plus large sur tablette pour respirer */
        padding: 0 1rem; /* ← marge latérale pour pas coller les bords */
        margin: 1rem auto 0;
        justify-content: center;
    }
    .bio-toggle {
        padding: 1rem 1.5rem;
        font-size: 1.2rem;
        margin: 1rem auto 0; /* ← un poil moins de marge top sur tablette */
    }
    .bio-content,
    .bio-content.open {
        width: calc(95vw - 2rem); /* même largeur visible que le toggle */
        max-width: calc(95vw - 2rem);
        margin: 1rem auto 0;
        padding: 1.5rem;
        flex-direction: column;
    }
    .bio-content img.bio-photo {
        flex: 0 0 auto;
        width: 100%;
        max-width: 380px;
        margin: 0 auto 1.5rem;
        display: block;
    }

    .gallery{columns:2;}

    .lightbox .caption{
        position:absolute;
        bottom:1rem;                     /* ← plus bas, moins haut sur l’image */
        left:5%; right:5%;               /* ← bien plus large, presque bord à bord */
        transform:none;                  /* ← plus besoin de translate */
        padding:0.8rem 1.2rem;           /* ← moins de padding vertical */
        font-size:0.9rem;                /* ← police plus petite */
        line-height:1;                   /* ← lignes plus serrées */
        max-width:none;                  /* ← prend toute la largeur disponible */
        background:rgba(0,0,0,0.7);      /* ← un poil plus transparent */
        border-radius:8px;
    }
    .lightbox .caption h3{
        font-size:1.3rem;                /* ← titre moins gros */
        margin-bottom:0.3rem;
    }
    .lightbox .caption p{
        margin:0.4rem 0;
    }
    .lightbox .caption .note{
        font-size:0.85rem;
        margin-top:0.6rem;
    }
}

@media(max-width:540px){
    .gallery{columns:1;}

    .bio-toggle-wrapper {
        max-width: 98vw;
        padding: 0 0.5rem;
        margin: 1rem auto 0;
    }
    .bio-toggle {
        margin:1rem auto 0;
        max-width: 90%;
        font-size: 1.1rem;
        padding: 0.9rem 1.2rem;
    }
    .bio-content,
    .bio-content.open {
        margin: 1rem auto 0;
        width: calc(98vw - 1rem); /* même largeur visible que le toggle */
        max-width: calc(98vw - 1rem);
        padding: 1.2rem;
    }

    .lightbox .caption{
        padding:0.4rem 0.4rem;             /* ← encore plus compact sur petit écran */
        font-size:0.85rem;
        bottom:0.8rem;
    }
    .lightbox .caption h3{font-size:1.2rem;}

    .scroll-nav {
        bottom: 1.5rem;
        right: 1.5rem;
        gap: 0.6rem;
        padding: 0.6rem;
    }
    .scroll-btn {
        width: 40px;
        height: 40px;
        font-size: 1.6rem;
    }
    h1 {
        font-size: 2.5rem;
    }
}

/* Accessibilité - Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}