/* =====================================================================
   « Glossaire de la cybersécurité » (préfixe .ssg-), en complément de pages.css.
   Index alphabétique en liens d'ancre, puis une ligne par terme :
   terme (h3) à gauche, définition à droite, filet en dessous.
   ===================================================================== */

.ssp .ssg-lead {
  margin-block-start: clamp(1.5rem, 4vw, 3rem);
  font-weight: 500;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
}

/* ---------- Bandeau lavande à bord supérieur arrondi : index + illustration ---------- */
.ssp .ssg-band {
  margin: 0;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  background: var(--ssp-sky);
  border-radius: 50% 50% 0 0 / clamp(24px, 4vw, 60px) clamp(24px, 4vw, 60px) 0 0;
}

.ssp .ssg-band__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.ssp .ssg-band__inner > * {
  margin-block: 0;
}

.ssp .ssg-band__text > * + *,
.ssp .ssg-band__text > .ssg-index {
  margin-block-start: clamp(1.25rem, 3vw, 2rem);
}

.ssp .ssg-illu img {
  width: 100%;
}

/* Pastilles des lettres */
.ssp .ssg-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
  max-width: 32rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ssp .ssg-index li {
  margin: 0;
}

.ssp .ssg-index a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  min-height: 44px;
  padding: 0.4rem 1rem;
  border: 1px solid var(--ssp-red);
  border-radius: 999px;
  background: var(--ssp-red);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
  color: var(--ssp-white);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.ssp .ssg-index a:hover,
.ssp .ssg-index a:focus-visible {
  background: var(--ssp-white);
  color: var(--ssp-red);
}

.ssp .ssg-index a:focus-visible {
  outline: 3px solid var(--ssp-navy);
  outline-offset: 3px;
}

/* ---------- Liste des termes ---------- */
.ssp .ssg-list {
  padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 7vw, 5rem);
}

.ssp .ssg-letter {
  margin: 0;
}

/* Cibles des ancres : un peu d'air sous l'en-tête collant (et sous la barre d'admin si connecté) */
.ssp .ssg-letter__title,
.ssp .ssg-term__title,
.ssp .ssg-band {
  scroll-margin-top: calc(var(--wp-admin--admin-bar--height, 0px) + 1rem);
}

.ssp .ssg-letter + .ssg-letter {
  margin-block-start: clamp(1.5rem, 4vw, 2.5rem);
}

/* Lettre : repère discret (absente du site actuel, où seule l'ancre existait) */
.ssp .ssg-letter__title {
  margin: 0;
  padding-block-end: 0.4rem;
  border-bottom: 3px solid var(--ssp-red);
  color: var(--ssp-red);
  font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
}

.ssp .ssg-term {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 0.5rem clamp(1.5rem, 5vw, 4rem);
  margin: 0;
  padding-block: clamp(1.25rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(18, 18, 84, 0.35);
}

.ssp .ssg-term > * {
  margin: 0;
}

.ssp .ssg-term__title {
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.45rem);
  font-weight: 700;
  line-height: 1.45;
  color: var(--ssp-navy);
  overflow-wrap: anywhere;
}

/* Terme ciblé par un lien (#dkim…) : légère mise en évidence */
.ssp .ssg-term:has(.ssg-term__title:target) {
  background: linear-gradient(90deg, var(--ssp-sky), transparent);
}

/* ---------- Bouton « revenir à l'index » (fixe, en bas à gauche) ---------- */
.ssp .ssg-top {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 20;
  margin: 0;
}

.ssp .ssg-top a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ssp-navy);
  box-shadow: var(--ssp-shadow);
}

.ssp .ssg-top a::before {
  content: "";
  width: 18px;
  height: 18px;
  background: var(--ssp-white);
  /* Flèche (Font Awesome Free 6.5.2, « arrow-up », CC BY 4.0) */
  -webkit-mask: url("../images/icons/arrow-up.svg") center / contain no-repeat;
  mask: url("../images/icons/arrow-up.svg") center / contain no-repeat;
}

.ssp .ssg-top a:hover,
.ssp .ssg-top a:focus-visible {
  background: var(--ssp-red);
}

.ssp .ssg-top a:focus-visible {
  outline: 3px solid var(--ssp-navy);
  outline-offset: 3px;
}

/* N'apparaît qu'après le début de la page, là où c'est possible (sinon toujours visible) */
@supports (animation-timeline: scroll()) {
  .ssp .ssg-top {
    animation: ssg-top-in linear both;
    animation-timeline: scroll(root);
    animation-range: 0 600px;
  }

  @keyframes ssg-top-in {
    0%, 60% { opacity: 0; visibility: hidden; }
    100% { opacity: 1; visibility: visible; }
  }
}

/* L'éditeur : bouton dans le flux, pas fixe */
.editor-styles-wrapper .ssp .ssg-top {
  position: static;
  animation: none;
}

/* ---------- Petits écrans ---------- */
@media (max-width: 781px) {
  .ssp .ssg-band__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .ssp .ssg-illu {
    max-width: 26rem;
    margin-inline: auto !important;
  }

  .ssp .ssg-index {
    gap: 0.7rem;
    max-width: none;
  }

  .ssp .ssg-term {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ssp .ssg-index a {
    transition: none;
  }
}
