:root {
  --bg: #08192b;
  --bg-deep: #061321;
  --player-bg: #001C2E;
  --accent: #FFC72C;
  --accent-hover: #FFD766;
  --text: #E8F1F8;
  --text-white: #FFFFFF;
  --muted: #8FB2CE;
  --muted-2: #A8C6E0;
  --mono-dim: #6E97B7;
  --mono-dimmer: #5B84A4;
  --disabled: #7EA1BE;
  --rule: rgba(168, 198, 224, .16);
  --border: rgba(168, 198, 224, .18);
  --border-2: rgba(168, 198, 224, .22);
  --hover-row: rgba(168, 198, 224, .07);
  --active-row: rgba(255, 199, 44, .1);
  --chip-bg: rgba(168, 198, 224, .12);

  /* Marge horizontale commune à tous les sites de Ludoc : 72 px, puis tout ce
     qui dépasse 1200 px de contenu. Le menu du header tombe ainsi au même
     endroit d'un site à l'autre. */
  --pad: max(72px, (100% - 1200px) / 2);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--bg); }

body {
  font-family: 'Barlow', sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent); color: var(--bg); }

img { max-width: 100%; }

.sb { scrollbar-width: thin; scrollbar-color: rgba(168, 198, 224, .22) transparent; }
.sb::-webkit-scrollbar { width: 8px; }
.sb::-webkit-scrollbar-thumb { background: rgba(168, 198, 224, .22); border-radius: 8px; }
.sb::-webkit-scrollbar-track { background: transparent; }

@keyframes bookFloat {
  0%, 100% { transform: rotateY(-20deg) rotateX(4deg) translateY(0); }
  50%      { transform: rotateY(-14deg) rotateX(2deg) translateY(-14px); }
}
@keyframes bookShadow {
  0%, 100% { transform: scaleX(1); opacity: .5; }
  50%      { transform: scaleX(.88); opacity: .32; }
}

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: center; gap: 34px;
  padding: 0 var(--pad); height: 76px; border-bottom: 1px solid var(--rule);
  background: var(--bg-deep); position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(6px);
}

/* Menu inter-sites, identique sur tous les sites de Ludoc. */
.site-nav { display: flex; align-items: center; justify-content: center; gap: 34px; }
.site-nav a {
  font-family: 'Barlow Condensed', 'Barlow Semi Condensed', sans-serif;
  font-weight: 600; font-size: 17px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); transition: color .2s ease;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.is-active {
  font-weight: 700; color: var(--accent);
  border-bottom: 2px solid var(--accent); padding-bottom: 3px;
}
.site-nav a.is-active:hover { color: var(--accent); }
/* Manuel mis en avant : pilule à la couleur du texte. */
.site-nav a.nav-manuel { border: 1px solid currentColor; border-radius: 999px; padding: 6px calc(14px - 0.16em) 6px 14px; }
.site-nav a.nav-manuel.is-active { border-bottom: 1px solid currentColor; padding-bottom: 6px; }

