:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2133;
  --muted: #5d6479;
  --line: #e4e7f0;
  --accent: #4f46e5;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, white);
  --ok: #15803d;
  --ok-soft: #e6f6ec;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 24, 50, .05), 0 8px 24px rgba(20, 24, 50, .06);
  --ease: cubic-bezier(.22, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --surface: #181c2e;
    --text: #eceffa;
    --muted: #9aa2bd;
    --line: #2a3050;
    --accent-soft: color-mix(in srgb, var(--accent) 18%, #181c2e);
    --ok: #4ade80;
    --ok-soft: #14301f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 130px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  animation: pageIn .45s var(--ease) both;
  transition: opacity .2s ease, transform .2s ease;
}
body.leaving { opacity: 0; transform: translateY(-6px); }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1120px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, #4f46e5, #0d9488); display: grid; place-items: center; color: #fff; font-size: 13px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.nav a:hover { background: var(--accent-soft); color: var(--text); }
.nav a[aria-current="page"] { background: var(--text); color: var(--bg); }

main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---------- Accueil ---------- */
.hero { padding: 40px 0 28px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.08; margin: 0 0 12px; letter-spacing: -.03em; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 56ch; margin: 0; }
.seq-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 24px; }
.seq-card {
  --accent: #4f46e5;
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 26px;
  box-shadow: var(--shadow);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .2s;
}
.seq-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent); }
.seq-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 14px 34px rgba(20, 24, 50, .14); }
.seq-card .num { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.seq-card h2 { margin: 6px 0 8px; font-size: 1.8rem; letter-spacing: -.02em; }
.seq-card p { margin: 0 0 18px; color: var(--muted); }
.seq-card ul { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 6px; font-size: .92rem; }
.seq-card li { display: flex; gap: 10px; color: var(--muted); }
.seq-card li b { color: var(--text); min-width: 44px; font-variant-numeric: tabular-nums; }
.go { font-weight: 700; color: var(--accent); display: inline-flex; gap: 6px; transition: gap .25s var(--ease); }
.seq-card:hover .go { gap: 12px; }

/* ---------- Page séquence ---------- */
.seq-head { padding: 20px 0 8px; }
.seq-head .num { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .85rem; }
.seq-head h1 { margin: 4px 0 6px; font-size: clamp(2rem, 6vw, 3rem); letter-spacing: -.03em; line-height: 1.1; }
.seq-head p { margin: 0; color: var(--muted); font-size: 1.05rem; }

.layout { display: grid; gap: 28px; grid-template-columns: 1fr; margin-top: 22px; }
@media (min-width: 900px) { .layout { grid-template-columns: 220px 1fr; align-items: start; } }

.toc { font-size: .92rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: flex; gap: 10px; padding: 9px 12px; border-radius: 12px; color: var(--muted); border-left: 3px solid transparent; transition: background .2s, color .2s; }
.toc a b { font-variant-numeric: tabular-nums; min-width: 40px; color: var(--text); }
.toc a:hover { background: var(--accent-soft); }
.toc a.active { background: var(--accent-soft); color: var(--text); border-left-color: var(--accent); font-weight: 600; }
@media (min-width: 900px) { .toc { position: sticky; top: 84px; } }
@media (max-width: 899px) {
  .toc { position: sticky; top: 57px; z-index: 10; margin: 0 -16px; padding: 8px 16px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .toc ol { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .toc ol::-webkit-scrollbar { display: none; }
  .toc a { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; background: var(--surface); }
  .toc a b { min-width: 0; }
  .toc a span { display: none; }
  .toc a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
  .toc a.active b { color: #fff; }
}

.seances { display: grid; gap: 22px; min-width: 0; }
.seance {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: clamp(18px, 4vw, 30px); box-shadow: var(--shadow); min-width: 0;
}
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

.seance-date { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; }
.seance-date::first-letter { text-transform: uppercase; }
.seance h2 { margin: 12px 0 4px; font-size: clamp(1.35rem, 4vw, 1.8rem); letter-spacing: -.02em; line-height: 1.2; }
.seance .note { color: var(--muted); margin: 6px 0 0; font-size: .95rem; }
.block { margin-top: 24px; }
.block h3 { margin: 0 0 12px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* Diaporamas */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--bg); color: var(--muted); padding: 8px 14px; border-radius: 999px; transition: all .2s; }
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.panel { animation: fade .4s var(--ease); }
.panel[hidden] { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.frame { position: relative; aspect-ratio: 960 / 589; width: 100%; border-radius: 14px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .5s; }
.frame iframe.ready { opacity: 1; }
.frame::before { content: "Chargement du diaporama…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.frame-actions { margin-top: 8px; display: flex; justify-content: flex-end; }
.link-small { font-size: .85rem; font-weight: 600; color: var(--accent); padding: 6px 4px; }
.link-small:hover { text-decoration: underline; }

/* Boutons ECLIGNE */
.btns { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.btn {
  display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 12px 16px;
  background: var(--accent); color: #fff; font-weight: 600; border-radius: 14px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .2s;
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 40%, transparent); filter: brightness(1.06); }
.btn:active { transform: translateY(0) scale(.98); }
.btn .ico { flex: none; width: 28px; height: 28px; border-radius: 9px; background: rgba(255, 255, 255, .22); display: grid; place-items: center; font-size: 13px; }
.btn .arr { margin-left: auto; opacity: .8; transition: transform .25s var(--ease); }
.btn:hover .arr { transform: translate(3px, -3px); }

/* PDF */
.files { display: grid; gap: 8px; }
.file {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg);
  transition: transform .25s var(--ease), border-color .2s, background .2s;
}
.file:hover { transform: translateX(4px); border-color: var(--accent); background: var(--accent-soft); }
.file .pdf { flex: none; font-size: 11px; font-weight: 800; color: #fff; background: #dc2626; border-radius: 8px; padding: 6px 7px; letter-spacing: .04em; }
.file .name { flex: 1; min-width: 0; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.file .name small { display: block; font-weight: 400; color: var(--muted); }
.tag { flex: none; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--muted); }
.tag.corrige { background: var(--ok-soft); color: var(--ok); }
.tag.cours { background: var(--accent-soft); color: var(--accent); }

/* Navigation bas de page */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.pager a { padding: 12px 18px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; font-weight: 600; transition: transform .25s var(--ease), border-color .2s; }
.pager a:hover { transform: translateY(-3px); border-color: var(--accent); }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 20px 16px 40px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media (max-width: 520px) {
  .brand span.t { display: none; }
  .nav a { padding: 8px 12px; }
}
