/* Rendu du contenu d'un cours : titres, listes, callouts, médias, cartes, formules. */

/* Typographie « document » : mesure étroite (voir #app.reading .content-inner
   dans layout.css), interligne aéré, grands titres en serif. */
.blocks { font-size: clamp(16px, 1.1vw, 17px); line-height: 1.7; }
.blocks h2 { font-family: var(--serif); font-size: clamp(23px, 2.5vw, 28px); margin: 44px 0 12px; letter-spacing: -.012em; font-weight: 600; color: var(--heading); }
.blocks h3 { font-size: clamp(18px, 1.9vw, 20px); margin: 30px 0 10px; letter-spacing: -.008em; font-weight: 700; color: var(--heading); }
.blocks h4 { font-size: clamp(16px, 1.6vw, 17.5px); margin: 24px 0 8px; font-weight: 700; }
.blocks h5 { font-size: 15.5px; margin: 20px 0 6px; font-weight: 700; }
.blocks p { margin: 12px 0; }
.blocks ul, .blocks ol { margin: 12px 0; padding-left: 25px; }
.blocks li { margin: 6px 0; }
.blocks li::marker { color: var(--accent); }
/* Enfants indentés d'un bloc (sous-points d'un paragraphe, d'un titre…). */
.blocks .blk-children { margin-left: 22px; }

.blocks a.ext-link, .blocks a.internal-link {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 2px; transition: background .15s, border-color .15s;
}
.blocks a.ext-link:hover, .blocks a.internal-link:hover { border-bottom-color: var(--accent); background: var(--accent-soft); }
.blocks a.internal-link { font-weight: 550; border-bottom-style: dotted; }

/* Renvoi vers un contenu encore non publié : lisible, mais clairement inactif. */
.blocks .link-soon {
  color: var(--text-faint); border-bottom: 1px dotted var(--border); cursor: help;
}
.blocks .link-soon::after {
  content: "à venir"; font-size: .72em; font-weight: 700; letter-spacing: .03em; vertical-align: .12em;
  margin-left: .35em; padding: 1px 6px; border-radius: 20px; background: var(--panel-2); color: var(--text-faint);
}

.blocks code { background: var(--panel-2); border: 1px solid var(--hairline); border-radius: 6px; padding: 1.5px 6px; font-size: .9em; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.blocks pre { background: var(--panel-2); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 14px 16px; overflow-x: auto; }
.blocks pre code { background: none; border: none; padding: 0; }

.blocks .table-wrap { overflow-x: auto; margin: 18px 0; -webkit-overflow-scrolling: touch; }
.blocks table { border-collapse: collapse; width: 100%; min-width: max-content; font-size: 14px; }
.blocks th, .blocks td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; vertical-align: top; }
.blocks thead th { background: var(--panel-2); font-weight: 700; }
.blocks tbody tr:nth-child(even) { background: color-mix(in srgb, var(--text) 3%, transparent); }
.blocks del { color: var(--text-faint); }

