/*
 * Page publique d'une race (templates/race_detail.html), mise en page inspirée des fiches race de Tipaw :
 * bannière photo pleine largeur, carte latérale blanche qui chevauche la bannière (portrait, boutons bleu marine,
 * caractéristiques, jauges en pattes, couleurs), textes à droite. Mobile : une colonne (titre, carte, textes).
 * Bootstrap 5.1 reste la base ; ces règles ajoutent l'habillage.
 */
.fiche-race {
    --fr-marine: var(--u-fonce, #091437);   /* Boutons, titres de la carte, pattes pleines : couleur foncée de l'univers */
    --fr-texte: #616b77;         /* Texte courant */
    --fr-titre: #3d4556;         /* Titres des rubriques */
    --fr-trait: #d7dae0;         /* Bordures, pattes vides */
    --fr-bleu-clair: var(--u-clair, #dde6fb);   /* Fonds décoratifs : couleur pâle de l'univers */
    --fr-rayon: .75rem;
    --fr-ombre: 0 .25rem 1.25rem rgba(9, 20, 55, .10);
    --fr-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    color: var(--fr-texte);
    padding-bottom: 2rem;
}
/* La bannière déborde du conteneur Bootstrap : on coupe le débordement horizontal (aucun défilement latéral) */
html { overflow-x: clip; }

/* --- Bannière pleine largeur --- */
.fr-banniere {
    margin: -1.5rem calc(50% - 50vw) 0;   /* Annule le « mt-4 » du conteneur et s'étend d'un bord à l'autre */
    height: clamp(190px, 28vw, 380px); background: #e9ecef; overflow: hidden; position: relative;
}
/* Photos de la race (bannière, portrait, vignettes) : photo entière centrée (.photo-entiere) sur un fond flou de la
   même photo (.photo-fond-flou, univers.css) ; un recadrage « cover » coupait le plus souvent la tête de l'animal */
.fr-photo-cadre { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #e9ecef; }
.fiche-race .photo-entiere { z-index: 1; }
.fr-banniere[data-vide] { background: linear-gradient(135deg, var(--fr-bleu-clair), #f8fafe); }

/* --- Grille : une colonne sur mobile, carte à gauche + contenu à droite à partir de 992 px --- */
.fr-grille {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem;
    grid-template-areas: "entete" "cote" "contenu";
}
.fr-entete { grid-area: entete; }
.fr-cote { grid-area: cote; }
.fr-contenu { grid-area: contenu; min-width: 0; }

/* Mobile : le titre est posé dans un cadre blanc qui chevauche la bannière */
.fr-entete {
    position: relative; z-index: 2; margin-top: -2.5rem; background: #fff; border-radius: var(--fr-rayon);
    padding: 1rem 1rem .25rem; box-shadow: var(--fr-ombre);
}
@media (min-width: 992px) {
    .fr-grille {
        grid-template-columns: 350px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 2.5rem;
        grid-template-areas: "cote entete" "cote contenu"; align-items: start;
    }
    .fr-entete { margin-top: 1.75rem; background: none; box-shadow: none; padding: 0; }
    .fr-cote { position: relative; z-index: 2; margin-top: -7rem; }   /* La carte chevauche la bannière */
}

/* --- Titre et présentation --- */
.fiche-race .breadcrumb a { color: var(--fr-texte); text-decoration: none; }
.fiche-race .breadcrumb a:hover { color: var(--fr-marine); text-decoration: underline; }
.fr-titre { font-family: var(--fr-serif); font-weight: 700; color: var(--fr-marine); font-size: clamp(1.6rem, 3.6vw, 2.3rem); line-height: 1.15; }
.fr-pastille {
    font-size: .75rem; font-weight: 600; color: var(--fr-marine); background: var(--fr-bleu-clair);
    border-radius: 2rem; padding: .2rem .7rem;
}
.fr-intro { font-size: 1rem; line-height: 1.6; }

/* --- Carte latérale --- */
.fr-carte { background: #fff; border-radius: var(--fr-rayon); box-shadow: var(--fr-ombre); padding: 0 1rem 1.25rem; }
.fr-portrait {
    position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in;
    border-radius: var(--fr-rayon) var(--fr-rayon) 0 0; overflow: hidden; margin: 0 -1rem; width: calc(100% + 2rem);
}
.fr-portrait .photo-entiere { transition: transform .4s; }
.fr-portrait:hover .photo-entiere { transform: scale(1.02); }
.galerie-compteur { z-index: 2; }
.galerie-compteur {
    position: absolute; bottom: .6rem; right: .6rem; padding: .2rem .6rem; border-radius: 2rem; font-size: .8rem;
    color: #fff; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px);
}
.galerie-vide {
    aspect-ratio: 4 / 3; margin: 0 -1rem; border-radius: var(--fr-rayon) var(--fr-rayon) 0 0;
    background: linear-gradient(135deg, #eef2f7, var(--fr-bleu-clair));
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; color: #6c7a8c;
}
.galerie-vide .bi { font-size: 3rem; }
.fr-boutons { display: grid; gap: .55rem; margin-top: 1rem; }
.fr-btn {
    background: var(--fr-marine); color: #fff; border-radius: .6rem; font-weight: 600; font-size: .9rem; padding: .5rem 1rem;
}
.fr-btn:hover, .fr-btn:focus { background: #1b2a5c; color: #fff; }

/* Titres de la carte : petites capitales à empattements, comme « CARACTÉRISTIQUES » chez Tipaw */
.fr-cote-titre {
    font-family: var(--fr-serif); font-weight: 700; font-size: 1.1rem; text-transform: uppercase; letter-spacing: .02em;
    color: var(--fr-marine); margin: 1.5rem 0 .6rem;
}
/* Caractéristiques : libellé à gauche, valeur à droite (empilés sur très petit écran) */
.fr-carac { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: .45rem .75rem; margin: 0; font-size: .9rem; }
.fr-carac dt { font-weight: 600; color: var(--fr-titre); }
.fr-carac dd { margin: 0; }
.sexe { display: inline-block; width: 1rem; text-align: center; font-weight: 700; }
.sexe-m { color: #1f6feb; }
.sexe-f { color: #d6336c; }

/* Jauges : 5 pattes, pleines en bleu marine */
.fr-notes { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.fr-notes li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .3rem 0; }
.fr-pattes { display: inline-flex; gap: 3px; flex-shrink: 0; }
.fr-pattes svg { width: 15px; height: 15px; fill: var(--fr-trait); opacity: .7; }
.fr-pattes svg.plein { fill: var(--fr-marine); opacity: 1; }

/* Couleurs de robe */
.couleurs { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem 1rem; font-size: .88rem; }
.couleurs li { display: flex; align-items: center; gap: .4rem; }
.couleurs .pastille { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }

/* --- Contenu --- */
.fr-appel {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: #faf6f0; border: 1px solid #efe6da; border-radius: 12px; padding: 20px; margin-bottom: 2rem;
}
.fr-appel::before {   /* Demi-cercle décoratif bleu clair dans le coin, comme chez Tipaw */
    content: ""; position: absolute; top: -3.5rem; left: -2rem; width: 7rem; height: 7rem; border-radius: 50%;
    background: var(--fr-bleu-clair); z-index: 0;
}
.fr-appel > * { position: relative; z-index: 1; }
.fr-appel-titre { font-weight: 700; font-size: 1.2rem; color: var(--fr-marine); margin-bottom: .35rem; }
.fr-appel-photos { display: grid; grid-template-columns: repeat(2, 64px); gap: .4rem; flex-shrink: 0; }
.fr-appel-photos img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; }

/* Rubriques en « article de magazine » : titres chocolat séparés par un liseré, paragraphes aérés */
.fiche-section { scroll-margin-top: 1rem; margin-bottom: 2.25rem; }
.fr-h2 {
    font-family: var(--fr-serif); font-size: 1.35rem; font-weight: 700; color: #4A2E2B; line-height: 1.3;
    margin: 2rem 0 1rem; padding-bottom: .55rem; border-bottom: 1px solid #eadfd3; position: relative;
}
.fr-h2::after {   /* Petit liseré accentué sous le début du titre */
    content: ""; position: absolute; left: 0; bottom: -2px; width: 3rem; height: 3px; border-radius: 3px;
    background: var(--u-accent, #4A2E2B);
}
.fiche-section .texte-riche { font-size: 1.02rem; line-height: 1.8; color: #4f5763; }
.fiche-section .texte-riche p { margin-bottom: 1.1rem; }
.fiche-section .texte-riche ul, .fiche-section .texte-riche ol { margin-bottom: 1.1rem; padding-left: 1.3rem; }
.fiche-section .texte-riche li { margin-bottom: .4rem; }
.fiche-section .texte-riche h3, .fiche-section .texte-riche h4 { color: #4A2E2B; font-weight: 700; margin: 1.5rem 0 .6rem; }
.fiche-section .texte-riche strong { color: #3d3532; }

/* Galerie */
.galerie-filtres { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.galerie-filtres .filtre { border: 1px solid var(--fr-trait); background: #fff; border-radius: 2rem; padding: .2rem .8rem; font-size: .85rem; }
.galerie-filtres .filtre.actif { background: var(--fr-marine); border-color: var(--fr-marine); color: #fff; }
.fr-vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.fr-vignettes .vignette { padding: 0; border: 0; border-radius: .6rem; overflow: hidden; background: #e9ecef; cursor: zoom-in; }
.fr-vignettes .vignette[hidden] { display: none; }
.fr-vignettes .photo-entiere { transition: transform .3s; }
.fr-vignettes .vignette:hover .photo-entiere { transform: scale(1.04); }

/* Fenêtre d'agrandissement */
.agrandi-nav {
    position: absolute; top: 50%; transform: translateY(-50%); width: 2.75rem; height: 2.75rem; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, .15); color: #fff; font-size: 1.25rem;
}
.agrandi-nav:hover { background: rgba(255, 255, 255, .3); }
.agrandi-nav.precedente { left: .75rem; }
.agrandi-nav.suivante { right: .75rem; }

/* Questions fréquentes (dépliables) */
.fr-faq details { border-bottom: 1px solid var(--fr-trait); padding: .7rem 0; }
.fr-faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.fr-faq summary::-webkit-details-marker { display: none; }
.fr-faq summary::after { content: "+"; font-weight: 700; color: var(--fr-marine); }
.fr-faq details[open] summary::after { content: "−"; }
.fr-faq h3 { font-size: 1rem; font-weight: 600; color: var(--fr-titre); margin: 0; }
.fr-faq p { margin: .5rem 0 0; line-height: 1.6; }

/* Crédits */
/* Crédits photos et sources : repliés, petits et gris pour ne pas alourdir la lecture */
.fiche-credits { border-top: 1px solid var(--fr-trait); padding-top: .75rem; margin-top: 2.5rem; font-size: .75rem; color: #8a929c; }
.fiche-credits summary { cursor: pointer; color: #8a929c; }
.fiche-credits summary:hover { color: var(--fr-titre); }
.fiche-credits details[open] summary { margin-bottom: .5rem; }
.fiche-credits ul { padding-left: 1rem; margin-bottom: .75rem; }
.fiche-credits a { color: #8a929c; word-break: break-all; }

@media (max-width: 400px) {
    .fr-carac { grid-template-columns: 1fr; gap: .1rem; }
    .fr-carac dd { margin-bottom: .45rem; }
    .fr-appel-photos { display: none; }
}
