/* En Avant ! Ca Kanam — couche « 2026 » : en-tête flottant, cartes statistiques,
   bandeau défilant, animations liées au défilement, bascule clair/sombre, ajouts CMS. */

:root { --radius-lg: 24px; --header-h: 64px; --header-top: calc(env(safe-area-inset-top, 0px) + 12px); }

/* ---------- En-tête flottant ---------- */
.site-header {
  position: fixed; left: 0; right: 0; top: var(--header-top);
  background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  transition: top .3s ease;
}
body::before { height: calc(env(safe-area-inset-top, 0px)); }
.site-header .wrap {
  height: var(--header-h); padding: 0 10px 0 12px; border-radius: 999px;
  background: rgba(6, 20, 47, .62); border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  box-shadow: 0 10px 40px -18px rgba(0, 0, 0, .55);
  transition: background .3s ease, box-shadow .3s ease;
}
.site-header.scrolled .wrap { background: rgba(6, 20, 47, .9); box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .6); }
.brand img { width: 42px; height: 42px; }
.nav a { border-radius: 999px; padding: 9px 14px; }
.nav .btn { margin-left: 6px; }
html { scroll-padding-top: calc(var(--header-h) + 36px); }

.theme-toggle {
  width: 42px; height: 42px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); color: #fff; margin-left: 6px;
}
.nav { order: 2; } .theme-toggle { order: 3; } .menu-toggle { order: 4; }
@media (max-width: 960px) { .theme-toggle { margin-left: auto; } .site-header .menu-toggle { margin-left: 0; } }
.theme-toggle:hover { background: rgba(255, 255, 255, .16); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

@media (max-width: 960px) {
  .menu-toggle { margin-left: auto; width: 42px; height: 42px; border-radius: 50%; }
  .theme-toggle { margin-left: 0; }
  .site-header .wrap { gap: 8px; }
  .nav {
    inset: calc(var(--header-top) + var(--header-h) + 10px) max(12px, env(safe-area-inset-right, 0px)) auto max(12px, env(safe-area-inset-left, 0px));
    border-radius: 24px; border: 1px solid rgba(255, 255, 255, .14); border-bottom: 3px solid var(--gold);
    background: rgba(6, 20, 47, .96); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    padding: 12px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
    max-height: calc(100dvh - var(--header-h) - 48px);
  }
  .nav a { border-radius: 14px; }
}
.brand { flex: 0 1 auto; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .brand-name small { display: none; } .brand-name { font-size: .9rem; } .brand img { width: 36px; height: 36px; } }

/* ---------- Héros ---------- */
.hero { padding-top: calc(var(--header-top) + var(--header-h) + clamp(40px, 6vw, 72px)); }
.hero::after {
  content: ""; position: absolute; z-index: -1; inset: -20%; pointer-events: none;
  background:
    radial-gradient(35% 30% at 78% 30%, rgba(58, 160, 240, .55), transparent 70%),
    radial-gradient(25% 25% at 62% 85%, rgba(242, 183, 5, .22), transparent 70%),
    radial-gradient(30% 30% at 15% 20%, rgba(21, 80, 200, .45), transparent 70%);
  filter: blur(20px);
}
@media (prefers-reduced-motion: no-preference) {
  .hero::after { animation: drift 18s ease-in-out infinite alternate; }
}
@keyframes drift { to { transform: translate3d(-4%, 3%, 0) scale(1.06); } }
.hero-visual::before {
  content: ""; position: absolute; left: 50%; bottom: 8%; width: 86%; aspect-ratio: 1; transform: translateX(-46%);
  border-radius: 50%; border: 2px solid rgba(242, 183, 5, .55);
  box-shadow: 0 0 80px 10px rgba(58, 160, 240, .25), inset 0 0 60px rgba(58, 160, 240, .25);
}
.hero-visual .portrait { position: relative; }
.hero-badge { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); background: rgba(6, 20, 47, .82); }
.hero h1 .gold {
  background: linear-gradient(100deg, #ffd34d 0%, var(--gold) 40%, #ffe9a3 55%, var(--gold) 70%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
  .hero h1 .gold { animation: shine 6s ease-in-out infinite; }
}
@keyframes shine { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  transition: transform .6s ease;
}
.btn:hover::after { transform: translateX(120%); }

/* ---------- Cartes statistiques (remplacent le bandeau jaune) ---------- */
.strip { background: transparent; color: var(--fg); position: relative; z-index: 2; margin-top: -34px; }
.strip .wrap { gap: 16px; }
.strip-item, .strip-item + .strip-item {
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface);
  box-shadow: 0 20px 50px -28px rgba(10, 31, 77, .55); padding: 18px 20px;
}
.strip-item svg { width: 48px; height: 48px; padding: 11px; border-radius: 14px; background: var(--gold); color: var(--navy-deep); }
.strip-item span { color: var(--muted); }
@media (max-width: 760px) { .strip .wrap { gap: 10px; } .strip-item, .strip-item + .strip-item { padding: 14px 16px; border-top: 1px solid var(--line); } }

