/*
Theme Name: Les Hobbies d'Alex
Template: twentytwentyfour
Author: Studio
Description: Thème galerie sur mesure — plongées, modélisme, paysage & nature. Conçu comme un espace d'exposition : murs calmes, photos qui portent la couleur, un accent par univers.
Version: 2.3.6
Requires at least: 6.4
Tested up to: 7.0
License: GNU General Public License v2 or later
Text Domain: hobbies-alex
*/

/* =================================================================
   1. TOKENS
   ================================================================= */
:root {
  /* Accents par univers */
  --plongees:        #1A6FA3;
  --plongees-deep:   #0B3F66;
  --plongees-bright: #2FA6C8;
  --plongees-wash:   #E7F2F9;

  --modelisme:       #7A6A52;
  --modelisme-deep:  #43392B;
  --modelisme-bright:#A89172;
  --modelisme-wash:  #F2EEE6;

  --paysage:         #3C7A45;
  --paysage-deep:    #1F4A28;
  --paysage-bright:  #5FA86A;
  --paysage-wash:    #E8F1E9;

  /* Neutres */
  --base:     #FBFAF7;
  --surface:  #FFFFFF;
  --ink:      #1C1B19;
  --muted:    #6B6862;
  --faint:    #9A968E;
  --line:     #E8E5DE;
  --line-soft:#F0EEE8;

  /* Type */
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans:  system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Mesures */
  --content: 1040px;
  --radius:  14px;
  --radius-s: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =================================================================
   2. BASE
   ================================================================= */
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.wp-singular {
  background: var(--base);
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
}

a { color: var(--ink); }

::selection {
  background: var(--plongees-wash);
  color: var(--plongees-deep);
}

/* Focus visible — accessibilité */
a:focus-visible,
button:focus-visible,
.hobbies-portal:focus-visible {
  outline: 2px solid var(--plongees);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =================================================================
   3. EN-TÊTE
   ================================================================= */
.wp-site-blocks > header,
header.wp-block-template-part {
  background: rgba(251, 250, 247, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.wp-block-site-title {
  font-family: var(--serif) !important;
  font-size: 1.25rem !important;
  font-weight: 400 !important;
  letter-spacing: -0.01em;
}

.wp-block-site-title a {
  color: var(--ink) !important;
  text-decoration: none !important;
}

.wp-block-navigation {
  font-family: var(--sans);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

/* Un peu plus d'air entre les liens du menu */
.wp-block-navigation:not(.is-responsive) > .wp-block-navigation__container,
.wp-block-navigation .wp-block-navigation__container {
  gap: 0.6em 1.6em;
}

.wp-block-navigation .wp-block-navigation-item__content {
  color: var(--muted) !important;
  text-decoration: none !important;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.wp-block-navigation .wp-block-navigation-item__content:hover,
.wp-block-navigation .current-menu-item .wp-block-navigation-item__content {
  color: var(--ink) !important;
  border-bottom-color: var(--ink);
}

/* =================================================================
   4. PAGE D'ACCUEIL
   ================================================================= */
.hobbies-home {
  font-family: var(--sans);
}

/* --- Hero --- */
.hobbies-hero {
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5.5rem) 1.5rem clamp(1.5rem, 3vw, 2.5rem);
}

.hobbies-hero .eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.1rem;
}

.hobbies-hero h1 {
  font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.3rem);
  line-height: 1.08;
  margin: 0 0 0.9rem;
}

.hobbies-hero p {
  font-size: 1.08rem;
  color: var(--muted);
  margin: 0;
  max-width: 30em;
  margin-inline: auto;
}

/* --- Les trois portails --- */
.hobbies-portals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  max-width: var(--content);
  margin: clamp(2rem, 4vw, 3.5rem) auto 0;
  padding: 0 1.5rem;
}

.hobbies-portal {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none !important;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), border-color 0.5s var(--ease);
  will-change: transform;
}

.hobbies-portal:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px -18px rgba(28, 27, 25, 0.32);
  border-color: transparent;
}

.portal-visual {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 18px 20px;
}

