/*
 Theme Name:   Kadence Child Master
 Theme URI:    https://ste.digital
 Description:  Child theme master — stack Framer-like (Lenis + GSAP + dark mode + glassmorphism)
 Author:       Stéphane
 Template:     kadence
 Version:      2.0.0
 Text Domain:  kadence-child
*/

/* ============================================================
   0. GOOGLE FONTS — Satoshi via Fontshare CDN
   ============================================================ */
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@700,500,400&display=swap');

/* ============================================================
   1. VARIABLES CSS GLOBALES
   ============================================================ */
:root {
  /* --- Typographie --- */
  --font-heading: 'Satoshi', 'Manrope', sans-serif;
  --font-body:    'Satoshi', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* --- Palette Light (défaut) --- */
  --color-primary:   #0A0A0A;
  --color-accent:    #6C63FF;
  --color-accent-2:  #00D4AA;
  --color-bg:        #FAFAFA;
  --color-bg-alt:    #F3F3F3;
  --color-surface:   rgba(255, 255, 255, 0.72);
  --color-border:    rgba(0, 0, 0, 0.08);
  --color-text:      #0A0A0A;
  --color-muted:     #6B7280;
  --color-white:     #FFFFFF;

  /* --- Glassmorphism --- */
  --glass-bg:      rgba(255, 255, 255, 0.65);
  --glass-border:  rgba(255, 255, 255, 0.40);
  --glass-blur:    blur(18px) saturate(180%);
  --glass-shadow:  0 8px 32px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255,255,255,0.8) inset;

  /* --- Spacing & Radius --- */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   32px;
  --radius-full: 9999px;

  /* --- Shadows --- */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.18);

  /* --- Transitions --- */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.76, 0, 0.24, 1);
  --duration-fast: 200ms;
  --duration-base: 380ms;
  --duration-slow: 600ms;

  /* --- Layout --- */
  --header-height:    64px;
  --header-height-sm: 48px;
  --max-width:        1280px;
  --section-padding:  clamp(60px, 8vw, 120px);
}

/* ============================================================
   2. DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --color-primary:   #F0F0F0;
  --color-accent:    #7C75FF;
  --color-accent-2:  #00E5B8;
  --color-bg:        #0A0A0A;
  --color-bg-alt:    #111111;
  --color-surface:   rgba(20, 20, 20, 0.80);
  --color-border:    rgba(255, 255, 255, 0.08);
  --color-text:      #F0F0F0;
  --color-muted:     #9CA3AF;
  --color-white:     #FFFFFF;

  --glass-bg:      rgba(15, 15, 15, 0.70);
  --glass-border:  rgba(255, 255, 255, 0.08);
  --glass-shadow:  0 8px 32px rgba(0, 0, 0, 0.40), 0 1px 0 rgba(255,255,255,0.04) inset;
}

/* ============================================================
   3. RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: auto; /* Lenis gère le smooth scroll */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--duration-slow) var(--ease-out-expo),
              color var(--duration-slow) var(--ease-out-expo);
  overflow-x: hidden;
}

/* ============================================================
   4. CURSEUR PERSONNALISÉ — Double rond (plein + creux)
   ============================================================ */
*, *:hover {
  cursor: none !important;
}

#cursor-dot,
#cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform;
  transition: opacity var(--duration-fast) ease;
}

#cursor-dot {
  width: 8px;
  height: 8px;
  background: var(--color-accent);
}

#cursor-ring {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--color-accent);
  opacity: 0.6;
  transition: width var(--duration-base) var(--ease-out-expo),
              height var(--duration-base) var(--ease-out-expo),
              opacity var(--duration-base) var(--ease-out-expo),
              background var(--duration-base) var(--ease-out-expo);
}

/* Effet magnétique au hover sur éléments interactifs */
a:hover ~ #cursor-ring,
button:hover ~ #cursor-ring,
.cursor-magnetic:hover ~ #cursor-ring {
  width: 56px;
  height: 56px;
  opacity: 0.35;
  background: rgba(108, 99, 255, 0.08);
}

