/**
 * @file
 * Liseuse du catalogue général (#4191). Couleurs reprises de l'habillage
 * Interactiv-Doc (#212a72, #0f4d92).
 */

.jkc {
  --jkc-bleu: #212a72;
  --jkc-bleu-clair: #0f4d92;
  --jkc-fond: #eef1f6;
  --jkc-barre-hauteur: 52px;
  display: flex;
  flex-direction: column;
  background: var(--jkc-fond);
  color: #1d1f2b;
  font-size: 15px;
}

.jkc:fullscreen {
  height: 100vh;
}

.jkc-indisponible {
  padding: 3rem 1rem;
  text-align: center;
}

/* Bandeau défilant */
.jkc-bandeau {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  background: #fff;
  color: var(--jkc-bleu);
  font-weight: 600;
  text-decoration: none;
  padding: 6px 0;
}

.jkc-bandeau span {
  display: inline-block;
  padding-left: 100%;
  animation: jkc-defile 22s linear infinite;
}

.jkc-bandeau:hover span,
.jkc-bandeau:focus span {
  animation-play-state: paused;
}

@keyframes jkc-defile {
  to {
    transform: translateX(-100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .jkc-bandeau span {
    animation: none;
    padding-left: 1rem;
  }
}

/* Barre d'outils */
.jkc-barre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  min-height: var(--jkc-barre-hauteur);
  padding: 6px 12px;
  background: var(--jkc-bleu-clair);
  color: #fff;
}

.jkc-groupe {
  display: flex;
  align-items: center;
  gap: 4px;
}

.jkc-bouton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.jkc-bouton:hover,
.jkc-bouton:focus-visible,
.jkc-bouton[aria-expanded="true"] {
  background: var(--jkc-bleu);
}

.jkc-bouton:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.jkc-bouton--icone {
  width: 38px;
  padding: 0;
  justify-content: center;
}

.jkc-bouton--principal {
  background: #fff;
  color: var(--jkc-bleu);
  font-weight: 600;
  border-color: #fff;
}

.jkc-bouton--principal:hover,
.jkc-bouton--principal:focus-visible {
  background: #dfe6f3;
  color: var(--jkc-bleu);
}

.jkc-bouton svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jkc-aller {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px;
}

.jkc-aller input {
  width: 4em;
  min-height: 34px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  text-align: center;
  font: inherit;
  color: #1d1f2b;
}

/* Corps : panneau latéral + scène */
.jkc-corps {
  position: relative;
  display: flex;
  flex: 1;
  /* La liseuse tient dans l'écran une fois la page défilée jusqu'à elle. */
  height: calc(100vh - var(--jkc-barre-hauteur) - 24px);
  height: calc(100svh - var(--jkc-barre-hauteur) - 24px);
  min-height: 360px;
}

.jkc:fullscreen .jkc-corps {
  height: auto;
}

.jkc-panneau {
  flex: 0 0 300px;
  overflow-y: auto;
  padding: 16px;
  background: #fff;
  border-right: 1px solid #d5dbe6;
}

.jkc-panneau[hidden] {
  display: none;
}

.jkc-panneau--large {
  flex-basis: 380px;
}

.jkc-panneau__titre {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--jkc-bleu);
}

.jkc-sommaire {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jkc-sommaire a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
}

.jkc-sommaire a:hover,
.jkc-sommaire a:focus-visible {
  background: var(--jkc-fond);
}

.jkc-sommaire__entree--n0 a {
  font-weight: 700;
  color: var(--jkc-bleu);
}

.jkc-sommaire__entree--n1 a {
  padding-left: 20px;
}

.jkc-sommaire__entree--n2 a,
.jkc-sommaire__entree--n3 a {
  padding-left: 34px;
  font-size: 0.92em;
}

.jkc-sommaire__page {
  color: #6a7184;
  font-variant-numeric: tabular-nums;
}

.jkc-recherche {
  display: flex;
  gap: 6px;
}

.jkc-recherche input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid #b9c2d3;
  border-radius: 4px;
  font: inherit;
}

.jkc-recherche .jkc-bouton--principal {
  background: var(--jkc-bleu-clair);
  color: #fff;
}

.jkc-recherche__etat {
  margin: 10px 0;
  color: #4b5266;
}