/* Dégradés évoquant chaque univers */
.portal-visual.plongees {
  background:
    radial-gradient(120% 80% at 70% 0%, rgba(47,166,200,0.55) 0%, transparent 55%),
    linear-gradient(165deg, var(--plongees-deep) 0%, var(--plongees) 70%, var(--plongees-bright) 100%);
}
.portal-visual.modelisme {
  background:
    radial-gradient(120% 80% at 75% 5%, rgba(168,145,114,0.45) 0%, transparent 55%),
    linear-gradient(165deg, var(--modelisme-deep) 0%, var(--modelisme) 72%, var(--modelisme-bright) 100%);
}
.portal-visual.paysage {
  background:
    radial-gradient(120% 80% at 72% 0%, rgba(95,168,106,0.5) 0%, transparent 55%),
    linear-gradient(165deg, var(--paysage-deep) 0%, var(--paysage) 70%, var(--paysage-bright) 100%);
}

/* Si une image de couverture est définie, elle prend le dessus */
.portal-visual.has-cover {
  background-size: cover;
  background-position: center;
}
.portal-visual.has-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(15,20,25,0.6) 100%);
}

.portal-icon {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 30px;
  line-height: 1;
  opacity: 0.5;
  filter: saturate(0) brightness(2.2);
  z-index: 2;
}

.portal-name {
  position: relative;
  z-index: 2;
  color: #fff;
  font-family: var(--sans);
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 12px rgba(0,0,0,0.25);
}

.portal-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.portal-desc {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
  flex: 1;
}

.portal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-count {
  font-size: 0.8rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.portal-go {
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: gap 0.3s var(--ease);
}
.plongees-ink  { color: var(--plongees); }
.modelisme-ink { color: var(--modelisme); }
.paysage-ink   { color: var(--paysage); }

.hobbies-portal:hover .portal-go { gap: 10px; }

/* --- Derniers ajouts --- */
.hobbies-recent {
  max-width: var(--content);
  margin: clamp(3rem, 6vw, 5rem) auto clamp(3rem, 6vw, 5rem);
  padding: 0 1.5rem;
}

.recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.7rem;
  margin-bottom: 1.4rem;
}

.recent-head h2 {
  font-size: 1.5rem;
  margin: 0;
}

.recent-head .count {
  font-size: 0.82rem;
  color: var(--faint);
  font-family: var(--sans);
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.recent-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--line-soft);
  display: block;
  text-decoration: none !important;
}

.recent-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s var(--ease);
}

.recent-cell:hover img {
  transform: scale(1.06);
}

.recent-cell .badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 20px;
  color: #fff;
  backdrop-filter: blur(4px);
}
.badge.plongees  { background: rgba(26,111,163,0.86); }
.badge.modelisme { background: rgba(67,57,43,0.86); }
.badge.paysage   { background: rgba(31,74,40,0.86); }

.recent-cell::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(10,12,14,0.32) 100%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.recent-cell:hover::after { opacity: 1; }

.recent-empty {
  text-align: center;
  color: var(--faint);
  font-size: 0.95rem;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* =================================================================
   5. PAGES THÈMES
   ================================================================= */
.theme-banner {
  position: relative;
  margin: 0 0 clamp(0.75rem, 1.5vw, 1.25rem);
  border-radius: 0;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: flex-end;
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

/* Largeur pleine même dans une mise en page contrainte */
.theme-banner.alignfull { width: 100vw; margin-inline: calc(50% - 50vw); }

.theme-banner.plongees {
  background:
    radial-gradient(90% 120% at 80% 0%, rgba(47,166,200,0.5) 0%, transparent 60%),
    linear-gradient(150deg, var(--plongees-deep) 0%, var(--plongees) 75%, var(--plongees-bright) 100%);
}
.theme-banner.modelisme {
  background:
    radial-gradient(90% 120% at 80% 0%, rgba(168,145,114,0.45) 0%, transparent 60%),
    linear-gradient(150deg, var(--modelisme-deep) 0%, var(--modelisme) 75%, var(--modelisme-bright) 100%);
}
.theme-banner.paysage {
  background:
    radial-gradient(90% 120% at 78% 0%, rgba(95,168,106,0.5) 0%, transparent 60%),
    linear-gradient(150deg, var(--paysage-deep) 0%, var(--paysage) 75%, var(--paysage-bright) 100%);
}

.theme-banner-inner {
  position: relative;
  z-index: 2;
  max-width: var(--content);
  margin: 0 auto;
  width: 100%;
}

.theme-banner .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.8);
  font-family: var(--sans);
  font-size: 0.84rem;
  text-decoration: none;
  margin-bottom: 0.8rem;
  transition: color 0.25s var(--ease);
}
.theme-banner .back:hover { color: #fff; }

.theme-banner h1 {
  color: #fff;
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3rem);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.25);
}

