/* Livre Blanc Céréales 2027 – seule feuille de style maison, par-dessus Bootstrap 5.3.
   Les COULEURS sont définies dans scss/bootstrap.scss (Bootstrap compilé au build) et utilisées ici par
   leur rôle : var(--bs-primary), --bs-secondary, --bs-dark, --bs-warning, --bs-light, --bs-danger.
   Dans le HTML : uniquement des classes Bootstrap (bg-dark, text-primary, btn-dark…) et les classes ci-dessous. */

html, body { overflow-x: clip; } /* clip et non hidden : hidden casse le menu sticky */

.btn-outline-dark { --bs-btn-border-width: 2px; }
.list-group-item.niveau-4 { padding-left: 4rem; }
.leger { font-weight: 400; }
.fw-black { font-weight: 900; }

/* Navigation */
.navbar .nav-link { color: var(--bs-dark); }
.navbar .nav-link.active, .navbar .nav-link.show { color: var(--bs-dark); border-bottom: 3px solid var(--bs-warning); }

/* Formes géométriques (quarts de cercle) */
.forme { position: absolute; pointer-events: none; }
.q-hd  { right: 0; top: 0; width: 260px; height: 260px; background: var(--bs-warning); border-radius: 0 0 0 260px; }
.q-hd2 { right: 260px; top: 0; width: 130px; height: 130px; background: var(--bs-secondary); border-radius: 0 0 130px 0; }
.q-bg  { left: 0; bottom: 0; width: 150px; height: 150px; background: var(--bs-warning); border-radius: 150px 0 0 0; }
.q-bg2 { left: 150px; bottom: 0; width: 100px; height: 100px; background: var(--bs-secondary); border-radius: 0 100px 0 0; }

