/* ============================================================
   Cercle Nest - Article de fond
   assets/css/article.css
   Chargé après site.css : mêmes variables, mêmes polices, aucune couleur nouvelle.
   ============================================================ */

/* Colonne de lecture : tout le contenu à 760 px, sauf le tableau (plus large). */
.art {
  width: min(calc(100% - 40px), 1080px);
  margin-inline: auto;
  padding: 54px 0 24px;
}

.art > * {
  max-width: var(--reading);
  margin-inline: auto;
}

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

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

.art h2 {
  margin: 3.2rem auto 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;
}

.art > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.art h3 {
  margin-block: 0 .9rem;
  color: var(--ink);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.25;
}

.art section[id],
.art h2[id] {
  scroll-margin-top: 132px;
}


/* ------------------------------------------------------------
   Bandeau de titre, sommaire et bande finale : propres aux articles
   (aucune classe de site.css n'est réutilisée ; seules les variables de :root le sont)
   ------------------------------------------------------------ */
.art-hero {
  padding: 64px 0 44px;
  background: var(--off);
  border-bottom: 1px solid var(--line);
}

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

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

.art-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -.02em;
}

.art-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;
}

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

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

.art-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;
}

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

.art-suite {
  padding: 46px 0;
  background: var(--blue);
  color: #fff;
}

.art-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;
}

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

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

.art-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;
}

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

/* Renvois de notes */
.art-fnref a {
  display: inline-block;
  padding: 0 .25em;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

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

/* Définitions de l'introduction */
.art-defs {
  margin-block: 1.4rem;
  padding: 1.2rem 1.4rem 1.2rem 2.4rem;
  background: var(--soft-blue);
  border-left: 5px solid var(--blue);
  border-radius: 0 var(--r) var(--r) 0;
}

.art-defs li + li {
  margin-top: .6rem;
}

/* Conditions de la décision linéaire, listes ouvertes/disciplinées */
.art-conditions,
.art-liste {
  margin-block: 1rem 1.4rem;
  padding-left: 1.4rem;
}

.art-conditions li,
.art-liste li {
  margin-bottom: .45rem;
}

/* Itinéraires */
.art-itin {
  margin-block: 2.2rem;
  padding: 1.6rem 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);
}

.art-label {
  margin-block: 0 .5rem;
  color: var(--bluegreen);
  font-size: .9rem !important;
  font-weight: 700;
  letter-spacing: .03em;
}

.art-chemin {
  list-style: none;
  margin-block: 0 1.4rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .35rem;
}

.art-chemin li {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-block: 0;
}

.art-chemin li + li::before {
  content: "\2192";
  color: var(--blue);
  font-weight: 700;
}

.art-chemin span {
  display: inline-block;
  padding: .4rem .8rem;
  background: var(--soft-blue);
  border: 1px solid #CFDCFB;
  border-radius: var(--r);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.art-etapes {
  margin-block: 0 1.2rem;
  padding-left: 1.4rem;
}

.art-etapes li {
  margin-bottom: .7rem;
  padding-left: .2rem;
}

.art-etapes li::marker {
  color: var(--blue);
}

.art-exemple {
  margin-block: 1.4rem 1.2rem;
  padding: 1.1rem 1.3rem .3rem;
  background: var(--soft-orange);
  border-left: 5px solid var(--orange);
  border-radius: 0 var(--r) var(--r) 0;
}

.art-exemple .art-label {
  color: var(--ink);
}

/* Échangeurs */
.art-echangeur {
  margin-block: 1.4rem;
  padding: 1.3rem 1.5rem .4rem;
  border: 1px solid var(--line);
  border-left: 5px solid var(--bluegreen);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--off);
}

.art-question {
  padding-left: 1rem;
  border-left: 4px solid var(--orange);
}

/* Tableau des onze auteurs : plus large que la colonne de lecture */
.art > .art-table {
  max-width: 1080px;
  margin-block: 1.6rem 2rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.art-table table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.art-table th,
.art-table td {
  padding: .8rem .9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 1rem;
  line-height: 1.45;
}

.art-table thead th {
  background: var(--soft-blue);
  color: var(--bluegreen);
  font-size: .85rem;
  letter-spacing: .03em;
}

.art-table tbody th {
  color: var(--ink);
  white-space: nowrap;
}

.art-table tbody tr:last-child th,
.art-table tbody tr:last-child td {
  border-bottom: 0;
}

.art-table:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Notes */
.art-notes {
  margin-top: 3.2rem;
}

.art-notes ol {
  margin-block: 0;
  padding-left: 1.6rem;
}

.art-notes li {
  margin-bottom: .6rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  scroll-margin-top: 132px;
}

.art-notes li:target {
  background: var(--soft-orange);
}

.art-retour {
  padding: 0 .3em;
  color: var(--blue);
  text-decoration: none;
}

/* Tablette */
@media (max-width: 900px) {
  .art {
    padding-top: 40px;
  }

  .art-hero {
    padding: 44px 0 32px;
  }
}

/* Téléphone : le tableau devient une suite de fiches, un auteur par fiche */
@media (max-width: 700px) {
  .art-toc nav {
    justify-content: flex-start;
  }

  .art > .art-table {
    overflow: visible;
    border: 0;
  }

  .art-table table,
  .art-table tbody,
  .art-table tr,
  .art-table th,
  .art-table td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .art-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .art-table tr {
    margin-bottom: 1rem;
    padding: .4rem 1rem .6rem;
    border: 1px solid var(--line);
    border-left: 5px solid var(--blue);
    border-radius: 0 var(--r) var(--r) 0;
    background: var(--paper);
  }

  .art-table tbody th {
    padding: .5rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.1rem;
    white-space: normal;
  }

  .art-table td {
    padding: .5rem 0;
    border-bottom: 0;
  }

  .art-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--bluegreen);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
}

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

  .art-toc {
    top: 69px;
  }

  .art-itin {
    padding: 1.2rem 1rem .4rem;
  }

  .art-echangeur,
  .art-exemple {
    padding-inline: 1rem;
  }

}