body:not(.cursor-active) #cursor-dot,
body:not(.cursor-active) #cursor-ring {
  opacity: 0;
}

/* ============================================================
   5. PAGE LOADER
   ============================================================ */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#page-loader.loaded {
  opacity: 0;
  visibility: hidden;
}

#page-loader span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: loader-bounce 1s ease-in-out infinite;
}

#page-loader span:nth-child(2) { animation-delay: 0.15s; }
#page-loader span:nth-child(3) { animation-delay: 0.30s; }

@keyframes loader-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1.1); opacity: 1; }
}

/* ============================================================
   6. HEADER — Glassmorphism + hide-on-scroll + centré flottant
   ============================================================ */
.site-header,
#masthead {
  position: fixed !important;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 1100px;
  height: var(--header-height);
  z-index: 9000;
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: top var(--duration-base) var(--ease-out-expo),
              opacity var(--duration-base) var(--ease-out-expo),
              transform var(--duration-base) var(--ease-out-expo),
              background var(--duration-slow) ease;
  will-change: transform;
}

/* Header masqué lors du scroll down */
.header--hidden {
  top: -100px !important;
  opacity: 0 !important;
}

/* Header réduit après scroll */
.header--scrolled {
  height: var(--header-height-sm);
  top: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 0 rgba(255,255,255,0.5) inset;
}

[data-theme="dark"] .header--scrolled {
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.04) inset;
}

/* Body padding pour compenser le header fixed */
body {
  padding-top: calc(var(--header-height) + 32px);
}

/* Menu centré — logo au centre, liens latéraux */
.header-layout--centered .site-branding {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ============================================================
   7. BURGER MENU ANIMÉ (morphing X)
   ============================================================ */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  cursor: none;
  background: transparent;
  border: none;
  padding: 8px;
  gap: 5px;
  transition: transform var(--duration-base) var(--ease-out-expo);
}

.hamburger:hover {
  transform: scale(1.1);
}

.hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--duration-base) var(--ease-out-expo),
              opacity var(--duration-base) ease,
              width var(--duration-base) var(--ease-out-expo);
  transform-origin: center;
}

/* État ouvert — morphing vers X */
.hamburger.is-active span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.hamburger.is-active span:nth-child(2) {
  opacity: 0;
  width: 0;
}
.hamburger.is-active span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Compatibilité sélecteurs Kadence natifs */
.kadence-menu-toggle-inner span,
.kadence-mobile-header-nav-2 .menu-toggle span {
  transition: transform var(--duration-base) var(--ease-out-expo),
              opacity var(--duration-base) ease !important;
  transform-origin: center !important;
  height: 1.5px !important;
  border-radius: 2px !important;
}

/* ============================================================
   8. NAVIGATION — Liens avec surlignage animé
   ============================================================ */
.main-navigation a,
.header-navigation a {
  position: relative;
  text-decoration: none;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 4px 0;
  transition: color var(--duration-fast) ease;
}

.main-navigation a::after,
.header-navigation a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--color-accent);
  transition: width var(--duration-base) var(--ease-out-expo);
  border-radius: 2px;
}

.main-navigation a:hover::after,
.header-navigation a:hover::after,
.main-navigation .current-menu-item a::after,
.header-navigation .current-menu-item a::after {
  width: 100%;
}

.main-navigation .current-menu-item a {
  color: var(--color-accent);
}

/* ============================================================
   9. BOUTONS ANIMÉS
   ============================================================ */

/* 9a — Bouton principal : Circle fill (remplissage circulaire) */
.wp-block-button__link,
.button,
button[type="submit"],
.kb-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 1.5px solid var(--color-text);
  border-radius: var(--radius-full);
  color: var(--color-text);
  background: transparent;
  overflow: hidden;
  cursor: none;
  text-decoration: none;
  transition: color var(--duration-base) var(--ease-out-expo),
              border-color var(--duration-base) ease;
  z-index: 0;
}