.theme-banner .icon {
  font-size: 0.9em;
  filter: saturate(0) brightness(2.4);
  opacity: 0.85;
}

.theme-intro {
  max-width: var(--content);
  margin: 0 auto clamp(0.75rem, 1.5vw, 1rem);
  padding: 0 1.5rem;
  font-family: var(--sans);
  color: var(--muted);
  font-size: 1.05rem;
}

/* Masquer le titre WordPress par défaut quand on utilise le bandeau */
.has-theme-banner .wp-block-post-title { display: none; }

/* Sur l'accueil : masquer le titre « Accueil » (le héros fait office
   de titre) et coller le héros pleine largeur juste sous l'en-tête. */
.has-hobbies-home .wp-block-post-title { display: none; }
.has-hobbies-home .hobbies-hero.has-image { margin-top: 0; }
.has-hobbies-home .wp-block-post-content > .hobbies-home:first-child { margin-top: 0; }

/* =================================================================
   6. GALERIES MODULA
   ================================================================= */
.modula-gallery,
.modula.modula-gallery {
  margin: 0 auto clamp(2rem, 4vw, 3rem) !important;
  max-width: var(--content);
}

.modula-items .modula-item,
.modula-item {
  border-radius: var(--radius-s) !important;
  overflow: hidden !important;
}

.modula-item img,
.modula-item .modula-item-content img {
  transition: transform 0.7s var(--ease) !important;
}

.modula-item:hover img {
  transform: scale(1.05);
}

/* Légendes plus sobres */
.modula-item-caption,
.modula-item figcaption {
  font-family: var(--sans) !important;
  font-size: 0.82rem !important;
  letter-spacing: 0.01em;
}

/* Masquer le lien d'édition pour les visiteurs déconnectés
   (géré aussi côté PHP, ceinture + bretelles) */
body:not(.logged-in) .modula-gallery + a[href*="action=edit"],
body:not(.logged-in) a.modula-edit-link { display: none !important; }

/* =================================================================
   7. PIED DE PAGE
   ================================================================= */
.wp-site-blocks > footer,
footer.wp-block-template-part {
  border-top: 1px solid var(--line);
  margin-top: clamp(3rem, 6vw, 5rem);
  padding: clamp(2rem, 4vw, 3rem) 1.5rem;
  background: var(--base);
}

.hobbies-footer {
  max-width: var(--content);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--sans);
}

.hobbies-footer .brand {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
}

.hobbies-footer nav {
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.hobbies-footer nav a {
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}
.hobbies-footer nav a:hover { color: var(--ink); }

.hobbies-footer .copy {
  font-size: 0.8rem;
  color: var(--faint);
  width: 100%;
  border-top: 1px solid var(--line-soft);
  padding-top: 1rem;
  margin-top: 0.4rem;
}

/* =================================================================
   6b. SECTION VIDÉOS
   ================================================================= */
.hobbies-videos {
  max-width: var(--content);
  margin: 0 auto clamp(2rem, 4vw, 3rem);
  padding: 0 1.5rem;
}

.videos-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.7rem;
  margin-bottom: 1.4rem;
}

.videos-head h2 {
  font-size: 1.5rem;
  margin: 0;
}

.videos-head .count {
  font-size: 0.8rem;
  color: #fff;
  background: var(--ink);
  border-radius: 20px;
  padding: 1px 10px;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}

