/* Charte commune : les composants spécialisés restent dans leurs feuilles.
   Ces variables relient toutes les pages à l'identité validée sur l'accueil. */
:root {
  --presentation-font: 'Source Sans 3', system-ui, sans-serif;
  --presentation-ink: #193e52;
  --presentation-muted: #516773;
  --presentation-accent: #b0522d;
  --presentation-line: #d9e2e5;
  --presentation-surface: #ffffff;
  --presentation-soft: #edf3f5;
  --presentation-primary: #254e64;
  --presentation-on-primary: #ffffff;
  --presentation-radius: 0.9rem;
  --pst-font-family-base: var(--presentation-font);
  --pst-font-family-heading: var(--presentation-font);
}

html[data-theme="light"] {
  --pst-color-background: #fbfcfc;
  --parigaux-bg: #fbfcfc;
  --parigaux-text: #193e52;
  --pst-color-text-base: #193e52;
  --pst-color-text-muted: #516773;
  --pst-color-secondary: #254e64;
  --pst-color-secondary-text: #ffffff;
  --pst-color-border: #d9e2e5;
}

html[data-theme="dark"] {
  --presentation-ink: #d6e8f0;
  --presentation-muted: #a4bac5;
  --presentation-accent: #efad8c;
  --presentation-line: #30434e;
  --presentation-surface: #161f27;
  --presentation-soft: #1b2b35;
  --presentation-primary: #aac8da;
  --presentation-on-primary: #102a39;
  --parigaux-text: #d6e8f0;
  --pst-color-text-base: #d6e8f0;
  --pst-color-text-muted: #a4bac5;
  --pst-color-secondary: #aac8da;
  --pst-color-secondary-text: #102a39;
  --pst-color-border: #30434e;
}

body {
  font-family: var(--presentation-font);
  font-size: 1.0625rem;
  color: var(--presentation-ink);
}