.wp-block-button__link::before,
.button::before,
button[type="submit"]::before,
.kb-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-text);
  border-radius: 50%;
  transform: scale(0);
  transform-origin: center;
  transition: transform var(--duration-base) var(--ease-out-expo),
              border-radius var(--duration-base) var(--ease-out-expo);
  z-index: -1;
}

.wp-block-button__link:hover::before,
.button:hover::before,
button[type="submit"]:hover::before,
.kb-btn:hover::before {
  transform: scale(2.5);
  border-radius: 0;
}

.wp-block-button__link:hover,
.button:hover,
button[type="submit"]:hover,
.kb-btn:hover {
  color: var(--color-bg);
}

/* 9b — Bouton accent avec Sliding Text */
.btn-sliding,
.wp-block-button.is-style-outline .wp-block-button__link {
  position: relative;
  overflow: hidden;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #fff;
  border: none;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
  cursor: none;
}

.btn-sliding .btn-text-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 20px;
  overflow: hidden;
  transition: transform var(--duration-base) var(--ease-out-expo);
}

.btn-sliding:hover .btn-text-wrapper {
  transform: translateY(-100%);
}

.btn-sliding .btn-text,
.btn-sliding .btn-text-clone {
  line-height: 20px;
  display: block;
}

/* 9c — Micro-interactions liens */
a:not(.wp-block-button__link):not(.button):not(.kb-btn) {
  transition: opacity var(--duration-fast) ease,
              transform var(--duration-fast) ease;
}

a:not(.wp-block-button__link):not(.button):not(.kb-btn):hover {
  opacity: 0.72;
}

/* ============================================================
   10. SECTIONS — Effets scroll & parallax containers
   ============================================================ */

/* Padding sections cohérent */
.wp-block-group,
.kb-section,
section {
  padding-top: var(--section-padding);
  padding-bottom: var(--section-padding);
}

/* Section reveal (classe ajoutée par GSAP) */
.section-reveal {
  opacity: 0;
  transform: translateY(40px);
}

.section-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

/* Ligne décorative de section */
.section-divider {
  width: 40px;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
  margin-bottom: 32px;
}

/* ============================================================
   11. CARDS EMPILÉES (Card Stack)
   ============================================================ */
.card-stack {
  position: relative;
  width: 100%;
}

.card-stack__item {
  position: sticky;
  top: calc(80px + var(--card-index, 0) * 16px);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  padding: 48px;
  margin-bottom: 20px;
  transform-origin: top center;
  transition: box-shadow var(--duration-base) ease,
              transform var(--duration-base) var(--ease-out-expo);
  will-change: transform;
}

.card-stack__item:hover {
  box-shadow: var(--shadow-lg);
}

/* Index des cartes */
.card-stack__item:nth-child(1) { --card-index: 0; }
.card-stack__item:nth-child(2) { --card-index: 1; }
.card-stack__item:nth-child(3) { --card-index: 2; }
.card-stack__item:nth-child(4) { --card-index: 3; }
.card-stack__item:nth-child(5) { --card-index: 4; }

/* ============================================================
   12. CARDS STANDARD — Style glassmorphism
   ============================================================ */
.wp-block-kadence-infobox,
.kb-info-box,
.card,
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: transform var(--duration-base) var(--ease-out-expo),
              box-shadow var(--duration-base) ease;
  will-change: transform;
}

.wp-block-kadence-infobox:hover,
.kb-info-box:hover,
.card:hover,
.glass-card:hover {
  transform: translateY(-4px) scale(1.005);
  box-shadow: var(--shadow-lg);
}

/* ============================================================
   13. TYPOGRAPHIE — Style éditorial / tech
   ============================================================ */