/* Pastille de comptage colorée selon l'univers */
.hobbies-videos.v-plongees  .count { background: var(--plongees); }
.hobbies-videos.v-modelisme .count { background: var(--modelisme); }
.hobbies-videos.v-paysage   .count { background: var(--paysage); }

.videos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.video-cell {
  margin: 0;
}

.video-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--line-soft);
  border-radius: var(--radius-s);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 16 / 9;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s var(--ease);
}

.video-thumb:hover img { transform: scale(1.05); }

.video-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(10,12,14,0.35) 100%);
}

.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  z-index: 2;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}

.video-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 53%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent var(--ink);
}

.video-thumb:hover .video-play {
  transform: translate(-50%, -50%) scale(1.08);
  background: #fff;
}

.hobbies-videos.v-plongees  .video-play::before { border-left-color: var(--plongees); }
.hobbies-videos.v-modelisme .video-play::before { border-left-color: var(--modelisme); }
.hobbies-videos.v-paysage   .video-play::before { border-left-color: var(--paysage); }

.video-cell figcaption {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink);
  margin-top: 0.6rem;
  line-height: 1.4;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-s);
  overflow: hidden;
  background: #000;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 900px) {
  .videos-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .videos-grid { grid-template-columns: 1fr; }
}

/* =================================================================
   8. ANIMATIONS AU DÉFILEMENT
   ================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(18px);
}
.reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal:nth-child(2).in { transition-delay: 0.08s; }
.reveal:nth-child(3).in { transition-delay: 0.16s; }
.reveal:nth-child(4).in { transition-delay: 0.24s; }

/* =================================================================
   9. RESPONSIVE
   ================================================================= */
@media (max-width: 900px) {
  .hobbies-portals { grid-template-columns: repeat(2, 1fr); }
  .recent-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .hobbies-portals { grid-template-columns: 1fr; gap: 16px; }
  .recent-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .hobbies-footer { flex-direction: column; align-items: flex-start; }
  .theme-banner { min-height: 150px; }
}

/* =================================================================
   10. MOUVEMENT RÉDUIT
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .hobbies-portal:hover { transform: none; }
  .recent-cell:hover img,
  .modula-item:hover img { transform: none; }
}

/* =================================================================
   11. HÉROS AVEC IMAGE (accueil)
   ================================================================= */
.hobbies-hero.has-image {
  position: relative;
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  min-height: clamp(420px, 58vh, 620px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background-size: cover;
  background-position: center;
  padding: 0;
  max-width: none;
  text-align: center;
}

.hobbies-hero.has-image .hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12,14,16,0.15) 0%, rgba(12,14,16,0.05) 35%, rgba(12,14,16,0.62) 100%);
}

.hobbies-hero.has-image .hero-inner {
  position: relative;
  z-index: 2;
  padding: 0 1.5rem clamp(3rem, 7vw, 5.5rem);
  max-width: 720px;
}

.hobbies-hero.has-image .eyebrow {
  color: rgba(255,255,255,0.75);
  margin-bottom: 1rem;
}

.hobbies-hero.has-image h1 {
  color: #fff;
  font-size: clamp(2.4rem, 1.4rem + 4.2vw, 4rem);
  margin: 0 0 0.8rem;
  text-shadow: 0 2px 30px rgba(0,0,0,0.35);
}

.hobbies-hero.has-image p {
  color: rgba(255,255,255,0.88);
  font-size: 1.1rem;
  margin: 0 auto;
  max-width: 32em;
  text-shadow: 0 1px 16px rgba(0,0,0,0.3);
}

/* =================================================================
   12. PORTAILS v2 — cartes immersives
   ================================================================= */
.hobbies-portals-v2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: var(--content);
  margin: clamp(2.2rem, 4.5vw, 3.8rem) auto 0;
  padding: 0 1.5rem;
}

.portal-card {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none !important;
  isolation: isolate;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

.portal-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 44px -20px rgba(28,27,25,0.42);
}

