/* Atlas d'anatomie : hub, région et fiche. Tokens du site uniquement (tokens.css).
   La fiche réutilise aussi le gabarit des articles (articles.css) : sommaire, prose, sources. */

/* Couleurs de correction du quiz : texte AA sur fond clair comme sur fond sombre. */
.anat-quiz {
  --anat-ok: var(--teal-text);
  --anat-ko: #B91C1C;
}
[data-theme="dark"] .anat-quiz { --anat-ko: #FCA5A5; }

/* ── En-têtes ─────────────────────────────────────────── */
.anat-hero { padding-block: 2.5rem 2rem; border-bottom: 1px solid var(--rule); }
.anat-hero__lead { max-width: 62ch; line-height: 1.7; }
.anat-facts {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  margin: 1.25rem 0 0; padding: 0; list-style: none;
  font-family: 'IBM Plex Mono', monospace; font-size: .75rem; color: var(--ink-faint);
}
.anat-facts li { display: inline-flex; align-items: center; gap: .4rem; }
.anat-facts li::before { content: ''; width: 6px; height: 6px; background: var(--teal); }
.anat-facts strong { color: var(--ink); font-weight: 600; }

/* ── Sections du hub et de la région ─────────────────── */
.anat-section { padding-block: 2.5rem; }
.anat-section + .anat-section { border-top: 1px solid var(--rule); }
.anat-h2 {
  display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1.25rem;
  font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; color: var(--ink);
}
.anat-h2__count {
  font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; font-weight: 500; color: var(--ink-faint);
  background: var(--surface-alt); border: 1px solid var(--rule); padding: .125rem .5rem;
}

/* Carte région (hub) */
.anat-region { display: grid; background: var(--surface); border: 1px solid var(--rule); }
.anat-region + .anat-region { margin-top: 1rem; }
.anat-region__media { display: block; background: #FFFFFF; border-bottom: 1px solid var(--rule); }
.anat-region__media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.anat-region__body { display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem; }
.anat-region__title { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.anat-region__title a { color: var(--ink); text-decoration: none; }
.anat-region__title a:hover { color: var(--teal-text); }
.anat-region__lead { max-width: 60ch; color: var(--ink-soft); line-height: 1.7; }
.anat-region__fiches { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.anat-region__fiches a {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem;
  padding: .65rem .85rem; border: 1px solid var(--rule); color: var(--ink); text-decoration: none;
  transition: border-color .15s, background-color .15s;
}
.anat-region__fiches a:hover { border-color: var(--teal); background: var(--teal-bg); }
.anat-region__fiche-name { font-weight: 600; }
.anat-region__fiche-meta { font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; color: var(--ink-faint); }
.anat-region__cta { align-self: flex-start; }
@media (min-width: 768px) {
  .anat-region { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .anat-region__media { border-bottom: 0; border-right: 1px solid var(--rule); }
  .anat-region__body { padding: 2rem; }
}

/* Régions annoncées : pas de lien */
.anat-planned { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.anat-planned li {
  padding: .35rem .75rem; border: 1px dashed var(--rule);
  font-size: .8125rem; color: var(--ink-faint); background: var(--surface);
}

/* Mode d'emploi */
.anat-method { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; counter-reset: etape; }
.anat-method li { counter-increment: etape; padding: 1.25rem; background: var(--surface); border: 1px solid var(--rule); }
.anat-method h3 { margin-bottom: .4rem; font-size: 1rem; font-weight: 600; }
.anat-method h3::before {
  content: counter(etape, decimal-leading-zero); margin-right: .6rem;
  font-family: 'IBM Plex Mono', monospace; font-size: .75rem; color: var(--teal-text);
}
.anat-method p { font-size: .875rem; line-height: 1.6; color: var(--ink-soft); }
@media (min-width: 768px) { .anat-method { grid-template-columns: repeat(3, 1fr); } }
.anat-see-also { margin-top: 1.5rem; font-size: .9375rem; color: var(--ink-soft); }
.anat-see-also a, .anat-disclaimer a { color: var(--teal-text); text-decoration: underline; text-underline-offset: 3px; }

/* Liste ordonnée des fiches (région) : toute la carte est cliquable via le lien du titre. */
.anat-list { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; }
.anat-card {
  position: relative; display: grid; background: var(--surface); border: 1px solid var(--rule);
  transition: border-color .2s, box-shadow .2s;
}
.anat-card:hover { border-color: var(--teal); box-shadow: 0 12px 28px rgba(15, 23, 42, .08); }
.anat-card:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.anat-card__media { background: #FFFFFF; border-bottom: 1px solid var(--rule); }
.anat-card__media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.anat-card__body { display: flex; flex-direction: column; gap: .75rem; padding: 1.25rem 1.5rem; }
.anat-card__top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.anat-card__step { font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-text); }
.anat-card__title { font-size: 1.2rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.anat-card__title a { color: var(--ink); text-decoration: none; }
.anat-card__title a::after { content: ''; position: absolute; inset: 0; }
.anat-card__title a:focus-visible { outline: none; }
.anat-card:hover .anat-card__title a { color: var(--teal-text); }
.anat-card__desc { font-size: .9375rem; line-height: 1.6; color: var(--ink-soft); }
.anat-card__objectives { display: grid; gap: .3rem; margin: 0; padding: 0; list-style: none; font-size: .8125rem; color: var(--ink-soft); }
.anat-card__objectives li { position: relative; padding-left: 1rem; }
.anat-card__objectives li::before { content: ''; position: absolute; left: 0; top: .55em; width: 5px; height: 5px; background: var(--teal); }
.anat-card__meta {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: auto; padding-top: .75rem;
  border-top: 1px solid var(--rule-soft); font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; color: var(--ink-faint);
}
.anat-card__cta { margin-left: auto; color: var(--teal-text); }
@media (min-width: 768px) {
  .anat-card { grid-template-columns: 15rem minmax(0, 1fr); }
  .anat-card__media { border-bottom: 0; border-right: 1px solid var(--rule); }
}

.anat-disclaimer { margin-top: 2rem; max-width: 75ch; font-size: .8125rem; line-height: 1.6; color: var(--ink-faint); }
.anat-back { display: inline-flex; margin-top: 1rem; font-size: .875rem; color: var(--teal-text); }

/* ── Fiche ───────────────────────────────────────────── */
.anat-lead { max-width: 65ch; margin-top: .9rem; font-size: 1.0625rem; line-height: 1.7; color: var(--ink-soft); }

.article-prose .anat-box { margin: 0 0 2rem; padding: 1.1rem 1.35rem; background: var(--surface); border: 1px solid var(--rule); }
.article-prose .anat-box__title {
  margin: 0 0 .6rem; font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
}
.article-prose .anat-checklist { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.article-prose .anat-checklist li { position: relative; margin: 0; padding-left: 1.6rem; color: var(--ink); line-height: 1.6; }
.article-prose .anat-checklist li::before {
  content: ''; position: absolute; left: .15rem; top: .45em; width: .45rem; height: .75rem;
  border-right: 2px solid var(--teal); border-bottom: 2px solid var(--teal); transform: rotate(40deg);
}

.anat-figure__orientation {
  display: block; margin-bottom: .2rem;
  font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--teal-text);
}

.anat-landmarks { display: grid; gap: .75rem; margin: 0 0 1rem; }
.anat-landmark { padding: .9rem 1.1rem; background: var(--surface); border: 1px solid var(--rule); border-left: 2px solid var(--teal); }
.anat-landmark dt { margin-bottom: .2rem; font-size: .9375rem; font-weight: 600; color: var(--ink); line-height: 1.4; }
.anat-landmark dd { margin: 0; font-size: .875rem; line-height: 1.65; color: var(--ink-soft); }
@media (min-width: 640px) { .anat-landmarks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.article-prose .anat-takeaways { margin-top: 2.5rem; padding: 1.25rem 1.5rem; background: var(--teal-bg); border-left: 2px solid var(--teal); }
.article-prose .anat-takeaways h2 { margin: 0 0 .75rem; font-size: 1.125rem; }

.article-prose .anat-pitfall { margin-top: 1.25rem; }
.article-prose .anat-pitfall p { margin: .2rem 0 0; color: inherit; line-height: 1.6; }
.article-prose .anat-pitfall strong { color: inherit; }
.article-prose .anat-pitfall .anat-pitfall__title { font-weight: 600; }

/* ── Planche légendée ────────────────────────────────── */
/* Le schéma garde un fond blanc dans les deux thèmes : les étiquettes suivent la planche. */
.anat-plate-band { padding-block: 2rem 2.5rem; border-bottom: 1px solid var(--rule); }
.anat-plate {
  --plate-bg: #FFFFFF;
  --plate-ink: #0F172A;
  container: planche / inline-size;
  max-width: 72rem; margin: 0 auto;
  background: var(--plate-bg); border: 1px solid var(--rule);
}
.anat-plate__tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  padding: .7rem 1rem; border-bottom: 1px solid var(--rule); background: var(--surface);
}
.anat-plate__toggle, .anat-plate__all {
  padding: .4rem .8rem; font: inherit; font-size: .8125rem; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--rule); cursor: pointer;
}
.anat-plate__toggle:hover, .anat-plate__all:hover { border-color: var(--teal); color: var(--teal-text); }
.anat-plate__toggle[aria-pressed="true"] { color: var(--monitor-text); background: var(--monitor-bg); border-color: var(--monitor-bg); }
.anat-plate__toggle:focus-visible, .anat-plate__all:focus-visible, .anat-plate__reveal:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.anat-plate__count { font-family: 'IBM Plex Mono', monospace; font-size: .75rem; color: var(--ink-faint); }

.anat-plate__stage { position: relative; }
.anat-plate__img { position: relative; }
.anat-plate__img a { display: block; cursor: zoom-in; }
.anat-plate__img a:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.anat-plate__img img { display: block; width: 100%; height: auto; }

/* Vue étroite : pastilles numérotées sur l'image, légende numérotée dessous. */
.anat-plate__markers { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.anat-plate__markers li {
  position: absolute; display: grid; place-items: center; width: 1.15rem; height: 1.15rem;
  transform: translate(-50%, -50%); border-radius: 50%;
  font-family: 'IBM Plex Mono', monospace; font-size: .625rem; font-weight: 600; line-height: 1;
  color: #FFFFFF; background: var(--plate-ink); box-shadow: 0 0 0 2px #FFFFFF;
}
.anat-plate__labels {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .4rem 1rem;
  margin: 0; padding: .9rem 1rem; list-style: none; border-top: 1px solid var(--rule); background: var(--surface);
}
.anat-plate__label { margin: 0; }
.anat-plate__pill { display: flex; align-items: baseline; gap: .5rem; font-size: .8125rem; line-height: 1.35; color: var(--ink); }
.anat-plate__n { flex: none; min-width: 1.15rem; font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; font-weight: 600; color: var(--teal-text); }
.anat-plate__line, .anat-plate__dot { display: none; }
.anat-plate__reveal {
  min-width: 2rem; padding: 0 .5rem; font: inherit; font-weight: 600; line-height: 1.35;
  color: var(--teal-text); background: var(--teal-bg); border: 1px dashed var(--teal); cursor: pointer;
}
.anat-plate__caption {
  padding: .85rem 1rem; border-top: 1px solid var(--rule); background: var(--surface);
  font-size: .8125rem; line-height: 1.6; color: var(--ink-soft);
}

/* Vue large : étiquettes dans les gouttières, reliées à leur point.
   860px = AnatomyPlate::BREAKPOINT_PX (le placement des étiquettes est calculé pour cette largeur). */
@container planche (min-width: 860px) {
  .anat-plate__stage { aspect-ratio: var(--plate-ratio); }
  .anat-plate__img { position: absolute; top: 0; bottom: 0; left: var(--plate-img-left); width: var(--plate-img-width); }
  .anat-plate__markers { display: none; }
  .anat-plate__labels { position: absolute; inset: 0; display: block; padding: 0; border: 0; background: none; pointer-events: none; }
  .anat-plate__pill {
    position: absolute; z-index: 2; max-width: var(--plate-label-max); transform: translateY(-50%);
    padding: 3px 8px; font-size: .75rem; font-weight: 500; line-height: 1.25;
    color: var(--plate-ink); background: var(--plate-bg); border: 1px solid rgba(15, 23, 42, .2);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06); pointer-events: auto;
  }
  .is-left .anat-plate__pill { justify-content: flex-end; text-align: right; }
  .anat-plate__n { display: none; color: #0F766E; }
  .anat-plate.is-revision .anat-plate__n { display: inline; }
  .anat-plate__reveal { color: #0F766E; background: #F0FDFA; }
  .anat-plate__line {
    display: block; position: absolute; z-index: 1; height: 1px; margin-top: -.5px;
    background: rgba(15, 23, 42, .55); transform-origin: 0 50%;
  }
  .anat-plate__dot {
    display: block; position: absolute; z-index: 1; width: 8px; height: 8px; transform: translate(-50%, -50%);
    border-radius: 50%; background: var(--plate-ink); box-shadow: 0 0 0 2px #FFFFFF;
  }
  .anat-plate__label:hover .anat-plate__pill { border-color: var(--teal); color: #0F766E; }
  .anat-plate__label:hover .anat-plate__line { height: 2px; margin-top: -1px; background: var(--teal); }
  .anat-plate__label:hover .anat-plate__dot { width: 11px; height: 11px; background: var(--teal); }
}

/* ── Corps de fiche : blocs pédagogiques ─────────────── */
.anat-chapter + .anat-chapter { margin-top: .5rem; }
.article-prose .anat-chapter h3 { margin-top: 1.9rem; }
.article-prose .anat-list-text { padding-left: 1.3rem; }
.article-prose .anat-list-text li::marker { color: var(--teal); }
.article-prose .anat-list-text--steps { counter-reset: etape; padding-left: 0; list-style: none; }
.article-prose .anat-list-text--steps li {
  counter-increment: etape; position: relative; padding: .55rem .9rem .55rem 3rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: .25rem;
}
.article-prose .anat-list-text--steps li + li { margin-top: .5rem; }
.article-prose .anat-list-text--steps li::before {
  content: counter(etape); position: absolute; left: .85rem; top: .6rem;
  display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 50%;
  font-family: 'IBM Plex Mono', monospace; font-size: .75rem; font-weight: 600;
  color: var(--monitor-text); background: var(--monitor-bg);
}
.article-prose .anat-table table { font-size: .875rem; }
.article-prose .anat-table caption {
  caption-side: top; padding: 0 0 .6rem; text-align: left;
  font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
}
.article-prose .anat-table tbody th { font-weight: 600; color: var(--ink); background: var(--surface); }
.article-prose .anat-table td:first-child { font-weight: inherit; }

.article-prose .anat-note { margin-block: 1.5rem; padding: 1rem 1.25rem; border-left: 3px solid var(--teal); background: var(--teal-bg); }
.article-prose .anat-note p { margin: 0; color: var(--ink); }
.article-prose .anat-note .anat-note__kind {
  margin-bottom: .2rem; font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--teal-text);
}
.article-prose .anat-note .anat-note__title { margin-bottom: .35rem; font-weight: 600; }
.article-prose .anat-note .anat-note__text { font-size: .9375rem; line-height: 1.75; color: var(--ink-soft); }
.article-prose .anat-note--clinique { border-left-color: var(--monitor-bg); background: var(--surface-alt); }
.article-prose .anat-note--clinique .anat-note__kind { color: var(--ink-soft); }
.article-prose .anat-note--attention { border-left-color: var(--warn-border); background: var(--warn-bg); }
.article-prose .anat-note--attention .anat-note__kind,
.article-prose .anat-note--attention p { color: var(--warn-text); }

.article-prose .anat-glossary dl { display: grid; gap: .6rem; margin: 0; }
.anat-glossary__item { display: grid; gap: .15rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.anat-glossary__item dt { font-weight: 600; color: var(--ink); }
.anat-glossary__item dd { margin: 0; font-size: .9375rem; line-height: 1.7; color: var(--ink-soft); }
@media (min-width: 640px) {
  .anat-glossary__item { grid-template-columns: 11rem minmax(0, 1fr); gap: 1rem; }
}
.article-prose .anat-faq h2 { margin-bottom: .75rem; }

/* ── Quiz ────────────────────────────────────────────── */
.anat-quiz { margin-top: 2.5rem; }
.article-prose .anat-quiz__list { display: grid; gap: 1rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.article-prose .anat-quiz__list > li { margin: 0; }
.anat-quiz__q { min-width: 0; margin: 0; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--rule); }
.anat-quiz__q legend {
  float: left; width: 100%; margin-bottom: .75rem; padding: 0;
  font-weight: 600; line-height: 1.5; color: var(--ink);
}
.anat-quiz__num { margin-right: .6rem; font-family: 'IBM Plex Mono', monospace; font-size: .75rem; font-weight: 500; color: var(--teal-text); }
.anat-quiz__choices { clear: both; display: grid; gap: .5rem; }
.anat-quiz__choice {
  display: flex; align-items: flex-start; gap: .7rem; padding: .6rem .85rem;
  border: 1px solid var(--rule); background: var(--surface); cursor: pointer;
  font-size: .9375rem; line-height: 1.5; color: var(--ink-soft);
  transition: border-color .15s, background-color .15s;
}
.anat-quiz__choice:hover { border-color: var(--teal); }
.anat-quiz__choice:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }
.anat-quiz__choice input { flex: none; margin-top: .3rem; accent-color: var(--teal); }
.anat-quiz__label { flex: 1; }
.anat-quiz__mark { flex: none; font-weight: 700; }
.anat-quiz__choice.is-locked { cursor: default; }
.anat-quiz__choice.is-locked:hover { border-color: var(--rule); }
.anat-quiz__choice.is-correct,
.anat-quiz__choice.is-correct:hover { border-color: var(--stage-1); background: var(--teal-bg); color: var(--ink); }
.anat-quiz__choice.is-correct .anat-quiz__mark { color: var(--anat-ok); }
.anat-quiz__choice.is-wrong,
.anat-quiz__choice.is-wrong:hover { border-color: var(--stage-5); color: var(--ink); }
.anat-quiz__choice.is-wrong .anat-quiz__mark { color: var(--anat-ko); }
.article-prose .anat-quiz__feedback { margin: .6rem 0 0; font-size: .875rem; font-weight: 600; }
.article-prose .anat-quiz__feedback:empty { margin: 0; }
.article-prose .anat-quiz__feedback.is-ok { color: var(--anat-ok); }
.article-prose .anat-quiz__feedback.is-ko { color: var(--anat-ko); }
.anat-quiz__correction { margin-top: .75rem; padding-top: .6rem; border-top: 1px dashed var(--rule); }
.anat-quiz__correction summary { cursor: pointer; font-size: .8125rem; font-weight: 500; color: var(--teal-text); }
.anat-quiz__correction summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.article-prose .anat-quiz__correction p { margin: .5rem 0 0; font-size: .875rem; line-height: 1.65; }

/* Score : panneau « moniteur » sombre, chiffres mint (charte Clinical Workstation). */
.anat-quiz__score {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  margin-top: 1rem; padding: .9rem 1.1rem; background: var(--monitor-bg); color: var(--monitor-text);
}
.article-prose .anat-quiz__score-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .9rem; margin: 0; color: var(--monitor-text); font-size: .875rem; }
.anat-quiz__score-value { font-family: 'IBM Plex Mono', monospace; font-size: 1.25rem; font-weight: 600; color: var(--mint); }
.anat-quiz__bilan { color: var(--monitor-text); }
.anat-quiz__reset {
  display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem;
  font: inherit; font-size: .8125rem; color: var(--monitor-text);
  background: transparent; border: 1px solid var(--monitor-faint); cursor: pointer;
}
.anat-quiz__reset:hover { border-color: var(--mint); color: var(--mint); }
.anat-quiz__reset:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .anat-card, .anat-region__fiches a, .anat-quiz__choice { transition: none; }
}

@media print {
  .anat-hero { padding-block: 1rem; }
  .anat-plate, .anat-landmark, .anat-quiz__q, .anat-takeaways, .anat-note, .anat-table, .anat-glossary__item { break-inside: avoid; }
  .anat-quiz__correction::details-content { display: block; content-visibility: visible; }
  .anat-quiz__correction summary { display: none; }
  .anat-quiz__mark { display: none; }
}