.bd-content {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.bd-header.navbar {
  border-bottom: 1px solid var(--presentation-line);
  background: var(--presentation-surface);
  box-shadow: none;
}

.bd-article :is(h1, h2, h3, h4, h5, h6, .sd-card-title),
.site-search h1,
.site-dialog h2 {
  color: var(--presentation-ink);
  font-family: var(--presentation-font);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.bd-article > section > h1, .site-search h1 {
  margin: 1.5rem 0 1.5rem;
  font-size: clamp(2.1rem, 4.4vw, 3.7rem);
  line-height: 1.1;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.bd-article > section > section > h2 {
  margin: 3rem 0 1.25rem;
  font-size: clamp(1.65rem, 2.8vw, 2.2rem);
  line-height: 1.2;
}

.bd-article > section > section > section > h3 { font-size: 1.35rem; }
.bd-article p { line-height: 1.7; }
.site-catalog-page > p:not([class]) { max-width: 48rem; color: var(--presentation-muted); font-size: 1.1rem; }
.bd-article :is(a, button, input, select, summary):focus-visible {
  outline: 3px solid var(--presentation-accent);
  outline-offset: 4px;
}

/* Menus et sommaire : repères calmes, identiques dans les deux thèmes. */
.bd-sidebar-primary { border-right: 1px solid var(--presentation-line); background: transparent; }
.bd-sidebar-primary .sidebar-header-items { background: var(--presentation-surface); }
.bd-sidebar-primary .nav-link { border-radius: 0.4rem; }
.bd-sidebar-primary .nav-link:hover { background: var(--presentation-soft); }
.bd-header .navbar-nav > .nav-item > .nav-link,
.bd-header .navbar-nav > .nav-item > div > .nav-link { font-weight: 600; }
.bd-header .dropdown-menu:not(.python-submenu-menu) {
  border: 1px solid var(--presentation-line);
  border-radius: 0.75rem;
  background: var(--presentation-surface);
  color: var(--presentation-ink);
  box-shadow: 0 12px 30px #193e5212;
}
.bd-header .dropdown-item { color: var(--presentation-ink); }
.bd-header .dropdown-item:is(:hover, :focus, .active, .current) { background: var(--presentation-soft); color: var(--presentation-ink); }

/* Les cartes Sphinx conservent leurs vrais liens et leur hauteur commune. */
html[data-theme] .bd-article .sd-card {
  border: 1px solid var(--presentation-line);
  border-radius: var(--presentation-radius) !important;
  background: var(--presentation-surface) !important;
  box-shadow: none !important;
}
html[data-theme] .bd-article .sd-card.sd-bg-light { background: var(--presentation-surface) !important; }
html[data-theme] .bd-article .sd-card .sd-card-body {
  padding: clamp(1.2rem, 2vw, 1.7rem);
  border-radius: inherit;
  background: transparent;
}
html[data-theme] .bd-article .sd-card-title { color: var(--presentation-ink); font-size: 1.3rem; font-weight: 600 !important; line-height: 1.25; }
.bd-article .site-navigation-card { transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease; }
html[data-theme] .bd-article .site-navigation-card:is(:hover, :focus-within) {
  border-color: var(--presentation-muted);
  transform: translateY(-3px);
  box-shadow: 0 12px 26px #193e520a !important;
}
.bd-article .cartes-centrees > .sd-col { flex: 1 1 15rem; max-width: 100%; min-width: 0; }
.bd-article .cartes-centrees .sd-card-body { align-items: stretch; text-align: left; }
.bd-article .site-card-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.site-card-icon { display: block; flex-shrink: 0; width: 2rem; height: 2rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.site-card-icon:has(use[href$="#bolt"]) { color: var(--presentation-accent); }
html[data-theme] .bd-article .site-chapter-card .sd-card-title { color: var(--presentation-muted); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.03em; }
html[data-theme] .bd-article .chapitre-card-titre { margin-top: 0; color: var(--presentation-ink); font-size: 1.3rem; line-height: 1.25; text-align: left; }
.bd-article .site-navigation-card .sd-card-text { color: var(--presentation-muted); font-size: 0.98rem; }
html[data-theme] .bd-article .cartes-centrees .card-action-label {
  align-self: stretch;
  margin-top: 1.25rem !important;
  border-top: 1px solid var(--presentation-line);
  border-radius: 0;
  padding: 0.9rem 0 0;
  background: transparent;
  color: var(--presentation-ink);
  font-size: 0.86rem;
  font-weight: 600;
}

/* Entrées de rubriques : de la couleur et un dessin propre à chaque univers.
   Le conteneur suit la place réelle de l'article, y compris à gros caractères. */
.site-catalog-page {
  --catalog-cool: #e9f2f6;
  --catalog-warm: #fcf0e8;
  --catalog-art: #32647c;
  --catalog-cool-line: #cbdfe9;
  --catalog-warm-line: #edd8ca;
  container: catalog / inline-size;
}
html[data-theme="dark"] .site-catalog-page {
  --catalog-cool: #1c3443;
  --catalog-warm: #362b29;
  --catalog-art: #97bfd3;
  --catalog-cool-line: #365366;
  --catalog-warm-line: #5c4239;
}
.site-catalog-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0 1rem;
  padding: 1.5rem 0;
}
.site-catalog-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -1rem 0 -1rem 35%;
  background: radial-gradient(ellipse at 65% 44%, var(--catalog-cool), transparent 67%),
              radial-gradient(ellipse at 92% 78%, var(--catalog-warm), transparent 57%);
  mask-image: linear-gradient(to right, transparent, #000 20%, #000 75%, transparent),
              linear-gradient(to bottom, transparent, #000 20%, #000 75%, transparent);
  mask-composite: intersect;
  pointer-events: none;
}
.site-catalog-copy { min-width: 0; }
.bd-article .site-catalog-eyebrow {
  margin: 0 0 0.8rem;
  color: var(--presentation-accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}
.bd-article .site-catalog-copy h1 {
  margin: 0 0 1.3rem;
  font-size: clamp(2.25rem, 5.8cqi, 3.65rem);
  line-height: 1.06;
  letter-spacing: -0.045em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.site-catalog-copy > p:not(.site-catalog-eyebrow) {
  max-width: 40rem;
  margin-bottom: 0.9rem;
  color: var(--presentation-muted);
  font-size: 1.075rem;
  line-height: 1.65;
}
.site-catalog-copy > p:last-child { margin-bottom: 0; }
.site-catalog-art {
  display: block;
  width: 100%;
  height: auto;
  max-height: 23rem;
  overflow: visible;
  color: var(--catalog-art);
  pointer-events: none;
}
.site-catalog-hero + .site-page-actions { margin: 0 0 2rem; }
html[data-theme] .bd-article .site-catalog-page .site-navigation-card {
  --catalog-card-tint: var(--catalog-cool);
  --catalog-card-line: var(--catalog-cool-line);
  --catalog-card-icon: var(--catalog-art);
  border-color: var(--catalog-card-line);
  border-radius: 1.15rem !important;
  background: linear-gradient(145deg, var(--catalog-card-tint), var(--presentation-surface) 88%) !important;
}
html[data-theme] .bd-article .site-catalog-page .site-card-warm {
  --catalog-card-tint: var(--catalog-warm);
  --catalog-card-line: var(--catalog-warm-line);
  --catalog-card-icon: var(--presentation-accent);
}
.site-catalog-page .site-navigation-card .site-card-icon {
  box-sizing: content-box;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--catalog-card-line);
  border-radius: 0.85rem;
  padding: 0.6rem;
  background: var(--presentation-surface);
  color: var(--catalog-card-icon);
  box-shadow: 0 4px 12px #193e5206;
  transition: transform 200ms ease;
}
html[data-theme] .bd-article .site-catalog-page .site-navigation-card .sd-card-body {
  padding: clamp(1.35rem, 2.8cqi, 1.9rem);
}
html[data-theme] .bd-article .site-catalog-page .card-action-label {
  border-color: var(--catalog-card-line);
  color: var(--catalog-card-icon);
}
html[data-theme] .bd-article .site-catalog-page .site-navigation-card:is(:hover, :focus-within) {
  border-color: var(--catalog-card-icon);
  box-shadow: 0 14px 28px #193e5210 !important;
}
.site-catalog-page .site-navigation-card:is(:hover, :focus-within) .site-card-icon { transform: translateY(-2px) rotate(-4deg); }
.site-catalog-page .sd-card-body > .sd-card-title + * { margin-top: 0; }
.site-catalog-page .python-path-choice .sd-card-title { font-size: 1.6rem; }
/* Deux invitations éditoriales : débuter Python et composer une séance. */
html[data-theme] .bd-article .site-catalog-page .site-card-featured {
  --catalog-card-icon: #ffffff;
  --catalog-card-line: #ffffff38;
  background: linear-gradient(125deg, #254e64, #193e52) !important;
  border-color: #315f77;
}
html[data-theme] .bd-article .site-catalog-page .site-card-featured :is(.sd-card-title, .chapitre-card-titre) { color: #ffffff; }
.site-catalog-page .site-card-featured .sd-card-text { color: #d6e8f0; }
.site-catalog-page .site-card-featured .site-card-icon { background: #ffffff0d; }
html[data-theme] .bd-article .site-catalog-page .site-card-featured .card-action-label { color: #efad8c; }
html[data-theme] .bd-article .site-catalog-page .site-card-featured:is(:hover, :focus-within) { border-color: #efad8c; }

@container catalog (max-width: 42rem) {
  .site-catalog-hero { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0.75rem 0 0; }
  .site-catalog-hero::before { inset: 35% 0 -1rem 20%; }
  .site-catalog-art { justify-self: end; width: min(72%, 19rem); max-height: 12rem; margin: 0.3rem 0 0; }
  .bd-article .site-catalog-copy h1 { font-size: clamp(2.1rem, 8.5cqi, 3.5rem); }
}
@container catalog (max-width: 24rem) {
  .site-catalog-art { width: 75%; max-height: 9.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .site-catalog-page .site-navigation-card .site-card-icon { transition: none; }
  .site-catalog-page .site-navigation-card:is(:hover, :focus-within) .site-card-icon { transform: none; }
}

/* Chapitres, documents et navigation de lecture. */
.site-course-page > .chapter-kicker { margin: -0.4rem 0 1.5rem; color: var(--presentation-accent); font-size: 0.82rem; font-weight: 600; }
.bd-article .chapter-pdf { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin: 1.5rem 0 2.5rem; }
.bd-article .chapter-pdf > a {
  display: inline-flex; align-items: center; min-height: 3rem;
  border: 1px solid var(--presentation-primary); border-radius: 0.5rem;
  padding: 0.7rem 1.1rem; background: var(--presentation-primary);
  color: var(--presentation-on-primary); font-size: 0.95rem; font-weight: 600; text-decoration: none;
}
.bd-article .chapter-pdf > a:hover { filter: brightness(0.94); }
html[data-theme] .bd-article .responsive-iframe { border: 1px solid var(--presentation-line); border-radius: var(--presentation-radius); background: var(--presentation-surface); box-shadow: none; }
.bd-article .responsive-iframe::after { display: none; }
.bd-article .responsive-iframe iframe { border-radius: inherit; }
.prev-next-area { gap: 1rem; border-top: 1px solid var(--presentation-line); padding-top: 1.5rem; }
.prev-next-area a { border: 1px solid var(--presentation-line); border-radius: 0.75rem; padding: 1rem; text-decoration: none; }
.prev-next-area a:hover { background: var(--presentation-soft); }
.prev-next-area .prev-next-title { font-family: var(--presentation-font); font-weight: 600; }
.site-page-actions { margin-block: 0 1.75rem; }
.site-action, .site-search button { border-color: var(--presentation-line); border-radius: 0.5rem; }
.site-action:not(.site-complete-step, .site-progress-control) { color: var(--presentation-muted); }
.site-search button[type="submit"] { padding-inline: 1rem; background: var(--presentation-primary); color: var(--presentation-on-primary); font-weight: 600; }
.site-search-form { margin: 1.8rem 0 2rem; }
.site-search-results > li { border: 1px solid var(--presentation-line); border-radius: var(--presentation-radius); padding: 1.25rem; background: var(--presentation-surface); }
.site-search-results h2 { font-family: var(--presentation-font); }
.site-dialog { border-color: var(--presentation-line); border-radius: var(--presentation-radius); background: var(--presentation-surface); color: var(--presentation-ink); }

/* Présentation personnelle, enseignement, recherche et CV. */
html[data-theme] .bd-article :is(.profile-hero, .teaching-hero, .research-hero, .cv-project) {
  border: 1px solid var(--presentation-line); border-radius: var(--presentation-radius);
  background: var(--presentation-soft); box-shadow: none;
}
.profile-hero::before { display: none; }
html[data-theme] .bd-article :is(.profile-name, .teaching-title, .research-title, .research-key-result strong) { color: var(--presentation-ink); font-family: var(--presentation-font); font-weight: 600; letter-spacing: -0.035em; }
html[data-theme] .bd-article :is(.profile-links, .teaching-links, .research-links) > a { border-color: var(--presentation-line); border-radius: var(--presentation-radius); background: var(--presentation-surface); box-shadow: none; }
.bd-article :is(.profile-links, .teaching-links, .research-links) strong { color: var(--presentation-ink); font-family: var(--presentation-font); font-weight: 600; }
html[data-theme] .bd-article :is(.profile-eyebrow, .teaching-eyebrow, .research-eyebrow, .profile-link-kicker) { color: var(--presentation-accent); }

/* Les cellules gardent leur code, leurs couleurs syntaxiques et leurs états. */
html[data-theme] .bd-article .python-cell { border-color: var(--presentation-line); border-radius: 0.75rem; box-shadow: none; }
html[data-theme] .bd-article .python-cell--example { border-left-color: var(--presentation-primary); }
html[data-theme] .bd-article .python-cell--exercise { border-left-color: var(--presentation-accent); }
html[data-theme] .bd-article .python-cell-header { background: var(--presentation-soft); color: var(--presentation-ink); border-bottom-color: var(--presentation-line); }
html[data-theme] .bd-article .python-actions { background: var(--presentation-surface); border-top-color: var(--presentation-line); }
html[data-theme] .bd-article .python-run { border-color: var(--presentation-primary); background: var(--presentation-primary); color: var(--presentation-on-primary); }
.bd-article .python-actions button { border-radius: 0.4rem; }
:root .bd-article .proof-puzzle { border-color: var(--presentation-line); background: var(--presentation-surface); box-shadow: none; }
:root .bd-article .proof-puzzle-property > .rubric { font-family: var(--presentation-font); }

/* Outils web : les variables locales évitent de changer les exports et
   l'application de bureau qui partage les fichiers du tableau de barème. */
:root .bd-article .lp-app {
  --lp-blue: var(--presentation-primary); --lp-blue-strong: var(--presentation-primary);
  --lp-blue-soft: var(--presentation-soft); --lp-orange: #b0522d;
  --lp-border: var(--presentation-line); --lp-muted: var(--presentation-muted);
  --lp-surface: var(--presentation-surface); --lp-surface-soft: var(--presentation-soft); --lp-text: var(--presentation-ink);
}
:root .bd-article .lp-card { border-radius: var(--presentation-radius); box-shadow: none; }
:root .bd-article .ga-app {
  --ga-ink: var(--presentation-ink); --ga-blue-soft: var(--presentation-soft);
  --ga-orange: var(--presentation-accent); --ga-surface: var(--presentation-surface);
  --ga-surface-soft: var(--presentation-soft); --ga-border: var(--presentation-line);
  --ga-muted: var(--presentation-muted); --ga-shadow: none;
}
:root .bd-article .ga-app :is(.ga-intro, .ga-controller, .ga-settings, .ga-figure-card, .ga-value-card) { border-radius: var(--presentation-radius); }
:root .bd-article .ga-intro { border-left-width: 1px; }
:root .bd-article .tb-app {
  --tb-blue: #254e64; --tb-blue-strong: #254e64; --tb-blue-soft: #edf3f5; --tb-orange: #254e64;
  --tb-border: #d9e2e5; --tb-muted: #516773; --tb-surface: #ffffff; --tb-surface-soft: #edf3f5; --tb-text: #193e52;
  font-family: var(--presentation-font);
}
html[data-theme="dark"] .bd-article .tb-app:not([data-app-theme="light"]),
:root .bd-article .tb-app[data-app-theme="dark"] {
  --tb-blue: #aac8da; --tb-blue-strong: #31566c; --tb-blue-soft: #1b2b35; --tb-orange: #31566c;
  --tb-border: #30434e; --tb-muted: #a4bac5; --tb-surface: #161f27; --tb-surface-soft: #1b2b35; --tb-text: #d6e8f0;
}
:root .bd-article .tb-shell { border-radius: var(--presentation-radius); box-shadow: none; }
:root .bd-article .tb-app :is(h2, h3) { color: var(--tb-text); }
:root .bd-article .tb-brand-icon { --tb-logo-background: #254e64; --tb-logo-paper: #ffffff; --tb-logo-grid: #254e64; --tb-logo-check: #b0522d; }
:root .bd-article .tb-app[data-app-theme="dark"] .tb-brand-icon { --tb-logo-background: #1b2b35; --tb-logo-paper: #30434e; --tb-logo-grid: #aac8da; --tb-logo-check: #efad8c; }

@media (min-width: 768px) {
  .bd-article .cartes-centrees > .sd-col { max-width: 50%; }
}
@media (min-width: 1200px) {
  .bd-article .cartes-centrees > .sd-col { max-width: 33.333333%; }
  .bd-article .python-path-choice > .sd-col { max-width: 50%; }
}
.bd-article .cartes-centrees > .sd-col:only-child { max-width: 100%; }

@media (max-width: 767.98px) {
  .bd-article > section > h1, .site-search h1 { margin-top: 1rem; }
  .bd-article > section > section > h2 { margin-top: 2.25rem; }
  .site-page-actions .site-action { min-height: 2.75rem; }
  .prev-next-area { flex-wrap: wrap; }
  .prev-next-area a { max-width: 100%; }
}

/* Le thème déplace le menu dans un dialogue pour l'ouvrir. Masquer son
   emplacement de repos évite qu'il traverse la page pendant un redimensionnement. */
@media (max-width: 959.98px) {
  .bd-container__inner > #pst-primary-sidebar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] .bd-article .site-navigation-card { transition: none; transform: none; }
}

body:has(.home-page) .bd-main {
  width: 100%;
}

body:has(.home-page) .bd-main .bd-content .bd-article-container {
  width: 100%;
  max-width: 76rem;
  padding-top: 0;
  /* Le conteneur défilant du thème bloquerait la position sticky du visuel. */
  overflow: visible;
}

body:has(.home-page) .bd-content {
  padding-top: 0;
}

/* Le titre Sphinx reste disponible aux lecteurs d'écran et aux moteurs.
   Le grand titre éditorial de l'accueil est le h2 #home-title. */
.bd-article > section:has(> .home-page) > h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.bd-article > section:has(> .home-page) > h1 .headerlink { display: none; }

.home-page {
  color: var(--presentation-ink);
  padding-top: 1.5rem;
}

.bd-article .home-page :is(h2, h3),
.bd-article .chapter-preview :is(h1, h2, h3) {
  color: var(--presentation-ink);
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.home-page p { margin: 0; }

.home-page .home-eyebrow,
.chapter-preview .chapter-kicker {
  margin: 0 0 1.1rem;
  color: var(--presentation-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  line-height: 1.5;
  text-transform: uppercase;
}

.home-introduction {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  column-gap: clamp(1.5rem, 4vw, 4rem);
}

.home-hero {
  grid-column: 1;
  grid-row: 1;
  padding: clamp(2.5rem, 6vw, 5rem) 0 4.5rem;
}

.home-hero > * { min-width: 0; }
.home-page { container: home / inline-size; }
.home-hero-copy { container-type: inline-size; }

.bd-article .home-page #home-title {
  margin: 0 0 1.7rem;
  font-size: min(clamp(3.2rem, 5.5vw, 5.2rem), 18cqi);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

#home-title > span { color: var(--presentation-accent); }

.home-page .home-lead {
  max-width: 26rem;
  color: var(--presentation-muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.home-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem 1.5rem;
  margin: 2rem 0 2.5rem;
}

.home-page .home-button,
.chapter-preview .chapter-pdf > a {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  min-height: 3rem;
  border: 1px solid #254e64;
  border-radius: 0.5rem;
  padding: 0.75rem 1.1rem;
  background: #254e64;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease;
}

.home-page .home-button:hover,
.chapter-preview .chapter-pdf > a:hover {
  background: #193e52;
  transform: translateY(-2px);
}

html[data-theme="dark"] :is(.home-page .home-button, .chapter-preview .chapter-pdf > a) {
  border-color: #aac8da;
  background: #aac8da;
  color: #102a39;
}

html[data-theme="dark"] :is(.home-page .home-button, .chapter-preview .chapter-pdf > a):hover {
  background: #d6e8f0;
}

.home-page .home-text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 2.75rem;
  color: var(--presentation-ink);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.home-page .home-text-link:hover { text-decoration: underline; text-underline-offset: 0.3em; }

.home-page a:focus-visible,
.chapter-preview a:focus-visible {
  outline: 3px solid var(--presentation-accent);
  outline-offset: 5px;
}

.home-page .home-author {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--presentation-muted);
  font-size: 0.82rem;
  line-height: 1.4;
  text-decoration: none;
}

.home-avatar {
  position: relative;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  overflow: hidden;
  border-radius: 50%;
}

.home-page .home-avatar img {
  position: absolute;
  top: -2%;
  left: 50%;
  width: 112%;
  max-width: none;
  height: auto;
  border-radius: 0 !important;
  transform: translateX(-46%);
}

.home-author strong, .home-author > span > span { display: block; }
.home-author strong { color: var(--presentation-ink); font-weight: 600; }
.home-author:hover strong { text-decoration: underline; text-underline-offset: 0.2em; }

.home-page .home-geometry {
  position: sticky;
  top: calc(var(--site-header-height, var(--pst-header-height, 4rem)) + 2rem);
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  margin: 4rem 0 2rem;
  padding: 1.5rem 0;
  text-align: center;
}

.home-fractal { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; }
.home-fractal-view {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  /* Les images transparentes flottent sur le fond ; les détails qui sortent
     du champ s'effacent progressivement, sans cercle ni cadre visible. */
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent), linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent);
  mask-composite: intersect;
}
.home-page .home-fractal-fallback {
  position: absolute; inset: 0;
  background: url("Images/Fractale/julia-light-0.webp") center / contain no-repeat;
}
html[data-theme="dark"] .home-page .home-fractal-fallback { background-image: url("Images/Fractale/julia-dark-0.webp"); }
.home-page .is-rendered .home-fractal-fallback { background-image: none; }
.home-fractal-canvas { position: absolute; inset: 0; display: none; width: 100%; height: 100%; }
.home-fractal.is-rendered .home-fractal-fallback { visibility: hidden; }
.home-fractal.is-rendered .home-fractal-canvas { display: block; }

.home-page .home-geometry figcaption {
  margin: 0 0 0.85rem;
  color: var(--presentation-ink) !important;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1rem;
  font-style: normal;
  font-weight: 600;
}

.home-introduction > #les-parcours { grid-column: 1; grid-row: 2; padding-top: 2rem; }
.home-introduction .home-section-heading { display: block; margin-bottom: 1.7rem; }
.home-introduction .home-section-heading > p { max-width: 26rem; }
.home-introduction .home-paths { grid-template-columns: 1fr; gap: 0.9rem; }
.home-introduction .home-path { padding: 1.5rem; }
.home-introduction .home-path-top { margin-bottom: 1.2rem; }
.home-introduction .home-path p { margin-bottom: 1rem; }

.home-section { padding-block: 4rem; border-top: 1px solid var(--presentation-line); }
.home-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.bd-article .home-page h2 { margin: 0 0 1.2rem; font-size: clamp(1.9rem, 3vw, 2.55rem); line-height: 1.15; }
.home-section-heading > p { max-width: 16rem; margin-bottom: 1.2rem; color: var(--presentation-muted); font-size: 0.98rem; }
.home-paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }

.home-page .home-path {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--presentation-line);
  border-radius: 0.9rem;
  padding: clamp(1.2rem, 2.3vw, 2rem);
  background: var(--presentation-surface);
  color: var(--presentation-ink);
  text-decoration: none;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.home-page .home-path-primary { background: var(--presentation-soft); }
.home-page .home-path:hover { border-color: var(--presentation-muted); transform: translateY(-4px); box-shadow: 0 12px 26px #193e520a; }
.home-path-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2.2rem; }
.home-path-top svg { display: block; width: 2rem; height: 2rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.home-path-top .home-icon-shape { fill: currentColor; fill-opacity: 0.06; }
.home-path-top .home-icon-detail { stroke-opacity: 0.55; stroke-width: 1.3; }
.home-path-top .home-icon-bolt { color: var(--presentation-accent); }
.bd-article .home-page .home-path h3 { margin: 0 0 0.8rem; font-size: 1.45rem; line-height: 1.2; }
.home-page .home-path p { margin: 0 0 2rem; color: var(--presentation-muted); font-size: 0.98rem; line-height: 1.6; }
.home-path-action { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--presentation-line); font-size: 0.85rem; font-weight: 600; }

.home-method { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 3rem; margin: 1.5rem 0 4rem; border-radius: 1rem; padding: clamp(1.5rem, 4vw, 3.5rem); background: #193e52; color: #ffffff; }
.bd-article .home-page .home-method h2 { color: #ffffff; }
.home-method .home-eyebrow { color: #b9d1dd; }
.home-method > div > p:last-child { max-width: 25rem; color: #d2e0e7; }
.home-method ul { display: grid; gap: 1.4rem; margin: 0; padding: 0; list-style: none; }
.home-method li { display: flex; align-items: baseline; gap: 1rem; }
.home-method strong { font-size: 1.1rem; font-weight: 600; }
.home-method li p { margin-top: 0.2rem; color: #d2e0e7; font-size: 0.93rem; line-height: 1.5; }
.home-teachers { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-bottom: 3rem; border-bottom: 1px solid var(--presentation-line); }
.home-teachers p:last-child { color: var(--presentation-muted); }
.home-teachers > a { flex-shrink: 0; }
.home-page .home-quote { margin: 3rem 0 2rem; border: 0; padding: 0; background: transparent; color: var(--presentation-muted); text-align: center; }
.home-quote p { font-family: 'Dancing Script', 'Segoe Script', 'Bradley Hand', cursive; font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 400; font-style: normal; line-height: 1.55; }
.home-quote cite { display: block; margin-top: 0.6rem; font-size: 0.8rem; font-style: normal; }

/* Chapitre témoin : lecture stable, aucun mouvement au défilement. */
.bd-article .chapter-preview > h1 { max-width: 40rem; margin: 1.5rem 0 1rem; font-size: clamp(2.4rem, 4.4vw, 3.7rem); line-height: 1.08; }
.chapter-preview .chapter-intro { margin-bottom: 3.5rem; }
.chapter-preview .chapter-kicker { margin-block: 1.2rem; color: var(--presentation-accent); }
.chapter-kicker > span { padding-inline: 0.5rem; color: var(--presentation-muted); }
.chapter-preview .chapter-lead { max-width: 38rem; color: var(--presentation-muted); font-size: 1.15rem; line-height: 1.65; }
.chapter-preview .chapter-pdf { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.3rem; margin: 1.7rem 0 2.1rem; }
.chapter-pdf > span { color: var(--presentation-muted); font-size: 0.85rem; }
.chapter-jumps { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; border-top: 1px solid var(--presentation-line); border-bottom: 1px solid var(--presentation-line); padding-block: 0.65rem; }
.chapter-jumps a { display: inline-flex; align-items: center; gap: 0.8rem; min-height: 2.75rem; color: var(--presentation-ink); font-size: 0.9rem; text-decoration: none; }
.chapter-jumps a:hover { text-decoration: underline; text-underline-offset: 0.3em; }
.bd-article .chapter-preview > section > h2 { margin: 2.75rem 0 1.5rem; font-size: 1.9rem; }
.chapter-preview .sd-card { border: 1px solid var(--presentation-line); border-radius: 0.85rem !important; background: var(--presentation-soft) !important; box-shadow: none; }
.chapter-preview .sd-card .sd-card-body { border-radius: inherit; padding: 1.6rem; background: transparent; }
.chapter-preview .sd-card-title { color: var(--presentation-ink); font-family: 'Source Sans 3', system-ui, sans-serif; font-size: 1.2rem; font-weight: 600; }
.chapter-preview .responsive-iframe { border: 1px solid var(--presentation-line); border-radius: 0.85rem; }

/* Les sections sont toujours visibles. L'observateur ajoute seulement une
   courte animation d'entrée, une fois, quand elles arrivent à l'écran. */
@keyframes home-enter {
  from { opacity: 0.65; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.home-entering { animation: home-enter 550ms ease-out both; }

@media (max-width: 1100px) {
  .home-actions { gap: 0.6rem; }
  .home-section-heading { align-items: flex-start; }
}

@media (max-width: 767.98px) {
  .home-page { padding-top: 0; }
  .home-introduction { display: block; }
  .home-hero { padding: 1.5rem 0 1rem; }
  .bd-article .home-page #home-title { font-size: min(clamp(3rem, 11vw, 4.8rem), 18cqi); }
  .home-page .home-fractal-fallback { background-image: url("Images/Fractale/julia-light-0-mobile.webp"); }
  html[data-theme="dark"] .home-page .home-fractal-fallback { background-image: url("Images/Fractale/julia-dark-0-mobile.webp"); }
  .home-page .is-rendered .home-fractal-fallback { background-image: none; }
  .home-page .home-lead { max-width: 30rem; }
  .home-actions { gap: 0.7rem 1.2rem; margin: 1.7rem 0 2rem; }
  .home-page .home-geometry { position: relative; top: auto; width: min(100%, 30rem); margin: 1rem auto 2rem; padding: 1.5rem 0 0; }
  .home-section { padding-block: 2.75rem; }
  .home-section-heading { display: block; margin-bottom: 1.5rem; }
  .home-section-heading > p { max-width: 28rem; }
  .home-paths { grid-template-columns: 1fr; }
  .home-page .home-path { padding: 1.5rem; }
  .home-path-top { margin-bottom: 1.5rem; }
  .home-page .home-path p { max-width: 32rem; margin-bottom: 1.3rem; }
  .home-method { grid-template-columns: 1fr; gap: 2rem; margin: 0.5rem 0 2.75rem; }
  .home-method ul { padding-left: 0; }
  .home-teachers { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
  .home-page .home-eyebrow { font-size: 0.7rem; }
  .chapter-preview .chapter-intro { margin-bottom: 2.5rem; }
}

@media (max-width: 359.98px) {
  .home-actions { align-items: flex-start; flex-direction: column; }
}

/* Le seuil en rem tient aussi compte des caractères agrandis par le lecteur. */
@container home (max-width: 38rem) {
  .home-introduction { display: block; }
  .home-page .home-geometry { position: relative; top: auto; width: min(100%, 30rem); margin: 1rem auto 2rem; }
  .home-method { grid-template-columns: 1fr; }
  .home-teachers { align-items: flex-start; flex-direction: column; }
}

#pst-back-to-top {
  background: #254e64;
  color: #ffffff;
}
#pst-back-to-top:hover { background: #193e52; }
#pst-back-to-top:focus-visible {
  outline: 3px solid var(--presentation-accent);
  outline-offset: 4px;
}
html[data-theme="dark"] #pst-back-to-top { background: #aac8da; color: #102a39; }
html[data-theme="dark"] #pst-back-to-top:hover { background: #d6e8f0; }

@media (prefers-reduced-motion: reduce) {
  .home-entering { animation: none; }
  .home-page :is(.home-path, .home-button), .chapter-preview .chapter-pdf > a { transition: none; }
  .home-page :is(.home-path, .home-button):hover, .chapter-preview .chapter-pdf > a:hover { transform: none; }
}

@media (min-width: 768px) and (max-height: 700px) {
  .home-page .home-geometry { top: calc(var(--site-header-height, var(--pst-header-height, 4rem)) + 0.5rem); }
}

/* Garder le dessin entier aussi sur téléphone en paysage. */
@media (max-height: 700px) {
  .home-fractal { max-height: 42vh; }
  .home-fractal-view { width: min(100%, 56vh); }
}

@media print {
  html[data-theme] {
    --presentation-ink: #193e52;
    --presentation-muted: #516773;
    --presentation-line: #c9d3d8;
    --presentation-surface: #ffffff;
    --presentation-soft: #edf3f5;
  }
  .home-introduction { display: block; }
  .site-catalog-hero { display: block; margin: 0; padding: 0; }
  .site-catalog-hero::before, .site-catalog-art { display: none; }
  html[data-theme] .bd-article .site-catalog-page .site-navigation-card { background: white !important; border-color: #c9d3d8; }
  html[data-theme] .bd-article .site-catalog-page .site-card-featured :is(.sd-card-title, .chapitre-card-titre, .sd-card-text, .site-card-icon) { color: #193e52; }
  .home-method { grid-template-columns: 1fr; }
  .home-paths { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-page .home-geometry { position: static; max-width: 28rem; margin: auto; }
  .home-method { break-inside: avoid; border: 1px solid #777; background: transparent; color: #193e52; }
  .home-method .home-eyebrow, .bd-article .home-page .home-method h2, .home-method :is(p, strong, span) { color: #193e52 !important; }
  .home-entering { animation: none; }
}
