:root {
  --paper: #f1f4f6;
  --surface: #ffffff;
  --ink: #0e2233;
  --muted: #4b6275;
  --line: #ccd8e0;
  --brand: #17607f;
  --brand-dark: #0b3f57;
  --brand-tint: #e3eff4;
  --mark: #f2b33d;
  --mark-tint: #fdf3dc;
  --radius: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 72px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }

/* ---------- En-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink); color: #fff;
  height: var(--header-h);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 24px; }
.brand { color: #fff; text-decoration: none; display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.brand span { font-size: .78rem; color: #a9c4d3; }
.nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav a {
  display: block; padding: 8px 14px; border-radius: 8px;
  color: #dbe8ef; text-decoration: none; font-weight: 600; font-size: .98rem;
}
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--mark); border-radius: 8px 8px 0 0; }
.nav-toggle { display: none; }

/* ---------- Pied de page ---------- */
.site-footer { margin-top: 96px; padding: 32px 0 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 8px; font-weight: 700; font-size: 1rem;
  text-decoration: none; border: 2px solid var(--brand); color: var(--brand); background: transparent;
  cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--brand-tint); color: var(--brand-dark); }
.btn-solid { background: var(--brand); color: #fff; }
.btn-solid:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-small { padding: 6px 14px; font-size: .9rem; border-width: 1.5px; }

/* ---------- Accueil ---------- */
.hero { padding: 72px 0 56px; }
.hero h1 { max-width: 16ch; }
.hero .lead { max-width: 62ch; margin-top: 24px; color: var(--muted); font-size: 1.15rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.section { padding: 40px 0; }
.section > .wrap > h2 { margin-bottom: 8px; }
.section .sub { color: var(--muted); max-width: 62ch; margin-bottom: 28px; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; }
.steps li::before {
  content: counter(step); position: absolute; top: -14px; left: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: .95rem;
}
.steps h3 { margin: 6px 0 6px; font-size: 1.02rem; }
.steps p { color: var(--muted); font-size: .94rem; }
.steps .links { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .92rem; font-weight: 600; }

.workshops { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
.workshop {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; text-decoration: none; color: var(--ink);
  transition: border-color .15s;
}
.workshop:hover { border-color: var(--brand); color: var(--ink); }
.workshop h3 { font-size: 1.5rem; color: var(--brand-dark); }
.workshop p { color: var(--muted); flex: 1; }
.workshop .meta { font-weight: 600; color: var(--brand); font-size: .95rem; }

.playlist-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 32px; }
.playlist-list li { border-top: 1px solid var(--line); }
.playlist-list a { display: flex; justify-content: space-between; gap: 16px; padding: 14px 4px; text-decoration: none; color: var(--ink); font-weight: 600; }
.playlist-list a:hover { color: var(--brand); }
.playlist-list .count { color: var(--muted); font-weight: 500; white-space: nowrap; }

.book {
  display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px;
}
.book .cover {
  width: 84px; height: 112px; border-radius: 4px; background: var(--brand-dark); color: #fff;
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem;
  box-shadow: 4px 4px 0 var(--mark);
}
.book p { color: var(--muted); margin: 6px 0 16px; max-width: 60ch; }

/* ---------- Pages de rubrique ---------- */
.page-head { padding: 56px 0 24px; }
.page-head .lead { margin-top: 16px; color: var(--muted); max-width: 64ch; font-size: 1.1rem; }

.note {
  margin: 8px 0 8px; padding: 14px 18px; background: var(--mark-tint);
  border-left: 4px solid var(--mark); border-radius: 0 8px 8px 0; max-width: 78ch; font-size: .97rem;
}

.group { margin-top: 44px; }
.group > h2 { margin-bottom: 16px; }
.docs { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.doc { display: grid; grid-template-columns: 76px 1fr auto; gap: 20px; align-items: center; padding: 18px 22px; }
.doc + .doc { border-top: 1px solid var(--line); }
.doc .ref { font-family: var(--font-display); font-weight: 800; color: var(--brand); font-size: 1.05rem; }
.doc h3 { margin-bottom: 4px; }
.doc p { color: var(--muted); font-size: .95rem; max-width: 66ch; }
.doc .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.doc .text-link { font-size: .9rem; font-weight: 600; align-self: center; }

.related { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 16px; }
.related a {
  display: block; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--ink);
}
.related a:hover { border-color: var(--brand); }
.related strong { display: block; color: var(--brand-dark); }
.related span { color: var(--muted); font-size: .92rem; }

/* ---------- Page vidéos ---------- */
.videos-layout { display: grid; grid-template-columns: 250px 1fr; gap: 48px; align-items: start; padding-top: 8px; }
.rail { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow: auto; }
.rail h2 { font-size: .95rem; color: var(--muted); font-weight: 700; margin: 20px 0 6px; letter-spacing: 0; }
.rail h2:first-child { margin-top: 0; }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail a {
  display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; margin-left: -12px;
  border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem;
}
.rail a:hover { background: var(--brand-tint); }
.rail a.is-active { background: var(--brand); color: #fff; }
.rail a.is-active .count { color: #cfe3ec; }
.rail .count { color: var(--muted); font-weight: 500; }

.pl { padding-bottom: 56px; }
.pl + .pl { padding-top: 8px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 48px; }
.pl-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; align-items: end; margin-bottom: 24px; }
.pl-head p { color: var(--muted); margin-top: 6px; max-width: 58ch; }
.pl-head .count { font-size: .95rem; color: var(--muted); font-weight: 600; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { display: block; text-decoration: none; color: var(--ink); }
.card .thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--brand-dark); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(to top, rgba(14,34,51,.55), transparent 55%);
  opacity: 0; transition: opacity .15s;
}
.card .play::before {
  content: ""; width: 54px; height: 54px; border-radius: 50%; background: var(--mark);
  box-shadow: 0 0 0 4px rgba(255,255,255,.9);
}
.card .play::after {
  content: ""; position: absolute; width: 0; height: 0;
  border-left: 16px solid var(--ink); border-top: 10px solid transparent; border-bottom: 10px solid transparent;
  margin-left: 5px;
}
.card:hover .play, .card:focus-visible .play { opacity: 1; }
.card .title { display: block; margin-top: 10px; font-weight: 600; font-size: .95rem; line-height: 1.35; }
.card:hover .title { color: var(--brand); }
.card.flash .thumb { outline: 4px solid var(--mark); outline-offset: 3px; }

/* ---------- Lecteur ---------- */
dialog.player {
  width: min(960px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 12px; background: #000; overflow: hidden;
}
dialog.player::backdrop { background: rgba(8, 20, 30, .82); }
.player-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 14px; background: var(--ink); color: #fff; }
.player-bar span { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-bar button { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.5); border-radius: 8px; padding: 5px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.player-bar button:hover { background: rgba(255,255,255,.12); }
.player-frame { aspect-ratio: 16 / 9; }
.player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- Adaptation mobile ---------- */
@media (max-width: 960px) {
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 28px; }
  .workshops { grid-template-columns: 1fr; }
  .playlist-list { grid-template-columns: 1fr; }
  .videos-layout { grid-template-columns: 1fr; gap: 8px; }
  .rail {
    position: sticky; top: var(--header-h); z-index: 10; max-height: none; overflow-x: auto;
    background: var(--paper); margin-inline: -20px; padding: 10px 20px; border-bottom: 1px solid var(--line);
  }
  .rail { display: flex; gap: 6px; }
  .rail h2 { display: none; }
  .rail ul { display: contents; }
  .rail li { flex: none; }
  .rail a { margin-left: 0; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); }
  .rail .count { display: none; }
  html { scroll-padding-top: calc(var(--header-h) + 64px); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-toggle {
    display: inline-flex; background: transparent; border: 1.5px solid rgba(255,255,255,.5); color: #fff;
    border-radius: 8px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer;
  }
  .nav { position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--ink); display: none; padding: 8px 20px 16px; }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; }
  .nav a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--mark); border-radius: 0 8px 8px 0; }
  .hero { padding-top: 40px; }
  .steps { grid-template-columns: 1fr; }
  .doc { grid-template-columns: 1fr; gap: 8px; padding: 18px; }
  .doc .actions { justify-content: flex-start; }
  .book { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
