/* ════════════════════════════════════════
   ANIMALIA — encyclopedie.css
   Le meuble à tiroirs · le fichier · le registre
   S'appuie sur les variables de style.css (Animalia).
════════════════════════════════════════ */

/* ══════════════════════════════════
   NIVEAU 1 — EN-TÊTE
══════════════════════════════════ */
.en-hero {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(2.2rem,5vw,4rem) clamp(1rem,4vw,2rem) clamp(1.6rem,3vw,2.4rem);
  text-align: center;
}
.en-hero h1 {
  font-family: var(--fd); font-weight: 400;
  font-size: clamp(2.6rem,6.4vw,4.6rem); line-height: 1.04;
}
.en-hero h1 em { color: var(--accent); font-style: italic; }
.en-hero .lead { margin: 1.1rem auto 1.8rem; }

/* ══════════════════════════════════
   NIVEAU 1 — LE MEUBLE
══════════════════════════════════ */
.en-salle {
  position: relative;
  overflow: hidden;
  background: #141f2b;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 48px);
  padding: clamp(2.5rem,5vw,4.5rem) clamp(1rem,4vw,3rem) clamp(3rem,6vw,5.5rem);
}
.meuble {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto;
  padding: clamp(.8rem,2vw,1.4rem);
  background: linear-gradient(160deg,#4a2f1a,#2e1c0f 60%,#24160b);
  border: 1px solid #1a0f07;
  box-shadow: 0 0 0 3px #8a6a2c, 0 0 0 9px #2a1a0d, 0 26px 44px rgba(0,0,0,.55);
}
.meuble-fronton {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .4rem 1rem;
  margin: 0 .3rem clamp(.8rem,2vw,1.2rem);
  padding: .55rem 1rem;
  background: linear-gradient(135deg,#e0c27a,#9a7a2c 55%,#7d5c22);
  color: #2a1d10;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 4px rgba(0,0,0,.4);
}
.meuble-fronton span { font-family: var(--fd); font-size: 1.15rem; letter-spacing: .04em; }
.meuble-fronton b { font-weight: 500; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; }

.tiroirs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: clamp(.6rem,1.4vw,1rem);
}
.tiroir {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 1.5rem 1rem 1.1rem;
  text-decoration: none;
  background:
    repeating-linear-gradient(92deg, rgba(0,0,0,.07) 0 1px, transparent 1px 7px),
    linear-gradient(180deg,#6b4527,#4e3019);
  border: 1px solid #1f1209;
  box-shadow: inset 0 0 0 1px rgba(255,220,160,.08), inset 0 -10px 18px rgba(0,0,0,.28), 0 3px 0 #1a0f07;
  transition: transform .25s ease, box-shadow .25s ease;
}
.tiroir:hover {
  transform: translateY(-5px) scale(1.015);
  box-shadow: inset 0 0 0 1px rgba(255,220,160,.12), inset 0 -10px 18px rgba(0,0,0,.2), 0 16px 22px rgba(0,0,0,.5);
}
.tiroir.vide { opacity: .45; pointer-events: none; }

/* Casier vide décoratif : même bois, étiquette vierge, non cliquable.
   Caché par défaut, affiché seulement quand il manque une case sur la dernière rangée. */
.tiroir-libre {
  display: none;
  cursor: default;
  justify-content: center;
  filter: brightness(.82) saturate(.85);
}
.tiroir-libre:hover { transform: none; box-shadow: inset 0 0 0 1px rgba(255,220,160,.08), inset 0 -10px 18px rgba(0,0,0,.28), 0 3px 0 #1a0f07; }
.tiroir-libre .etiquette { min-height: 58px; }
.tiroir-libre .poignee { margin-top: 1.9rem; }
@media (min-width: 861px)                       { .tiroir-libre.pour-3 { display: flex; } }
@media (min-width: 521px) and (max-width: 860px) { .tiroir-libre.pour-2 { display: flex; } }

/* ── Décor : instruments de mesure de part et d'autre du meuble ──
   Centrés dans l'espace libre à gauche et à droite (largeur du meuble : 1080px).
   Masqués sous 1500px pour ne pas encombrer les écrans moyens et mobiles. */
.deco {
  display: none;
  position: absolute; top: 50%;
  width: min(230px, calc((100% - 1080px) / 2 - 60px));
  height: auto;
  filter: drop-shadow(0 12px 14px rgba(0,0,0,.5));
  opacity: .93;
  pointer-events: none;
}
.deco-g { left:  calc((100% - 1080px) / 4); transform: translate(-50%, -50%) rotate(-4deg); }
.deco-d { right: calc((100% - 1080px) / 4); transform: translate(50%, -50%) rotate(3deg); }
@media (min-width: 1500px) { .deco { display: block; } }

.tiroir-num {
  position: absolute; top: .55rem; left: .7rem;
  font-size: .66rem; letter-spacing: .18em; color: rgba(224,194,122,.7);
}

/* Porte-étiquette en laiton + carton */
.porte-etiquette {
  display: block; width: min(100%, 250px);
  padding: 5px;
  background: linear-gradient(135deg,#e0c27a,#9a7a2c 55%,#7d5c22);
  box-shadow: 0 2px 4px rgba(0,0,0,.45);
  position: relative;
}
.porte-etiquette::before, .porte-etiquette::after {   /* rivets */
  content: ""; position: absolute; top: 50%; width: 5px; height: 5px; margin-top: -2.5px;
  border-radius: 50%; background: #5a4216; box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.porte-etiquette::before { left: -9px; }
.porte-etiquette::after  { right: -9px; }
.etiquette {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .8rem;
  background: #f3edd8;
  box-shadow: inset 0 0 10px rgba(120,90,40,.18);
}
.etq-emoji { font-size: 1.9rem; line-height: 1; filter: sepia(.55) saturate(1.15); }
.etq-txt { display: flex; flex-direction: column; text-align: left; min-width: 0; }
.etq-txt b { font-family: var(--fd); font-weight: 400; font-size: 1.2rem; color: #171b24; line-height: 1.15; }
.etq-txt em { font-size: .82rem; color: #6a5a3c; }

.tiroir-nb {
  margin-top: .8rem;
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  color: #e7d4a6;
}
/* Poignée en laiton */
.poignee {
  display: block; width: 74px; height: 14px; margin-top: .7rem;
  border-radius: 0 0 14px 14px;
  border: 3px solid #b48a3a; border-top: none;
  box-shadow: 0 3px 3px rgba(0,0,0,.4);
  position: relative;
}
.poignee::before, .poignee::after {
  content: ""; position: absolute; top: -5px; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,#f0d68e,#8a6a2c);
}
.poignee::before { left: -7px; }
.poignee::after  { right: -7px; }

/* ══════════════════════════════════
   NIVEAUX 2 & 3 — BANDEAU SOMBRE
══════════════════════════════════ */
.en-bandeau {
  background: #141f2b;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 48px);
  color: #e8eef4;
  padding: 1.2rem clamp(1rem,4vw,3rem) clamp(2.2rem,4vw,3.2rem);
}
.en-crumbs {
  max-width: 1140px; margin: 0 auto 1.6rem;
  font-size: .86rem; font-style: italic; color: #93a6b8;
}
.en-crumbs a { color: #d2ad55; text-decoration: none; }
.en-crumbs a:hover { text-decoration: underline; }
.en-crumbs span { margin: 0 .3rem; opacity: .6; }

.en-bandeau-in {
  max-width: 1140px; 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.2rem,5vw,3.6rem); line-height: 1.05; }
.en-bandeau h1 em { color: #d2ad55; font-style: italic; }
.en-bandeau .hero-tag { margin-bottom: .9rem; color: #d2ad55; border-color: rgba(210,173,85,.45); }
.en-lat  { font-style: italic; color: #d2ad55; margin-top: .3rem; font-size: 1.05rem; }
.en-desc { color: #93a6b8; font-style: italic; margin-top: .5rem; max-width: 52ch; font-size: 1.05rem; }

.medaillon {
  width: clamp(110px,14vw,150px); aspect-ratio: 1;
  padding: 8px; border-radius: 50%;
  background: linear-gradient(135deg,#e0c27a,#9a7a2c 55%,#7d5c22);
  box-shadow: 0 12px 24px rgba(0,0,0,.5);
}
.medaillon span {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%,#e0dcc6,#c9c5ac);
  box-shadow: inset 0 0 22px rgba(0,0,0,.35);
  font-size: clamp(3rem,6vw,4.4rem);
  filter: sepia(.4);
}
.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 rgba(255,255,255,.12);
}
.en-compteur strong { font-family: var(--fd); font-weight: 400; font-size: clamp(1.6rem,3vw,2.2rem); color: #d2ad55; text-align: right; }
.en-compteur span { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: #93a6b8; }

.en-main { max-width: 1140px; 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.7rem,3.4vw,2.3rem); text-align: center; margin-bottom: 2rem; }
.en-vide { text-align: center; font-style: italic; color: var(--ink-muted); padding: 3rem 0; }

/* ══════════════════════════════════
   NIVEAU 2 — LE FICHIER (fiches à onglet)
══════════════════════════════════ */
.fichier {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px,1fr));
  gap: 2rem 1rem;
}
.fiche {
  position: relative; display: block; padding-top: 18px;
  text-decoration: none; color: var(--ink);
  transition: transform .2s ease;
}
.fiche:nth-child(3n+2) .fiche-onglet { left: 38%; }
.fiche:nth-child(3n)   .fiche-onglet { left: auto; right: 10px; }
.fiche-onglet {
  position: absolute; top: 0; left: 10px;
  min-width: 34px; height: 20px; padding: 0 .5rem;
  background: #e8dfc4; border: 1px solid #cbb887; border-bottom: none;
  border-radius: 5px 5px 0 0;
  font-family: var(--fd); font-size: .85rem; line-height: 20px; text-align: center; color: #6a5a3c;
}
.fiche-corps {
  display: flex; flex-direction: column; align-items: center;
  padding: 1rem .6rem .9rem;
  background: linear-gradient(#f6f1de, #efe7cc);
  border: 1px solid #cbb887;
  box-shadow: 0 3px 0 #ddd0a8, 0 6px 0 #e9e0c5, 0 10px 18px rgba(0,0,0,.12);  /* fiches empilées derrière */
  background-image:
    linear-gradient(transparent 31px, #d8b9a0 31px, #d8b9a0 32px, transparent 32px),
    linear-gradient(#f6f1de, #efe7cc);
}
.fiche-lettre { font-family: var(--fd); font-size: 2.8rem; line-height: 1; color: var(--accent); margin: .5rem 0 .4rem; }
.fiche-nb { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: #6a5a3c; }
.fiche:hover { transform: translateY(-6px); }
.fiche:hover .fiche-onglet { background: #d2ad55; color: #2a1d10; border-color: #9a7a2c; }

/* ══════════════════════════════════
   NIVEAU 3 — ONGLETS ALPHABÉTIQUES
══════════════════════════════════ */
.onglets {
  position: sticky; top: 64px; z-index: 150;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 3px;
  padding: .5rem 1rem 0;
  background: rgba(235,231,220,.96); backdrop-filter: blur(4px);
  border-bottom: 3px solid #9a7a2c;
}
.onglet {
  min-width: 30px; padding: .3rem .35rem .25rem; text-align: center;
  font-family: var(--fd); font-size: .98rem; text-decoration: none;
  color: var(--ink-light); background: var(--parch-dark);
  border-radius: 5px 5px 0 0; transition: background .18s, color .18s;
}
.onglet:hover { background: var(--accent-light); color: var(--accent-dark); }
.onglet.actif { background: linear-gradient(135deg,#e0c27a,#9a7a2c); color: #2a1d10; }

/* ══════════════════════════════════
   NIVEAU 3 — LE REGISTRE
══════════════════════════════════ */
.en-bandeau--court { padding-bottom: clamp(1.8rem,3vw,2.6rem); }
.en-bandeau--court .en-bandeau-in { grid-template-columns: auto minmax(0,1fr); }
.grande-lettre {
  font-family: var(--fd); font-style: italic;
  font-size: clamp(5rem,11vw,8rem); line-height: .8; color: #d2ad55;
  text-shadow: 0 6px 18px rgba(0,0,0,.45);
}

.registre {
  display: grid; grid-template-columns: 1fr 1fr;
  background: #f6f1de; border: 1px solid #cbb887;
  box-shadow: 0 10px 26px rgba(0,0,0,.12);
  position: relative;
  padding: 1.4rem 0;
}
.registre::after {                         /* reliure centrale */
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 14px; margin-left: -7px;
  background: linear-gradient(90deg, rgba(0,0,0,.08), rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,.08));
  pointer-events: none;
}
.registre-col {
  list-style: none; margin: 0;
  padding: 0 1.6rem 0 0;
  position: relative;
}
.registre-col::before {                    /* marge rouge */
  content: ""; position: absolute; top: -1.4rem; bottom: -1.4rem; left: 58px; width: 1px; background: #d8b9a0;
}
.registre-col li { border-bottom: 1px solid rgba(36,71,95,.12); }
.registre-col a {
  display: flex; align-items: baseline; gap: .5rem;
  padding: .38rem 0 .38rem 0;
  text-decoration: none; color: #3a2f22; font-size: .95rem;
  transition: background .15s;
}
.registre-col a:hover { background: rgba(210,173,85,.16); }
.registre-col a:hover .reg-sci { color: var(--accent); }
.reg-n {
  flex: 0 0 48px; text-align: right; padding-right: .3rem;
  font-family: var(--fd); font-size: .8rem; color: #9a7a2c;
}
.reg-sci { font-style: italic; padding-left: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reg-points { flex: 1; min-width: 1rem; border-bottom: 1px dotted rgba(106,90,60,.45); transform: translateY(-4px); }
.reg-commun { font-size: .86rem; color: #6a5a3c; text-align: right; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }

/* Pagination : les feuillets */
.feuillets { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; margin-top: 2.2rem; }
.feuillets a, .feuillets 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: #f6f1de; border: 1px solid #cbb887;
}
.feuillets a:hover { background: var(--accent); border-color: var(--accent); color: var(--on); }
.feuillets .actif { background: linear-gradient(135deg,#e0c27a,#9a7a2c); color: #2a1d10; border-color: #9a7a2c; }
.feuillets .etc { background: none; border: none; }

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 860px) {
  .tiroirs { 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: 700px) {
  .registre { grid-template-columns: 1fr; }
  .registre::after { display: none; }
  .registre-col + .registre-col { border-top: 1px solid rgba(36,71,95,.12); }
  .reg-commun { display: none; }
}
@media (max-width: 520px) {
  .tiroirs { grid-template-columns: 1fr; }
  .en-bandeau-in, .en-bandeau--court .en-bandeau-in { grid-template-columns: 1fr; text-align: center; }
  .medaillon { margin: 0 auto; }
  .en-desc { margin-left: auto; margin-right: auto; }
  .onglet { min-width: 24px; font-size: .85rem; }
}
