/* Présentation commune des pages d'accueil de chapitre.
   Cette couche ne s'active que sur les pages portant chapter-overview. */

.chapter-overview {
  --blue: #3159c6;
  --blue-d: #24469f;
  --blue-bg: #eef3ff;
  --blue-bd: #dce5ff;
  --chapter-accent: #3159c6;
  --chapter-accent-dark: #24469f;
  --chapter-accent-soft: #eef3ff;
}

.chapter-overview.subject-pc {
  --chapter-accent: #197768;
  --chapter-accent-dark: #155f55;
  --chapter-accent-soft: #eef9f6;
  --blue: #197768;
  --blue-d: #155f55;
  --blue-bg: #eef9f6;
  --blue-bd: #cfe9e2;
}

.chapter-overview .ci-main {
  padding-top: 24px;
}

.chapter-overview .ci-hero {
  isolation: isolate;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--card-bd);
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(21, 49, 79, .07);
}

.chapter-overview .ci-hero::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(21, 49, 79, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 49, 79, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(90deg, transparent 34%, #000 100%);
}

.chapter-overview .ci-hero-badge {
  color: var(--chapter-accent-dark);
  background: var(--chapter-accent-soft);
  border-color: color-mix(in srgb, var(--chapter-accent) 22%, white);
}

.chapter-overview .ci-hero h1 {
  max-width: 18ch;
  font-size: clamp(2.25rem, 5vw, 3.45rem);
  hyphens: auto;
  overflow-wrap: anywhere;
}

.chapter-overview .ci-stat {
  background: rgba(255, 255, 255, .92);
  border-color: color-mix(in srgb, var(--chapter-accent) 18%, white);
}

.chapter-overview .ci-path-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  overflow-x: auto;
  padding: 3px 1px 5px;
  scrollbar-width: thin;
}

.chapter-overview .ci-path-label {
  flex: 0 0 auto;
  margin-right: 3px;
  color: var(--ink-3);
  font: 800 .7rem/1 var(--ui);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.chapter-overview .ci-path-link {
  flex: 0 0 auto;
  padding: 8px 13px;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--card-bd);
  border-radius: 9px;
  font: 700 .78rem/1.2 var(--ui);
  text-decoration: none;
}

.chapter-overview .ci-path-link[aria-current="location"],
.chapter-overview .ci-path-link:hover,
.chapter-overview .ci-path-link:focus-visible {
  color: #fff;
  background: var(--chapter-accent);
  border-color: var(--chapter-accent);
}

.chapter-overview .ci-obj {
  padding: 22px 24px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(21, 49, 79, .045);
}

.chapter-overview .ci-obj-label {
  color: var(--navy);
  font-family: var(--ui);
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.chapter-overview .ci-obj-item {
  min-width: 0;
  color: var(--ink-2);
  font-family: var(--ui);
  font-size: .94rem;
  line-height: 1.5;
}

.chapter-overview .ci-obj-text {
  flex: 1;
  min-width: 0;
}

.chapter-overview .ci-obj-num {
  color: var(--chapter-accent-dark);
  background: var(--chapter-accent-soft);
}

.chapter-overview .ci-sec {
  scroll-margin-top: var(--chapter-anchor-offset, 74px);
}

.chapter-overview .ci-sec-head h2 {
  color: var(--navy);
  font-weight: 800;
}

.chapter-overview .ci-card,
.chapter-overview .ci-listcard {
  box-shadow: 0 5px 18px rgba(21, 49, 79, .045);
}

.chapter-overview .ci-card.featured {
  border-color: var(--chapter-accent);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--chapter-accent) 14%, transparent);
}

.chapter-overview .ci-more-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 2px 0 14px;
  padding: 10px 16px;
  color: var(--chapter-accent-dark);
  background: var(--chapter-accent-soft);
  border: 1px solid color-mix(in srgb, var(--chapter-accent) 24%, white);
  border-radius: 10px;
  font: 800 .84rem/1.2 var(--ui);
  cursor: pointer;
}

/* La règle .ci-grid { display:grid } prend sinon le dessus sur le style
   natif de [hidden] : l'état annoncé et la visibilité doivent coïncider. */
.chapter-overview .ci-grid[hidden] {
  display: none !important;
}

.chapter-overview .ci-hero-sub,
.chapter-overview .ci-card-desc,
.chapter-overview .ci-listcard-desc,
.chapter-overview .ci-sec-intro {
  font-family: var(--ui);
}

.chapter-overview .ci-hero-sub:empty {
  display: none;
}

.chapter-overview .ci-more-toggle:hover,
.chapter-overview .ci-more-toggle:focus-visible {
  color: #fff;
  background: var(--chapter-accent);
  border-color: var(--chapter-accent);
}

.chapter-overview .ci-more-icon {
  font-size: 1rem;
  transition: transform .18s;
}

.chapter-overview .ci-more-toggle[aria-expanded="true"] .ci-more-icon {
  transform: rotate(180deg);
}

/* Vidéos par capacité : même bouton, porté par un <details> natif. */
.chapter-overview .ci-videos-more > summary {
  list-style: none;
}
.chapter-overview .ci-videos-more > summary::-webkit-details-marker {
  display: none;
}
.chapter-overview .ci-videos-more[open] .ci-more-icon {
  transform: rotate(180deg);
}

.chapter-overview .ci-path-link:focus-visible,
.chapter-overview .ci-more-toggle:focus-visible,
.chapter-overview .ci-card:focus-visible,
.chapter-overview .ci-listcard:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--chapter-accent) 28%, transparent);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .chapter-overview .ci-main {
    padding: 16px 12px 44px;
  }

  .chapter-overview .ci-hero {
    margin-bottom: 14px;
    padding: 24px 18px;
    border-radius: 17px;
  }

  .chapter-overview .ci-hero h1 {
    font-size: 2.35rem;
  }

  .chapter-overview .ci-path-nav {
    margin-bottom: 20px;
  }

  .chapter-overview .ci-obj {
    padding: 19px 17px;
  }

  .chapter-overview .ci-more-toggle {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chapter-overview .ci-more-icon {
    transition: none;
  }
}

@media print {
  .chapter-overview .ci-path-nav,
  .chapter-overview .ci-more-toggle {
    display: none !important;
  }

  .chapter-overview .ci-hero {
    padding: 0 0 18px;
    border: 0;
    border-bottom: 1pt solid #999;
    border-radius: 0;
    box-shadow: none;
  }

  .chapter-overview .ci-grid[hidden] {
    display: grid !important;
  }
}
