@charset "UTF-8";

/* ==========================================================================
   NC1 – Calcul numérique
   Feuille de style inspirée des boîtes tcolorbox du cours LaTeX original.
   ========================================================================== */

@font-face {
  font-family: "Latin Modern Roman";
  src: url("fonts/lmroman12-regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern Roman";
  src: url("fonts/lmroman12-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern Roman";
  src: url("fonts/lmroman12-italic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern Sans";
  src: url("fonts/lmsans10-regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern Sans";
  src: url("fonts/lmsans10-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Latin Modern Sans";
  src: url("fonts/lmsans10-oblique.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bleu: #1d70b7;
  --bleu-fonce: #13578f;
  --bleu-clair: #eaf3fb;
  --cours-bg: #f1f2fb;
  --encre: #1a1f24;
  --texte-doux: #536476;
  --ligne: #d7e0e9;
  --danger: #c41111;
  --serif: "Latin Modern Roman", "Computer Modern Serif", "CMU Serif", Georgia, "Times New Roman", serif;
  --sans: "Latin Modern Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --largeur: 1040px;
  --ombre-douce: 0 8px 30px rgba(22, 55, 88, 0.11);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--encre);
  background-color: #e9eff6;
  background-image:
    radial-gradient(circle at 12% 6%, rgba(29, 112, 183, 0.09), transparent 28rem),
    radial-gradient(circle at 88% 24%, rgba(29, 112, 183, 0.055), transparent 30rem),
    linear-gradient(180deg, #eef4fa 0%, #e7eef6 100%);
  background-attachment: fixed;
  font-family: var(--serif);
  font-size: clamp(1rem, 0.96rem + 0.18vw, 1.08rem);
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: #fff;
  background: var(--bleu);
}

img,
svg {
  max-width: 100%;
}

button {
  font: inherit;
}

a {
  color: var(--bleu-fonce);
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--bleu);
}

sup {
  font-size: 0.62em;
  line-height: 0;
}

:focus-visible {
  outline: 3px solid #f0a500;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 200;
  padding: 0.55rem 0.85rem;
  color: #fff;
  background: var(--bleu-fonce);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.9rem;
  transform: translateY(-180%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: none;
}

.reading-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 110;
  height: 3px;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--bleu), #54a9e8);
  box-shadow: 0 0 8px rgba(29, 112, 183, 0.45);
  transition: width 0.08s linear;
}

/* --------------------------------------------------------------------------
   Barre de navigation
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(255, 255, 255, 0.93);
  border-bottom: 1px solid rgba(29, 112, 183, 0.13);
  box-shadow: 0 3px 18px rgba(22, 55, 88, 0.06);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(100%, 1280px);
  min-height: 64px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--encre);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--encre);
}

.brand__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.45rem;
  height: 2.45rem;
  color: #fff;
  background: var(--bleu);
  border-radius: 9px;
  box-shadow: 0 3px 9px rgba(29, 112, 183, 0.25);
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.brand__badge sup {
  margin-left: 0.02em;
  font-size: 0.55em;
  vertical-align: super;
}

.brand__label {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.site-nav a,
.site-nav__examples {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.46rem 0.68rem;
  color: #2e465e;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.site-nav a:hover,
.site-nav__examples:hover,
.site-nav a.is-current {
  color: var(--bleu-fonce);
  background: var(--bleu-clair);
}

.site-nav__num {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.22rem;
  color: var(--bleu);
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.24);
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 700;
}

.site-nav a.is-current .site-nav__num {
  color: #fff;
  background: var(--bleu);
  border-color: var(--bleu);
}

.site-nav__examples {
  margin-left: 0.2rem;
  color: #fff;
  background: var(--bleu-fonce);
}

.site-nav__examples:hover {
  color: #fff;
  background: var(--bleu);
}

.site-nav__badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.25rem;
  color: var(--bleu-fonce);
  background: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  padding: 0.5rem 0.72rem;
  color: var(--bleu-fonce);
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.25);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
}

.nav-toggle__icon {
  display: grid;
  gap: 3px;
  width: 15px;
}

.nav-toggle__icon span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Feuille principale
   -------------------------------------------------------------------------- */

.sheet {
  position: relative;
  width: calc(100% - 2.4rem);
  max-width: var(--largeur);
  margin: 1.5rem auto 7rem;
  padding: clamp(1.1rem, 2.6vw, 2.7rem);
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.09);
  border-radius: 6px;
  box-shadow: var(--ombre-douce);
}

/* Bandeau de titre, d’après \cadtitre de ProfCollege */
.course-banner {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 6.5rem;
  overflow: hidden;
  background: #b0c4de;
  border-radius: 2px;
  box-shadow: 0 3px 12px rgba(29, 63, 97, 0.12);
}

.course-banner__left {
  display: grid;
  flex: 0 0 clamp(5rem, 13vw, 7rem);
  place-items: center;
  color: #fff;
  background: var(--bleu);
  font-family: var(--sans);
  font-size: clamp(1.65rem, 3.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.course-banner__title {
  display: grid;
  flex: 1;
  place-items: center;
  min-width: 0;
  margin: 0;
  padding: 1rem 7.2rem 1rem 1rem;
  color: #101820;
  font-family: var(--sans);
  font-size: clamp(1.65rem, 4vw, 3.05rem);
  font-weight: 700;
  line-height: 1.06;
  text-align: center;
  text-wrap: balance;
}

.course-banner__category {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  margin: 0;
  color: #244b70;
  font-family: var(--sans);
  font-size: clamp(0.56rem, 1.1vw, 0.72rem);
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1.28;
  text-align: right;
  transform: translateY(-50%);
}

/* Encart d’aide */
.page-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.72rem;
  margin: 1.15rem 0 0;
  padding: 0.8rem 0.95rem;
  color: #35526b;
  background: #f4f8fd;
  border: 1px solid #d7e7f6;
  border-left: 3px solid var(--bleu);
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.page-hint p {
  margin: 0;
}

.page-hint strong {
  color: var(--bleu-fonce);
  font-family: var(--sans);
}

.page-hint__icon {
  flex: none;
  margin-top: 0.1rem;
  color: var(--bleu);
}

.page-hint__keys {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  margin-left: 0.25rem;
  white-space: nowrap;
}

kbd {
  display: inline-block;
  min-width: 1.35rem;
  padding: 0.06rem 0.3rem;
  color: #28445e;
  background: #fff;
  border: 1px solid #c5d7e8;
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Titres de sections
   -------------------------------------------------------------------------- */

.course-section {
  margin-top: 3.1rem;
  scroll-margin-top: 92px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  margin: 0 0 1.2rem;
  color: var(--bleu);
  font-family: var(--sans);
  font-size: clamp(1.35rem, 2.5vw, 1.72rem);
  font-weight: 700;
  line-height: 1.18;
  text-wrap: balance;
}

.section-title__num {
  display: inline-grid;
  place-items: center;
  min-width: 1.9em;
  height: 1.65em;
  padding: 0 0.32em;
  color: #fff;
  background: var(--bleu);
  border-radius: 2px;
  font-size: 0.95em;
  font-weight: 700;
  line-height: 1;
}

.subsection-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1.9rem 0 0.8rem;
  color: var(--bleu);
  font-family: var(--sans);
  font-size: clamp(1.06rem, 1.8vw, 1.22rem);
  font-weight: 700;
  line-height: 1.3;
}

.subsection-title__num {
  flex: none;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Boîte de cours (\begin{crs})
   -------------------------------------------------------------------------- */

.crs {
  --crs-pad: clamp(0.9rem, 2vw, 1.25rem);
  position: relative;
  margin: 1.65rem 0 1.45rem;
  padding: 0 var(--crs-pad) 1.02rem;
  background: var(--cours-bg);
  border: 2px solid var(--bleu);
  border-top: 0;
  box-shadow: 6px 6px 0 rgba(29, 112, 183, 0.05);
  scroll-margin-top: 92px;
}

.crs__title {
  display: inline-block;
  max-width: calc(100% + var(--crs-pad) + 2px);
  margin: 0 0 0.82rem calc(-1 * var(--crs-pad) - 2px);
  padding: 0.4rem 1rem 0.43rem;
  color: #fff;
  background: var(--bleu);
  border-radius: 0 0 10px 0;
  box-shadow: 3px 4px 0 rgba(29, 112, 183, 0.12);
  font-family: var(--sans);
  font-size: 1.01rem;
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
}

.crs > p {
  margin: 0.55rem 0;
}

.crs.is-active {
  animation: target-pulse 1.15s ease;
}

@keyframes target-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-soft, var(--bleu-clair));
  }
  45% {
    box-shadow:
      0 0 0 9px var(--accent-soft, var(--bleu-clair)),
      0 14px 34px rgba(23, 63, 104, 0.18);
  }
  100% {
    box-shadow: 0 0 0 0 var(--accent-soft, var(--bleu-clair));
  }
}

.crs__intro {
  color: #2b4c6b;
  font-weight: 700;
}

.math-block {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15rem 0;
  scrollbar-width: thin;
}

.math-block .katex-display {
  margin: 0.4rem 0;
}

/* Règle importante */
.rule-warning {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem 0.62rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed rgba(29, 112, 183, 0.2);
  color: var(--danger);
  font-size: 0.97rem;
  font-weight: 600;
}

.rule-warning p {
  margin: 0;
}

.rule-warning__icon {
  display: inline-flex;
  flex: none;
  color: var(--danger);
}

.rule-warning__reminder {
  color: var(--encre);
  font-weight: 400;
  white-space: nowrap;
}

.rule-warning__reminder strong {
  color: var(--encre);
}

@media (max-width: 680px) {
  .rule-warning {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .rule-warning__reminder {
    grid-column: 2;
    padding-top: 0.2rem;
  }
}

/* Listes de cours */
.course-list {
  margin: 0.55rem 0 0.4rem;
  padding: 0;
  list-style: none;
}

.course-list li {
  position: relative;
  margin: 0.34rem 0;
  padding-left: 1.25rem;
}

.course-list li::before {
  content: "";
  position: absolute;
  top: 0.58em;
  left: 0.18rem;
  width: 6px;
  height: 6px;
  background: var(--bleu);
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   Cartes d’exemples interactives
   -------------------------------------------------------------------------- */

.accent-1 { --accent: #1d70b7; --accent-soft: #e8f2fc; --accent-ink: #0f4c81; }
.accent-2 { --accent: #2a7fb8; --accent-soft: #eaf5fc; --accent-ink: #155a86; }
.accent-3 { --accent: #0f7f9c; --accent-soft: #e6f7fa; --accent-ink: #08596d; }
.accent-4 { --accent: #3d5fc0; --accent-soft: #edf0fc; --accent-ink: #2a418e; }
.accent-5 { --accent: #147d8c; --accent-soft: #e6f6f7; --accent-ink: #0a5661; }
.accent-6 { --accent: #4b63c4; --accent-soft: #eef0fb; --accent-ink: #33428c; }
.accent-7 { --accent: #0e859f; --accent-soft: #e5f7fb; --accent-ink: #075a6c; }
.accent-8 { --accent: #2d6fb0; --accent-soft: #eaf3fb; --accent-ink: #14507f; }
.accent-9 { --accent: #5367c8; --accent-soft: #eff1fc; --accent-ink: #35458f; }

.example-card {
  --accent: #1d70b7;
  --accent-soft: #e8f2fc;
  --accent-ink: #0f4c81;
  position: relative;
  margin: 1.15rem 0 1rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.17);
  border-left: 3px solid var(--accent);
  border-radius: 2px 6px 6px 2px;
  box-shadow: 0 2px 8px rgba(23, 63, 104, 0.08);
  scroll-margin-top: 100px;
  scroll-margin-bottom: 100px;
  transition: box-shadow 0.24s ease, border-color 0.24s ease, transform 0.24s ease;
}

.example-card:hover {
  box-shadow: 0 5px 18px rgba(23, 63, 104, 0.12);
}

.example-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.example-card__top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem 0.55rem 0.72rem;
  background: linear-gradient(90deg, var(--accent-soft), #fff 74%);
  border-bottom: 1px solid var(--accent-soft);
}

.example-card__label {
  flex: none;
  padding: 0.28rem 0.7rem;
  color: #fff;
  background: var(--accent);
  border-radius: 2px 8px 2px 2px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.example-card__name {
  min-width: 0;
  overflow: hidden;
  color: var(--accent-ink);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.example-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  padding: 0.28rem 0.6rem;
  color: var(--accent-ink);
  background: #fff;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.example-toggle::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.example-toggle:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.example-toggle:hover::before {
  background: #fff;
}

.example-card__body {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 0.36s ease, opacity 0.26s ease;
}

.example-card__body-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0.86rem 0.95rem 0.82rem;
}

.example-card.is-active {
  border-color: var(--accent);
  animation: example-pulse 1.15s ease;
}

.example-card.is-active .example-card__label {
  animation: label-pop 0.42s ease;
}

@keyframes example-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-soft), 0 3px 10px rgba(23, 63, 104, 0.08);
  }
  45% {
    box-shadow: 0 0 0 9px var(--accent-soft), 0 15px 34px rgba(23, 63, 104, 0.18);
  }
  100% {
    box-shadow: 0 0 0 0 var(--accent-soft), 0 3px 10px rgba(23, 63, 104, 0.08);
  }
}

@keyframes label-pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

/* Calculs et formules */
.calc {
  max-width: 100%;
  margin: 0.32rem 0;
  padding: 0.08rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 1.01em;
  scrollbar-width: thin;
}

.calc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 2.8rem;
}

.calc-row .calc {
  margin: 0.25rem 0;
}

/* Étapes d’un exemple : visibles ensemble, ou une à une en mode entraînement */
.example-sequence {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2em;
}

/* Étapes de résolution affichées verticalement */
.example-sequence--stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.example-step {
  min-width: 0;
}

.example-step[hidden] {
  display: none !important;
}

.example-step--text {
  margin: 0.42rem 0;
}

.example-step.is-new {
  animation: step-reveal 0.34s ease both;
}

@keyframes step-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Contrôles pas à pas */
.example-practice {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.72rem;
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px dashed rgba(29, 112, 183, 0.24);
  scroll-margin-bottom: 6rem;
}

.example-card.is-practice .example-practice {
  display: flex;
}

.step-btn {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 50%;
  place-items: center;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.step-btn:hover:not(:disabled) {
  color: #fff;
  background: var(--accent);
}

.step-btn:disabled {
  color: #8796a6;
  background: #f5f8fb;
  border-color: #d4dee8;
  cursor: not-allowed;
  opacity: 0.7;
}

.example-practice__count {
  min-width: 6.3rem;
  color: var(--accent-ink);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.example-card.is-practice .example-toggle::before {
  background: transparent;
  border: 1px solid var(--accent);
}

/* Mini-exemples */
.mini-example {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 100%;
  padding: 0.32rem 0.62rem 0.32rem 0;
  overflow-x: auto;
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.15);
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(23, 63, 104, 0.07);
  font-size: 0.95rem;
  scrollbar-width: thin;
}

.mini-example__label {
  flex: none;
  padding: 0.23rem 0.66rem;
  color: #fff;
  background: var(--bleu);
  border-radius: 0 7px 7px 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.definition-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1.4rem;
}

.definition-line > p {
  margin: 0.4rem 0;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  margin: 0.55rem 0;
}

.two-col > div + div {
  padding-left: 1.2rem;
  border-left: 1px solid rgba(29, 112, 183, 0.22);
}

.two-col p {
  margin: 0.35rem 0 0.5rem;
}

/* Schéma de la distributivité : développer / factoriser */
.distributivity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  max-width: 34rem;
  margin: 0.6rem auto 0.8rem;
  padding: 0.05rem 0;
}

.distributivity__formula {
  max-width: 100%;
  padding: 0.05rem 0.7rem;
  overflow-x: auto;
  font-size: 1.08rem;
  text-align: center;
}

.distributivity__arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.06rem;
  width: min(100%, 8.6rem);
  color: var(--bleu);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.15;
}

.distributivity__label {
  flex: none;
}

.distributivity__path {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.distributivity--identities .distributivity__arrow {
  width: min(100%, 12.5rem);
}

.distributivity--identities .katex-display {
  margin: 0.15rem 0;
}

/* --------------------------------------------------------------------------
   Propriétés (tableau à deux colonnes)
   -------------------------------------------------------------------------- */

.property-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.6rem;
  border-top: 1px solid rgba(29, 112, 183, 0.22);
}

.property {
  min-width: 0;
  padding: 0.72rem 0.9rem 0.78rem;
  border-bottom: 1px solid rgba(29, 112, 183, 0.22);
}

.property:nth-child(odd) {
  border-right: 1px solid rgba(29, 112, 183, 0.22);
}

.property__formula {
  position: relative;
  max-width: 100%;
  margin: 0 0 0.42rem;
  padding-left: 1.05rem;
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 1.01rem;
  scrollbar-width: thin;
}

.property__formula::before {
  content: "";
  position: absolute;
  top: 0.58em;
  left: 0.1rem;
  width: 6px;
  height: 6px;
  background: var(--bleu);
  border-radius: 50%;
}

.property__example {
  --accent: var(--bleu);
  --accent-soft: var(--bleu-clair);
  --accent-ink: var(--bleu-fonce);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.42rem 0.58rem;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(23, 63, 104, 0.08);
  font-size: 0.94rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.property__sequence {
  flex: 1 1 180px;
  min-width: 0;
}

.property__toggle {
  flex: none;
  margin-left: auto;
  padding: 0.16rem 0.48rem;
  color: var(--bleu-fonce);
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.35);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.property__toggle:hover {
  color: #fff;
  background: var(--bleu);
  border-color: var(--bleu);
}

.property__step-nav {
  display: none;
  flex-basis: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 0.32rem;
  padding-top: 0.22rem;
}

.property__example.is-practice .property__step-nav {
  display: flex;
}

.step-btn--small {
  width: 1.75rem;
  height: 1.75rem;
}

.step-btn--small svg {
  width: 15px;
  height: 15px;
}

.property__step-count {
  min-width: 2.2rem;
  color: var(--accent-ink);
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 700;
  text-align: center;
}

.property:hover .property__example {
  transform: translateY(-1px);
  box-shadow: 0 3px 9px rgba(23, 63, 104, 0.11);
}

.ex-chip {
  flex: none;
  display: inline-block;
  padding: 0.11rem 0.43rem;
  color: #fff;
  background: var(--bleu);
  border-radius: 2px 6px 2px 2px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
}

/* --------------------------------------------------------------------------
   Boîtes Application (\begin{exemple})
   -------------------------------------------------------------------------- */

.exemple {
  position: relative;
  margin: 1.8rem 0;
  padding: 0 0 0 1.08rem;
  border-left: 2px solid #2b83c8;
  scroll-margin-top: 92px;
}

.exemple__title {
  display: inline-block;
  margin: 0 0 0.65rem -1.08rem;
  padding: 0.29rem 0.9rem 0.33rem;
  color: #fff;
  background: var(--bleu);
  border-radius: 0 0 8px 0;
  font-family: var(--sans);
  font-size: 0.99rem;
  font-weight: 700;
  line-height: 1.25;
}

.exemple > p {
  margin: 0.45rem 0;
}

.hint-inline {
  color: var(--texte-doux);
  font-family: var(--serif);
  font-size: 0.82rem;
  font-style: italic;
}

/* Quiz à révéler */
.quiz-grid {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.68rem;
}

.quiz-grid--five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.quiz-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quiz-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.45rem;
  min-height: 82px;
  padding: 0.68rem 0.72rem;
  color: var(--encre);
  background: #fff;
  border: 1px solid var(--ligne);
  border-radius: 4px;
  font-family: var(--serif);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.quiz-card:hover {
  border-color: #8fc2e8;
  box-shadow: 0 4px 12px rgba(23, 63, 104, 0.1);
  transform: translateY(-1px);
}

.quiz-card.is-revealed {
  background: #eff7fe;
  border-color: var(--bleu);
  box-shadow: 0 4px 12px rgba(23, 63, 104, 0.11);
}

.quiz-card__prompt {
  display: block;
  overflow-x: auto;
  font-size: 1rem;
  scrollbar-width: thin;
}

.quiz-card__answer {
  display: block;
  color: var(--bleu);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.quiz-card.is-revealed .quiz-card__answer {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.quiz-card__answer--text {
  color: var(--danger);
  font-family: var(--sans);
  font-size: 0.86rem;
}

/* --------------------------------------------------------------------------
   Boîtes Automatisme
   -------------------------------------------------------------------------- */

.auto {
  margin: 1.9rem 0;
  padding: 0 0 0 1.08rem;
  border-left: 4px solid #3b5b7a;
  scroll-margin-top: 92px;
}

.auto__title {
  margin: 0 0 0.65rem;
  color: var(--bleu);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.auto__title span {
  color: #315a7d;
}

.exercise-grid {
  display: grid;
  margin-top: 0.55rem;
  border-top: 1px solid #263849;
  border-left: 1px solid #263849;
}

.exercise-grid--fractions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.exercise-grid--powers {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.exercise {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 195px;
  padding: 0.8rem 0.85rem;
  background: #fff;
  border-right: 1px solid #263849;
  border-bottom: 1px solid #263849;
}

.exercise__prompt {
  max-width: 100%;
  margin: 0;
  overflow-x: auto;
  font-size: 0.99rem;
  scrollbar-width: thin;
}

/* Réponse MathLive et validation */
.answer-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.answer-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.answer-prefix {
  flex: none;
  font-size: 1.05rem;
  line-height: 1;
  white-space: nowrap;
}

.answer-line .answer-mathfield {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.answer-mathfield {
  --placeholder-color: #536476;
  display: block;
  width: 100%;
  min-height: 2.45rem;
  padding: 0.2rem 0.4rem;
  color: var(--encre);
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.38);
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1.12rem;
}

.answer-mathfield::part(placeholder) {
  color: #536476;
  opacity: 1;
}

.answer-mathfield::part(virtual-keyboard-toggle),
.answer-mathfield::part(menu-toggle) {
  display: none;
}

/* Clavier volontairement réduit aux touches essentielles. */
.ML__keyboard .MLK__toolbar {
  display: none !important;
}

.ML__keyboard .key-action {
  color: var(--keycap-secondary-text, #243444);
  background: var(--keycap-secondary-background, #e2e6ea);
}

.ML__keyboard .key-action .svg-glyph {
  width: 1.35em;
  height: 1.35em;
  fill: currentColor;
}

.answer-mathfield:focus-within {
  border-color: var(--bleu);
  outline: none;
  box-shadow: 0 0 0 2px var(--bleu-clair);
}

.validate-btn {
  align-self: flex-start;
  padding: 0.3rem 0.68rem;
  color: #fff;
  background: var(--bleu);
  border: 1px solid var(--bleu);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.validate-btn:hover {
  background: var(--bleu-fonce);
  border-color: var(--bleu-fonce);
  box-shadow: 0 3px 9px rgba(29, 112, 183, 0.2);
}

.answer-feedback {
  min-height: 1.1em;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.answer-feedback.is-correct {
  color: #1e7a3c;
}

.answer-feedback.is-wrong {
  color: var(--danger);
}

.answer-feedback.is-unsimplified {
  color: #a35f00;
}

.reveal-btn {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.28rem 0.58rem;
  color: var(--bleu-fonce);
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.4);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.reveal-btn:hover {
  color: #fff;
  background: var(--bleu);
  border-color: var(--bleu);
}

.exercise.is-open .reveal-btn {
  color: #fff;
  background: var(--bleu-fonce);
  border-color: var(--bleu-fonce);
}

.exercise__answer {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.32s ease, opacity 0.24s ease;
}

.exercise.is-open .exercise__answer {
  grid-template-rows: 1fr;
  opacity: 1;
}

.exercise__answer-inner {
  min-height: 0;
  overflow: hidden;
}

.exercise__answer-inner p {
  margin: 0.28rem 0 0;
  padding-top: 0.52rem;
  border-top: 1px dashed #cfdfef;
  overflow-x: auto;
  color: #16466f;
  font-size: 0.95rem;
  scrollbar-width: thin;
}

/* --------------------------------------------------------------------------
   Méthode et entraînement
   -------------------------------------------------------------------------- */

.methode {
  position: relative;
  margin: 2rem 0;
  padding: 1.18rem clamp(0.9rem, 2vw, 1.25rem) 1.1rem;
  background: var(--cours-bg);
  border-top: 4px solid #3c6385;
  box-shadow: 0 2px 10px rgba(23, 63, 104, 0.06);
  scroll-margin-top: 92px;
}

.methode__title {
  margin: 0 0 0.78rem;
  color: var(--bleu);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.methode__title span {
  color: #2f5d84;
}

.methode > p {
  margin: 0.55rem 0;
}

.practice {
  margin-top: 0.9rem;
  padding: 0.85rem 0.9rem 0.8rem;
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.16);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(23, 63, 104, 0.05);
}

.practice__prompt {
  margin: 0;
}

.practice__condition {
  margin: 0.2rem 0 0.55rem;
  color: var(--texte-doux);
  font-size: 0.9rem;
  font-style: italic;
}

.practice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.72rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.46rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn--primary {
  color: #fff;
  background: var(--bleu);
  border-color: var(--bleu);
  box-shadow: 0 3px 8px rgba(29, 112, 183, 0.2);
}

.btn--primary:hover {
  background: var(--bleu-fonce);
  border-color: var(--bleu-fonce);
}

.btn--soft {
  color: var(--bleu-fonce);
  background: #fff;
  border-color: rgba(29, 112, 183, 0.32);
}

.btn--soft:hover {
  background: var(--bleu-clair);
}

.btn[aria-expanded="true"] {
  box-shadow: inset 0 0 0 2px rgba(29, 112, 183, 0.16);
}

.practice__panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.32s ease, opacity 0.24s ease;
}

.practice__panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.practice__panel-inner {
  min-height: 0;
  overflow: hidden;
}

.practice__panel-inner p {
  margin: 0.6rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px dashed #cfdfef;
  overflow-x: auto;
  color: #16466f;
  font-size: 0.95rem;
  scrollbar-width: thin;
}

/* --------------------------------------------------------------------------
   Remarque des carrés parfaits
   -------------------------------------------------------------------------- */

.square-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.32rem 0.75rem;
  margin: 0.72rem 0 0.9rem;
}

.square {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.28rem;
  padding: 0.3rem 0.5rem;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 3px;
  font-size: 0.95rem;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.square > span {
  color: var(--texte-doux);
  font-family: var(--sans);
  font-size: 0.78rem;
}

.square:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(23, 63, 104, 0.09);
  transform: translateX(2px);
}

/* Propriétés des racines */
.property-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.42rem 0 0.75rem;
  padding: 0;
  list-style: none;
}

.property-list li {
  position: relative;
  padding-left: 1.35rem;
  font-size: 1.01rem;
}

.property-list li::before {
  content: "▶";
  position: absolute;
  top: 0;
  left: 0;
  color: #253544;
  font-size: 0.6em;
  line-height: 2.8;
}

.condition {
  color: var(--texte-doux);
  font-size: 0.88rem;
}

/* --------------------------------------------------------------------------
   Boîte Attention
   -------------------------------------------------------------------------- */

.attention {
  position: relative;
  margin: 2rem 0;
  padding: 1.05rem 3rem;
  background: #fff;
  border-top: 3px solid var(--danger);
  border-bottom: 3px solid var(--danger);
  scroll-margin-top: 92px;
}

.attention::before,
.attention::after {
  content: "!";
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  width: 2.25rem;
  place-items: center;
  color: #fff;
  background: var(--danger);
  font-family: var(--sans);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}

.attention::before {
  left: 0;
}

.attention::after {
  right: 0;
}

.attention p {
  margin: 0;
  font-size: 1.01rem;
}

/* --------------------------------------------------------------------------
   Pied de page
   -------------------------------------------------------------------------- */

.course-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  margin-top: 2.8rem;
  padding-top: 0.95rem;
  color: var(--texte-doux);
  border-top: 1px solid var(--ligne);
  font-family: var(--sans);
  font-size: 0.8rem;
}

.course-footer a {
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.course-footer a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Dock de navigation des exemples
   -------------------------------------------------------------------------- */

.example-dock {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 90;
  display: flex;
  align-items: stretch;
  max-width: calc(100vw - 1.4rem);
  padding: 0.3rem;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(29, 112, 183, 0.22);
  border-radius: 12px;
  box-shadow: 0 12px 42px rgba(18, 50, 80, 0.24);
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.52rem 0.66rem;
  color: #294760;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.dock-btn:hover {
  color: var(--bleu);
  background: var(--bleu-clair);
}

.dock-btn__label {
  white-space: nowrap;
}

.dock-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 7.2rem;
  padding: 0.25rem 1.15rem;
  color: var(--bleu);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--ligne);
  border-left: 1px solid var(--ligne);
  font-family: var(--sans);
  cursor: pointer;
}

.dock-center:hover {
  background: #f8fbfe;
}

.dock-center__eyebrow {
  color: var(--texte-doux);
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.dock-center__count {
  display: flex;
  align-items: baseline;
  gap: 0.16rem;
  color: var(--bleu);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.dock-center__count strong {
  font-size: 1.02rem;
}

.dock-center__count span {
  color: var(--texte-doux);
  font-size: 0.78rem;
  font-weight: 500;
}

.dock-center__chevron {
  position: absolute;
  top: 50%;
  right: 0.32rem;
  color: var(--texte-doux);
  transform: translateY(-50%);
  transition: transform 0.2s ease;
}

.dock-center[aria-expanded="true"] .dock-center__chevron {
  transform: translateY(-50%) rotate(180deg);
}

.example-menu {
  position: absolute;
  bottom: calc(100% + 0.62rem);
  left: 50%;
  width: min(420px, calc(100vw - 1.5rem));
  max-height: min(60vh, 470px);
  padding: 0.62rem;
  overflow-y: auto;
  visibility: hidden;
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.2);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(18, 50, 80, 0.25);
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  scrollbar-width: thin;
}

.example-menu.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.example-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.1rem 0.12rem 0.48rem;
}

.example-menu__title {
  margin: 0;
  color: var(--texte-doux);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.example-menu__close {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  color: var(--texte-doux);
  background: transparent;
  border: 0;
  border-radius: 50%;
  place-items: center;
  cursor: pointer;
}

.example-menu__close:hover {
  color: var(--bleu);
  background: var(--bleu-clair);
}

.example-menu__list {
  display: grid;
  gap: 0.12rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.example-menu__item {
  display: flex;
  align-items: center;
  gap: 0.52rem;
  width: 100%;
  padding: 0.48rem 0.52rem;
  color: var(--encre);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.example-menu__item:hover,
.example-menu__item.is-current {
  color: var(--bleu-fonce);
  background: #eff6fd;
}

.example-menu__dot {
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--dot, var(--bleu));
  border-radius: 50%;
}

.example-menu__num {
  flex: none;
  min-width: 1.35rem;
  color: var(--texte-doux);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.example-menu__item-title {
  font-weight: 600;
  line-height: 1.25;
}

/* Bouton retour en haut */
.to-top {
  position: fixed;
  right: 1rem;
  bottom: 5.7rem;
  z-index: 70;
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  visibility: hidden;
  color: var(--bleu);
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.22);
  border-radius: 50%;
  box-shadow: 0 5px 18px rgba(18, 50, 80, 0.16);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, color 0.2s ease, background 0.2s ease;
  place-items: center;
  cursor: pointer;
}

.to-top.is-visible {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.to-top:hover {
  color: #fff;
  background: var(--bleu);
}

/* --------------------------------------------------------------------------
   Apparition au défilement
   -------------------------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Adaptations écran intermédiaire
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .quiz-grid--five {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .exercise-grid--powers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exercise {
    min-height: 170px;
  }
}

@media (max-width: 820px) {
  .topbar__inner {
    flex-wrap: wrap;
    padding: 0 0.9rem;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    right: 0.7rem;
    left: 0.7rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.18rem;
    margin: 0;
    padding: 0.55rem;
    background: #fff;
    border: 1px solid rgba(29, 112, 183, 0.17);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 16px 30px rgba(18, 50, 80, 0.16);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a,
  .site-nav__examples {
    justify-content: flex-start;
    padding: 0.62rem 0.7rem;
    border-radius: 7px;
    font-size: 0.9rem;
  }

  .site-nav__examples {
    margin: 0.12rem 0 0;
  }

  .sheet {
    width: calc(100% - 1.4rem);
    margin-top: 0.9rem;
  }

  .property-grid {
    grid-template-columns: 1fr;
  }

  .property:nth-child(odd) {
    border-right: 0;
  }

  .exercise-grid--fractions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .square-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --------------------------------------------------------------------------
   Adaptations mobile
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  body {
    font-size: 1rem;
    background-image: none;
    background-color: #f1f5fa;
  }

  .sheet {
    width: 100%;
    margin: 0 0 5.8rem;
    padding: 0.9rem 0.85rem 1.1rem;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .brand__label {
    display: none;
  }

  .course-banner {
    min-height: 7.4rem;
  }

  .course-banner__left {
    flex-basis: 4.5rem;
    font-size: 1.55rem;
  }

  .course-banner__title {
    padding: 2.15rem 0.7rem 0.8rem;
    font-size: clamp(1.5rem, 8vw, 2rem);
  }

  .course-banner__category {
    top: 0.42rem;
    right: 0.55rem;
    font-size: 0.56rem;
    transform: none;
  }

  .page-hint {
    font-size: 0.84rem;
  }

  .page-hint__keys {
    display: none;
  }

  .course-section {
    margin-top: 2.5rem;
  }

  .section-title {
    gap: 0.45rem;
    font-size: 1.28rem;
  }

  .subsection-title {
    font-size: 1.04rem;
  }

  .crs {
    box-shadow: 4px 4px 0 rgba(29, 112, 183, 0.05);
  }

  .crs__title {
    font-size: 0.93rem;
    border-radius: 0 0 8px 0;
  }

  .example-card__name {
    display: none;
  }

  .example-card__top {
    gap: 0.4rem;
  }

  .example-card__body-inner {
    padding: 0.78rem 0.72rem 0.72rem;
  }

  .example-toggle {
    padding: 0.28rem 0.52rem;
    font-size: 0.7rem;
  }

  .step-btn {
    width: 2.75rem;
    height: 2.75rem;
  }

  .step-btn--small {
    width: 2rem;
    height: 2rem;
  }

  .calc {
    font-size: 0.94em;
  }

  .calc-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .two-col {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .two-col > div + div {
    padding-top: 0.8rem;
    border-top: 1px solid rgba(29, 112, 183, 0.22);
    border-left: 0;
    padding-left: 0;
  }

  .quiz-grid--five,
  .quiz-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exercise-grid--fractions,
  .exercise-grid--powers {
    grid-template-columns: 1fr;
  }

  .exercise {
    min-height: 0;
  }

  .exercise__prompt {
    font-size: 0.96rem;
  }

  .attention {
    padding: 0.95rem 2.55rem;
  }

  .attention::before,
  .attention::after {
    width: 1.8rem;
    font-size: 1.25rem;
  }

  .course-footer {
    padding-bottom: 0.35rem;
  }

  .example-dock {
    right: 0.6rem;
    bottom: max(0.6rem, env(safe-area-inset-bottom));
    left: 0.6rem;
    justify-content: space-between;
    max-width: none;
    transform: none;
  }

  .dock-btn {
    justify-content: center;
    min-width: 2.6rem;
    padding: 0.55rem 0.6rem;
  }

  .dock-btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .dock-center {
    flex: 1;
    min-width: 0;
  }

  .to-top {
    right: 0.7rem;
    bottom: 5.25rem;
  }

  .example-menu {
    right: 0;
    left: 0;
    width: auto;
    transform: translateY(8px);
  }

  .example-menu.is-open {
    transform: translateY(0);
  }
}

@media (max-width: 360px) {
  .quiz-grid--five,
  .quiz-grid--three {
    grid-template-columns: 1fr;
  }

  .square-grid {
    grid-template-columns: 1fr;
  }

  .course-banner__title {
    font-size: 1.42rem;
  }
}

/* --------------------------------------------------------------------------
   Menu des cours
   -------------------------------------------------------------------------- */

.menu-intro {
  margin: 1.25rem 0 0;
  color: var(--texte-doux);
  font-size: 1.02rem;
}

.course-menu {
  margin-top: 2.2rem;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
  max-width: 760px;
  margin-top: 1.1rem;
}

.course-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.3rem 1.35rem 1.15rem;
  color: var(--encre);
  background: #fff;
  border: 1px solid rgba(29, 112, 183, 0.18);
  border-left: 5px solid var(--bleu);
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(23, 63, 104, 0.09);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.course-card:hover {
  color: var(--encre);
  border-color: rgba(29, 112, 183, 0.38);
  box-shadow: 0 10px 28px rgba(23, 63, 104, 0.15);
  transform: translateY(-3px);
}

.course-card__code {
  display: inline-grid;
  width: 3.4rem;
  height: 2rem;
  color: #fff;
  background: var(--bleu);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  place-items: center;
}

.course-card__tag {
  color: var(--bleu-fonce);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.course-card__title {
  margin: 0.1rem 0 0;
  color: var(--bleu);
  font-family: var(--sans);
  font-size: 1.65rem;
  line-height: 1.15;
}

.course-card__desc {
  margin: 0.15rem 0 0.25rem;
  color: #3d4c5b;
  line-height: 1.55;
}

.course-card__list {
  display: grid;
  gap: 0.2rem;
  margin: 0.1rem 0 0.6rem;
  padding: 0;
  color: #405264;
  font-size: 0.9rem;
  list-style: none;
}

.course-card__list li {
  position: relative;
  padding-left: 1.1rem;
}

.course-card__list li::before {
  content: "•";
  position: absolute;
  left: 0.1rem;
  color: var(--bleu);
  font-weight: 700;
}

.course-card__meta {
  margin-top: auto;
  padding-top: 0.6rem;
  color: var(--texte-doux);
  border-top: 1px solid var(--ligne);
  font-family: var(--sans);
  font-size: 0.74rem;
}

.course-card__cta {
  margin-top: 0.55rem;
  color: var(--bleu);
  font-family: var(--sans);
  font-weight: 700;
}

.course-card:hover .course-card__cta {
  color: var(--bleu-fonce);
}

.menu-note {
  margin: 1.3rem 0 0;
  color: var(--texte-doux);
  font-size: 0.86rem;
  font-style: italic;
}

@media (max-width: 640px) {
  .course-grid {
    max-width: none;
  }

  .course-card {
    padding: 1rem;
  }

  .course-card__title {
    font-size: 1.35rem;
  }
}

/* --------------------------------------------------------------------------
   Impression
   -------------------------------------------------------------------------- */

@media print {
  @page {
    margin: 1.4cm;
  }

  html {
    scroll-behavior: auto;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 11pt;
  }

  .topbar,
  .reading-progress,
  .example-dock,
  .to-top,
  .page-hint,
  .skip-link,
  .example-toggle,
  .reveal-btn,
  .practice__actions,
  .example-practice,
  .property__toggle,
  .property__step-nav,
  .answer-box,
  .noscript {
    display: none !important;
  }

  .sheet {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .course-banner {
    box-shadow: none;
  }

  .js .reveal,
  .example-card__body,
  .exercise__answer,
  .practice__panel {
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    grid-template-rows: 1fr !important;
  }

  .example-card__body-inner,
  .exercise__answer-inner,
  .practice__panel-inner {
    overflow: visible !important;
  }

  .quiz-card__answer {
    opacity: 1 !important;
    transform: none !important;
  }

  .example-step[hidden] {
    display: inline !important;
  }

  .example-step--text[hidden] {
    display: block !important;
  }

  .crs,
  .exemple,
  .methode,
  .auto,
  .attention,
  .example-card,
  .practice {
    break-inside: avoid;
  }

  .crs,
  .example-card,
  .methode,
  .practice {
    box-shadow: none !important;
  }

  .course-section {
    break-before: auto;
  }
}

/* --------------------------------------------------------------------------
   Mouvement réduit
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

.noscript {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 200;
  padding: 0.8rem 1rem;
  color: #fff;
  background: var(--danger);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 0.9rem;
  text-align: center;
}

/* Sans JavaScript, on laisse tout le contenu visible. */
.no-js .example-toggle,
.no-js .reveal-btn,
.no-js .practice__actions,
.no-js .example-dock,
.no-js .to-top,
.no-js .nav-toggle {
  display: none;
}

.no-js .exercise__answer,
.no-js .practice__panel {
  grid-template-rows: 1fr;
  opacity: 1;
}

.no-js .quiz-card__answer {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.no-js .quiz-card {
  cursor: default;
}

@media (max-width: 820px) {
  .no-js .site-nav {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    margin: 0 0 0.55rem;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
}
