/* SiteEnMain Formations — mise en page des leçons (inspirée de CleanCodeCraft) */
:root {
	--sem-accent: var(--ast-global-color-0, #2563eb);
	--sem-ink: #1f2328;
	--sem-muted: #5b6470;
	--sem-line: #e5e7eb;
	--sem-soft: #f6f7f9;
	--sem-current: #fdf3d8;
	--sem-bar: #e8a317;
	--sem-ok: #1a7f37;
	--sem-red: #c0392b;
	--sem-code-bg: #1e2329;
	--sem-radius: 10px;
}

.sem-lesson-page .entry-header,
.sem-lesson-page .ast-breadcrumbs-wrapper { display: none; }
.sem-lesson-page .site-content > .ast-container { max-width: 1240px; }

.sem-course { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 40px; align-items: start; color: var(--sem-ink); }

/* Barre latérale */
.sem-side { position: sticky; top: 24px; }
.sem-side__toggle { display: none; }
.sem-side__inner { max-height: calc(100vh - 48px); overflow: auto; padding-right: 6px; }
.sem-side__title { font-weight: 700; font-size: 1.15rem; margin: 0 0 14px; }
.sem-progress { margin-bottom: 18px; }
.sem-progress__row { display: flex; justify-content: space-between; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; color: var(--sem-muted); margin-bottom: 6px; }
.sem-progress__bar { height: 6px; background: var(--sem-line); border-radius: 99px; overflow: hidden; }
.sem-progress__bar span { display: block; height: 100%; background: var(--sem-bar); border-radius: 99px; transition: width .3s; }
.sem-toc { list-style: none; margin: 0; padding: 0; }
.sem-toc__item a { display: flex; gap: 12px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; color: var(--sem-muted); text-decoration: none; font-size: .92rem; line-height: 1.45; }
.sem-toc__item a:hover { background: var(--sem-soft); color: var(--sem-ink); }
.sem-toc__item.is-current a { background: var(--sem-current); color: var(--sem-ink); font-weight: 700; }
.sem-toc__label { flex: 1; }
.sem-toc__dot { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 3px; border: 1.5px solid #c9ced6; border-radius: 50%; position: relative; }
.sem-toc__item.is-done .sem-toc__dot { border-color: var(--sem-ok); }
.sem-toc__item.is-done .sem-toc__dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--sem-ok); }
.sem-toc__item.is-current .sem-toc__dot { border-color: #8a5a00; }
.sem-toc__item.is-current .sem-toc__dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #8a5a00; }
.sem-toc__item.is-locked a { opacity: .75; }

/* Étiquettes et boutons */
.sem-tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--sem-soft); color: var(--sem-muted); white-space: nowrap; }
.sem-tag--free { background: #e6f4ea; color: var(--sem-ok); }
.sem-tag--pro { background: #fdf3d8; color: #8a5a00; }
.sem-btn { display: inline-block; padding: 11px 18px; border-radius: 8px; border: 1px solid var(--sem-line); background: #fff; color: var(--sem-ink); font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.sem-btn:hover { border-color: var(--sem-ink); color: var(--sem-ink); }
.sem-btn--primary { background: var(--sem-accent); border-color: var(--sem-accent); color: #fff; }
.sem-btn--primary:hover { filter: brightness(.92); color: #fff; }
.sem-btn--done.is-done { background: #e6f4ea; border-color: var(--sem-ok); color: var(--sem-ok); }

/* Leçon */
.sem-crumbs { font-size: .85rem; color: var(--sem-muted); margin-bottom: 8px; }
.sem-crumbs a { color: var(--sem-muted); }
.sem-lesson__title { font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.2; margin: 0 0 10px; }
.sem-lesson__meta { display: flex; gap: 12px; align-items: center; color: var(--sem-muted); font-size: .9rem; margin-bottom: 28px; }
.sem-lesson__body { font-size: 1.05rem; line-height: 1.7; max-width: 780px; }
.sem-lesson__body h2 { font-size: 1.45rem; margin: 2.2em 0 .6em; }
.sem-lesson__body h3 { font-size: 1.15rem; margin: 1.8em 0 .5em; }
.sem-lesson__body table { width: 100%; border-collapse: collapse; margin: 1em 0 1.5em; font-size: .95rem; }
.sem-lesson__body th, .sem-lesson__body td { border: 1px solid var(--sem-line); padding: 8px 10px; text-align: left; vertical-align: top; }
.sem-lesson__body th { background: var(--sem-soft); }
.sem-lesson__body code { background: var(--sem-soft); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.sem-lesson__body pre { position: relative; background: var(--sem-code-bg); color: #e6edf3; padding: 16px 18px; border-radius: var(--sem-radius); overflow: auto; font-size: .86rem; line-height: 1.55; margin: 1em 0 1.5em; }
.sem-lesson__body pre code { background: none; padding: 0; color: inherit; font-size: inherit; white-space: pre; }
.sem-copy { position: absolute; top: 8px; right: 8px; font-size: .75rem; padding: 4px 10px; border-radius: 6px; border: 1px solid #3b434c; background: #2b323a; color: #e6edf3; cursor: pointer; }
.sem-copy:hover { background: #3b434c; }

/* Encadrés */
.sem-box { border-radius: var(--sem-radius); padding: 16px 20px; margin: 1.5em 0; border-left: 4px solid var(--sem-line); background: var(--sem-soft); }
.sem-box > :last-child { margin-bottom: 0; }
.sem-box__title { font-weight: 700; margin: 0 0 6px; }
.sem-box--astuce { border-left-color: #e8a317; background: #fffaf0; }
.sem-box--attention { border-left-color: var(--sem-red); background: #fdf1f0; }
.sem-box--retenir { border-left-color: var(--sem-ok); background: #f0f8f2; }
.sem-box--lab { border-left-color: var(--sem-accent); background: #f2f6fd; }
.sem-box--prompt { border-left-color: #6f42c1; background: #f6f2fc; }
.sem-schema { background: #fff; border: 1px solid var(--sem-line); border-radius: var(--sem-radius); padding: 18px; margin: 1.2em 0 1.5em; overflow-x: auto; }
.sem-schema pre { background: none; color: var(--sem-ink); padding: 0; margin: 0; }
.sem-quiz ol { padding-left: 1.2em; }
.sem-quiz li { margin-bottom: .9em; }
.sem-quiz ul { list-style: none; padding-left: 0; margin-top: .3em; }

/* Corrigé formateur (admin) */
.sem-corrige { border: 2px dashed var(--sem-red); background: #fff6f5; border-radius: var(--sem-radius); padding: 18px 22px; margin: 2em 0; }
.sem-corrige__label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sem-red); margin: 0 0 10px; }

/* Verrou et appels à l'action */
.sem-teaser { position: relative; max-height: 420px; overflow: hidden; }
.sem-teaser::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 140px; background: linear-gradient(rgba(255,255,255,0), #fff); }
.sem-paywall, .sem-cta { border: 1px solid var(--sem-line); border-radius: 14px; padding: 26px; margin: 28px 0; background: #fff; box-shadow: 0 6px 24px rgba(16, 24, 40, .06); }
.sem-paywall { text-align: center; }
.sem-paywall__icon { font-size: 1.8rem; }
.sem-paywall__title, .sem-cta__title { font-weight: 700; font-size: 1.15rem; margin: 6px 0; }
.sem-paywall__actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 0; }
.sem-paywall .sem-paywall__actions { justify-content: center; }
.sem-done-wrap { margin: 32px 0 8px; }
.sem-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.sem-pager a { display: block; border: 1px solid var(--sem-line); border-radius: var(--sem-radius); padding: 12px 16px; text-decoration: none; color: var(--sem-ink); }
.sem-pager a:hover { border-color: var(--sem-ink); }
.sem-pager small { display: block; color: var(--sem-muted); }
.sem-pager__next { text-align: right; grid-column: 2; }

/* Programme (page de vente) */
.sem-programme__meta { display: flex; gap: 10px; }
.sem-programme__meta span { background: var(--sem-soft); border-radius: 99px; padding: 3px 12px; font-size: .85rem; }
.sem-programme__list { list-style: none; padding: 0; margin: 18px 0; }
.sem-programme__item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--sem-line); }
.sem-programme__num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--sem-muted); min-width: 28px; }
.sem-programme__text { flex: 1; }
.sem-programme__text a { font-weight: 600; text-decoration: none; }
.sem-programme__text small { display: block; color: var(--sem-muted); margin-top: 2px; }
.sem-programme__item.is-done .sem-programme__num { color: var(--sem-ok); }

/* Offres */
.sem-offres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.sem-offre__once { display: block; margin-top: 8px; font-size: .88rem; text-align: center; }
@media (max-width: 1100px) { .sem-offres { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sem-offre { border: 1px solid var(--sem-line); border-radius: 14px; padding: 24px; position: relative; display: flex; flex-direction: column; }
.sem-offre ul { flex: 1; padding-left: 1.1em; }
.sem-offre--featured { border: 2px solid var(--sem-accent); }
.sem-offre__badge { position: absolute; top: -12px; left: 20px; background: var(--sem-accent); color: #fff; font-size: .75rem; padding: 2px 10px; border-radius: 99px; margin: 0; }
.sem-offre__name { font-weight: 700; margin: 0; }
.sem-offre__price { font-size: 1.6rem; font-weight: 800; margin: 4px 0 10px; }

@media (max-width: 900px) {
	.sem-course { grid-template-columns: 1fr; gap: 16px; }
	.sem-side { position: static; }
	.sem-side__toggle { display: block; width: 100%; padding: 10px 14px; border: 1px solid var(--sem-line); border-radius: 8px; background: var(--sem-soft); font-weight: 600; text-align: left; cursor: pointer; }
	.sem-side__inner { display: none; max-height: none; margin-top: 10px; }
	.sem-side.is-open .sem-side__inner { display: block; }
	.sem-offres { grid-template-columns: 1fr; }
	.sem-pager { grid-template-columns: 1fr; }
	.sem-pager__next { grid-column: 1; }
}
.sem-pager span { display: block; font-size: 1rem; font-weight: 600; line-height: 1.35; }
.sem-done-wrap .sem-btn, .sem-paywall__actions .sem-btn { font-size: .95rem; }
.sem-shot { margin: 1.4em 0 1.8em; }
.sem-shot img { display: block; width: 100%; height: auto; border: 1px solid var(--sem-line); border-radius: var(--sem-radius); background: #f6f6f6; }
.sem-shot figcaption { font-size: .88rem; color: var(--sem-muted); margin-top: 8px; }

/* === v1.3.1 : marges et mobile === */
.sem-course { max-width: 1240px; margin: 0 auto; padding: 28px 24px 56px; box-sizing: border-box; }
/* Mobile : grille sans débordement, marges, lisibilité */
.sem-course > * { min-width: 0; }
.sem-lesson__body { overflow-wrap: break-word; }
.sem-lesson__body img { max-width: 100%; height: auto; }
.sem-lesson__body pre code { white-space: pre; }
.sem-lesson__body blockquote { margin: 1.2em 0; padding: .2em 0 .2em 16px; border-left: 3px solid var(--sem-line); color: var(--sem-muted); font-style: normal; }
.sem-side .sem-side__toggle,
.sem-side .sem-side__toggle:hover,
.sem-side .sem-side__toggle:focus { background: var(--sem-soft); color: var(--sem-ink); border: 1px solid var(--sem-line); box-shadow: none; text-transform: none; letter-spacing: 0; font-size: .95rem; }
.sem-side__toggle::after { content: "▾"; float: right; transition: transform .2s; }
.sem-side.is-open .sem-side__toggle::after { transform: rotate(180deg); }

@media (max-width: 900px) {
	.sem-course { padding: 14px 16px 40px; }
	.sem-lesson-page .site-content > .ast-container { padding-left: 16px; padding-right: 16px; }
	.sem-lesson-page .site-content { padding-top: 16px; }
	.sem-course { grid-template-columns: minmax(0, 1fr); }
	.sem-crumbs { font-size: .8rem; line-height: 1.4; }
	.sem-lesson__title { font-size: 1.55rem; line-height: 1.25; word-break: normal; overflow-wrap: anywhere; }
	.sem-lesson__meta { margin-bottom: 20px; flex-wrap: wrap; }
	.sem-lesson__body { font-size: 1rem; line-height: 1.65; }
	.sem-lesson__body h2 { font-size: 1.3rem; line-height: 1.3; margin: 1.8em 0 .5em; }
	.sem-lesson__body h3 { font-size: 1.08rem; line-height: 1.35; }
	.sem-lesson__body ul, .sem-lesson__body ol { padding-left: 1.2em; margin-left: 0; }
	.sem-lesson__body pre { font-size: .78rem; padding: 14px; margin-left: -4px; margin-right: -4px; }
	.sem-lesson__body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: .88rem; }
	.sem-lesson__body th, .sem-lesson__body td { padding: 7px 8px; min-width: 90px; }
	.sem-box { padding: 14px 16px; }
	.sem-schema { padding: 12px; }
	.sem-schema pre { font-size: .72rem; }
	.sem-corrige { padding: 14px 16px; }
	.sem-paywall, .sem-cta { padding: 20px 16px; }
	.sem-paywall__actions { flex-direction: column; }
	.sem-paywall__actions .sem-btn { width: 100%; text-align: center; }
	.sem-done-wrap .sem-btn { width: 100%; text-align: center; }
	.sem-toc__item a { padding: 10px 8px; }
	.sem-programme__item { gap: 10px; }
	.sem-programme__item .sem-tag { align-self: flex-start; }
	.sem-programme__meta { flex-wrap: wrap; }
	.sem-offre { padding: 20px 18px; }
}

/* v1.3.1 : finitions mobile */
.sem-lesson__body blockquote, .sem-lesson__body blockquote p { font-size: 1rem; line-height: 1.6; }
.sem-lesson__body blockquote { background: var(--sem-soft); border-radius: 0 8px 8px 0; padding: 12px 16px; }
.sem-box__title { line-height: 1.35; }
.sem-box p:first-of-type { margin-top: 0; }
@media (max-width: 640px) {
	.sem-lesson__body table.sem-table--stack { display: block; overflow: visible; border: 0; }
	.sem-table--stack thead { display: none; }
	.sem-table--stack tbody, .sem-table--stack tr { display: block; }
	.sem-table--stack tr { border: 1px solid var(--sem-line); border-radius: 10px; margin: 0 0 12px; padding: 6px 12px; background: #fff; }
	.sem-lesson__body .sem-table--stack td { display: block; position: relative; border: 0; border-bottom: 1px solid var(--sem-soft); padding: 7px 0 7px 36%; min-width: 0; min-height: 1.6em; }
	.sem-lesson__body .sem-table--stack td:last-child { border-bottom: 0; }
	.sem-table--stack td::before { content: attr(data-label); position: absolute; left: 0; top: 8px; width: 32%; font-weight: 600; color: var(--sem-muted); font-size: .8rem; line-height: 1.35; }
	.sem-table--stack td:first-child { font-weight: 600; }
	.sem-lesson__body td code { white-space: normal; word-break: break-word; }
	.sem-schema { position: relative; }
	.sem-schema.is-scroll::after { content: "← faites défiler →"; display: block; text-align: center; font-size: .72rem; color: var(--sem-muted); margin-top: 6px; }
}

.sem-btn, button.sem-btn { text-transform: none; letter-spacing: 0; }
.sem-shot a { display: block; cursor: zoom-in; }
@media (max-width: 640px) { .sem-shot figcaption::after { content: " · Touchez l'image pour l'agrandir."; } }
.sem-offre ul { list-style: none; padding-left: 0; margin: 12px 0 18px; }
.sem-offre li { position: relative; padding-left: 24px; margin-bottom: 8px; line-height: 1.45; }
.sem-offre li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--sem-ok); font-weight: 700; }
.sem-offre .sem-btn { text-align: center; }
.sem-btn { box-sizing: border-box; max-width: 100%; }
.sem-cta p { font-size: 1rem; line-height: 1.55; }
@media (max-width: 640px) {
	.sem-cta .sem-paywall__actions, .sem-cta [class*="actions"] { flex-direction: column; }
	.sem-cta .sem-btn { width: 100%; text-align: center; }
	.sem-paywall__title, .sem-cta__title { font-size: 1.08rem; line-height: 1.35; }
	.sem-pager a { padding: 12px 14px; }
}
