/* ============================================================
   Cercle Nest - Bibliothèque (page /bibliotheque et fiches des auteurs)
   assets/css/bibliotheque.css
   Chargé après site.css : mêmes variables, mêmes polices, aucune couleur nouvelle.
   Feuille autonome : aucune classe de site.css ou de article.css n'est réutilisée.
   ============================================================ */

/* ------------------------------------------------------------
   Bandeau de titre
   ------------------------------------------------------------ */
.bib-hero {
  padding: 64px 0 44px;
  background: var(--off);
  border-bottom: 1px solid var(--line);
}

.bib-hero-in {
  width: min(calc(100% - 40px), var(--max));
  margin-inline: auto;
}

.bib-surtitre {
  margin: 0 0 18px;
  color: var(--orange);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.bib-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -.02em;
}

/* Fiche : fil d'Ariane, titre et portrait */
.bib-hero--fiche {
  padding: 28px 0 40px;
}

.bib-fil {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .5rem;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: .88rem;
}

.bib-fil a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.bib-fil a:hover,
.bib-fil a:focus-visible {
  text-decoration: underline;
}

.bib-fil [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.bib-hero-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.bib-hero-txt {
  flex: 1;
  min-width: 0;
}

.bib-hero--fiche h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.3rem);
}

.bib-sous-titre {
  margin: 16px 0 0;
  color: var(--bluegreen);
  font-size: clamp(1.1rem, 1.6vw + .6rem, 1.4rem);
  font-weight: 600;
  line-height: 1.3;
}

.bib-ouvrage {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.4;
}

