/* ════════════════════════════════════════
   MONERA — encyclopedie.css
   Le portoir de boîtes de Petri · la galerie d'identification · la fiche de résultats
   S'appuie sur les variables de style.css (Monera).
════════════════════════════════════════ */

/* Papier quadrillé de labo, comme l'en-tête de l'accueil */
.en-hero, .en-bandeau {
  background-image: linear-gradient(#d5dfda 1px, transparent 1px), linear-gradient(90deg, #d5dfda 1px, transparent 1px);
  background-size: 34px 34px;
}

/* ══════════════════════════════════
   NIVEAU 1 — EN-TÊTE
══════════════════════════════════ */
.en-hero { text-align: center; padding: clamp(2.2rem,5vw,4rem) clamp(1rem,4vw,2rem) clamp(1.6rem,3vw,2.4rem); border-bottom: 1px solid var(--border); }
.en-hero h1 { font-family: var(--fd); font-weight: 800; font-size: clamp(2.4rem,6vw,4.4rem); letter-spacing: -.05em; line-height: 1; }
.en-hero .lead { max-width: 52ch; margin: 1rem auto 1rem; font-size: 1.05rem; font-style: italic; color: var(--ink-muted); line-height: 1.6; }
.en-total { font-family: var(--fd); font-size: .8rem; color: var(--accent); font-weight: 800; }

/* ══════════════════════════════════
   NIVEAU 1 — LE PORTOIR
══════════════════════════════════ */
.en-portoir { position: relative; max-width: 1040px; margin: 0 auto; padding: clamp(2.2rem,5vw,3.6rem) clamp(1rem,4vw,2rem) clamp(3rem,6vw,5rem); }
.boites { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: clamp(1.8rem,4vw,2.8rem) clamp(1rem,3vw,2rem); }

.petri { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--ink); }
.petri.vide { opacity: .45; pointer-events: none; }