mark, .hl { border-radius: 4px; padding: 0 4px; color: var(--hl-text); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hl-yellow { background: #fdeea1; } .hl-green { background: #bdefcb; } .hl-mint { background: #aeefda; } .hl-cyan { background: #a7ebf7; }
.hl-blue { background: #c2dbff; } .hl-purple { background: #e4d2ff; } .hl-pink { background: #ffcfe3; } .hl-red { background: #ffd0d0; } .hl-gray { background: #e5e2db; }
.hl-gradient-yellow { background: linear-gradient(120deg, #fdeea1, #ffcf8a); }
.hl-gradient-red { background: linear-gradient(120deg, #ffd0d0, #ffb0bd); }
.hl-gradient-blue { background: linear-gradient(120deg, #c2dbff, #b3bcff); }
.hl-gradient-purple { background: linear-gradient(120deg, #e4d2ff, #f3b8fb); }
.hl-gradient-brown { background: linear-gradient(120deg, #ece6df, #dcc2af); }
mark.search-hit { background: #ffd94d; color: #201f1c; box-shadow: 0 0 0 3px rgba(255, 217, 77, .5); border-radius: 3px; }

.callout { background: var(--heading-soft); border-left: 3px solid var(--heading); border-radius: var(--r-sm); padding: 15px 20px; margin: 20px 0; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
blockquote { border-left: 3px solid var(--border); margin: 18px 0; padding: 4px 20px; color: var(--text-dim); font-style: italic; }
hr.sep-light { border: none; border-top: 1px solid var(--hairline); margin: 28px 0; }
hr.sep-strong { border: none; height: 1px; margin: 42px 0; background: linear-gradient(90deg, transparent, var(--border), transparent); }
.checklist { list-style: none; padding-left: 4px; }
.checklist li { display: flex; align-items: baseline; gap: 9px; }
.checklist .cb { flex: none; font-size: 14px; }

/* ============ MÉDIAS ============ */
figure.media { margin: 24px 0; text-align: center; }
figure.media img {
  max-width: 100%; height: auto; border-radius: var(--r-sm); box-shadow: var(--shadow-sm);
  cursor: zoom-in; transition: transform .25s var(--ease); background: var(--panel-2);
}
figure.media img:hover { transform: scale(1.008); }
/* Photos : taille raisonnable. Schémas et dessins : pleine largeur. */
figure.media-photo img { max-width: min(100%, 640px); max-height: 480px; }
/* Mode sombre : les schémas Craft sont à encre foncée sur fond transparent. */
:root[data-theme="dark"] figure.media-schema img { background: #fff; padding: 12px; }
figure.media figcaption { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
/* Place réservée tant que l'image n'est pas arrivée : le texte ne saute pas.
   (Pas de `content-visibility: auto` ici : sur des schémas hauts, il laissait
   de grandes zones vides au défilement rapide.) */
figure.media img.is-loading { min-height: 180px; }

.math-display { margin: 22px 0; padding: 12px 8px; text-align: center; overflow-x: auto; overflow-y: hidden; }
.math-display .katex { font-size: 1.12em; }
.math-error { display: block; background: var(--red-soft); color: var(--red); padding: 10px 14px; border-radius: var(--r-xs); white-space: pre-wrap; font-size: 13.5px; }
/* Formule en attente du chargement de KaTeX : on garde le texte source lisible. */
.math-pending { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .95em; color: var(--text-dim); }

.link-card, .yt-card, .file-card {
  display: flex; align-items: center; gap: 14px; margin: 18px 0; text-decoration: none; color: var(--text); overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .2s;
}
.link-card:hover, .yt-card:hover, .file-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.link-card { padding: 15px 18px; }
.link-card .icon { font-size: 22px; flex: none; }
.link-card .lc-title { font-weight: 600; font-size: 15px; }
.link-card .lc-host { font-size: 12.5px; color: var(--text-dim); }
.yt-card { max-width: 560px; }
.yt-thumb { position: relative; flex: none; width: 190px; aspect-ratio: 16/9; background: #14120f; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.yt-play span {
  width: 46px; height: 46px; border-radius: 50%; background: rgba(221, 54, 44, .95); color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center; padding-left: 4px; box-shadow: 0 3px 12px rgba(0, 0, 0, .3);
  transition: transform .18s var(--ease);
}
.yt-card:hover .yt-play span { transform: scale(1.12); }
.yt-info { padding: 12px 16px 12px 2px; min-width: 0; }
.yt-badge { display: inline-block; background: #dd362c; color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 5px; letter-spacing: .04em; margin-bottom: 6px; }
.yt-title { font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.file-card { padding: 14px 18px; max-width: 560px; }
.file-card .icon { font-size: 21px; flex: none; }
.file-card .fc-name { font-weight: 600; font-size: 14.5px; word-break: break-word; }
.file-card .fc-hint { font-size: 12px; color: var(--text-dim); }

/* ============ TOGGLES & CARTES ============ */
details.toggle, details.card-section { margin: 16px 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--card); }
details.toggle > summary, details.card-section > summary {
  cursor: pointer; list-style: none; padding: 13px 16px; user-select: none; display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; transition: background .15s;
}
details.toggle > summary::-webkit-details-marker, details.card-section > summary::-webkit-details-marker { display: none; }
details.toggle > summary:hover, details.card-section > summary:hover { background: var(--panel-2); }
details.toggle > summary .nav-chevron, details.card-section > summary .nav-chevron { color: var(--text-dim); flex: none; }
details[open].toggle > summary, details[open].card-section > summary { border-bottom: 1px solid var(--hairline); }
.toggle-body, .card-body { padding: 8px 18px 15px; }
details.card-section { margin: 22px 0; }
details.card-section > summary { color: var(--heading); }
.card-icon { flex: none; font-size: 19px; }

[id^="b-"] { scroll-margin-top: 20px; }
.blk-flash { animation: blkFlash 1.9s ease-out; border-radius: 8px; }
@keyframes blkFlash {
  0%, 28% { background: var(--accent-soft); box-shadow: 0 0 0 7px var(--accent-soft); }
  100% { background: transparent; box-shadow: 0 0 0 7px transparent; }
}
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ============ COURS COMMUN (recopié depuis un autre module) ============ */
.mirror-note {
  display: flex; align-items: flex-start; gap: 12px; margin: 0 0 26px; padding: 14px 18px;
  border-radius: var(--r); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-size: 14px; line-height: 1.5;
}
.mirror-note .mn-icon { font-size: 19px; line-height: 1.3; flex: none; }
.mirror-note strong { font-weight: 700; }
.mirror-note a { color: var(--accent); font-weight: 600; }

/* ============ PAGES SÉANCE / SÉQUENCE / MODULE ============ */
.listing-intro { color: var(--text-dim); font-size: 15px; margin: 0 0 26px; }
.listing-group { margin: 0 0 30px; }
.listing-group h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); font-weight: 700;
  margin: 32px 0 14px; display: flex; align-items: center; gap: 12px;
}
.listing-group h2::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.listing-group h2 .crumb-link { font: inherit; color: inherit; letter-spacing: inherit; }
.listing-group h2 .crumb-link:hover { color: var(--accent); }
.listing-list { display: flex; flex-direction: column; gap: 9px; }
.listing-item {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; font: inherit;
  padding: 14px 18px; border-radius: var(--r); border: 1px solid var(--border); background: var(--card);
  color: var(--text); cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s;
}
.listing-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.listing-item .li-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.listing-item .li-title { flex: 1; font-weight: 600; font-size: 15px; min-width: 0; }
.listing-item .li-sub { display: block; font-weight: 400; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.listing-item .li-arrow { flex: none; color: var(--accent); }
.listing-item.is-soon { cursor: default; background: var(--panel-2); box-shadow: none; color: var(--text-faint); }
.listing-item.is-soon:hover { transform: none; box-shadow: none; border-color: var(--border); }
.listing-item.is-soon .li-num { background: var(--panel); color: var(--text-faint); }
.listing-item.is-soon .li-title { font-weight: 500; }
.listing-item .li-soon {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 10px; border-radius: 20px;
  background: var(--panel); color: var(--text-faint); box-shadow: inset 0 0 0 1px var(--hairline);
}
