/* SPL course: library, subject contents and long-form chapter reading. */
:root, [data-theme="alpine"] {
  --fig-ink:var(--ink); --fig-muted:#8a8e96; --fig-soft:#f1f2f4; --fig-line:#c9cbd1;
  --fig-warm:#c8553d; --fig-warm-soft:#f6dcd4; --fig-cold:#2f6db3; --fig-cold-soft:#d7e5f5;
  --fig-cloud:#ffffff; --fig-cloud-edge:#9aa3ad; --fig-ground:#c9bfa8; --fig-ground-soft:#ece6d8;
  --fig-green:#3f7d4e; --fig-accent:var(--accent);
  --call-examen:#3e5aca; --call-suisse:#c8102e; --call-attention:#b07a12; --call-neutral:#72757d;
}
[data-theme="midnight"] {
  --fig-muted:#8f939c; --fig-soft:#26282d; --fig-line:#464951;
  --fig-warm:#ef8a6f; --fig-warm-soft:#4a2b24; --fig-cold:#7fb1ec; --fig-cold-soft:#1f3349;
  --fig-cloud:#d9dce2; --fig-cloud-edge:#9aa3ad; --fig-ground:#7d7360; --fig-ground-soft:#38342b;
  --fig-green:#7cc49c;
  --call-examen:#9baeff; --call-suisse:#ff6b7d; --call-attention:#d1b771; --call-neutral:#979ba5;
}

.course .page-heading .eyebrow { display:block; margin-bottom:8px; }
.course .page-heading p { max-width:68ch; line-height:1.6; }
.course-status { color:var(--muted); font-size:12px; margin:-12px 0 22px; }
.course-note { font-size:12px; line-height:1.6; color:var(--ink-2); background:var(--surface-2); border:1px solid var(--rule); border-radius:6px; padding:12px 14px; margin-bottom:22px; max-width:90ch; }
.course-note a { color:var(--accent); text-decoration:underline; text-underline-offset:2px; }
/* One truncated line, so a long chapter title never pushes the account link off screen. */
#course-breadcrumb { display:block; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#course-breadcrumb > * + * { margin-left:12px; }
.breadcrumb a { color:var(--muted); }
.breadcrumb a:hover { color:var(--ink); }