/* ---------- Bandeau défilant ---------- */
.marquee { overflow: hidden; padding-block: 26px 0; }
.marquee-track { display: flex; width: max-content; gap: 0; }
.marquee-track span {
  display: inline-flex; align-items: center; gap: 28px; padding-right: 28px; white-space: nowrap;
  font-family: var(--f-display); font-weight: 900; font-style: italic; font-stretch: 115%; text-transform: uppercase;
  font-size: clamp(1.4rem, 3.4vw, 2.4rem); color: transparent; -webkit-text-stroke: 1.5px var(--accent-text);
}
.marquee-track span::after { content: "✦"; color: var(--gold); -webkit-text-stroke: 0; font-style: normal; }
.marquee-track span:nth-child(even) { color: var(--accent-text); -webkit-text-stroke: 0; }
@media (prefers-reduced-motion: no-preference) {
  .marquee-track { animation: marquee 38s linear infinite; }
}
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee + .president { padding-top: clamp(48px, 7vw, 88px); }

/* ---------- Titres de section ---------- */
.section-title { position: relative; }
.section-head .section-title::after {
  content: ""; display: block; width: 72px; height: 6px; margin-top: 16px; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold), var(--sky));
}

/* ---------- Cartes ---------- */
.prog, .news, .c-card, .media-item, .form-card { border-radius: var(--radius-lg); }
.prog { box-shadow: 0 24px 60px -36px rgba(10, 31, 77, .55); transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease, border-color .35s; }
.prog:hover { transform: translateY(-6px); box-shadow: 0 34px 70px -34px rgba(10, 31, 77, .6); border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); }
.prog-media img { transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.prog:hover .prog-media img { transform: scale(1.06); }
.prog-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(6, 20, 47, .45)); pointer-events: none; }
.prog-num { z-index: 1; border-radius: 14px 14px 0 0; }
.c-card { transition: transform .3s ease, border-color .3s ease; }
.c-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); }
.fact { border-radius: 16px; }
.president-photo .frame { border-radius: 32px; }
.president-photo::after { border-radius: 32px; }
blockquote.quote { border-radius: 20px; background: linear-gradient(135deg, var(--navy), var(--royal)); }

/* ---------- Animations liées au défilement (navigateurs récents ; contenu visible sinon) ---------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .prog, .news, .c-card, .media-item, .fact, .section-head, .president-photo, .form-card {
      animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 60%;
    }
  }
}
@keyframes reveal { from { transform: translateY(40px) scale(.97); } to { transform: none; } }

/* ---------- Ajouts CMS ---------- */
.prog-grid.count-4 .prog, .prog-grid.count-2 .prog { grid-column: span 3; }
.prog-grid.count-1 .prog { grid-column: 1 / -1; }
.prog-grid.count-3 .prog, .prog-grid.count-6 .prog { grid-column: span 2; }
@media (max-width: 1000px) {
  .prog-grid[class] .prog { grid-column: span 1; }
  .prog-grid.count-5 .prog:last-child, .prog-grid.count-3 .prog:last-child, .prog-grid.count-1 .prog { grid-column: 1 / -1; }
}
@media (max-width: 640px) { .prog-grid[class] .prog { grid-column: auto; } }

.bio { display: grid; gap: 14px; color: var(--muted); font-size: 1.05rem; max-width: 65ch; }
.bio strong { color: var(--fg); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.news-media.is-video { aspect-ratio: auto; background: #000; }
.news-media video { width: 100%; display: block; aspect-ratio: 16 / 9; background: #000; }
.news-more summary { cursor: pointer; color: var(--accent-text); font-weight: 700; margin-top: 4px; }
.news-full { display: grid; gap: 10px; margin-top: 10px; color: var(--muted); }
.news { transition: transform .3s ease; }
.news:hover { transform: translateY(-4px); }

.embed { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.medias { background: var(--surface-2); }
.actualites + .medias { background: var(--surface-2); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.media-item { margin: 0; background: var(--surface); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.media-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; transition: transform .6s ease; }
.media-zoom { display: block; overflow: hidden; }
.media-zoom:hover img { transform: scale(1.04); }
.media-item video { width: 100%; aspect-ratio: 16 / 9; background: #000; display: block; }
.media-item figcaption { padding: 14px 18px; font-weight: 600; font-size: .95rem; }
.media-item .link-arrow { padding: 18px 16px 0; }

.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.socials a { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; font-weight: 700; font-size: .88rem; }
.socials a:hover { border-color: var(--accent-text); }
.contact { background: var(--bg); }
.medias + .contact, .actualites + .contact { background: var(--bg); }
