/* ════════════════════════════════════════
   FUNGI — encyclopedie.css
   La table des sporées · la clairière · le carnet de récolte
   S'appuie sur les variables de style.css (Fungi).
════════════════════════════════════════ */

/* ══════════════════════════════════
   NIVEAU 1 — EN-TÊTE
══════════════════════════════════ */
.en-hero {
  max-width: 820px; margin: 0 auto; text-align: center;
  padding: clamp(2.4rem,5vw,4.2rem) clamp(1rem,4vw,2rem) 1rem;
}
.en-hero h1 { font-family: var(--fd); font-weight: 400; font-size: clamp(2.6rem,6.6vw,4.8rem); line-height: 1; }
.en-hero h1 em { color: var(--accent); font-style: normal; }
.en-hero .lead { margin: 1.2rem auto 1.8rem; max-width: 52ch; }
.en-total { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }

/* ══════════════════════════════════
   NIVEAU 1 — LA TABLE DES SPORÉES
══════════════════════════════════ */
.en-table {
  position: relative;
  max-width: 1100px; margin: 0 auto;
  padding: clamp(1.6rem,4vw,3rem) clamp(1rem,4vw,2.4rem) clamp(3rem,6vw,5rem);
}
.sporees {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
  gap: clamp(1.4rem,3vw,2.6rem) clamp(1rem,2.6vw,2.2rem);
}

/* Une feuille de papier mi-blanche mi-noire, légèrement de travers */
.feuille {
  display: flex; flex-direction: column; text-decoration: none; color: #2a1b10;
  transform: rotate(var(--t, 0deg));
  transition: transform .3s ease, filter .3s ease;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.45));
}
.feuille:hover { transform: rotate(0deg) translateY(-6px) scale(1.02); filter: drop-shadow(0 18px 22px rgba(0,0,0,.55)); }
.feuille.vide { opacity: .45; pointer-events: none; }

.papier {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / .86;
  background:
    linear-gradient(90deg, transparent 49.6%, rgba(0,0,0,.25) 50%, transparent 50.4%),
    linear-gradient(90deg, #ece0c4 50%, #17110b 50%);
}
.papier::after {                                   /* grain du papier */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(120,90,50,.18) 1px, transparent 1.4px);
  background-size: 5px 5px;
  mix-blend-mode: overlay;
}