.portal-media {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--u-deep) 0%, var(--u-accent) 68%, var(--u-bright) 100%);
  background-size: cover;
  background-position: center;
  transition: transform 0.8s var(--ease);
}
.portal-media.has-cover { background-size: cover; }
.portal-card:hover .portal-media { transform: scale(1.05); }

.portal-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,12,14,0.05) 30%, rgba(10,12,14,0.72) 100%);
  transition: background 0.5s var(--ease);
}

.portal-overlay {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 22px 22px 20px;
  color: #fff;
}

.portal-count {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  font-variant-numeric: tabular-nums;
}

.portal-title {
  font-family: var(--serif);
  font-size: 1.65rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 16px rgba(0,0,0,0.35);
}

.portal-sub {
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(255,255,255,0.85);
  margin: 2px 0 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease), opacity 0.5s var(--ease), margin 0.5s var(--ease);
}
.portal-card:hover .portal-sub,
.portal-card:focus-visible .portal-sub {
  max-height: 4.5em;
  opacity: 1;
  margin-top: 4px;
}

.portal-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
}
.portal-cta .arrow { transition: transform 0.3s var(--ease); }
.portal-card:hover .portal-cta .arrow { transform: translateX(5px); }

/* =================================================================
   13. GALERIE — barre d'outils, à la une, grille
   ================================================================= */
.hobbies-media {
  max-width: var(--content);
  margin: 0 auto clamp(2.5rem, 5vw, 4rem);
  padding: 0 1.5rem;
}

.media-empty,
.media-none {
  text-align: center;
  color: var(--faint);
  font-size: 0.95rem;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-family: var(--sans);
}

/* --- Barre de filtres --- */
.media-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.65rem;
  margin-bottom: 1.6rem;
  font-family: var(--sans);
}

.media-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.1rem;
}

.media-filter {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 0 6px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.media-filter:hover { color: var(--ink); }
.media-filter.is-active {
  color: var(--ink);
  border-bottom-color: var(--u-accent, var(--ink));
}
.media-filter .n {
  font-size: 0.74rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  margin-left: 3px;
}

.media-years .media-filter { font-size: 0.84rem; }

/* --- À la une --- */
.media-featured {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.media-featured .media-cell { margin: 0; }
.media-featured .media-open { aspect-ratio: 16 / 10; }
.media-featured .media-open img { height: 100%; object-fit: cover; }
.media-featured .media-caption { opacity: 1; transform: none; }

/* --- Grille libre (les photos gardent leurs proportions) --- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
.media-grid .media-cell { margin: 0; }
.media-grid .media-open { height: 100%; }
.media-grid .media-open img { height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }

.media-featured.is-empty,
.media-grid.is-empty { display: none; }
.media-cell.is-hidden { display: none !important; }

/* --- Cellule --- */
.media-cell { position: relative; }

.media-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--line-soft);
  border-radius: var(--radius-s);
  overflow: hidden;
  cursor: zoom-in;
}
.media-cell.is-video .media-open { cursor: pointer; aspect-ratio: 16 / 9; }
.media-cell.is-video .media-open img { height: 100%; object-fit: cover; }

.media-open img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.7s var(--ease);
}
.media-open:hover img,
.media-open:focus-visible img { transform: scale(1.045); }

.media-open::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(10,12,14,0.55) 100%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.media-open:hover::after,
.media-open:focus-visible::after { opacity: 1; }
.media-cell.is-video .media-open::after { opacity: 0.55; }

/* Légende au survol */
.media-caption {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  color: #fff;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  pointer-events: none;
}
.media-open:hover .media-caption,
.media-open:focus-visible .media-caption {
  opacity: 1;
  transform: none;
}
.media-caption-title {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  text-shadow: 0 1px 10px rgba(0,0,0,0.4);
}
.media-caption-meta {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.82);
}

/* Lecture vidéo */
.media-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  z-index: 2;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
.media-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent var(--u-accent, var(--ink));
}
.media-open:hover .media-play {
  transform: translate(-50%, -50%) scale(1.08);
  background: #fff;
}

