/* ============ Variables de thème ============ */
:root {
  --bg: #faf9f7;
  --bg-card: #fff;
  --bg-card-alt: #f7f7f7;
  --bg-muted: #eee;
  --bg-quote: #f4f3f1;
  --text: #1a1a1a;
  --text-muted: #999;
  --text-muted-2: #777;
  --text-muted-3: #888;
  --border: #eee;
  --avatar-bg: #ddd;
  --accent-bg: #1a1a1a;
  --accent-text: #fff;
  --disabled: #ccc;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a;
    --bg-card: #1e2024;
    --bg-card-alt: #24272b;
    --bg-muted: #2a2d31;
    --bg-quote: #24272b;
    --text: #f1f0ed;
    --text-muted: #9a9a9a;
    --text-muted-2: #aaaaaa;
    --text-muted-3: #9a9a9a;
    --border: #2c2f33;
    --avatar-bg: #33363b;
    --accent-bg: #f1f0ed;
    --accent-text: #15171a;
    --disabled: #4a4d51;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a;
  --bg-card: #1e2024;
  --bg-card-alt: #24272b;
  --bg-muted: #2a2d31;
  --bg-quote: #24272b;
  --text: #f1f0ed;
  --text-muted: #9a9a9a;
  --text-muted-2: #aaaaaa;
  --text-muted-3: #9a9a9a;
  --border: #2c2f33;
  --avatar-bg: #33363b;
  --accent-bg: #f1f0ed;
  --accent-text: #15171a;
  --disabled: #4a4d51;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  padding-bottom: 0;
  transition: background 0.2s ease, color 0.2s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
button { font: inherit; border: none; background: none; cursor: pointer; }

/* ============ Header ============ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-logo { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.site-nav { display: none; gap: 1.5rem; font-size: 0.9rem; }
.site-nav a.is-active { font-weight: 700; }
.header-icons { display: flex; align-items: center; gap: 0.75rem; }
.icon-btn { display: flex; align-items: center; color: var(--text); }
@media (min-width: 900px) {
  .site-nav { display: flex; }
}

/* ============ Boutons / labels communs ============ */
.tag-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  opacity: 0.85;
}
.tag-label-small {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted-3);
  margin: 0.6rem 0 0.25rem;
}
.btn-lire {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.55rem 1.1rem;
  background: #fff;
  color: #111;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  width: fit-content;
}

/* ============ Hero carrousel ============ */
.hero-carousel {
  position: relative;
  margin: 1rem;
  border-radius: 18px;
  overflow: hidden;
  height: 55vh;
  min-height: 320px;
}
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.hero-slide.is-active { opacity: 1; pointer-events: auto; }
.hero-slide img {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; inset: 0;
}
.hero-content {
  position: absolute;
  left: 0; bottom: 0;
  z-index: 1;
  padding: 1.5rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.hero-content h1 { font-size: 1.6rem; line-height: 1.2; margin-bottom: 0.5rem; }
.hero-content p { font-size: 0.9rem; opacity: 0.95; margin: 0; }
.carousel-dots {
  position: absolute;
  right: 1.25rem; bottom: 1.25rem;
  z-index: 2;
  display: flex;
  gap: 0.5rem;
}
.carousel-dots button {
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
  font-weight: 600;
}
.carousel-dots button.is-active { color: #fff; text-decoration: underline; }
@media (min-width: 900px) {
  .hero-content h1 { font-size: 2.4rem; }
  .hero-content p { font-size: 1rem; }
}

/* ============ Derniers articles (grille) ============ */
.derniers-articles { padding: 1.5rem 1rem 0.5rem; }
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-heading h2 { font-size: 1.2rem; }
.voir-tout { font-size: 0.85rem; font-weight: 600; }

.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 700px) { .articles-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .articles-grid { grid-template-columns: repeat(4, 1fr); } }

.article-card { display: flex; flex-direction: column; }
.article-card img { border-radius: 12px; aspect-ratio: 4/3; object-fit: cover; }
.article-card .article-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; margin-top: 0.15rem; }
.article-card .article-date { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ============ Bannière carrousel ============ */
.banniere-carousel {
  position: relative;
  margin: 2rem 1rem 1rem;
  border-radius: 18px;
  overflow: hidden;
  height: 40vh;
  min-height: 260px;
}
.banniere-slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.banniere-slide.is-active { opacity: 1; pointer-events: auto; }
.banniere-slide img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.banniere-content {
  position: absolute; left: 0; bottom: 0; z-index: 1;
  padding: 1.5rem; color: #fff; max-width: 440px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.banniere-content h2 { font-size: 1.4rem; margin-bottom: 0.4rem; }
.banniere-content p { font-size: 0.88rem; margin: 0; opacity: 0.95; }
.carousel-arrows {
  position: absolute; right: 1.25rem; bottom: 1.25rem; z-index: 2;
  display: flex; gap: 0.5rem;
}
.carousel-arrows button {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.85); color: #111;
  display: flex; align-items: center; justify-content: center;
}

/* ============ Pages de catégorie (liste) ============ */
.page-header { padding: 1.5rem 1rem 0.5rem; }
.page-header h1 { font-size: 1.6rem; }
.page-description { color: var(--text-muted-2); margin-top: 0.4rem; }

.articles-list { display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem; }
.article-row {
  display: flex; gap: 1rem; align-items: center;
  background: var(--bg-card); border-radius: 14px; padding: 0.6rem;
}
.article-row img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.article-row-content { display: flex; flex-direction: column; gap: 0.25rem; }
.article-row .article-title { font-weight: 600; font-size: 0.95rem; }
.article-meta, .article-row .article-meta { font-size: 0.78rem; color: var(--text-muted); }

/* ============ Catégories (sommaire) ============ */
.categories-grid {
  display: grid; grid-template-columns: 1fr; gap: 1rem; padding: 1rem;
}
@media (min-width: 700px) { .categories-grid { grid-template-columns: repeat(3, 1fr); } }
.category-tile { position: relative; border-radius: 16px; overflow: hidden; min-height: 200px; }
.category-tile img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.category-tile-label {
  position: relative; z-index: 1; display: inline-block;
  margin: 1rem; padding: 0.5rem 0.9rem;
  background: rgba(255,255,255,0.9); border-radius: 8px;
  font-weight: 700; font-size: 0.95rem; color: #111;
}

/* ============ Galerie (fil photo) ============ */
.filter-tabs {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  padding: 0 1rem 1rem;
}
.filter-tabs button {
  padding: 0.4rem 0.9rem; border-radius: 20px;
  background: var(--bg-muted); color: var(--text); font-size: 0.82rem; font-weight: 600;
}
.filter-tabs button.is-active { background: var(--accent-bg); color: var(--accent-text); }

.fil-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; padding: 0 1rem 1.5rem;
}
@media (min-width: 700px) { .fil-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .fil-grid { grid-template-columns: repeat(4, 1fr); } }
.fil-item { border-radius: 12px; overflow: hidden; aspect-ratio: 1/1; }
.fil-item img { width: 100%; height: 100%; object-fit: cover; }