/* La sporée : lamelles en étoile (conic-gradient) estompées vers le bord */
.sporee {
  width: 74%; aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 7%, var(--c) 7.5% 9%, transparent 10%),
    repeating-conic-gradient(from var(--r, 0deg), var(--c) 0 .8deg, transparent 1.1deg 3.3deg),
    radial-gradient(circle, color-mix(in srgb, var(--c) 55%, transparent) 0 30%, transparent 70%);
  -webkit-mask: radial-gradient(circle, transparent 0 6.5%, #000 7%, #000 42%, rgba(0,0,0,.7) 58%, transparent 71%);
          mask: radial-gradient(circle, transparent 0 6.5%, #000 7%, #000 42%, rgba(0,0,0,.7) 58%, transparent 71%);
  transition: transform .6s ease;
}
.feuille:hover .sporee { transform: rotate(8deg) scale(1.03); }

/* L'étiquette manuscrite épinglée sous la feuille */
.note {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .7rem;
  background: #f1e6cc; padding: .7rem 1rem .75rem;
  border-top: 1px dashed rgba(60,40,20,.3);
}
.note b { font-family: var(--fd); font-weight: 400; font-size: 1.22rem; color: #1d140d; width: 100%; line-height: 1.15; }
.note em { font-size: .86rem; color: #7a5a30; }
.note .nb { margin-left: auto; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: #8a6a3a; }

/* La feuille des toxiques : tampon rouge */
.feuille.danger .note { background: #f0d9cf; }
.feuille.danger .note b { color: #7a1c12; }
.feuille.danger .note em { color: #a5482b; }
.tampon {
  position: absolute; right: 9%; bottom: 10%;
  font-family: var(--fd); font-size: .9rem; letter-spacing: .2em; text-transform: uppercase;
  color: #c0432f; border: 2px solid #c0432f; padding: .1rem .55rem;
  transform: rotate(-12deg); opacity: .85; background: rgba(23,17,11,.35);
}

/* Feuilles vierges : complètent la dernière rangée, non cliquables */
.papier { box-shadow: inset 0 0 0 1px rgba(239,225,198,.10); }
.feuille.vierge { display: none; pointer-events: none; filter: brightness(.7) sepia(.35) drop-shadow(0 6px 8px rgba(0,0,0,.35)); }
.feuille.vierge .note b { font-family: 'EB Garamond', serif; font-style: italic; font-size: .95rem; color: #8a6a3a; }
@media (min-width: 901px)                        { .feuille.vierge.pour-3 { display: flex; } }
@media (min-width: 561px) and (max-width: 900px) { .feuille.vierge.pour-2 { display: flex; } }

/* Décor : souche (gauche) et cloche à sporée (droite), grand écran uniquement.
   Centrés dans la marge libre de chaque côté de la table (largeur max 1100px). */
.deco {
  display: none;
  position: absolute; top: 46%;
  width: min(230px, calc((100vw - 1100px) / 2 - 50px));
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 14px 16px rgba(0,0,0,.55));
}
.deco-g { left:  calc((100vw - 1100px) / -4); transform: translate(-50%, -50%) rotate(-3deg); }
.deco-d { right: calc((100vw - 1100px) / -4); transform: translate(50%, -50%) rotate(2deg); }
@media (min-width: 1500px) { .deco { display: block; } }

/* Raccourcis par saison */
.en-saisons {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem 1rem;
  margin-top: clamp(2.4rem,5vw,3.4rem); color: var(--ink-muted); font-style: italic;
}
.en-saisons a {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem 1rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card);
  color: var(--ink-light); text-decoration: none; font-style: normal; font-size: .92rem;
  transition: border-color .2s, color .2s;
}
.en-saisons a:hover { border-color: var(--c); color: var(--c); }
.en-saisons i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

/* ══════════════════════════════════
   NIVEAUX 2 & 3 — BANDEAU
══════════════════════════════════ */
.en-bandeau {
  background: linear-gradient(#140c07, #22160d);
  border-bottom: 1px solid var(--border);
  padding: 1.2rem clamp(1rem,4vw,3rem) clamp(2.2rem,4vw,3.2rem);
}
.en-crumbs { max-width: 1100px; margin: 0 auto 1.6rem; font-size: .86rem; font-style: italic; color: var(--ink-muted); }
.en-crumbs a { color: var(--accent); text-decoration: none; }
.en-crumbs a:hover { text-decoration: underline; }
.en-crumbs span { margin: 0 .3rem; opacity: .6; }

.en-bandeau-in {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: auto minmax(0,1fr) auto;
  gap: clamp(1.2rem,3vw,2.6rem); align-items: center;
}
.en-bandeau h1 { font-family: var(--fd); font-weight: 400; font-size: clamp(2.1rem,5vw,3.5rem); line-height: 1.05; }
.en-bandeau h1 em { color: var(--c, var(--accent)); font-style: normal; }
.en-bandeau .hero-tag { margin-bottom: .9rem; }
.en-lat  { font-style: italic; color: var(--gold); margin-top: .3rem; font-size: 1.05rem; }
.en-desc { color: var(--ink-muted); font-style: italic; margin-top: .5rem; max-width: 54ch; font-size: 1.05rem; }
.leg-tox { color: #c0432f; font-style: normal; }

/* Grand chapeau de champignon aux couleurs du groupe */
.grand-chapeau { position: relative; width: clamp(110px,14vw,150px); height: clamp(100px,12.5vw,135px); }
.grand-chapeau i {
  position: absolute; left: 0; right: 0; top: 0; height: 56%;
  border-radius: 50% 50% 14% 14% / 92% 92% 14% 14%;
  background:
    radial-gradient(circle at 28% 48%, rgba(255,255,255,.32) 0 5px, transparent 6px),
    radial-gradient(circle at 62% 30%, rgba(255,255,255,.28) 0 4px, transparent 5px),
    radial-gradient(circle at 76% 62%, rgba(255,255,255,.22) 0 3px, transparent 4px),
    linear-gradient(170deg, color-mix(in srgb, var(--c) 100%, #fff 18%), var(--c) 55%, color-mix(in srgb, var(--c) 70%, #000));
  box-shadow: 0 10px 18px rgba(0,0,0,.45);
  z-index: 2;
}
.grand-chapeau s {
  position: absolute; left: 36%; right: 36%; top: 48%; bottom: 0;
  background: linear-gradient(90deg, #efe3c8, #d9c9a4);
  border-radius: 6px 6px 12px 12px;
}

.en-compteur {
  display: grid; grid-template-columns: auto auto; gap: .1rem .7rem; align-items: baseline;
  padding-left: clamp(1rem,2vw,2rem); border-left: 1px solid var(--border);
}
.en-compteur strong { font-family: var(--fd); font-weight: 400; font-size: clamp(1.6rem,3vw,2.2rem); color: var(--accent); text-align: right; }
.en-compteur span { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }

.en-main { max-width: 1100px; margin: 0 auto; padding: clamp(2.2rem,5vw,3.6rem) clamp(1rem,4vw,3rem) 4.5rem; }
.en-titre { font-family: var(--fd); font-weight: 400; font-size: clamp(1.6rem,3.4vw,2.2rem); text-align: center; margin-bottom: 2.4rem; }
.en-vide { text-align: center; font-style: italic; color: var(--ink-muted); padding: 3rem 0; }

/* ══════════════════════════════════
   NIVEAU 2 — LA CLAIRIÈRE (une lettre = un champignon)
══════════════════════════════════ */
.clairiere {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px,1fr));
  gap: 2.4rem 1rem;
  padding-bottom: 1rem;
}
.champi {
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: var(--ink);
  position: relative; padding-bottom: .4rem;
}
.champi::after {                                    /* le sol */
  content: ""; position: absolute; left: 6%; right: 6%; bottom: 1.55rem; height: 6px;
  border-radius: 50%; background: radial-gradient(ellipse, rgba(0,0,0,.55), transparent 70%);
}
.chapeau {
  position: relative; z-index: 2;
  width: 92px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50% 50% 12% 12% / 95% 95% 12% 12%;
  font-family: var(--fd); font-size: 1.65rem; color: #1d140d; padding-top: .3rem;
  background:
    radial-gradient(circle at 22% 46%, rgba(255,255,255,.3) 0 3px, transparent 4px),
    radial-gradient(circle at 78% 56%, rgba(255,255,255,.26) 0 2.5px, transparent 3.5px),
    linear-gradient(170deg, color-mix(in srgb, var(--c) 100%, #fff 22%), var(--c) 60%, color-mix(in srgb, var(--c) 75%, #000));
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.18), 0 6px 10px rgba(0,0,0,.35);
  transition: transform .3s cubic-bezier(.3,1.6,.5,1);
}
.pied {
  width: 26px; height: var(--h, 40px); margin-top: -3px;
  background: linear-gradient(90deg, #efe3c8, #d9c9a4);
  border-radius: 4px 4px 9px 9px;
  transition: height .3s cubic-bezier(.3,1.6,.5,1);
}
.champi:nth-child(3n+1) .pied { --h: 34px; }
.champi:nth-child(3n+2) .pied { --h: 46px; }
.champi:nth-child(4n)   .chapeau { width: 84px; }
.champi-nb { margin-top: .55rem; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.champi:hover .chapeau { transform: translateY(-8px) scale(1.07); }
.champi:hover .pied { height: calc(var(--h, 40px) + 8px); margin-bottom: -8px; }
.champi:hover .champi-nb { color: var(--accent); }

/* ══════════════════════════════════
   NIVEAU 3 — BARRE DES LETTRES
══════════════════════════════════ */
.lettres-bar {
  position: sticky; top: 64px; z-index: 150;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  padding: .55rem 1rem;
  background: rgba(29,20,13,.95); backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--border);
}
.lb {
  min-width: 32px; height: 28px; padding: 0 .3rem; line-height: 30px; text-align: center;
  font-family: var(--fd); font-size: .95rem; text-decoration: none; color: var(--ink-light);
  border-radius: 50% 50% 8px 8px / 85% 85% 8px 8px;               /* petits chapeaux */
  background: var(--card); border: 1px solid var(--border);
  transition: background .18s, color .18s;
}
.lb:hover { border-color: var(--c); color: var(--c); }
.lb.actif { background: var(--c); border-color: var(--c); color: #1d140d; }

/* ══════════════════════════════════
   NIVEAU 3 — LE CARNET DE RÉCOLTE
══════════════════════════════════ */
.en-bandeau--court .en-bandeau-in { grid-template-columns: auto minmax(0,1fr); }
.grande-lettre {
  font-family: var(--fd); font-size: clamp(5rem,11vw,8rem); line-height: .8;
  color: var(--c); text-shadow: 0 6px 18px rgba(0,0,0,.5);
}

.carnet {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.4rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 0 0 22px 22px;
  padding: 1.2rem 1.6rem 1.6rem;
  position: relative;
}
.carnet::before {                                   /* bandeau-chapeau en haut du carnet */
  content: ""; position: absolute; left: -1px; right: -1px; top: -18px; height: 18px;
  border-radius: 18px 18px 0 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 6px, rgba(0,0,0,.14) 6px 8px),
    var(--c);
}
.carnet-col { list-style: none; }
.carnet-col li { border-bottom: 1px solid rgba(239,225,198,.08); }
.carnet-col a {
  display: flex; align-items: baseline; gap: .55rem;
  padding: .4rem .4rem; border-radius: 4px;
  text-decoration: none; color: var(--ink-light); font-size: .96rem;
  transition: background .15s, padding-left .15s;
}
.carnet-col a:hover { background: rgba(239,225,198,.06); padding-left: .8rem; }
.carnet-col a:hover .sci { color: var(--ink); }
.mini {                                             /* mini-chapeau devant chaque nom */
  flex: 0 0 auto; width: 12px; height: 7px; transform: translateY(-1px);
  border-radius: 50% 50% 2px 2px / 100% 100% 2px 2px; background: var(--c);
}
.sci { font-style: italic; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commun { margin-left: auto; font-size: .86rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; text-align: right; }
.badge {
  flex: 0 0 auto; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  color: #e0743a; border: 1px solid rgba(192,67,47,.55); border-radius: 999px; padding: 0 .5rem;
}
.tox .mini { background: #c0432f; }
.tox .sci { color: #f0c9b8; }

/* Pagination */
.pages { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; margin-top: 2.2rem; }
.pages a, .pages span {
  min-width: 38px; padding: .4rem .6rem; text-align: center;
  font-family: var(--fd); font-size: .95rem; text-decoration: none;
  color: var(--ink-light); background: var(--card); border: 1px solid var(--border); border-radius: 999px;
}
.pages a:hover { border-color: var(--accent); color: var(--accent); }
.pages .actif { background: var(--accent); border-color: var(--accent); color: #1d140d; }
.pages .etc { background: none; border: none; }

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 900px) {
  .sporees { grid-template-columns: 1fr 1fr; }
  .en-bandeau-in { grid-template-columns: auto minmax(0,1fr); }
  .en-compteur { grid-column: 1/-1; border-left: 0; padding-left: 0; grid-template-columns: repeat(4,auto); justify-content: start; }
}
@media (max-width: 760px) {
  .carnet { grid-template-columns: 1fr; }
  .commun { display: none; }
}
@media (max-width: 560px) {
  .sporees { grid-template-columns: 1fr; max-width: 360px; margin: 0 auto; }
  .en-bandeau-in, .en-bandeau--court .en-bandeau-in { grid-template-columns: 1fr; text-align: center; }
  .grand-chapeau { margin: 0 auto; }
  .en-desc { margin-left: auto; margin-right: auto; }
  .clairiere { grid-template-columns: repeat(auto-fill, minmax(88px,1fr)); }
  .chapeau { width: 76px; height: 42px; font-size: 1.4rem; }
}