/* Library */
.course-library { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-bottom:24px; }
.course-card { display:flex; flex-direction:column; gap:8px; padding:18px; border:1px solid var(--rule); border-radius:6px; background:var(--surface); min-height:190px; }
a.course-card:hover { border-color:var(--rule-strong); box-shadow:0 2px 8px #0000000d; }
.course-card.is-pending { background:var(--bg-deep); color:var(--muted); }
.course-card__code { font:500 11px 'Geist Mono',monospace; color:var(--accent); }
.is-pending .course-card__code { color:var(--muted); }
.course-card__name { font-size:16px; font-weight:600; letter-spacing:-.02em; }
.course-card__intro { font-size:12px; line-height:1.6; color:var(--ink-2); flex:1; }
.is-pending .course-card__intro { color:var(--muted); }
.course-card__meta { font-size:11px; color:var(--muted); }

/* Subject contents */
.chapter-list { list-style:none; padding:0; margin:0 0 30px; border-top:1px solid var(--rule); }
.chapter-list a { display:grid; grid-template-columns:40px minmax(0,1fr) auto; gap:16px; align-items:baseline; padding:18px 10px; border-bottom:1px solid var(--rule); }
.chapter-list a:hover { background:var(--surface-2); }
.chapter-list__n { font:500 12px 'Geist Mono',monospace; color:var(--muted); }
.chapter-list__body { display:flex; flex-direction:column; gap:5px; }
.chapter-list__title { font-size:15px; font-weight:550; }
.chapter-list__resume { font-size:12px; color:var(--muted); line-height:1.55; }
.chapter-list__time { font-size:11px; color:var(--muted); white-space:nowrap; }

/* Chapter */
.chapter-layout { display:grid; grid-template-columns:minmax(0,72ch) 220px; gap:56px; justify-content:space-between; align-items:start; }
.chapter-toc { position:sticky; top:24px; display:flex; flex-direction:column; gap:2px; padding-top:8px; }
.chapter-toc .sidebar-label { padding:0 0 8px; }
.chapter-toc a { font-size:12px; color:var(--muted); padding:5px 0 5px 12px; border-left:2px solid var(--rule); line-height:1.4; }
.chapter-toc a:hover { color:var(--ink); border-left-color:var(--accent); }
.chapter__head { margin-bottom:28px; padding-bottom:22px; border-bottom:1px solid var(--rule); }
.chapter__head h1 { font-size:32px; font-weight:600; letter-spacing:-.04em; line-height:1.2; margin:10px 0 12px; }
.chapter__resume { font-size:15px; line-height:1.6; color:var(--ink-2); }
.chapter__meta { font-size:11px; color:var(--muted); margin-top:12px; }
.chapter__body { font-size:15px; line-height:1.75; color:var(--ink); }
.chapter__body > * + * { margin-top:1em; }
.chapter__body h2 { font-size:22px; font-weight:600; letter-spacing:-.025em; line-height:1.3; margin-top:2.2em; scroll-margin-top:24px; }
.chapter__body h3 { font-size:17px; font-weight:600; letter-spacing:-.015em; margin-top:1.7em; scroll-margin-top:24px; }
.chapter__body ul,.chapter__body ol { padding-left:1.4em; }
.chapter__body li + li { margin-top:.35em; }
.chapter__body a { color:var(--accent); text-decoration:underline; text-underline-offset:2px; text-decoration-thickness:1px; }
.chapter__body code { font:13px 'Geist Mono',monospace; background:var(--surface-2); padding:1px 5px; border-radius:3px; }
.chapter__body strong { font-weight:600; }
/* Reading mode: references live in the list at the end; the toggle brings the markers back. */
.chapter:not(.show-refs) .cite,.chapter:not(.show-refs) .cite-line { display:none; }
.chapter__tools { display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; margin-top:14px; font-size:12px; }
.chapter__tools a { color:var(--muted); text-decoration:underline; text-decoration-color:var(--rule-strong); text-underline-offset:2px; }
.refs-toggle { display:inline-flex; align-items:center; gap:8px; padding:6px 10px; border:1px solid var(--rule); border-radius:5px; color:var(--ink-2); background:var(--surface); font-size:12px; }
.refs-toggle::before { content:''; width:26px; height:14px; border-radius:7px; background:var(--rule-strong); box-shadow:inset -12px 0 0 2px var(--surface); transition:box-shadow .15s; }
.refs-toggle[aria-pressed="true"]::before { background:var(--accent); box-shadow:inset 12px 0 0 2px var(--surface); }
.refs-toggle:hover { border-color:var(--rule-strong); }
.ref-passages { display:block; color:var(--muted); font-size:11px; margin-top:2px; }
.cite { font-size:10px; line-height:0; margin-left:1px; white-space:nowrap; }
.cite a { text-decoration:none !important; font-family:'Geist Mono',monospace; }
.table-scroll { overflow-x:auto; border:1px solid var(--rule); border-radius:6px; }
.chapter__body table { width:100%; border-collapse:collapse; font-size:13px; line-height:1.5; }
.chapter__body th { text-align:left; font-weight:550; background:var(--bg-deep); }
.chapter__body th,.chapter__body td { padding:9px 12px; border-bottom:1px solid var(--rule); vertical-align:top; }
.chapter__body tr:last-child td { border-bottom:0; }

.callout { border:1px solid var(--rule); border-left:3px solid var(--call-neutral); border-radius:0 6px 6px 0; padding:14px 18px; background:var(--surface-2); font-size:14px; line-height:1.65; }
.callout > * + * { margin-top:.6em; }
.callout__title { font-size:11px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--call-neutral); }
.callout--examen { border-left-color:var(--call-examen); } .callout--examen .callout__title { color:var(--call-examen); }
.callout--suisse { border-left-color:var(--call-suisse); } .callout--suisse .callout__title { color:var(--call-suisse); }
.callout--suisse .callout__title::before { content:'+'; display:inline-grid; place-items:center; width:14px; height:14px; margin-right:7px; background:var(--call-suisse); color:#fff; font-size:12px; font-weight:700; border-radius:2px; vertical-align:-2px; }
.callout--attention { border-left-color:var(--call-attention); } .callout--attention .callout__title { color:var(--call-attention); }
.callout--formule { font-family:'Geist Mono',monospace; font-size:13px; }
.callout--formule .callout__title { font-family:'Geist',sans-serif; }

.course-figure { margin:1.8em 0; }
.course-figure__art { border:1px solid var(--rule); border-radius:6px; padding:12px; background:var(--surface); }
.course-figure svg { display:block; width:100%; height:auto; max-height:520px; font-family:'Geist',sans-serif; }
.course-figure figcaption { font-size:12px; line-height:1.55; color:var(--muted); margin-top:8px; }
.figure-credit { display:block; font-size:10px; margin-top:2px; }

/* Figure palette: classes used by content/cours/figures/*.svg */
.course-figure .s-ink { stroke:var(--fig-ink); } .course-figure .s-muted { stroke:var(--fig-muted); }
.course-figure .s-line { stroke:var(--fig-line); } .course-figure .s-warm { stroke:var(--fig-warm); }
.course-figure .s-cold { stroke:var(--fig-cold); } .course-figure .s-accent { stroke:var(--fig-accent); }
.course-figure .s-green { stroke:var(--fig-green); } .course-figure .s-cloud { stroke:var(--fig-cloud-edge); }
.course-figure .f-ink { fill:var(--fig-ink); } .course-figure .f-muted { fill:var(--fig-muted); }
.course-figure .f-soft { fill:var(--fig-soft); } .course-figure .f-bg { fill:var(--surface); }
.course-figure .f-warm { fill:var(--fig-warm); } .course-figure .f-warm-soft { fill:var(--fig-warm-soft); }
.course-figure .f-cold { fill:var(--fig-cold); } .course-figure .f-cold-soft { fill:var(--fig-cold-soft); }
.course-figure .f-cloud { fill:var(--fig-cloud); } .course-figure .f-ground { fill:var(--fig-ground); }
.course-figure .f-ground-soft { fill:var(--fig-ground-soft); } .course-figure .f-accent { fill:var(--fig-accent); }
.course-figure .f-green { fill:var(--fig-green); } .course-figure .f-none { fill:none; }
.course-figure text { fill:var(--fig-ink); font-size:14px; }
.course-figure text.t-muted { fill:var(--fig-muted); } .course-figure text.t-small { font-size:12px; }
.course-figure text.t-warm { fill:var(--fig-warm); } .course-figure text.t-cold { fill:var(--fig-cold); }
.course-figure text.t-accent { fill:var(--fig-accent); } .course-figure text.t-bold { font-weight:600; }
.course-figure text.t-mono { font-family:'Geist Mono',monospace; font-size:12px; }

.chapter__practice { margin:36px 0 10px; }
.chapter__refs { margin-top:36px; padding-top:22px; border-top:1px solid var(--rule); }
.chapter__refs h2 { font-size:14px; font-weight:600; margin-bottom:12px; }
.chapter__refs ol { padding-left:1.6em; font-size:12px; line-height:1.6; color:var(--ink-2); }
.chapter__refs li + li { margin-top:6px; }
.chapter__refs li:target { background:var(--surface-2); outline:4px solid var(--surface-2); }
.chapter__refs a { color:var(--ink); text-decoration:underline; text-decoration-color:var(--rule-strong); text-underline-offset:2px; overflow-wrap:anywhere; }
.chapter__disclaimer { font-size:11px; color:var(--muted); margin-top:16px; line-height:1.6; }
.chapter__nav { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin:30px 0 10px; }
.chapter__nav a { display:flex; flex-direction:column; gap:4px; padding:14px 16px; border:1px solid var(--rule); border-radius:6px; font-size:13px; font-weight:550; }
.chapter__nav a:hover { border-color:var(--rule-strong); }
.chapter__nav a > span { font-size:11px; font-weight:400; color:var(--muted); }
.chapter__nav a.is-next { text-align:right; grid-column:2; }

@media (max-width:1200px) {
  .chapter-layout { grid-template-columns:minmax(0,1fr); }
  .chapter-toc { display:none; }
  .course-library { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:600px) {
  .course-library { grid-template-columns:minmax(0,1fr); }
  .course-card { min-height:0; }
  .chapter__head h1 { font-size:25px; }
  .chapter__body { font-size:15px; line-height:1.7; }
  .chapter__body h2 { font-size:19px; }
  .chapter-list a { grid-template-columns:28px minmax(0,1fr); }
  .chapter-list__time { display:none; }
  .chapter__nav { grid-template-columns:minmax(0,1fr); }
  .chapter__nav a.is-next { grid-column:1; }
  .course-figure__art { padding:6px; }
  .callout { padding:12px 14px; }
}