.media-duration {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(12,14,16,0.72);
  padding: 2px 8px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.media-cell .badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 20px;
  color: #fff;
  backdrop-filter: blur(4px);
}
.media-cell .badge ~ .media-caption { bottom: 38px; }

/* =================================================================
   14. VISIONNEUSE
   ================================================================= */
html.lb-open { overflow: hidden; }

.hobbies-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}
.hobbies-lightbox.is-on { opacity: 1; }

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17,16,14,0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lb-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 340px);
  gap: 24px;
  padding: clamp(16px, 3vw, 40px);
  align-items: center;
}

/* --- Scène --- */
.lb-stage {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.lb-media img {
  max-width: 100%;
  max-height: calc(100vh - 100px);
  width: auto;
  height: auto;
  border-radius: var(--radius-s);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
}
.lb-media.is-video { width: 100%; }
.lb-media iframe {
  width: 100%;
  max-width: 1080px;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius-s);
  background: #000;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
}

/* --- Flèches --- */
.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background 0.25s var(--ease);
}
.lb-arrow:hover { background: rgba(255,255,255,0.24); }
.lb-prev { left: 6px; }
.lb-next { right: 6px; }
.lb-arrow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
}
.lb-prev::before { transform: translate(-30%, -50%) rotate(-135deg); }
.lb-next::before { transform: translate(-70%, -50%) rotate(45deg); }

/* --- Cartel (panneau d'informations) --- */
.lb-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px 26px 24px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  font-family: var(--sans);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.5);
}

.lb-univers {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.lb-univers-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--u-accent, var(--ink));
  flex: none;
}

.lb-title {
  font-size: 1.45rem;
  line-height: 1.2;
  margin: 0 0 8px;
}

.lb-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 14px;
}

.lb-desc {
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 16px;
  white-space: pre-line;
}

.lb-exif {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--faint);
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.lb-title[hidden], .lb-meta[hidden], .lb-desc[hidden],
.lb-exif[hidden], .lb-univers[hidden] { display: none; }

/* --- Compteur & fermeture --- */
.lb-counter {
  position: absolute;
  left: clamp(16px, 3vw, 40px);
  bottom: 14px;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  font-variant-numeric: tabular-nums;
}

.lb-close {
  position: absolute;
  top: 14px;
  right: clamp(14px, 2.5vw, 30px);
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s var(--ease);
}
.lb-close:hover { background: rgba(255,255,255,0.24); }

/* =================================================================
   15. BANDEAU DE PAGE UNIVERS v2
   ================================================================= */
.theme-banner.v2 {
  min-height: clamp(220px, 32vh, 320px);
  background: linear-gradient(150deg, var(--u-deep) 0%, var(--u-accent) 72%, var(--u-bright) 100%);
}

.theme-banner.v2.has-cover {
  background-size: cover;
  background-position: center;
}
.theme-banner.v2.has-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,13,16,0.22) 0%, rgba(10,13,16,0.66) 100%);
}
.theme-banner.v2.has-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--u-deep);
  opacity: 0.28;
  mix-blend-mode: multiply;
}

.theme-banner.v2 .banner-meta {
  color: rgba(255,255,255,0.82);
  font-family: var(--sans);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
  font-variant-numeric: tabular-nums;
}

/* =================================================================
   16. DERNIERS AJOUTS v2 (accueil)
   ================================================================= */
.recent-grid-v2 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.recent-grid-v2 .media-cell { margin: 0; }
.recent-grid-v2 .media-open {
  aspect-ratio: 1;
  cursor: zoom-in;
}
.recent-grid-v2 .media-open img {
  height: 100%;
  object-fit: cover;
}
.recent-grid-v2 .media-cell.is-video .media-open { aspect-ratio: 1; }
.recent-grid-v2 .media-play { width: 44px; height: 44px; }
.recent-grid-v2 .media-caption { display: none; }

/* =================================================================
   17. RESPONSIVE (nouveautés)
   ================================================================= */
@media (max-width: 1100px) {
  .lb-inner { grid-template-columns: 1fr minmax(250px, 300px); }
}