.jkc-resultats {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jkc-resultats a {
  display: block;
  padding: 8px;
  border-bottom: 1px solid #e3e7ef;
  color: inherit;
  text-decoration: none;
}

.jkc-resultats a:hover,
.jkc-resultats a:focus-visible {
  background: var(--jkc-fond);
}

.jkc-resultats strong {
  display: block;
  color: var(--jkc-bleu);
}

.jkc-resultats span {
  font-size: 0.9em;
  color: #4b5266;
}

.jkc-scene {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.jkc-livre {
  width: 100%;
  height: 100%;
}

.jkc-chargement {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #4b5266;
}

.jkc-chargement[hidden] {
  display: none;
}

/* Onglets à droite du livre, sous-chapitres en volets vers la gauche */
.jkc-onglets {
  position: relative;
  /* Au-dessus des pages de StPageFlip (z-index jusqu'à 5). */
  z-index: 10;
  display: flex;
  flex: 0 0 180px;
  padding: 16px 0;
}

.jkc-onglets__liste,
.jkc-volet__liste {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jkc-onglets__liste {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

/* Les volets s'ouvrent à hauteur de l'élément survolé ; le JS les remonte
   s'ils dépassent le bas du livre. */
.jkc-onglet,
.jkc-volet__entree {
  position: relative;
}

.jkc-onglet {
  display: flex;
  flex: 1 1 0;
  min-height: 44px;
}

.jkc-onglet__lien {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-left: 4px solid transparent;
  border-radius: 0 4px 4px 0;
  background: var(--jkc-bleu);
  color: #fff;
  text-decoration: none;
  line-height: 1.25;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.18);
}

.jkc .jkc-onglet__lien:hover,
.jkc .jkc-onglet__lien:focus,
.jkc .jkc-onglet:hover > .jkc-onglet__lien,
.jkc .jkc-onglet:focus-within > .jkc-onglet__lien {
  background: var(--jkc-bleu-clair);
  color: #fff;
}

.jkc-onglet__lien:focus-visible,
.jkc-volet a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

.jkc-onglet--actif > .jkc-onglet__lien {
  border-left-color: #fff;
  font-weight: 700;
}

.jkc-onglet__page,
.jkc-volet__page {
  flex: 0 0 auto;
  min-width: 1.7em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.jkc-volet {
  position: absolute;
  top: 0;
  right: 100%;
  display: none;
  width: 300px;
  padding: 6px 0 10px;
  background: var(--jkc-bleu);
  color: #fff;
  box-shadow: -4px 4px 16px rgba(0, 0, 0, 0.3);
}

.jkc-onglet:hover > .jkc-volet,
.jkc-onglet:focus-within > .jkc-volet,
.jkc-volet__entree:hover > .jkc-volet,
.jkc-volet__entree:focus-within > .jkc-volet {
  display: block;
}

.jkc-volet__titre {
  margin: 4px 16px 8px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.jkc-volet a {
  display: flex;
  gap: 12px;
  padding: 7px 16px;
  color: #fff;
  text-decoration: none;
  line-height: 1.3;
}

/* Préfixe .jkc : les liens survolés du thème (a:hover) ne doivent pas
   repeindre le texte. */
.jkc .jkc-volet a:hover,
.jkc .jkc-volet a:focus,
.jkc .jkc-volet__entree:hover > a,
.jkc .jkc-volet__entree:focus-within > a {
  background: var(--jkc-bleu-clair);
  color: #fff;
}

.jkc-volet__entree--parent > a::after {
  content: "‹";
  margin-left: auto;
  padding-left: 8px;
}

/* Onglets imprimés dans le PDF, rendus cliquables. */
.jkc-lien--onglet:hover,
.jkc-lien--onglet:focus-visible {
  background: rgba(15, 77, 146, 0.25);
}

/* Pages */
.jkc-page {
  background: #fff;
}

.jkc-page__contenu {
  position: relative;
  width: 100%;
  height: 100%;
}

.jkc-page__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.jkc-page__surlignage,
.jkc-page__liens {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.jkc-surligne {
  position: absolute;
  background: rgba(255, 214, 0, 0.45);
  mix-blend-mode: multiply;
}

.jkc-lien {
  position: absolute;
  pointer-events: auto;
}

.jkc-lien:hover,
.jkc-lien:focus-visible {
  background: rgba(15, 77, 146, 0.15);
  outline: 1px solid var(--jkc-bleu-clair);
}

/* Écrans étroits : le panneau recouvre la scène au lieu de la pousser. */
@media (max-width: 900px) {
  .jkc-barre {
    justify-content: center;
  }

  .jkc-bouton span:not(.visually-hidden) {
    display: none;
  }

  .jkc-bouton--principal span:not(.visually-hidden) {
    display: inline;
  }

  .jkc-corps {
    height: calc(100svh - 2 * var(--jkc-barre-hauteur) - 16px);
  }

  .jkc-panneau,
  .jkc-panneau--large {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 5;
    width: min(100%, 380px);
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
  }

  .jkc-scene {
    padding: 8px;
  }

  /* Pas la place : le sommaire de la barre d'outils prend le relais. */
  .jkc-onglets {
    display: none;
  }
}

@media (max-width: 600px) {
  .jkc-bouton[data-jkc-action="premiere"],
  .jkc-bouton[data-jkc-action="derniere"] {
    display: none;
  }
}

/* Formulaire de téléchargement. Le thème masque les libellés de tous les
   webforms (main.css : `.webform-submission-form label { display: none }`) et
   compte sur des placeholders ; il encadre le conteneur du champ, pas le champ,
   et ignore les champs tel, qui restaient invisibles. Ici, libellé au-dessus
   du champ et cadre sur le champ lui-même. */
[data-jkc-formulaire] .webform-submission-form label {
  display: block;
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--jkc-bleu);
}
[data-jkc-formulaire] .webform-submission-form .js-form-type-textfield,
[data-jkc-formulaire] .webform-submission-form .js-form-type-email,
[data-jkc-formulaire] .webform-submission-form .js-form-type-tel {
  height: auto;
  border: 0;
  margin: 0 0 12px;
}
[data-jkc-formulaire] .webform-submission-form .js-form-type-textfield input,
[data-jkc-formulaire] .webform-submission-form .js-form-type-email input,
[data-jkc-formulaire] .webform-submission-form .js-form-type-tel input {
  width: 100%;
  height: 42px;
  padding: 8px 12px;
  border: 1px solid #706f6f;
  font-size: 16px;
  font-weight: 400;
}
[data-jkc-formulaire] .webform-submission-form .js-form-type-checkbox {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: start;
  margin: 0 0 12px;
}
[data-jkc-formulaire] .webform-submission-form .js-form-type-checkbox input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;
}
[data-jkc-formulaire] .webform-submission-form .js-form-type-checkbox label {
  margin: 0;
  font-weight: 400;
  color: inherit;
}
[data-jkc-formulaire] .webform-submission-form .js-form-type-checkbox .description {
  grid-column: 1 / -1;
  margin-top: 8px;
}
[data-jkc-formulaire] .webform-submission-form .form-required::after {
  content: " *";
  color: #c0392b;
}