/* ============ Article ============ */
.article-layout {
  display: flex; flex-direction: column; gap: 2rem;
  padding: 1.5rem 1rem; max-width: 1100px; margin: 0 auto;
}
@media (min-width: 900px) {
  .article-layout { flex-direction: row; align-items: flex-start; }
  .article-single { flex: 1; min-width: 0; }
  .article-sidebar { width: 280px; flex-shrink: 0; }
}
.article-breadcrumb {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem;
}
.article-single h1 { font-size: 1.6rem; line-height: 1.3; margin-bottom: 1rem; }
.article-meta { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.25rem; }
.author-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--avatar-bg); object-fit: cover; flex-shrink: 0; }
.author-name { display: block; font-size: 0.85rem; font-weight: 600; }
.article-meta-sub { display: block; font-size: 0.78rem; color: var(--text-muted); }
.article-image { border-radius: 14px; margin-bottom: 1.5rem; width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.article-body { font-size: 1rem; line-height: 1.7; }
.article-body h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
.article-body blockquote {
  margin: 1.25rem 0; padding: 0.9rem 1.1rem; border-left: 3px solid var(--text);
  font-style: italic; color: var(--text-muted-2); background: var(--bg-quote); border-radius: 0 8px 8px 0;
}
.tags-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
.tag-pill { padding: 0.35rem 0.8rem; background: var(--bg-muted); border-radius: 20px; font-size: 0.78rem; font-weight: 600; }

.article-sidebar h3 { font-size: 1rem; margin-bottom: 0.9rem; }
.sidebar-item { display: flex; gap: 0.75rem; margin-bottom: 0.9rem; }
.sidebar-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.sidebar-item-title { display: block; font-size: 0.85rem; font-weight: 600; line-height: 1.3; }
.sidebar-item-date { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ============ À propos ============ */
.apropos-page { max-width: 700px; margin: 0 auto; padding: 2rem 1rem; }
.apropos-page h1 { font-size: 1.6rem; margin-bottom: 1rem; }

/* ============ Pagination ============ */
.pagination { display: flex; justify-content: center; align-items: center; gap: 1.5rem; padding: 2rem 1rem; font-size: 0.85rem; }
.pagination a { font-weight: 600; }

/* ============ Footer desktop ============ */
.site-footer {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 1.5rem; border-top: 1px solid var(--border); background: var(--bg-card);
}
.site-footer .site-nav { display: flex; }
.social-icons { display: flex; gap: 0.9rem; }
@media (min-width: 900px) { .site-footer { display: flex; } }

/* ============ Nav mobile fixe ============ */
.mobile-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 0.5rem 0.25rem calc(0.5rem + env(safe-area-inset-bottom));
}
.mobile-nav a, .mobile-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  font-size: 0.68rem; color: var(--text-muted-2);
}
body { padding-bottom: 4.5rem; }
@media (min-width: 900px) {
  .mobile-nav { display: none; }
  body { padding-bottom: 0; }
}

/* ============ Colonne d'accueil (main + encadré Galerie) ============ */
.home-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1rem;
}
.home-main { display: flex; flex-direction: column; gap: 0; }
.home-main .hero-carousel,
.home-main .derniers-articles { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }

.galerie-promo {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  align-self: flex-start;
  height: fit-content;
}
.promo-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}
.promo-slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 1.8s ease;
}
.promo-slide.is-active { opacity: 1; }
.promo-slide img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

.galerie-promo-content { padding: 1.1rem 1.1rem 0; }
.galerie-promo-content p { font-size: 0.92rem; line-height: 1.5; margin: 0.4rem 0 0.9rem; color: var(--text-muted-2); }
.btn-lire-dark { background: var(--accent-bg); color: var(--accent-text); }

.social-icons-promo {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  padding: 1.5rem 1.1rem 1.25rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.social-icons-promo a { color: var(--text); }
.social-icons-promo .is-disabled { color: var(--disabled); cursor: default; }

@media (min-width: 1100px) {
  .home-layout { flex-direction: row; align-items: flex-start; }
  .home-main { flex: 1 1 auto; min-width: 0; }
  .galerie-promo { width: 300px; flex-shrink: 0; margin: 1rem 0; }
}

/* ============ Switch mode nuit ============ */
.theme-toggle { padding: 0; line-height: 0; }
.toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #6F00FF;
  padding: 3px;
  transition: background 0.25s ease;
}
.toggle-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6F00FF;
  transform: translateX(0);
  transition: transform 0.25s ease;
}
.toggle-thumb .icon-moon { display: none; }
.toggle-thumb .icon-sun { display: block; }

/* Suit le système si aucun choix manuel n'a été fait */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toggle-track { background: #383c43; }
  :root:not([data-theme="light"]) .toggle-thumb { transform: translateX(22px); color: #383c43; }
  :root:not([data-theme="light"]) .toggle-thumb .icon-sun { display: none; }
  :root:not([data-theme="light"]) .toggle-thumb .icon-moon { display: block; }
}
/* Choix manuel via le switch, prioritaire sur le système */
[data-theme="dark"] .toggle-track { background: #383c43; }
[data-theme="dark"] .toggle-thumb { transform: translateX(22px); color: #383c43; }
[data-theme="dark"] .toggle-thumb .icon-sun { display: none; }
[data-theme="dark"] .toggle-thumb .icon-moon { display: block; }

/* ============ Logo (marque + nom) ============ */
.site-logo { display: flex; align-items: baseline; gap: 0.55rem; }
.logo-mark { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.logo-name { font-size: 0.72rem; font-weight: 300; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted-2); }

/* ============ Case "plus d'articles" (pagination) ============ */
.article-card-more { position: relative; cursor: pointer; }
.stacked-thumbs {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 12px;
  background: var(--bg-muted);
  perspective: 1000px;
}
.stacked-thumb {
  position: absolute;
  width: 62%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}
.stacked-thumb-0 { left: 2%;  top: 18%; z-index: 3; transform: rotateY(0deg)   translateZ(0)     scale(1);    }
.stacked-thumb-1 { left: 20%; top: 12%; z-index: 2; transform: rotateY(-8deg)  translateZ(-30px) scale(0.9);  opacity: 0.9;  }
.stacked-thumb-2 { left: 38%; top: 6%;  z-index: 1; transform: rotateY(-14deg) translateZ(-60px) scale(0.8);  opacity: 0.78; }

@keyframes wave-0 {
  0%, 100% { transform: rotateY(0deg) translateZ(0) scale(1) translateY(0); }
  50% { transform: rotateY(0deg) translateZ(0) scale(1.05) translateY(-12px); }
}
@keyframes wave-1 {
  0%, 100% { transform: rotateY(-8deg) translateZ(-30px) scale(0.9) translateY(0); }
  50% { transform: rotateY(-8deg) translateZ(-30px) scale(0.98) translateY(-12px); }
}
@keyframes wave-2 {
  0%, 100% { transform: rotateY(-14deg) translateZ(-60px) scale(0.8) translateY(0); }
  50% { transform: rotateY(-14deg) translateZ(-60px) scale(0.9) translateY(-12px); }
}
.article-card-more:hover .stacked-thumb-0 { animation: wave-0 1s ease-in-out infinite; }
.article-card-more:hover .stacked-thumb-1 { animation: wave-1 1s ease-in-out infinite 0.18s; }
.article-card-more:hover .stacked-thumb-2 { animation: wave-2 1s ease-in-out infinite 0.36s; }
.article-card-more:hover .stacked-thumb-0 { animation: wave-0 3s ease-in-out infinite; }
.article-card-more:hover .stacked-thumb-1 { animation: wave-1 3s ease-in-out infinite; }
.article-card-more:hover .stacked-thumb-2 { animation: wave-2 3s ease-in-out infinite; }

.article-card-more .article-title { margin-top: 0.85rem; }

/* ============ Bouton partager ============ */
.article-actions {
  display: flex; align-items: center; gap: 0.75rem;
  margin-top: 1.5rem;
}
.share-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg-muted); border-radius: 20px;
  font-size: 0.82rem; font-weight: 600; color: var(--text);
}