@media (max-width: 900px) {
  .hobbies-portals-v2 { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .portal-card { aspect-ratio: 3 / 4; }
  .portal-title { font-size: 1.3rem; }
  .portal-sub { display: none; }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .recent-grid-v2 { grid-template-columns: repeat(3, 1fr); }

  .lb-inner {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: stretch;
    padding-bottom: 12px;
  }
  .lb-media img { max-height: 58vh; }
  .lb-panel {
    max-height: 32vh;
    padding: 18px 20px 16px;
  }
  .lb-title { font-size: 1.2rem; }
  .lb-counter { display: none; }
}

@media (max-width: 640px) {
  .hobbies-portals-v2 { grid-template-columns: 1fr; }
  .portal-card { aspect-ratio: 16 / 10; }
  .portal-sub { display: block; }
  .media-featured { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .recent-grid-v2 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .media-toolbar { flex-direction: column; align-items: flex-start; }
  .hobbies-hero.has-image { min-height: 340px; }
}

/* =================================================================
   18. MOUVEMENT RÉDUIT (nouveautés)
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  .portal-card:hover,
  .portal-card:hover .portal-media,
  .media-open:hover img,
  .portal-cta .arrow { transform: none !important; }
  .hobbies-lightbox { transition: none; }
  .portal-sub { max-height: none; opacity: 1; }
}

/* =================================================================
   19. BARRE D'OUTILS ENRICHIE (recherche, tri, univers)
   ================================================================= */
.media-toolbar { row-gap: 0.8rem; }

.media-filter .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}

.media-tools {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-left: auto;
}

.media-search input,
.media-sort select {
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
}
.media-search input {
  width: 170px;
  transition: width 0.3s var(--ease), border-color 0.3s var(--ease);
}
.media-search input:focus {
  width: 220px;
  outline: none;
  border-color: var(--u-accent, var(--ink));
}

/* --- Sections par année --- */
.media-year-block { margin-bottom: 1.6rem; }
.media-year-block.is-empty { display: none; }
.media-year {
  font-size: 1.15rem;
  margin: 0 0 0.8rem;
  color: var(--muted);
}

/* =================================================================
   20. VISIONNEUSE — outils, liés, vues, zoom
   ================================================================= */
.lb-tools {
  position: absolute;
  top: 14px;
  left: clamp(14px, 2.5vw, 30px);
  display: flex;
  gap: 8px;
  z-index: 3;
}

.lb-tool {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.25s var(--ease);
}
.lb-tool:hover { background: rgba(255,255,255,0.24); }
.lb-tool[hidden] { display: none; }
.hobbies-lightbox.is-playing [data-lb-play] { background: rgba(255,255,255,0.3); }

/* Panneau escamotable */
.hobbies-lightbox.panel-hidden .lb-panel { display: none; }
.hobbies-lightbox.panel-hidden .lb-inner { grid-template-columns: 1fr; }

/* Zoom */
.lb-media img { transition: transform 0.15s ease-out; will-change: transform; }
.lb-media.is-zoomed { cursor: grab; overflow: hidden; }
.lb-media.is-zoomed:active { cursor: grabbing; }
.lb-media.is-zoomed img { transition: none; }

/* Vues */
.lb-views {
  font-size: 0.74rem;
  color: var(--faint);
  margin: 0 0 12px;
  font-variant-numeric: tabular-nums;
}

/* Médias liés */
.lb-related { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.lb-related h3 {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
}
.lb-related-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-related-thumb {
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--line-soft);
}
.lb-related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease);
}
.lb-related-thumb:hover img { transform: scale(1.1); }

/* =================================================================
   21. CARTE DES LIEUX
   ================================================================= */
.hobbies-carte {
  max-width: var(--content);
  margin: 0 auto clamp(2rem, 4vw, 3rem);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  z-index: 1;
  position: relative;
}
.hobbies-carte-pop {
  display: block;
  text-decoration: none !important;
  width: 150px;
}
.hobbies-carte-pop img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
  margin-bottom: 6px;
  background: var(--line-soft);
}
.hobbies-carte-thumb {
  position: relative;
  display: block;
}
.hobbies-carte-play {
  position: absolute;
  top: calc(50% - 3px);
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
}
.hobbies-carte-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #1C1B19;
}
.hobbies-carte-pop span {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.3;
}

