/*
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: 1.1.0
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;
}

.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(1.5rem, 3vw, 2.5rem);
  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(1.5rem, 3vw, 2rem);
  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; }

/* =================================================================
   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; }
}