h1, h2, h3, h4, h5, h6,
.wp-block-heading {
  font-family: var(--font-heading);
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h1, .is-style-display { font-size: clamp(2.8rem, 5.5vw, 5.5rem); }
h2                     { font-size: clamp(2rem, 3.5vw, 3.5rem); }
h3                     { font-size: clamp(1.4rem, 2vw, 2rem); }

/* Classe SplitText cible */
.split-chars .char,
.split-words .word {
  display: inline-block;
  overflow: hidden;
}

.split-chars .char-inner,
.split-words .word-inner {
  display: inline-block;
  transform: translateY(110%);
}

/* Texte accent / gradient */
.text-gradient {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Highlight surlignage animé */
.text-highlight {
  position: relative;
  display: inline-block;
  z-index: 0;
}

.text-highlight::before {
  content: '';
  position: absolute;
  bottom: 2px;
  left: -2px;
  right: -2px;
  height: 40%;
  background: var(--color-accent);
  opacity: 0.2;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease-out-expo);
  border-radius: 2px;
}

.text-highlight.is-visible::before {
  transform: scaleX(1);
}

/* Compteurs animés */
.count-up {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   14. CONTENU & BLOG
   ============================================================ */

/* Lazy loading articles */
.lazy-articles .post-entry {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.lazy-articles .post-entry.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* Bouton "Load more" */
.load-more-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 48px auto 0;
  padding: 14px 32px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: none;
  transition: border-color var(--duration-fast) ease,
              box-shadow var(--duration-base) ease;
}

.load-more-btn:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-glow);
}

.load-more-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Progress bar lecture */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-2));
  z-index: 99997;
  transition: width 100ms linear;
}

/* ============================================================
   15. TRANSITIONS ENTRE PAGES (page-swipe)
   ============================================================ */
.page-transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-accent);
  z-index: 99990;
  transform: translateY(100%);
  pointer-events: none;
}

.page-transition-overlay.enter {
  animation: page-enter var(--duration-slow) var(--ease-out-expo) forwards;
}

.page-transition-overlay.exit {
  animation: page-exit var(--duration-slow) var(--ease-in-out) forwards;
}

@keyframes page-enter {
  0%   { transform: translateY(100%); }
  100% { transform: translateY(0%); }
}

@keyframes page-exit {
  0%   { transform: translateY(0%); }
  100% { transform: translateY(-100%); }
}

/* ============================================================
   16. DARK MODE TOGGLE
   ============================================================ */
#dark-mode-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  border: 1.5px solid var(--color-border);
  cursor: none;
  transition: background var(--duration-base) ease,
              border-color var(--duration-base) ease;
  flex-shrink: 0;
}

#dark-mode-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-text);
  transition: transform var(--duration-base) var(--ease-out-expo),
              background var(--duration-base) ease;
}

[data-theme="dark"] #dark-mode-toggle::before {
  transform: translateX(20px);
  background: var(--color-accent);
}

[data-theme="dark"] #dark-mode-toggle {
  background: rgba(108, 99, 255, 0.15);
  border-color: rgba(108, 99, 255, 0.3);
}

/* Icône soleil/lune */
#dark-mode-toggle .toggle-icon {
  position: absolute;
  right: -28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

/* ============================================================
   17. FORMULAIRES
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}

/* ============================================================
   18. UTILITAIRES
   ============================================================ */

/* Smooth scroll sur ancres — Lenis prend la main via JS */
html.lenis {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

/* Container responsive */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
}

/* Visibilité AOS (garder compatibilité) */
[data-aos] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

[data-aos].aos-animate {
  opacity: 1;
  transform: translateY(0);
}

/* Grille auto */
.auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

/* Badge / Tag */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-muted);
}

/* Séparateur décoratif */
.noise-bg {
  position: relative;
}

.noise-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

/* ============================================================
   19. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .site-header,
  #masthead {
    width: calc(100% - 24px);
    top: 12px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .card-stack__item {
    padding: 28px;
    position: relative;
    top: auto;
  }

  #cursor-dot,
  #cursor-ring {
    display: none;
  }

  * { cursor: auto !important; }

  .site-header,
  #masthead {
    width: calc(100% - 16px);
    top: 8px;
    border-radius: var(--radius-lg);
  }
}

/* ============================================================
   20. REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #page-loader { display: none; }
  html { scroll-behavior: smooth; }
}