/* La boîte vue de dessus : couvercle en verre + gélose teintée + colonies */
.boite-petri {
  position: relative; width: min(100%, 250px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.9), rgba(255,255,255,.35) 40%, rgba(220,230,226,.6));
  box-shadow:
    inset 0 0 0 2px rgba(30,26,44,.18),
    inset 0 0 0 9px rgba(255,255,255,.65),
    inset 0 0 0 10px rgba(30,26,44,.12),
    0 14px 26px rgba(30,26,44,.16), 0 3px 0 #c9d3cf;
  transition: transform .3s ease, box-shadow .3s ease;
}
.gelose {
  position: absolute; inset: 12px; border-radius: 50%;
  background-color: color-mix(in srgb, var(--c) 16%, #f4f0df);
  box-shadow: inset 0 0 22px color-mix(in srgb, var(--c) 22%, transparent);
  transition: filter .3s ease;
}
.boite-petri::after {                              /* reflet du couvercle */
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: linear-gradient(140deg, rgba(255,255,255,.55) 0 18%, transparent 34% 100%);
}
.petri:hover .boite-petri { transform: translateY(-6px) rotate(-4deg); box-shadow: inset 0 0 0 2px var(--c), inset 0 0 0 9px rgba(255,255,255,.65), inset 0 0 0 10px rgba(30,26,44,.12), 0 22px 34px rgba(30,26,44,.2), 0 3px 0 #c9d3cf; }
.petri:hover .gelose { filter: saturate(1.4); }

/* Le scotch d'étiquetage posé en travers */
.scotch {
  position: absolute; z-index: 2; top: 16%; left: 50%; transform: translateX(-50%) rotate(-6deg);
  padding: .3rem .8rem; white-space: nowrap;
  font-family: var(--fd); font-weight: 800; font-size: .72rem; letter-spacing: .02em; color: var(--ink);
  background: rgba(255,251,222,.92); border-left: 3px solid var(--c);
  box-shadow: 0 2px 4px rgba(30,26,44,.12);
}
.biohazard {
  position: absolute; z-index: 2; right: 12%; bottom: 12%;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #1e1a2c; background: #f5c400; box-shadow: 0 0 0 2px #1e1a2c;
}

.cartel { margin-top: 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; }
.cartel b { font-family: var(--fd); font-weight: 800; font-size: 1.12rem; letter-spacing: -.03em; }
.cartel em { font-family: var(--fd); font-style: normal; font-size: .7rem; color: var(--ink-muted); margin-top: .2rem; }
.cartel .n { margin-top: .45rem; font-family: var(--fd); font-size: .76rem; color: var(--ink-muted); }
.cartel .n strong { color: var(--c); font-size: 1rem; }
.petri.danger .cartel b { color: var(--danger); }

/* Emplacements libres : complètent la dernière rangée, non cliquables */
.petri.libre { display: none; pointer-events: none; }
.petri.libre .boite-petri { background: transparent; box-shadow: inset 0 0 0 2px rgba(30,26,44,.15); border: 2px dashed rgba(30,26,44,.18); }
.petri.libre .boite-petri::after { display: none; }
.petri.libre .cartel b, .petri.libre .cartel em { color: var(--ink-muted); opacity: .6; }
@media (min-width: 901px)                        { .petri.libre.pour-3 { display: flex; } }
@media (min-width: 561px) and (max-width: 900px) { .petri.libre.pour-2 { display: flex; } }

/* Décor : bec Bunsen (gauche) et portoir de tubes (droite), grand écran uniquement */
.deco {
  display: none; position: absolute; top: 50%;
  width: min(220px, calc((100vw - 1040px) / 2 - 50px)); height: auto;
  pointer-events: none; filter: drop-shadow(0 10px 14px rgba(30,26,44,.14));
}
.deco-g { left:  calc((100vw - 1040px) / -4); transform: translate(-50%, -50%); }
.deco-d { right: calc((100vw - 1040px) / -4); transform: translate(50%, -50%); }
@media (min-width: 1500px) { .deco { display: block; } }

/* ══════════════════════════════════
   NIVEAUX 2 & 3 — BANDEAU
══════════════════════════════════ */
.en-bandeau { border-bottom: 1px solid var(--border); padding: 1.2rem clamp(1rem,4vw,3rem) clamp(2rem,4vw,2.8rem); }
.en-crumbs { max-width: 1040px; margin: 0 auto 1.6rem; font-family: var(--fd); font-size: .74rem; 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 .35rem; opacity: .6; }

.en-bandeau-in { max-width: 1040px; 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: 800; font-size: clamp(2rem,5vw,3.4rem); letter-spacing: -.05em; line-height: 1.02; }
.en-bandeau .hero-tag { margin-bottom: .9rem; font-family: var(--fd); font-weight: 800; color: var(--c); border-color: color-mix(in srgb, var(--c) 40%, transparent); background: var(--card); }
.en-lat  { font-family: var(--fd); font-size: .8rem; color: var(--c); margin-top: .5rem; }
.en-desc { color: var(--ink-muted); font-style: italic; margin-top: .5rem; max-width: 56ch; font-size: 1.05rem; }

.mini-petri {
  position: relative; width: clamp(110px,14vw,150px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff, rgba(255,255,255,.4) 45%, rgba(220,230,226,.7));
  box-shadow: inset 0 0 0 2px rgba(30,26,44,.18), inset 0 0 0 7px rgba(255,255,255,.7), 0 10px 20px rgba(30,26,44,.14);
}
.mini-petri .gelose { inset: 9px; }

.en-compteur {
  display: grid; grid-template-columns: auto auto; gap: .2rem .7rem; align-items: baseline;
  padding: .9rem 1.1rem; background: var(--card); border: 1px solid var(--border); border-top: 4px solid var(--c);
  font-family: var(--fd);
}
.en-compteur span { font-size: .72rem; color: var(--ink-muted); text-align: right; }
.en-compteur strong { font-size: clamp(1.2rem,2.4vw,1.6rem); letter-spacing: -.03em; color: var(--ink); }

.en-main { max-width: 1040px; margin: 0 auto; padding: clamp(2.2rem,5vw,3.4rem) clamp(1rem,4vw,2rem) 4.5rem; }
.en-titre { font-family: var(--fd); font-weight: 800; font-size: clamp(1.4rem,3vw,1.9rem); letter-spacing: -.03em; text-align: center; }
.en-sous { text-align: center; font-family: var(--fd); font-size: .72rem; color: var(--ink-muted); margin: .5rem 0 2rem; }
.en-vide { text-align: center; font-style: italic; color: var(--ink-muted); padding: 3rem 0; }

/* ══════════════════════════════════
   NIVEAU 2 — LA GALERIE (barrettes de 10 cupules)
══════════════════════════════════ */
.galerie {
  position: relative; margin-bottom: 1.6rem;
  padding: 1rem 1.2rem 1rem 3.4rem;
  background: linear-gradient(#ffffff, #f2f5f4);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 18px rgba(30,26,44,.08);
}
.galerie-ref {                                   /* référence imprimée sur la barrette */
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%) rotate(-90deg);
  font-family: var(--fd); font-weight: 800; font-size: .66rem; letter-spacing: .1em; color: var(--ink-muted);
}
.cupules { display: grid; grid-template-columns: repeat(10, minmax(0,1fr)); gap: .55rem; }
.cupule { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--ink); }
.cup-l { font-family: var(--fd); font-weight: 800; font-size: 1.05rem; line-height: 1; margin-bottom: .4rem; }
.cup-tube {
  position: relative; width: 100%; max-width: 54px; height: 70px;
  border-radius: 6px 6px 22px 22px; overflow: hidden;
  background: #f7faf8; box-shadow: inset 0 0 0 1.5px #b4c3bc, inset 0 4px 0 rgba(255,255,255,.8);
  transition: transform .25s ease, box-shadow .25s ease;
}
.cup-tube i {                                    /* le réactif : plus foncé = plus d'espèces */
  position: absolute; left: 0; right: 0; bottom: 0; height: 74%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c));
  opacity: var(--i, .5);
  border-radius: 0 0 22px 22px;
}
.cup-tube i::before {                            /* ménisque */
  content: ""; position: absolute; left: 0; right: 0; top: -3px; height: 6px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 45%, #fff);
}
.cup-nb { margin-top: .45rem; font-family: var(--fd); font-size: .66rem; color: var(--ink-muted); }
.cupule:hover .cup-tube { transform: translateY(-4px); box-shadow: inset 0 0 0 2px var(--c), 0 8px 14px color-mix(in srgb, var(--c) 30%, transparent); }
.cupule:hover .cup-l, .cupule:hover .cup-nb { color: var(--c); }
.cupule-vide { pointer-events: none; opacity: .45; }