.bib-ouvrage span {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.bib-portraits {
  flex: none;
  display: flex;
  gap: 12px;
}

.bib-portraits img {
  display: block;
  width: 240px;
  height: 240px;
  object-fit: cover;
  border-radius: var(--r);
  background: var(--soft-blue);
  box-shadow: var(--shadow);
}

.bib-portraits--duo img {
  width: 160px;
  height: 160px;
}

/* ------------------------------------------------------------
   Sommaire de la page (hub) : barre défilante collée sous l'en-tête
   ------------------------------------------------------------ */
.bib-toc {
  position: sticky;
  top: 77px;
  z-index: 50;
  min-height: 44px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.bib-toc::-webkit-scrollbar {
  display: none;
}

.bib-toc nav {
  width: max-content;
  min-width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.bib-toc a {
  padding: 7px 12px;
  border-radius: 6px;
  color: var(--ink);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.bib-toc a:hover,
.bib-toc a:focus-visible,
.bib-toc a[aria-current="true"] {
  background: var(--blue);
  color: #fff;
}

/* ------------------------------------------------------------
   Colonne de lecture
   ------------------------------------------------------------ */
.bib-page {
  width: min(calc(100% - 40px), var(--max));
  margin-inline: auto;
  padding: 48px 0 40px;
}

.bib-page p,
.bib-page li {
  font-size: clamp(1.08rem, .35vw + 1rem, 1.2rem);
  line-height: 1.7;
  hyphens: auto;
  overflow-wrap: break-word;
}

.bib-page p {
  margin-block: 0 1.15rem;
}

.bib-page h2 {
  margin: 3.2rem 0 1.2rem;
  padding-top: 2.2rem;
  border-top: 1px solid var(--line);
  color: var(--bluegreen);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.2;
  scroll-margin-top: 132px;
}

.bib-page section[id] {
  scroll-margin-top: 132px;
}

.bib-page h3 {
  margin-block: 0 .7rem;
  color: var(--ink);
  font-size: clamp(1.2rem, 1.6vw + .6rem, 1.45rem);
  line-height: 1.25;
}

.bib-page a {
  color: var(--blue);
}

.bib-page strong {
  color: var(--ink);
}

/* ------------------------------------------------------------
   Page /bibliotheque : sections (même grille que les sections du site)
   ------------------------------------------------------------ */
.bib-sec {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

.bib-sec:first-child {
  padding-top: 0;
  border-top: 0;
}

.bib-kicker {
  margin: 0;
  color: var(--orange);
  font-size: .8rem !important;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.bib-page .bib-sec-body > h2 {
  margin: 0 0 1.3rem;
  padding-top: 0;
  border-top: 0;
  font-size: clamp(1.9rem, 3.2vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -.02em;
}

.bib-sec-body > p {
  max-width: 820px;
}

/* ------------------------------------------------------------
   Page /bibliotheque : fiche résumée d'un auteur
   ------------------------------------------------------------ */
.bib-auteur {
  display: flex;
  align-items: flex-start;
  gap: 26px;
  margin-block: 1.8rem;
  padding: 1.5rem 1.8rem .7rem;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.bib-auteur-photo {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bib-auteur-photo img {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: cover;
  border-radius: var(--r);
  background: var(--soft-blue);
}

.bib-auteur-photo--duo img {
  width: 80px;
  height: 80px;
}

.bib-auteur-corps {
  flex: 1;
  min-width: 0;
  max-width: 760px;
}

.bib-auteur-corps h3 a {
  color: var(--ink);
  text-decoration: none;
}

.bib-auteur-corps h3 a:hover,
.bib-auteur-corps h3 a:focus-visible {
  color: var(--blue);
  text-decoration: underline;
}

/* Question du Cercle NEST (orange = questionnement) */
.bib-q {
  padding: .75rem 1rem;
  background: var(--soft-orange);
  border-left: 4px solid var(--orange);
  border-radius: 0 var(--r) var(--r) 0;
  font-weight: 600;
}

.bib-q span {
  display: block;
  margin-bottom: .15rem;
  color: var(--ink);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.bib-page a.bib-plus {
  display: inline-block;
  margin: 0 0 .9rem;
  font-size: .98rem;
  font-weight: 700;
  text-decoration: none;
}

.bib-page a.bib-plus::after {
  content: " \2192";
}

.bib-page a.bib-plus:hover,
.bib-page a.bib-plus:focus-visible {
  text-decoration: underline;
}

/* Répertoire */
.bib-repertoire {
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.bib-rep {
  position: relative;
  margin: 0;
  padding: 1.1rem 1.1rem .6rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: var(--r);
  background: var(--paper);
}

.bib-rep:hover,
.bib-rep:focus-within {
  box-shadow: var(--shadow);
}

.bib-rep-photos {
  display: flex;
  gap: 8px;
  margin-bottom: .8rem;
}

.bib-rep-photos img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--r);
  background: var(--soft-blue);
}

.bib-rep h3 {
  margin-bottom: .4rem;
  font-size: 1.15rem;
}

.bib-page .bib-rep h3 a {
  color: var(--ink);
  text-decoration: none;
}

.bib-page .bib-rep h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.bib-page .bib-rep h3 a:hover,
.bib-page .bib-rep h3 a:focus-visible {
  color: var(--blue);
  text-decoration: underline;
}

.bib-page .bib-rep p {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.5;
}

/* ------------------------------------------------------------
   Fiche d'un auteur : texte à gauche, apport et exemples à droite
   ------------------------------------------------------------ */
.bib-page--fiche {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  column-gap: 56px;
  align-items: start;
}

.bib-page--fiche > * {
  grid-column: 1;
  min-width: 0;
}

.bib-page--fiche > .bib-question,
.bib-page--fiche > .bib-pager,
.bib-page--fiche > .bib-voisins {
  grid-column: 1 / -1;
}

.bib-page--fiche > .bib-texte {
  grid-row: 2;
}

.bib-page--fiche > .bib-org {
  grid-column: 2;
  grid-row: 2 / span 3;
  position: sticky;
  top: 100px;
  margin-top: 0;
}

.bib-texte p {
  max-width: 780px;
}

.bib-question {
  margin: 0 0 2.4rem;
  padding: 1.2rem 1.4rem .4rem;
  background: var(--soft-orange);
  border-left: 5px solid var(--orange);
  border-radius: 0 var(--r) var(--r) 0;
}

.bib-page .bib-question-label {
  margin-bottom: .4rem;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.bib-page .bib-question-texte {
  color: var(--ink);
  font-size: clamp(1.3rem, 1.8vw + .7rem, 1.8rem);
  font-weight: 700;
  line-height: 1.35;
}

/* Renvois de notes et de sources */
.bib-fnref a,
.bib-ref a {
  padding: 0 .15em;
  font-weight: 700;
  text-decoration: none;
}

.bib-ref a {
  font-size: .8em;
}

.bib-fnref a:hover,
.bib-fnref a:focus-visible,
.bib-ref a:hover,
.bib-ref a:focus-visible {
  text-decoration: underline;
}

/* Dans une organisation */
.bib-org {
  margin-top: 2.6rem;
  padding: 1.4rem 1.6rem .6rem;
  border: 1px solid var(--line);
  border-top: 5px solid var(--blue);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.bib-page .bib-org h2 {
  margin: 0 0 1rem;
  padding-top: 0;
  border-top: 0;
  font-size: 1.5rem;
}

.bib-page .bib-org h3 {
  margin: 1.2rem 0 .4rem;
  color: var(--bluegreen);
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.bib-exemples {
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
}

.bib-exemples li {
  margin-bottom: .8rem;
  padding: .7rem 1rem;
  background: var(--soft-orange);
  border-left: 4px solid var(--orange);
  border-radius: 0 var(--r) var(--r) 0;
  font-style: italic;
}

/* Notes et sources */
.bib-notes ol,
.bib-sources ol {
  margin-block: 0;
  padding-left: 1.6rem;
}

.bib-page .bib-notes li,
.bib-page .bib-sources li {
  margin-bottom: .5rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  scroll-margin-top: 132px;
}

.bib-sources li a {
  overflow-wrap: anywhere;
  hyphens: none;
}

.bib-notes li:target,
.bib-sources li:target {
  background: var(--soft-orange);
}

.bib-retour {
  padding: 0 .3em;
  text-decoration: none;
}

/* Fiches voisines */
.bib-pager {
  border-top: 1px solid var(--line);
  padding-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 3rem;
}

.bib-page a.bib-pager-lien {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-height: 56px;
  padding: .9rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}

.bib-pager-suiv {
  text-align: right;
}

.bib-pager-lien span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.bib-pager-lien strong {
  font-size: 1.15rem;
}

.bib-pager-prec span::before {
  content: "\2190  ";
}

.bib-pager-suiv span::after {
  content: "  \2192";
}

.bib-page a.bib-pager-lien:hover,
.bib-page a.bib-pager-lien:focus-visible {
  border-color: var(--blue);
  box-shadow: var(--shadow);
}

/* Même régime de questionnement */
.bib-voisins ul {
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.bib-voisins li {
  margin: 0;
  padding: .9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
}

.bib-voisins li span {
  display: block;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.4;
}

.bib-page .bib-voisins-regime {
  color: var(--orange);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------
   Bande finale
   ------------------------------------------------------------ */
.bib-suite {
  padding: 46px 0;
  background: var(--blue);
  color: #fff;
}

.bib-suite-in {
  width: min(calc(100% - 40px), var(--max));
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.bib-suite h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.15;
}

.bib-liens {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bib-lien {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 7px;
  background: #fff;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.bib-lien:hover,
.bib-lien:focus-visible {
  text-decoration: underline;
}

/* ------------------------------------------------------------
   Retour en haut de page (lien d'ancre, sans JavaScript)
   ------------------------------------------------------------ */
.bib-haut {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-width: 48px;
  min-height: 48px;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.bib-haut:hover,
.bib-haut:focus-visible {
  background: var(--bluegreen);
  color: #fff;
}

.bib-haut:focus-visible,
.bib-toc a:focus-visible,
.bib-page a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

@supports (animation-timeline: scroll()) {
  .bib-haut {
    opacity: 0;
    visibility: hidden;
    animation: bib-haut-in linear both;
    animation-timeline: scroll(root block);
    animation-range: 500px 700px;
  }

  @keyframes bib-haut-in {
    to {
      opacity: 1;
      visibility: visible;
    }
  }
}

/* ------------------------------------------------------------
   Tablette
   ------------------------------------------------------------ */
@media (max-width: 1000px) {
  .bib-page--fiche {
    display: block;
  }

  .bib-page--fiche > .bib-org {
    position: static;
    margin-top: 2.2rem;
  }

  .bib-sec {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 44px 0;
  }
}

@media (max-width: 900px) {
  .bib-hero {
    padding: 44px 0 32px;
  }

  .bib-hero--fiche {
    padding: 24px 0 32px;
  }

  .bib-page {
    padding-top: 40px;
  }
}

/* ------------------------------------------------------------
   Mobile et tablette étroite (700 px et moins) : confort de lecture
   ------------------------------------------------------------ */
@media (max-width: 700px) {
  .bib-toc nav {
    justify-content: flex-start;
  }

  .bib-page p,
  .bib-page li {
    font-size: 1.0625rem;
    line-height: 1.65;
  }

  .bib-hero-grid {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 20px;
  }

  .bib-portraits img {
    width: 120px;
    height: 120px;
  }

  .bib-portraits--duo img {
    width: 104px;
    height: 104px;
  }

  .bib-auteur {
    flex-direction: column;
    gap: 12px;
    padding: 1.1rem 1.1rem .4rem;
  }

  .bib-auteur-photo {
    flex-direction: row;
  }

  .bib-org {
    padding: 1.2rem 1.1rem .4rem;
  }

  .bib-pager-suiv {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .bib-hero-in,
  .bib-page,
  .bib-suite-in {
    width: min(calc(100% - 28px), var(--max));
  }

  .bib-toc {
    top: 69px;
  }

  .bib-haut span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .bib-haut {
    padding: 0;
    width: 48px;
  }

  .bib-repertoire {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------
   Impression
   ------------------------------------------------------------ */
@media print {
  .skip-link,
  .site-header,
  .bib-toc,
  .bib-haut,
  .bib-pager,
  .bib-suite,
  .site-footer {
    display: none !important;
  }

  .bib-hero {
    padding: 0 0 16px;
    background: none;
    border: 0;
  }

  .bib-page {
    width: 100%;
    padding: 0;
  }

  .bib-auteur,
  .bib-org,
  .bib-question,
  .bib-rep {
    break-inside: avoid;
    box-shadow: none;
  }
}