/* Retour en haut de page : lien d'ancre, sans JavaScript.
   Masque au debut de la page puis visible apres ~600 px de defilement
   (animation liee au defilement ; sans support, le lien reste visible). */
.art-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);
}

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

.art-haut:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

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

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

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

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


/* Mobile et tablette étroite (700 px et moins) : confort de lecture */
@media (max-width: 700px) {
  .art p,
  .art li {
    font-size: 1.0625rem;
    line-height: 1.65;
  }

  .art {
    padding-top: 36px;
  }

  /* Parcours : une étape par ligne, numérotée */
  .art-chemin {
    flex-direction: column;
    align-items: stretch;
    gap: .4rem;
    counter-reset: etape;
  }

  .art-chemin li {
    align-items: stretch;
    gap: .6rem;
    counter-increment: etape;
  }

  .art-chemin li::before,
  .art-chemin li + li::before {
    content: counter(etape);
    flex: none;
    align-self: center;
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
  }

  .art-chemin span {
    flex: 1;
  }

  /* Sommaire replié (le script ajoute le bouton) */
  .art-toc.is-collapsible {
    max-height: calc(100vh - 90px);
    max-height: calc(100dvh - 90px);
    overflow-x: hidden;
    overflow-y: auto;
  }

  .art-toc.is-collapsible .art-toc-btn {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
  }

  .art-toc-label {
    color: var(--muted);
  }

  .art-toc-cur {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--blue);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .art-toc-btn svg {
    flex: none;
    transition: transform .2s ease;
  }

  .art-toc[data-open="true"] .art-toc-btn svg {
    transform: rotate(180deg);
  }

  .art-toc.is-collapsible nav {
    display: none;
  }

  .art-toc.is-collapsible[data-open="true"] nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 0 8px 8px;
    border-top: 1px solid var(--line);
  }

  .art-toc.is-collapsible[data-open="true"] nav a {
    padding: 12px;
    font-size: .8rem;
  }

  /* Fiches des auteurs : nom et question directrice, le reste au toucher */
  .art-table.is-fold tbody th {
    position: relative;
    padding-right: 2rem;
    cursor: pointer;
  }

  .art-table.is-fold tbody th::after {
    content: "+";
    position: absolute;
    top: .35rem;
    right: 0;
    color: var(--blue);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.3;
  }

  .art-table.is-fold tr.is-open th::after {
    content: "\2212";
  }

  .art-table.is-fold tr:not(.is-open) td:not([data-label="Question directrice"]) {
    display: none;
  }

  .art-table.is-fold tbody th:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: 2px;
  }

  .art-fnref a {
    min-width: 28px;
    min-height: 28px;
  }
}

/* Note affichée en bas d'écran */
.art-note-pop {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 110;
  max-height: 60vh;
  max-height: 60dvh;
  overflow-y: auto;
  padding: 1rem 18px calc(1rem + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 4px solid var(--blue);
  box-shadow: 0 -10px 30px rgba(23, 43, 58, .18);
}

.art-note-pop p {
  margin: 0 0 .9rem;
  font-size: 1rem;
  line-height: 1.55;
}

.art-note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.art-note-actions a {
  color: var(--blue);
  font-size: .9rem;
  font-weight: 700;
}

.art-note-actions button {
  min-height: 44px;
  padding: 0 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
}

/* Progression de lecture */
.art-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 101;
  height: 3px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

.art-toc-btn {
  display: none;
}

/* Impression */
@media print {
  .skip-link,
  .site-header,
  .art-toc,
  .art-haut,
  .art-progress,
  .art-note-pop,
  .art-toc-btn,
  .site-footer,
  .art-suite {
    display: none !important;
  }

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

  .art {
    width: 100%;
    padding: 0;
  }

  .art > * {
    max-width: none;
  }

  .art-itin,
  .art-echangeur,
  .art-exemple,
  .art-table tr {
    break-inside: avoid;
    box-shadow: none;
  }

  .art-table table {
    min-width: 0;
  }

  .art-fnref a,
  .art-retour {
    color: inherit;
  }
}