/* ══════════════════════════════════
   NIVEAU 3 — BARRE DES LETTRES
══════════════════════════════════ */
.lettres-bar {
  position: sticky; top: 62px; z-index: 150;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 3px;
  padding: .55rem 1rem; background: rgba(238,242,240,.95); backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--border);
}
.lb {
  min-width: 30px; height: 30px; line-height: 28px; text-align: center;
  font-family: var(--fd); font-weight: 800; font-size: .8rem; text-decoration: none;
  color: var(--ink-light); background: var(--card); border: 1px solid var(--border);
  transition: border-color .18s, color .18s;
}
.lb:hover { border-color: var(--c); color: var(--c); }
.lb.actif { background: var(--c); border-color: var(--c); color: #fff; }

/* ══════════════════════════════════
   NIVEAU 3 — LA FICHE DE RÉSULTATS
══════════════════════════════════ */
.en-bandeau--court .en-bandeau-in { grid-template-columns: auto minmax(0,1fr); }
.grande-lettre {
  font-family: var(--fd); font-weight: 800; font-size: clamp(4.4rem,10vw,7rem); line-height: .85; letter-spacing: -.06em;
  color: var(--c);
}

.fiche { background: var(--card); border: 1px solid var(--border); border-top: 5px solid var(--c); box-shadow: 0 10px 22px rgba(30,26,44,.08); }
.fiche-entete, .fiche-lignes a {
  display: grid; grid-template-columns: 4.2rem minmax(0,1.3fr) minmax(0,1fr) 3.6rem; gap: 1rem; align-items: center;
  padding: .5rem 1.1rem;
}
.fiche-entete {
  font-family: var(--fd); font-weight: 800; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted);
  border-bottom: 2px solid var(--ink); padding-top: .8rem; padding-bottom: .6rem;
}
.fiche-entete span:last-child, .f-path { text-align: center; }
.fiche-lignes { list-style: none; }
.fiche-lignes li { border-bottom: 1px solid rgba(30,26,44,.08); }
.fiche-lignes li:nth-child(even) { background: rgba(213,223,218,.25); }
.fiche-lignes a { text-decoration: none; color: var(--ink-light); transition: background .15s; }
.fiche-lignes a:hover { background: color-mix(in srgb, var(--c) 9%, #fff); }
.fiche-lignes a:hover .f-sci { color: var(--ink); }
.f-n { font-family: var(--fd); font-size: .72rem; color: var(--ink-muted); }
.f-sci { font-style: italic; font-size: .98rem; display: flex; align-items: center; gap: .55rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puce { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.f-commun { font-size: .9rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-path { font-family: var(--fd); font-weight: 800; color: var(--ink-muted); }
.patho .f-path b { display: inline-block; min-width: 1.6rem; color: #fff; background: var(--danger); padding: 0 .3rem; }
.patho .puce { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-light); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Pagination */
.pages { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: 2.2rem; }
.pages a, .pages span {
  min-width: 36px; padding: .4rem .6rem; text-align: center;
  font-family: var(--fd); font-weight: 800; font-size: .8rem; text-decoration: none;
  color: var(--ink-light); background: var(--card); border: 1px solid var(--border);
}
.pages a:hover { border-color: var(--accent); color: var(--accent); }
.pages .actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.pages .etc { background: none; border: none; }

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 900px) {
  .boites { grid-template-columns: 1fr 1fr; }
  .en-bandeau-in { grid-template-columns: auto minmax(0,1fr); }
  .en-compteur { grid-column: 1/-1; grid-template-columns: repeat(4,auto); justify-content: start; }
}
@media (max-width: 700px) {
  .cupules { grid-template-columns: repeat(5, minmax(0,1fr)); row-gap: 1rem; }
  .fiche-entete, .fiche-lignes a { grid-template-columns: 3.2rem minmax(0,1fr) 2.6rem; }
  .fiche-entete span:nth-child(3), .f-commun { display: none; }
}
@media (max-width: 560px) {
  .boites { grid-template-columns: 1fr; max-width: 300px; margin: 0 auto; }
  .en-bandeau-in, .en-bandeau--court .en-bandeau-in { grid-template-columns: 1fr; text-align: center; }
  .mini-petri { margin: 0 auto; }
  .en-desc { margin-left: auto; margin-right: auto; }
  .galerie { padding-left: 1rem; padding-top: 2rem; }
  .galerie-ref { top: .7rem; left: 1rem; transform: none; }
}