.site-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-outline {
  font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; font-size: 13px; color: var(--text-white);
  padding: 9px 16px; border: 1px solid var(--border-2); border-radius: 3px;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-solid {
  font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; font-size: 13px; color: var(--bg);
  background: var(--accent); padding: 10px 16px; border-radius: 3px;
}
.btn-solid:hover { background: var(--accent-hover); color: var(--bg); }

/* ---------- Chevron labels ---------- */
.chevron {
  display: inline-block;
  font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700;
  text-transform: uppercase;
}
.chevron-accent {
  position: relative;
  background: var(--accent); color: var(--bg);
  font-size: 14px; letter-spacing: .14em;
  padding: 11px 18px;
  border-radius: 10px 0 0 10px; margin-right: 15px;
}
.chevron-accent::after {
  content: ""; position: absolute; left: 100%; top: 0; bottom: 0; width: 15px;
  background: var(--accent); clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.chevron-accent.chevron-sm {
  font-size: 13px; letter-spacing: .16em; padding: 6px 13px;
  border-radius: 9px 0 0 9px; margin-right: 13px;
}
.chevron-accent.chevron-sm::after { width: 13px; }
.chevron-chip {
  position: relative;
  background: var(--chip-bg); color: var(--text);
  font-size: 14px; letter-spacing: .18em;
  padding: 6px 12px;
  border-radius: 8px 0 0 8px; margin-right: 10px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}

/* ---------- Home ---------- */
.home-main { padding: 56px var(--pad) 72px; width: 100%; }
.home-h1 {
  font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700;
  font-size: 52px; line-height: 1.04; margin: 0 0 12px; text-transform: uppercase;
  letter-spacing: -.005em;
}
.home-h1 span { color: var(--accent); display: block; white-space: nowrap; font-size: 46px; }
.home-sub { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.5; white-space: nowrap; }

.section-divider { display: flex; align-items: baseline; gap: 14px; margin: 52px 0 20px; }
.rule-line { flex: 1; height: 1px; background: var(--rule); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px;
}
.card { cursor: pointer; display: flex; flex-direction: column; gap: 14px; color: inherit; }
.card-thumb {
  position: relative; border-radius: 5px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-deep); aspect-ratio: 16/9;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
/* Survol : contour jaune épaissi et léger zoom de l'image, comme sur le setup. */
.card:hover .card-thumb,
.card:focus-visible .card-thumb { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.card:hover .card-thumb img,
.card:focus-visible .card-thumb img { transform: scale(1.05); }
.card-duration {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(0, 10, 18, .82); color: var(--text-white);
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .02em;
  padding: 4px 8px; border-radius: 2px;
}
.card-hover {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 20, 36, .55); opacity: 0; transition: opacity .18s ease;
}
.card:hover .card-hover { opacity: 1; }
.play-btn {
  width: 66px; height: 66px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(0, 8, 16, .5);
}
.play-triangle {
  width: 0; height: 0; margin-left: 5px;
  border-left: 20px solid var(--bg); border-top: 13px solid transparent; border-bottom: 13px solid transparent;
}
.card-meta { display: flex; flex-direction: column; gap: 6px; }
.card-title {
  font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700;
  font-size: 22px; line-height: 1.14; text-transform: uppercase; color: var(--text);
}
.card-url, .card-desc { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--mono-dim); line-height: 1.4; }

/* ---------- Book block (home) ---------- */
.book-block {
  display: flex; align-items: center; gap: 34px; margin-top: 72px;
  padding: 28px 34px; background: var(--bg-deep); border: 1px solid var(--border);
  border-radius: 5px; color: inherit;
}
.book-block:hover { border-color: var(--accent); }
.book-3d-wrap { flex: 0 0 auto; perspective: 1400px; padding: 22px 30px 34px 14px; }
.book-3d { position: relative; transform-style: preserve-3d; animation: bookFloat 7s ease-in-out infinite; will-change: transform; }
.book-cover {
  width: 168px; height: auto; display: block; border-radius: 2px 4px 4px 2px;
  box-shadow: 26px 26px 48px rgba(0, 8, 16, .62), 0 0 0 1px rgba(168, 198, 224, .14);
}
.book-pages {
  position: absolute; top: 2px; right: -9px; bottom: 2px; width: 10px; border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #d8d3c6 0%, #f3efe6 35%, #cfc9bb 70%, #b8b2a4 100%);
  transform: rotateY(14deg); transform-origin: left center;
}
.book-spine-shadow {
  position: absolute; left: 0; top: 0; bottom: 0; width: 14px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0));
  border-radius: 2px 0 0 2px; pointer-events: none;
}
.book-floor-shadow {
  position: absolute; left: 8%; right: -4%; bottom: -26px; height: 22px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 6, 12, .75), rgba(0, 6, 12, 0) 70%);
  filter: blur(6px); animation: bookShadow 7s ease-in-out infinite;
}
.book-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.book-kicker { font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.book-title { font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700; font-size: 30px; line-height: 1.08; text-transform: uppercase; color: var(--text); }
.book-desc { color: var(--muted); font-size: 16px; line-height: 1.5; max-width: 46ch; }
.book-block .chevron { margin-top: 8px; align-self: flex-start; }

/* ---------- Watch layout ---------- */
.watch-layout { display: flex; align-items: stretch; flex: 1; min-height: 0; }

.sidebar {
  width: 330px; flex: 0 0 330px; border-right: 1px solid var(--rule);
  background: var(--bg-deep); padding: 24px 0 40px; overflow-y: auto;
  max-height: calc(100vh - 79px);
}
.sidebar-heading {
  font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700; font-size: 13px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 0 22px 16px;
}
.sidebar-heading-bonus { margin-top: 10px; padding-top: 20px; border-top: 1px solid var(--rule); }
.row { display: flex; align-items: center; gap: 13px; border-left: 3px solid transparent; text-decoration: none; }
.row:hover { background: var(--hover-row) !important; }
.row-chapter { padding: 11px 22px; cursor: pointer; }
.row-disabled { cursor: default; }
.row-disabled:hover { background: transparent !important; }
.row-num {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 500;
  width: 28px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 2px;
  flex: 0 0 28px;
}
.row-title { flex: 1; font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 600; font-size: 17px; letter-spacing: .01em; text-transform: uppercase; }
.row-note { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--mono-dimmer); white-space: nowrap; }
.row-video { padding: 9px 22px 9px 66px; cursor: pointer; }
.row-bonus.row-video { padding: 11px 22px; gap: 13px; }
.row-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; }
.row-video-title { flex: 1; font-size: 15px; line-height: 1.25; }
.row-video-duration { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--mono-dimmer); }