/* En-tête des pages (fond dark) */
.entete .breadcrumb { --bs-breadcrumb-divider-color: rgba(255,255,255,.6); --bs-breadcrumb-item-active-color: rgba(255,255,255,.75); }
.entete .breadcrumb a { color: #fff; }
.eds .nav-link { border: 1.5px solid rgba(255,255,255,.4); color: #fff; font-weight: 600; white-space: nowrap; }
.eds .nav-link.active { background: #fff; color: var(--bs-dark); border-color: #fff; }

/* Accueil */
/* Bandeau d'accueil : fond dark collé au menu ; photo à droite, du haut du bandeau jusqu'au bord de l'écran */
.hero-visuel { position: absolute; top: 0; right: 0; bottom: 0; width: 46%; }
.photo-hero { position: absolute; inset: 0 0 0 0; background: url(/medias/2017/02/header-default.png) 30% 50% / cover; border-radius: 0 0 0 200px; }
.bloc-livre { position: relative; }
.bloc-livre::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 62%; background: var(--bs-dark); }
.couv { width: 260px; aspect-ratio: 3 / 4; background: linear-gradient(rgba(var(--bs-dark-rgb), .15), rgba(var(--bs-dark-rgb), .7)), url(/medias/2020/02/Maladies-froment-septoriose-02-e1582290903330.jpg) center / cover; border-radius: 4px 14px 14px 4px; box-shadow: 18px 22px 44px rgba(0,0,0,.35); }
.logos img { height: 44px; width: auto; }

/* Cartes des thématiques : fond light (paille) + rond en coin */
.theme { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-height: 120px; padding: 1.1rem 1.25rem; border-radius: 1.1rem; background: var(--bs-light); color: var(--bs-dark); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.theme:hover { transform: translateY(-3px); box-shadow: 0 .5rem 1.5rem rgba(var(--bs-dark-rgb), .15); color: var(--bs-dark); }
.theme b { position: relative; font-size: 1.1rem; line-height: 1.2; }
.theme small { position: relative; color: var(--bs-secondary-color); }
.coin { position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--bs-warning); opacity: .55; }
.coin.v { background: var(--bs-secondary); }
.theme-lg { min-height: 190px; padding: 1.5rem; }
.theme-lg b { font-size: 1.6rem; }
.theme-lg .coin { right: -30px; top: -30px; width: 130px; height: 130px; opacity: .7; }

/* Tuiles des éditions par année */
.edition { display: block; height: 100%; background: #fff; border-radius: .9rem; padding: 1rem 1.1rem; text-decoration: none; color: var(--bs-dark); transition: transform .15s, box-shadow .15s; }
.edition:hover { transform: translateY(-3px); box-shadow: 0 .5rem 1.25rem rgba(var(--bs-dark-rgb), .12); color: var(--bs-dark); }
.edition b { display: block; font-weight: 800; font-size: 1.6rem; line-height: 1.1; }
.edition small { color: var(--bs-secondary-color); }

/* Contenu des pages (HTML importé de WordPress) */
.contenu h2 { margin-top: 2rem; color: var(--bs-dark); font-weight: 800; }
.contenu h3 { margin-top: 1.5rem; font-size: 1.3rem; color: var(--bs-dark); font-weight: 700; }
.contenu img { margin-bottom: 1rem; border-radius: .5rem; }
.contenu table { font-size: .95rem; }

/* Boutons du contenu (<a class="btn btn-primary"> venus de WordPress) : aucun HTML spécial, tout est ici.
   - bouton seul : pilule vert foncé (dark) + flèche (→ page du site, ↗ site externe, ↓ fichier à télécharger)
   - boutons rangés en colonnes (.row) : cartes fond light (paille) avec rond en coin, comme les thématiques */
.contenu .btn-primary {
  --bs-btn-bg: var(--bs-dark); --bs-btn-border-color: var(--bs-dark);
  --bs-btn-hover-bg: color-mix(in srgb, var(--bs-dark) 80%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--bs-dark) 80%, #000);
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .7rem 1.4rem; border-radius: 999px; font-weight: 600; text-align: left;
  box-shadow: 0 .35rem 1rem rgba(var(--bs-dark-rgb), .18); transition: transform .15s, box-shadow .15s, background-color .15s;
}
.contenu .btn-primary::after { content: "→"; font-weight: 700; transition: transform .15s; }
.contenu .btn-primary[target="_blank"]::after { content: "↗"; }
.contenu .btn-primary:is([href$=".pdf"], [href$=".zip"], [href$=".xlsx"], [href$=".xls"], [href$=".docx"])::after { content: "↓"; }
.contenu .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 .6rem 1.4rem rgba(var(--bs-dark-rgb), .25); }
.contenu .btn-primary:hover::after { transform: translateX(3px); }
.contenu .btn-primary[target="_blank"]:hover::after { transform: translate(2px, -2px); }
.contenu .btn-primary.pdf::before { background: var(--bs-danger); }

.contenu .row .btn-primary {
  position: relative; overflow: hidden; display: flex; width: 100%; min-height: 5.5rem; align-items: flex-end;
  justify-content: space-between; padding: 1.1rem 1.25rem; border-radius: 1.1rem;
  --bs-btn-bg: var(--bs-light); --bs-btn-border-color: var(--bs-light); --bs-btn-color: var(--bs-dark);
  --bs-btn-hover-bg: var(--bs-light); --bs-btn-hover-border-color: var(--bs-light); --bs-btn-hover-color: var(--bs-dark);
  --bs-btn-active-bg: var(--bs-light); --bs-btn-active-color: var(--bs-dark);
  font-size: 1.1rem; font-weight: 700; line-height: 1.2; box-shadow: none;
}
.contenu .row .btn-primary::before { content: ""; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--bs-warning); opacity: .55; transition: transform .2s; }
.contenu .row .col-md:nth-child(even) .btn-primary::before { background: var(--bs-secondary); }
.contenu .row .btn-primary::after { position: relative; color: var(--bs-primary); }
.contenu .row .btn-primary:hover { box-shadow: 0 .5rem 1.5rem rgba(var(--bs-dark-rgb), .15); }
.contenu .row .btn-primary:hover::before { transform: scale(1.12); }
.contenu .row .btn-primary.pdf::before { position: absolute; }

/* Pastille « PDF » des liens PDF isolés dans le texte (class="pdf" venue de WordPress) */
a.pdf::before { content: "PDF"; display: inline-block; font-size: .7em; font-weight: 700; color: #fff; background: var(--bs-danger); border-radius: .25rem; padding: .1em .4em; margin-right: .5em; vertical-align: .15em; }
a.btn.pdf::before { background: rgba(0,0,0,.25); }

/* Listes de fichiers : list-group Bootstrap généré au build (eleventy.config.js, transform « listesFichiers »).
   Ici seulement l'arrondi, aux dimensions des autres cartes du site. */
:is(.contenu, .docs) .list-group { --bs-list-group-border-radius: 1rem; }

/* Éditions : paragraphes qui ne contiennent qu'un lien PDF, regroupés visuellement en une liste */
.docs p > a.pdf:only-child { display: flex; align-items: center; gap: .25rem; padding: .8rem 1rem; color: var(--bs-body-color); font-weight: 600; text-decoration: none; }
.docs p > a.pdf:only-child::after { content: "Télécharger ↓"; margin-left: auto; padding-left: 1rem; font-weight: 400; font-size: .9rem; color: var(--bs-primary); white-space: nowrap; }
.docs p > a.pdf:only-child:hover { background: var(--bs-tertiary-bg); }
.docs p:has(> a.pdf:only-child) { margin: 0; background: #fff; border: 1px solid var(--bs-border-color); border-bottom: 0; }
.docs p:has(> a.pdf:only-child):not(p:has(> a.pdf:only-child) + p) { border-radius: 1rem 1rem 0 0; }
.docs p:has(> a.pdf:only-child):not(:has(+ p > a.pdf:only-child)) { border-bottom: 1px solid var(--bs-border-color); border-radius: 0 0 1rem 1rem; margin-bottom: 1.5rem; }
.docs p:has(> a.pdf:only-child):not(p:has(> a.pdf:only-child) + p):not(:has(+ p > a.pdf:only-child)) { border-radius: 1rem; }
.docs p { margin-bottom: .5rem; }

/* Version courte (accueil) : 7 premiers fichiers, sans cadre ni « Télécharger » */
.docs-courts .list-group { --bs-list-group-border-radius: 0; box-shadow: none !important; }
.docs-courts .list-group-item { border-width: 0 0 var(--bs-list-group-border-width); }
.docs-courts .list-group-item:nth-child(n+8) { display: none; }
.docs-courts .list-group-item a { padding-left: 0 !important; padding-right: 0 !important; }
.docs-courts .list-group-item a > :last-child { display: none; }

@media (max-width: 991.98px) {
  .bloc-livre::before { width: 100%; }
  /* bandeau d'accueil : la photo passe au-dessus du texte, collée au menu */
  .hero-visuel { position: relative; width: 100%; height: 300px; }
}
@media (max-width: 767.98px) {
  .q-hd { width: 110px; height: 110px; border-radius: 0 0 0 110px; }
  .q-hd2 { right: 110px; width: 56px; height: 56px; border-radius: 0 0 56px 0; }
  .hero-visuel { height: 220px; }
  .photo-hero { border-radius: 0 0 0 110px; }
  .q-bg { width: 80px; height: 80px; border-radius: 80px 0 0 0; }
  .q-bg2 { left: 80px; width: 56px; height: 56px; border-radius: 0 56px 0 0; }
  .couv { width: 190px; }
  .logos img { height: 32px; }
}