/* =================================================================
   22. MODE SOMBRE
   ================================================================= */
html[data-theme="dark"] {
  --base:      #161512;
  --surface:   #201F1B;
  --ink:       #ECE9E1;
  --muted:     #A9A59B;
  --faint:     #807C72;
  --line:      #2F2D28;
  --line-soft: #262420;
}

html[data-theme="dark"] body { background: var(--base); color: var(--ink); }

/* Titres et texte du contenu : suivre le thème sombre même si le
   thème parent ou les blocs WordPress imposent leur propre couleur. */
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] p,
html[data-theme="dark"] li,
html[data-theme="dark"] .wp-block-heading,
html[data-theme="dark"] .wp-block-post-title,
html[data-theme="dark"] .entry-title,
html[data-theme="dark"] .wp-block-post-content {
  color: var(--ink);
}

/* Liens de navigation et de contenu */
html[data-theme="dark"] a { color: var(--ink); }
html[data-theme="dark"] .wp-block-navigation .wp-block-navigation-item__content {
  color: var(--muted) !important;
}
html[data-theme="dark"] .wp-block-navigation .wp-block-navigation-item__content:hover,
html[data-theme="dark"] .wp-block-navigation .current-menu-item .wp-block-navigation-item__content {
  color: var(--ink) !important;
  border-bottom-color: var(--ink);
}

/* Le texte blanc posé sur les images (héros, bandeaux, cartes) reste
   blanc : ces éléments ont déjà leur propre fond sombre. */
html[data-theme="dark"] .hobbies-hero.has-image h1,
html[data-theme="dark"] .hobbies-hero.has-image p,
html[data-theme="dark"] .theme-banner h1,
html[data-theme="dark"] .theme-banner .banner-meta,
html[data-theme="dark"] .portal-title,
html[data-theme="dark"] .portal-sub,
html[data-theme="dark"] .media-caption-title {
  color: #fff;
}

html[data-theme="dark"] .wp-site-blocks > header,
html[data-theme="dark"] header.wp-block-template-part {
  background: #1B1A17;
}
/* Le fond crème est souvent peint par un groupe interne : on le neutralise. */
html[data-theme="dark"] header.wp-block-template-part .wp-block-group,
html[data-theme="dark"] header.wp-block-template-part .has-base-background-color,
html[data-theme="dark"] header.wp-block-template-part .has-background {
  background-color: transparent !important;
}
/* Titre du site et liens toujours lisibles */
html[data-theme="dark"] .wp-block-site-title a,
html[data-theme="dark"] .wp-block-site-title {
  color: var(--ink) !important;
}

html[data-theme="dark"] .media-open::after {
  background: linear-gradient(180deg, transparent 52%, rgba(0,0,0,0.65) 100%);
}

html[data-theme="dark"] .hobbies-lightbox .lb-backdrop {
  background: rgba(8,8,7,0.96);
}

html[data-theme="dark"] .hobbies-carte { border-color: var(--line); }
html[data-theme="dark"] .leaflet-tile { filter: brightness(0.75) contrast(1.05); }

/* Bouton de bascule */
.hobbies-theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 800;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px -8px rgba(0,0,0,0.3);
  transition: transform 0.25s var(--ease);
}
.hobbies-theme-toggle:hover { transform: scale(1.08); }
html.lb-open .hobbies-theme-toggle { display: none; }

/* =================================================================
   23. RESPONSIVE & MOUVEMENT RÉDUIT (nouveautés 2.2)
   ================================================================= */
@media (max-width: 900px) {
  .media-tools { margin-left: 0; width: 100%; }
  .media-search input { flex: 1; width: auto; }
  .lb-tools { top: auto; bottom: 12px; left: 12px; }
  .lb-tools .lb-tool { width: 38px; height: 38px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-related-thumb:hover img,
  .hobbies-theme-toggle:hover { transform: none; }
}