.sidebar-book {
  display: flex; align-items: center; gap: 14px; margin: 26px 22px 0; padding-top: 22px;
  border-top: 1px solid var(--rule); color: inherit;
}
.sidebar-book:hover { opacity: .8; }
.sidebar-book img { width: 58px; height: auto; display: block; border-radius: 2px; }
.book-kicker-sm { font-size: 11px; }
.book-title-sm { font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 600; font-size: 16px; line-height: 1.12; text-transform: uppercase; color: var(--text); margin-top: 4px; }

.watch-main { flex: 1; min-width: 0; padding: 30px 34px 44px; display: flex; flex-direction: column; gap: 22px; }
.watch-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.watch-head-left { min-width: 0; }
.watch-title { font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700; font-size: 38px; line-height: 1.06; margin: 14px 0 0; text-transform: uppercase; }
.watch-slug { display: flex; align-items: center; gap: 12px; margin-top: 9px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--mono-dim); }
.watch-nav { display: flex; gap: 10px; flex: 0 0 auto; }
.nav-btn {
  display: flex; align-items: center; gap: 9px;
  font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 600; font-size: 13px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted-2); border: 1px solid var(--border-2); border-radius: 3px; padding: 10px 15px;
}
.nav-btn:hover { border-color: var(--accent); color: var(--accent); }

.player-row { display: flex; align-items: stretch; gap: 20px; min-width: 0; }

.player {
  flex: 1; min-width: 0; aspect-ratio: 16/9; background: var(--player-bg); border: 1px solid var(--border);
  border-radius: 5px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 12, 20, .45);
}
.player iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- Chapters panel ("Dans cette vidéo") ---------- */
.chapters-panel {
  flex: 0 0 296px; display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 5px; background: var(--bg-deep); overflow: hidden;
}
.chapters-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 16px; border-bottom: 1px solid var(--rule);
}
.chapters-panel-title {
  font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700; font-size: 13px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.chapters-panel-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--mono-dimmer); }
.chapters-panel-list { flex: 1; overflow-y: auto; padding: 6px 0 10px; }

.watch-desc { max-width: 78ch; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.mark-row {
  display: flex; align-items: baseline; gap: 12px; width: 100%; padding: 9px 16px;
  cursor: pointer; border: 0; border-left: 3px solid transparent; background: transparent;
  font: inherit; text-align: left; color: inherit;
}
.mark-row:hover { background: var(--hover-row); }
.mark-time { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 500; color: var(--mono-dim); flex: 0 0 auto; }
.mark-label { flex: 1; font-size: 15px; line-height: 1.3; color: var(--muted-2); }
.mark-row.is-active { border-left-color: var(--accent); background: var(--active-row); }
.mark-row.is-active .mark-time { color: var(--accent); }
.mark-row.is-active .mark-label { color: var(--text-white); }

.sidebar-desktop { display: contents; }
.mobile-toc { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { :root { --pad: 40px; } }

@media (max-width: 860px) {
  :root { --pad: 16px; }
  .site-header {
    height: auto; padding: 10px 16px 12px; gap: 10px;
    flex-direction: column; align-items: stretch;
  }
  .site-nav { justify-content: space-between; gap: 8px; }
  .site-nav a { font-size: 14px; letter-spacing: .1em; }
  .site-nav a.nav-manuel { padding: 4px calc(9px - 0.1em) 4px 9px; }
  .site-nav a.is-active { padding-bottom: 2px; }
  .site-header .btn-solid { text-align: center; }
  .site-header .brand .label { font-size: 11px; }

  .home-main { padding: 32px var(--pad) 48px; }
  .home-h1 { font-size: 34px; }
  .home-h1 span { font-size: 28px; white-space: normal; }
  .home-sub { white-space: normal; font-size: 15px; }
  .card-grid { grid-template-columns: 1fr; }

  .book-block { flex-direction: column; align-items: flex-start; gap: 20px; padding: 22px; margin-top: 48px; }
  .book-3d-wrap { padding: 10px 24px 24px 10px; }

  .watch-layout { flex-direction: column; }
  .sidebar-desktop { display: none; }
  .watch-main { padding: 18px 16px 32px; order: 1; }
  .watch-title { font-size: 26px; }
  .watch-head { flex-direction: column; align-items: flex-start; gap: 14px; order: 1; }
  .player-row { order: 0; }

  .player-row { flex-direction: column; }
  .chapters-panel { flex: 0 0 auto; max-height: 260px; }

  .mobile-toc { display: block; order: 2; }
  .mobile-toc summary {
    cursor: pointer; list-style: none;
    font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 700; font-size: 13px;
    letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
    padding: 16px 16px; border-top: 1px solid var(--rule); background: var(--bg-deep);
  }
  .mobile-toc summary::-webkit-details-marker { display: none; }
  .mobile-toc summary::after { content: ' ▾'; }
  .mobile-toc[open] summary::after { content: ' ▴'; }
  .mobile-toc .sidebar { width: 100%; flex: none; max-height: none; border-right: 0; }
  .mobile-toc .sidebar-heading { display: none; }
}
