/* =============================================
   IMPORTS & RESET
   ============================================= */
/* GOOGLE FONTS */
@import url("https://fonts.googleapis.com/css?family=Inter:400,600,700|Indie+Flower&display=swap");

/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* =============================================
   VARIABLES
   ============================================= */
:root {
  /* darkmode */
  --background-general-dark: #1a1a2e;
  --background-surface-dark: #29295a;
  --background-leger-dark: #1e1e36;
  --background-moyen-dark: #20203b;
  --text-light: #f5f6fa;
  /* lightmode*/
  --text-dark: #1a1a2e;
  --background-general-light: #f5f6fa;
  --background-surface-light: #e3dacb;
  --background-leger-light: #f0ede3;
  --background-moyen-light: #edead7;
  /* colors */
  --count-color: #6c5ce7;
  --accent-blue: #0984e3;
  /* var autres */
  --background-transparent: rgba(0, 0, 0, 0);
  --radius-main: 16px;
  --radius-small: 7px;
  --shadow-main: 0 2px 8px rgba(30, 30, 60, 0.1);
  --gap-main: 16px;
  --padding-main: 12px 20px;
  --nav-block-size: 44px;
  --nav-icon-size: 40px;
  /* accents Leclerc (fruits & balance) */
  --leclerc-accent: #3c8c3c;
  --leclerc-accent-alt: #d97b1d;
  --leclerc-bg-tint: rgba(60, 140, 60, 0.08);
}

/* =============================================
   LANDING PAGE (index)
   ============================================= */
body.landing {
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  text-shadow: 0 0 2px currentColor;
}

body.landing .header-row,
body.landing .header-row * {
  text-shadow: none;
}

body.landing .fixed-brand-clone,
body.landing .fixed-brand-clone *,
body.landing .main-title-group,
body.landing .main-title-group * {
  text-shadow: none;
}

body.landing a,
body.landing button,
body.landing .cta-btn,
body.landing .landing-cta-link,
body.landing .cta-btn *,
body.landing .landing-cta-link * {
  text-shadow: none;
}

/* Animated background canvas (index only) */
body.landing .animated-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0; /* behind content sections; header/dots already have higher z-index */
  pointer-events: none;
}
/* Ensure landing sections paint above the canvas without altering header/dots positions */
body.landing section.landing-block {
  position: relative;
  z-index: 1;
}

section.landing-block {
  scroll-snap-align: start;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(2rem, 4vw, 5rem) 1.5rem;
  gap: 2rem;
  text-align: center;
  opacity: 0;
  transform: translateY(40px);
  transition: 0.8s ease;
  color: var(--text-light);
}
body.light section.landing-block {
  color: var(--text-dark);
}
section.landing-block.visible {
  opacity: 1;
  transform: translateY(0);
}
.landing-header-wrapper {
  position: sticky;
  top: 0;
  z-index: 1200;
}

/* Brand (logo + titres) fixé indépendamment comme sur discord.com */
body.landing .fixed-brand-clone {
  position: fixed;
  top: 8px; /* aligné sur le padding header (8px 14px) */
  left: 14px;
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 0;
  z-index: 1600; /* au-dessus du header pour éviter tout recouvrement lors de scroll */
  pointer-events: auto;
}
body.landing .fixed-brand-clone .cv-logo {
  height: 60px;
  width: 60px;
}
/* Conserver l'espace d'origine dans le header pour ne pas décaler la nav */
body.landing .header-row .header-home-link.brand-placeholder {
  visibility: hidden; /* garde la largeur/hauteur, aucune modification visuelle externe */
}

@media (max-width: 430px) {
  body.landing .fixed-brand-clone {
    top: 6px; /* header réduit à 6px 10px */
    left: 10px;
    transform: translateZ(0); /* stabilité mobile */
  }
  body.landing .fixed-brand-clone .cv-logo {
    height: 54px;
    width: 54px;
  }
}

/* Index (landing): align brand sizing at ≤715px to match ≤430px */
@media (max-width: 715px) {
  /* Fixed brand clone (visible brand on index) */
  body.landing .fixed-brand-clone {
    top: 6px;
    left: 10px;
    transform: translateZ(0);
  }
  body.landing .fixed-brand-clone .cv-logo {
    width: 41.8px !important;
    height: 41.8px !important;
  }
  /* Placeholder brand inside header keeps same compact footprint */
  body.landing .header-row .header-home-link.brand-placeholder .cv-logo {
    width: 41.8px !important;
    height: 41.8px !important;
  }
  /* Title group sizing to match mobile-compact */
  body.landing .main-title-group {
    min-width: 66px !important;
    height: 35.2px !important;
  }
  body.landing .main-title-paul {
    font-size: 0.88rem;
    margin-left: 5.5px;
  }
  body.landing .main-title-alessandrini {
    font-size: 0.825rem;
    margin-left: 5.5px;
  }
}

.landing-cta-link {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  padding: 8px 16px;
  border-radius: 24px;
  background: var(--background-leger-dark);
  color: var(--text-light);
  box-shadow: var(--shadow-main);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition:
    background 0.25s,
    transform 0.2s;
  line-height: 1.1;
}
.landing-cta-link:hover {
  background: var(--background-surface-dark);
  transform: translateY(-2px);
}
.landing-cta-link.secondary {
  background: transparent;
  outline: 2px solid var(--background-leger-dark);
}
.landing-cta-link.secondary:hover {
  background: var(--background-general-light);
  transform: translateY(-2px);
}
body.light .landing-cta-link {
  background: var(--background-leger-light);
  color: var(--text-dark);
}
body.light .landing-cta-link.secondary {
  background: transparent;
  outline: 2px solid var(--background-leger-light);
  color: var(--text-dark);
}
body.light .landing-cta-link.secondary:hover {
  background: var(--background-general-dark);
}
/* Light mode styles for cta-btn */
body.light .cta-btn {
  background: var(--background-surface-light);
  color: var(--text-dark);
  border-color: transparent;
}
body.light .cta-btn.secondary {
  background: transparent;
  color: var(--text-dark);
  border-color: var(--background-surface-light);
}
body.light .cta-btn:hover {
  background: var(--text-dark);
  color: var(--text-light);
}
body.light .cta-btn.secondary:hover {
  background: var(--text-dark);
  color: var(--text-light);
  border-color: var(--text-dark);
}
/* Shrink only the 'Entrer dans le CV' button on very small screens */
@media (max-width: 470px) {
  .landing-cta-link.enter-btn {
    padding: 6px 10px;
    font-size: 0.7rem;
  }
}
/* Responsive: compacter le header si petits écrans */
@media (max-width: 640px) {
  .navbar {
    gap: 6px;
  }
  .landing-cta-link {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  .main-title-group {
    margin-right: 8px;
  }
}

.landing-block.hero {
  position: relative;
}
.landing-block.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.1;
  margin: 0;
  color: var(--text-light);
}

body.light .landing-block.hero h1 {
  color: var(--text-dark);
}

.cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.cta-btn {
  background: var(--background-surface-dark);
  color: var(--text-light);
  padding: 0.9rem 1.6rem;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.3s,
    color 0.3s,
    transform 0.25s;
  box-shadow: var(--shadow-main);
  border: 2px solid transparent;
}
.cta-btn.secondary {
  background: transparent;
  color: var(--text-light);
  border: 2px solid var(--background-surface-dark);
}
.cta-btn:hover {
  transform: translateY(-2px);
  background: var(--text-light);
  color: var(--text-dark);
}
.cta-btn.secondary:hover {
  background: var(--text-light);
  color: var(--text-dark);
  border-color: var(--text-light);
}
.scroll-indicator {
  position: absolute;
  bottom: 7rem;
  left: 50%;
  transform: translate(-50%, 0);
  font-size: 0.75rem;
  opacity: 0.6;
  letter-spacing: 1px;
  color: var(--text-light);
}
body.light .scroll-indicator {
  color: var(--text-dark);
}
/* Bouton fonctionnement: header par défaut, hero en mobile */
.fonctionnement-hero {
  display: none;
}
@media (max-width: 640px) {
  .fonctionnement-header {
    display: none !important;
  }
  .fonctionnement-hero {
    display: inline-flex;
    margin-top: 0.25rem;
  }
  .landing-block.hero {
    padding-top: 6rem;
  }
  .scroll-indicator {
    bottom: 1.2rem;
  }
}
@supports (padding: env(safe-area-inset-bottom)) {
  .scroll-indicator {
    padding-bottom: calc(env(safe-area-inset-bottom));
  }
}
.mock {
  max-width: 750px;
  width: 100%;
  background: color-mix(in srgb, var(--text-dark) 6%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: 0 4px 18px -6px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 1rem;
}
body.light .mock {
  background: rgba(255, 255, 255, 0.08);
  border-color: color-mix(in srgb, var(--text-dark) 6%, transparent);
}
.timeline-slider-mock {
  gap: 0.75rem;
}
.timeline-slider-mock .range-slider-visual {
  width: min(100%, 520px);
  margin: 0 auto;
  pointer-events: none;
  position: relative;
}
.timeline-slider-mock .range-slider-visual .range-slider {
  pointer-events: none;
}
.range-slider-mock-markers {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
}
.range-slider-mock-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text-light);
  border: 2px solid var(--background-surface-dark);
  pointer-events: none;
  transition: opacity 0.2s ease;
  opacity: 1;
}
body.light .range-slider-mock-marker {
  background: var(--text-dark);
  border-color: var(--background-surface-light);
}
.range-slider-mock-marker:nth-child(1) {
  left: 0.5%;
}
.range-slider-mock-marker:nth-child(2) {
  left: 66.66%;
}
.range-slider-mock-marker:nth-child(3) {
  left: 99.5%;
}
.timeline-slider-visual-input {
  width: 100%;
  background: linear-gradient(
      90deg,
      var(--background-general-light) 0 25%,
      rgba(255, 255, 255, 0.18) 25%
    )
    border-box;
}
body.light .timeline-slider-visual-input {
  background: linear-gradient(
      90deg,
      var(--background-general-dark) 0 25%,
      rgba(0, 0, 0, 0.12) 25%
    )
    border-box;
}
.competence-cards-preview {
  display: flex;
  gap: 0.6rem;
  overflow: hidden;
}
.competence-card-placeholder {
  flex: 0 0 55%;
  background: rgba(0, 0, 0, 0.15);
  min-height: 140px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
body.light .competence-card-placeholder {
  background: rgba(0, 0, 0, 0.08);
}

/* SVG visuals inside competence cards */
.competence-visual-svg {
  width: 80px;
  height: 60px;
  opacity: 0.85;
}

/* Panel animation (card 1) */
.svg-screen {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  opacity: 0.4;
}

.svg-panel {
  animation: panel-slide 2.5s ease-in-out infinite;
  transform-origin: center;
}

.svg-panel-bg {
  fill: currentColor;
  opacity: 0.3;
}

.svg-panel-line {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.6;
}

.svg-arrow {
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0.7;
  animation: arrow-pulse 2.5s ease-in-out infinite;
}

@keyframes panel-slide {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.3;
  }
  50% {
    transform: translateX(-30px);
    opacity: 1;
  }
}

@keyframes arrow-pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* Swipe gesture animation (card 2) */
.svg-hand {
  animation: hand-swipe 2.8s ease-in-out infinite;
}

.svg-hand-palm,
.svg-hand-finger {
  fill: currentColor;
  opacity: 0.6;
}

.svg-swipe-arrow {
  animation: swipe-arrow-move 2.8s ease-in-out infinite;
}

.svg-swipe-path {
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0.7;
}

@keyframes hand-swipe {
  0%,
  100% {
    transform: translateX(-20px);
    opacity: 0.3;
  }
  50% {
    transform: translateX(20px);
    opacity: 1;
  }
}

@keyframes swipe-arrow-move {
  0%,
  100% {
    transform: translateX(-10px);
    opacity: 0.4;
  }
  50% {
    transform: translateX(10px);
    opacity: 1;
  }
}

/* Vertical swipe UP animation (card 2 - mobile panel) */
.svg-panel-base {
  fill: currentColor;
  opacity: 0.3;
}

.svg-drag-handle {
  fill: currentColor;
  opacity: 0.6;
  animation: handle-pulse 2.5s ease-in-out infinite;
}

.svg-panel-content {
  animation: content-reveal 2.5s ease-in-out infinite;
  opacity: 0.5;
}

.svg-content-line {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.6;
}

.svg-hand-vertical {
  animation: hand-swipe-up 2.5s ease-in-out infinite;
}

.svg-swipe-arrow-up {
  animation: arrow-swipe-up 2.5s ease-in-out infinite;
}

.svg-swipe-path-vertical {
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0.7;
}

@keyframes handle-pulse {
  0%,
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes content-reveal {
  0%,
  100% {
    opacity: 0.2;
    transform: translateY(20px);
  }
  50% {
    opacity: 0.7;
    transform: translateY(0);
  }
}

@keyframes hand-swipe-up {
  0%,
  100% {
    transform: translateY(10px);
    opacity: 0.3;
  }
  50% {
    transform: translateY(-30px);
    opacity: 1;
  }
}

@keyframes arrow-swipe-up {
  0%,
  100% {
    transform: translateY(10px);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-20px);
    opacity: 1;
  }
}

/* Text-only card (card 3) */
.competence-card-text {
  gap: 0.4rem;
}

.competence-text-icon {
  font-size: 2rem;
  animation: icon-bounce 2s ease-in-out infinite;
}

@keyframes icon-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.1);
  }
}

.competence-visual-label {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.8;
  text-align: center;
}

.contact-cv-mock {
  gap: 1.2rem;
}
.contact-cv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}
.contact-cv-card {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
}
body.light .contact-cv-card {
  background: rgba(0, 0, 0, 0.08);
}
.contact-cv-description {
  opacity: 0.85;
  margin-top: 6px;
}
.contact-cv-cta-row {
  margin-top: 6px;
}
.contact-cv-hint {
  display: inline-block;
  margin-top: 4px;
  opacity: 0.7;
}
.tagline {
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 500;
  max-width: 900px;
  color: var(--text-light);
}
body.light .tagline {
  color: var(--text-dark);
}
.coming {
  opacity: 0.55;
  font-style: italic;
  font-size: 0.9rem;
}
.disabled-search {
  padding: 0.9rem 1.1rem;
  border: 2px dashed var(--background-surface-dark);
  border-radius: 12px;
  background: transparent;
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.6;
  width: 100%;
  max-width: 460px;
  color: var(--text-light);
}
body.light .disabled-search {
  color: var(--text-dark);
  border-color: var(--background-surface-light);
}
/* Mock search bar (visual replica from cv.html) */
.header-search-bar-mock {
  max-width: 460px;
  width: 100%;
  pointer-events: none;
  opacity: 0.85;
  margin: 0 auto;
  height: 38px !important;
  min-height: 38px;
  max-height: 38px;
  min-width: 300px;
  flex: 0 0 auto;
}
.header-search-bar-mock .search-input {
  cursor: not-allowed;
}
.header-search-bar-mock .search-btn {
  cursor: not-allowed;
  pointer-events: none;
}
/* Mock navbar (visual replica from cv.html) */
.navbar-mock {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}
.navbar-visual {
  pointer-events: none;
  opacity: 0.85;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 12px;
}
.navbar-visual a {
  cursor: not-allowed;
  pointer-events: none;
}
.navbar-visual .theme-switch input {
  pointer-events: none;
  cursor: not-allowed;
}
.navbar-visual .theme-switch .slider {
  cursor: not-allowed;
}
.search-hint {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  opacity: 0.75;
  max-width: 520px;
  line-height: 1.4;
}
.search-hint em {
  font-style: italic;
  opacity: 0.9;
}
.dots-nav {
  position: fixed;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  z-index: 40;
}
.dots-nav button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--background-surface-dark);
  border: none;
  cursor: pointer;
  transition: 0.3s;
  box-shadow: var(--shadow-main);
}
.dots-nav button.active {
  background: var(--background-general-light);
  transform: scale(1.4);
}
@media (max-width: 740px) {
  .cta-row {
    flex-direction: column;
  }
  .dots-nav {
    right: 0.6rem;
  }
}

/* =============================================
   STYLES DE BASE
   ============================================= */
/* DEBUG / MAQUETTE */
.square {
  border: 2px dashed #888;
}

/* PAGE ENTIERE */
html,
body {
  height: 100%;
  /* Stable viewport height: fallback to JS-provided --app-vh, else vh */
  min-height: calc(var(--app-vh, 1vh) * 100);
  margin: 0;
  padding: 0;
  background-color: var(--background-general-dark);
}

body {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: calc(var(--app-vh, 1vh) * 100);
  background-color: var(--background-general-dark);
}

/* =============================================
   HEADER & NAVIGATION
   ============================================= */
.header-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  min-height: 39px;
  padding: 8px 14px;
  background: var(--background-surface-dark);
  box-shadow: var(--shadow-main);
  margin-bottom: 10px;
  gap: 12px;
  transition:
    padding 0.2s,
    min-height 0.2s;
  position: relative;
  z-index: 1000;
}

/* LOGO+TITRE */
.header-home-link {
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--radius-main);
  transition:
    background 0.15s,
    transform 0.18s cubic-bezier(0.4, 1.4, 0.6, 1);
  flex-direction: row;
  will-change: transform;
}

.header-home-link:hover {
  transform: scale(1.1);
  z-index: 2;
}

/* LOGO CV */
.cv-logo {
  height: 60px;
  width: 60px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

/* TITRE GROUPE */
.main-title-group {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: 44px;
  margin-right: 18px;
  margin-left: -9px;
  min-width: 90px;
}

.main-title-paul {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0;
  line-height: 1.1;
  letter-spacing: 1px;
}

.main-title-alessandrini {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-light);
  line-height: 1.1;
  letter-spacing: 1px;
}

/* BARRE DE RECHERCHE */
.header-search-bar {
  position: relative; /* Pour positionner l'autocomplete */
  display: flex;
  align-items: center;
  margin: 0 18px 0 12px;
  background: var(--text-light);
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-main);
  height: 38px;
  min-width: 300px;
  max-width: 480px;
  flex: 1 1 180px;
  padding: 0 6px;
}

.search-input {
  border: none;
  background: var(--background-transparent);
  color: var(--text-dark);
  font-size: 1rem;
  outline: none;
  width: 100%;
}

.search-btn {
  background: var(--background-transparent);
  border: none;
  color: var(--text-dark);
  font-size: 1.2rem;
  cursor: pointer;
  outline: none;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  color: var(--background-surface-dark);
}

.search-icon {
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  object-fit: contain;
  display: block;
}

/* NAVBAR */
.header-row nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* DARK/LIGHT MODE SWITCH */
.theme-switch {
  display: flex;
  align-items: center;
  cursor: pointer;
  height: var(--nav-block-size);
  margin-right: 8px;
}

.theme-switch input {
  display: none;
}

.theme-switch .slider {
  position: relative;
  width: 56px;
  height: 32px;
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-main);
  background: var(--background-general-light);
  transition: background 0.3s;
  display: flex;
  align-items: center;
  padding: 4px;
}

.theme-switch .icon {
  position: absolute;
  width: 22px;
  height: 22px;
  top: 5px;
  transition: opacity 0.3s;
  pointer-events: none;
}

.theme-switch .sun {
  left: 6px;
  opacity: 1;
}

.theme-switch .moon {
  right: 6px;
  opacity: 0.5;
}

.theme-switch .slider::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 24px;
  height: 24px;
  background: var(--background-surface-dark);
  border-radius: 50%;
  transition:
    transform 0.3s,
    background 0.3s;
  z-index: 1;
}

.theme-switch input:checked + .slider {
  background: var(--background-general-dark);
}

.theme-switch input:checked + .slider::before {
  transform: translateX(24px);
  background: var(--background-general-light);
}

.theme-switch input:checked + .slider .sun {
  opacity: 0.5;
}

.theme-switch input:checked + .slider .moon {
  opacity: 1;
}
/*LINK NAVBAR*/
.header-row nav a {
  text-decoration: none;
  color: var(--text-light);
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-small);
  padding: 7px 14px;
  transition:
    background 0.2s,
    color 0.2s;
}

.header-row nav a:hover {
  background: var(--background-general-light);
  color: var(--background-surface-dark);
}

/* NAVBAR ICON BLOCKS */
.nav-search-btn,
.contact-info-block,
.classic-cv-block,
.color-generator-block,
.stats-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--nav-block-size);
  height: var(--nav-block-size);
  border-radius: var(--radius-main);
  background: transparent;
  transition: background 0.2s;
  padding: 0;
  margin: 0;
  text-decoration: none;
  border: none;
  cursor: pointer;
  position: relative;
}

/* NAV ICON */
.nav-icon,
.loupe-blanc,
.loupe-noir {
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  object-fit: contain;
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.15s;
}

.icon-loupe.second,
.icon-contact.second,
.icon-pdf.second,
.icon-palette.second,
.icon-stats.second {
  opacity: 0;
  pointer-events: none;
}

.nav-search-btn:hover .icon-loupe.main,
.contact-info-block:hover .icon-contact.main,
.classic-cv-block:hover .icon-pdf.main,
.color-generator-block:hover .icon-palette.main,
.stats-block:hover .icon-stats.main {
  opacity: 0;
}

.nav-search-btn:hover .icon-loupe.second,
.contact-info-block:hover .icon-contact.second,
.classic-cv-block:hover .icon-pdf.second,
.color-generator-block:hover .icon-palette.second,
.stats-block:hover .icon-stats.second {
  opacity: 1;
}

/* Hover background pour tous les boutons navbar */
.nav-search-btn:hover,
.contact-info-block:hover,
.classic-cv-block:hover,
.color-generator-block:hover,
.stats-block:hover {
  background: var(--background-general-light);
}

body.light .nav-search-btn:hover,
body.light .contact-info-block:hover,
body.light .classic-cv-block:hover,
body.light .color-generator-block:hover,
body.light .stats-block:hover {
  background: var(--background-general-dark);
}

/* Emojis dans les icônes palette (font-size adapté) + stats*/
.icon-palette {
  font-size: 1.5rem;
  line-height: -0.7rem;
}

.icon-stats {
  font-size: 1.5rem;
  line-height: -0.7rem;
  padding-left: 3.5px;
}

/* =============================================
   HAMBURGER MENU (≤1000px)
   ============================================= */
/* Bouton hamburger - masqué par défaut */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: var(--nav-block-size);
  height: var(--nav-block-size);
  background: transparent;
  border: none;
  border-radius: var(--radius-main);
  cursor: pointer;
  padding: 10px;
  transition: background 0.2s;
  position: relative;
  z-index: 1002;
}

.hamburger-btn:hover {
  background: var(--text-dark);
}

body.light .hamburger-btn:hover {
  background: var(--background-general-light);
}

.hamburger-btn:hover .hamburger-line {
  background: var(--text-light);
}

body.light .hamburger-btn:hover .hamburger-line {
  background: var(--text-dark);
}

.hamburger-line {
  width: 24px;
  height: 3px;
  background: var(--text-light);
  border-radius: 2px;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease,
    background 0.2s;
}

body.light .hamburger-line {
  background: var(--text-dark);
}

/* Animation du bouton hamburger quand le menu est ouvert */
body.hamburger-menu-open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.hamburger-menu-open .hamburger-line:nth-child(2) {
  opacity: 0;
}

body.hamburger-menu-open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Overlay du menu hamburger */
.hamburger-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

body.light .hamburger-menu {
  background: rgba(255, 255, 255, 0.3);
}

.hamburger-menu[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

/* Contenu du menu */
.hamburger-menu-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 90%;
  max-width: 400px;
  padding: 30px;
  background: var(--background-surface-dark);
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-main);
}

body.light .hamburger-menu-content {
  background: var(--background-surface-light);
}

/* Items du menu */
.hamburger-menu-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: var(--background-general-dark);
  border-radius: var(--radius-main);
  text-decoration: none;
  color: var(--text-light);
  font-weight: 600;
  font-size: 1.1rem;
  transition:
    background 0.3s ease,
    transform 0.2s ease,
    box-shadow 0.3s ease;
  cursor: pointer;
  position: relative;
  border: none;
  width: 100%;
  text-align: left;
}

body.light .hamburger-menu-item {
  background: var(--background-general-light);
  color: var(--text-dark);
}

.hamburger-menu-item:hover {
  background: var(--background-general-light);
  color: var(--text-dark);
  transform: translateX(5px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--text-light) 40%, transparent);
}

body.light .hamburger-menu-item:hover {
  background: var(--background-general-dark);
  color: var(--text-light);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.25);
}

/* Icônes dans le menu */
.hamburger-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  transition:
    opacity 0.15s,
    transform 0.2s ease;
}

/* Animation des icônes au hover */
.hamburger-menu-item:hover .hamburger-icon {
  transform: scale(1.1);
}

.hamburger-menu-item .icon-loupe.second,
.hamburger-menu-item .icon-contact.second,
.hamburger-menu-item .icon-pdf.second {
  position: absolute;
  left: 20px;
  opacity: 0;
}

.hamburger-menu-item:hover .icon-loupe.main,
.hamburger-menu-item:hover .icon-contact.main,
.hamburger-menu-item:hover .icon-pdf.main {
  opacity: 0;
}

.hamburger-menu-item:hover .icon-loupe.second,
.hamburger-menu-item:hover .icon-contact.second,
.hamburger-menu-item:hover .icon-pdf.second {
  opacity: 1;
}

/* Theme switch dans le menu */
.theme-switch-mobile {
  position: relative;
}

.theme-switch-mobile .hamburger-icon {
  transition: opacity 0.3s;
}

.theme-switch-mobile .sun {
  opacity: 0;
}

.theme-switch-mobile .moon {
  opacity: 1;
}

body.light .theme-switch-mobile .sun {
  opacity: 1;
}

body.light .theme-switch-mobile .moon {
  opacity: 0;
}

.hamburger-menu-label {
  flex: 1;
}

.theme-label {
  pointer-events: none;
}

/* Responsive : afficher le menu hamburger à ≤1000px */
@media (max-width: 1000px) {
  /* Afficher le bouton hamburger uniquement sur la page CV */
  body.cv-page .hamburger-btn {
    display: flex;
  }

  /* Masquer les liens navbar classiques uniquement sur la page CV */
  body.cv-page .navbar > .nav-search-btn,
  body.cv-page .navbar > .contact-info-block,
  body.cv-page .navbar > .classic-cv-block,
  body.cv-page .navbar > .color-generator-block,
  body.cv-page .navbar > .favorites-badge,
  body.cv-page .navbar > .stats-block {
    display: none;
  }

  /* Garder le theme-switch visible mais le positionner à gauche du hamburger */
  body.cv-page .navbar > .theme-switch {
    order: -1;
    margin-right: auto;
  }

  /* Positionner le hamburger à droite */
  body.cv-page .hamburger-btn {
    margin-left: auto;
  }

  /* Afficher le menu overlay uniquement sur la page CV */
  body.cv-page .hamburger-menu {
    display: block;
  }
}

/* Adaptation pour mobile ≤430px (header en bas) */
@media (max-width: 430px) {
  .hamburger-btn {
    /* Le bouton reste à sa place dans le header qui est désormais en bas */
    position: relative;
  }

  .hamburger-menu-content {
    /* Ajuster la position pour éviter de chevaucher le header en bas */
    top: 45%;
    max-height: calc(100% - 120px);
    overflow-y: auto;
  }
}

/* =============================================
   RANGE SLIDER
   ============================================= */
.range-slider-container {
  width: 80%;
  padding: 16px 0 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--background-surface-dark);
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-main);
  margin-bottom: 12px;
  position: relative;
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: var(--text-light);
  outline: none;
  opacity: 0.85;
  transition: opacity 0.2s;
  box-shadow: var(--shadow-main);
  margin-bottom: 4px;
  margin-top: -4px;
  display: block;
  position: relative;
  /* Default, replaced by JS updateThumb() */
  --thumb-img: url("../img/rangeslider/darkmode/etudes-bleu.png");
}

/* THUMB */
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 38px;
  border-radius: 19px;
  background: var(--text-light)
    var(--thumb-img, url("../img/rangeslider/darkmode/etudes-bleu.png")) center
    center no-repeat;
  background-size: 50px 50px !important;
  border: 3px solid var(--background-surface-dark);
  box-shadow: 0 2px 6px rgba(30, 30, 60, 0.15);
  cursor: pointer;
  transition:
    background 0.2s,
    border 0.2s,
    transform 0.15s;
  position: relative;
}

.range-slider:hover::-webkit-slider-thumb,
.range-slider:focus:hover::-webkit-slider-thumb,
.range-slider:active::-webkit-slider-thumb {
  background-size: 56px 56px !important;
  transform: scale(1.05);
}

.range-slider:focus::-webkit-slider-thumb {
  background: var(--background-surface-dark)
    var(--thumb-img, url("../img/rangeslider/darkmode/etudes-blanc.png")) center
    center no-repeat;
  background-size: 56px 56px !important;
  border: 3px solid var(--text-light);
}

/* Firefox */
.range-slider::-moz-range-thumb {
  width: 70px;
  height: 38px;
  border-radius: 19px;
  background: var(--text-light)
    var(--thumb-img, url("../img/rangeslider/darkmode/etudes-bleu.png")) center
    center no-repeat;
  border: 3px solid var(--background-surface-dark);
  box-shadow: 0 2px 6px rgba(30, 30, 60, 0.15);
  cursor: pointer;
  transition:
    background 0.2s,
    border 0.2s,
    transform 0.15s;
}

/* Edge/IE */
.range-slider::-ms-thumb {
  width: 70px;
  height: 38px;
  border-radius: 19px;
  background: var(--text-light)
    var(--thumb-img, url("../img/rangeslider/darkmode/etudes-bleu.png")) center
    center no-repeat;
  border: 3px solid var(--background-surface-dark);
  box-shadow: 0 2px 6px rgba(30, 30, 60, 0.15);
  cursor: pointer;
  transition:
    background 0.2s,
    border 0.2s,
    transform 0.15s;
}

/* =============================================
   CONTENEURS LAYOUT
   ============================================= */
.fix-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
}
/* CONTENAIR CHANGEANT */
.content-container {
  width: 100%;
  overflow: hidden;
  position: relative;
  height: 100%;
}

.content-slider {
  display: flex;
  transition: transform 0.5s ease-out;
  width: 400%;
  height: 100%;
}

.content-section {
  flex: 0 0 17.5%;
  width: 17.5%;
  padding: 20px;
  box-sizing: border-box;
  border-left: 8px solid var(--background-general-dark);
  border-right: 8px solid var(--background-general-dark);
  border-bottom: 8px solid var(--background-general-dark);
  border-top: none;
  height: 100%;
  min-height: calc((var(--app-vh, 1vh) * 100) - 180px);
  display: flex;
  flex-direction: column;
}

/* Prefer stable svh when supported (prevents URL/tab bars from affecting layout) */
@supports (height: 100svh) {
  html,
  body {
    min-height: 100svh;
  }
  body {
    min-height: 100svh;
  }
  .content-section {
    min-height: calc(100svh - 180px);
  }
}

/* etudes */
#etudes {
  background-color: var(--background-moyen-dark);
  background-image:
    linear-gradient(rgba(144, 202, 249, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(144, 202, 249, 0.2) 1px, transparent 1px);
  background-size: 32px 32px;
  background-attachment: local;
  border-radius: var(--radius-main);
  box-shadow:
    var(--shadow-main),
    0 5px 15px rgba(0, 0, 0, 0.1);
  padding: 39px 20px;
  font-family:
    "Indie Flower", cursive, "Comic Sans MS", "Segoe Script", sans-serif;
  color: var(--text-light);
  line-height: 1.19;
  position: relative;
  border: 1px solid rgba(144, 202, 249, 0.3);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: auto;
}

#etudes::before {
  content: "";
  position: fixed;
  left: calc(8px + 25px);
  top: 0;
  height: 100%;
  width: 2px;
  background-color: rgba(255, 99, 71, 0.7);
  z-index: 1;
}

#etudes .etudes {
  padding-left: 30px;
  padding-bottom: 1px;
  margin-bottom: 30px;
  position: relative;
  transition: transform 0.2s;
}

#etudes .etudes:hover {
  transform: translateY(-3px);
}

#etudes .titre-section {
  color: var(--text-light);
  font-size: 1.3rem;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  position: relative;
  padding-bottom: 4px;
}

#etudes h1.titre-section {
  font-size: 1.35rem;
  line-height: 1.48;
}

#etudes h2.titre-section {
  font-size: 1.35rem;
  line-height: 1.48;
}

#etudes .titre-section::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  height: 3px;
  width: 80%;
  background: linear-gradient(
    90deg,
    var(--background-surface-light),
    transparent
  );
}

#etudes .texte-etudes {
  font-size: 1.1rem;
  line-height: 1.77;
  padding-left: 5px;
  position: relative;
}

#etudes .etudes:nth-child(odd) .texte-etudes {
  transform: rotate(-0.3deg);
}

#etudes .etudes:nth-child(even) .texte-etudes {
  transform: rotate(0.2deg);
}

/* etudes chart */

.trading-chart {
  width: 90%;
  margin: 20px auto 10px;
  padding: 8px;
  position: relative;
  max-width: 480px;
  border-radius: 10px;
  transform: rotate(-0.5deg);
  transition: transform 0.3s ease;
}

.trading-chart:hover {
  transform: rotate(0.5deg) translateY(-3px);
}

.trading-chart::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(144, 202, 249, 0.08);
  border-radius: 10px;
  z-index: -1;
}

.trading-chart::after {
  content: "📈";
  position: absolute;
  top: -10px;
  right: 20px;
  font-size: 24px;
  transform: rotate(5deg);
  opacity: 0.8;
}

.trading-chart-img {
  width: 100%;
  height: auto;
  max-height: 250px;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.light-mode-img {
  display: none;
}

/* trades */
#trading {
  background-color: #e6f2ff;
}

/* Trading chart full section */

#trading.content-section {
  /* Remove inner padding so the chart can occupy the full section */
  padding: 0;
}

#trading .contenu-principal {
  flex: 1;
  display: flex;
  min-height: 0;
  flex-direction: column; /* Permet d'empiler chart + strip */
}
.trading-live-chart {
  flex: 1;
  width: 100%;
  /* Background synchronized with chart theme (dark by default) */
  background-color: var(--background-moyen-dark);
  height: 100%;
  min-height: 0;
  position: relative; /* Needed so tooltip absolute positioning anchors to the chart container */
}

/* Mobile-only press hint overlay inside trading chart */
.trading-live-chart .press-hint {
  position: absolute;
  left: 25%;
  bottom: 25%;
  top: auto;
  transform: translate(-50%, 50%);
  opacity: 0;
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
  pointer-events: none;
  z-index: 5;
  padding: 10px 16px 12px;
  font-size: 12px;
  line-height: 1.35;
  border-radius: 18px;
  border: 1px solid rgba(239, 83, 80, 0.3);
  background: linear-gradient(
    145deg,
    rgba(32, 32, 59, 0.62),
    rgba(32, 32, 59, 0.48)
  );
  color: var(--text-light, #f5f6fa);
  backdrop-filter: blur(2px);
  box-shadow: 0 4px 18px -4px rgba(0, 0, 0, 0.35);
  max-width: clamp(240px, 80%, 440px);
  text-align: center;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  letter-spacing: 0.25px;
  box-sizing: border-box;
}
.trading-live-chart .press-hint.show {
  opacity: 1;
  transform: translate(-50%, 50%);
}

/* Center only the swipe variant in the middle of the chart */
.trading-live-chart .press-hint.variant-swipe {
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
}
.trading-live-chart .press-hint.variant-swipe.show {
  transform: translate(-50%, -50%);
}

/* Icon-only variants */
.trading-live-chart .press-hint .hint-icon {
  display: inline-block;
  font-size: 22px;
}
.trading-live-chart .press-hint.variant-pulse .hint-icon {
  animation: hint-pulse 1.2s ease-in-out infinite;
}
.trading-live-chart .press-hint.variant-swipe .hint-icon {
  animation: hint-swipe 1.6s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.95;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

@keyframes hint-swipe {
  0% {
    transform: translateX(-12px);
    opacity: 0.85;
  }
  50% {
    transform: translateX(12px);
    opacity: 1;
  }
  100% {
    transform: translateX(-12px);
    opacity: 0.85;
  }
}

/* Light theme variant */
body.light .trading-live-chart .press-hint {
  background: linear-gradient(
    145deg,
    rgba(237, 234, 215, 0.75),
    rgba(237, 234, 215, 0.55)
  );
  color: var(--text-dark, #1a1a2e);
  border-color: rgba(239, 83, 80, 0.3);
}

/* Only display on coarse pointers (mobile/tablet) */
@media (pointer: fine) {
  .trading-live-chart .press-hint {
    display: none;
  }
}

/* Bandeau de swipe sous la chart trading */
.trading-swipe-strip {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.45);
  background: var(--background-general-dark);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-x; /* autorise le swipe horizontal, bloque le vertical */
}

.trading-swipe-strip .swipe-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0.8;
  color: var(--text-light);
  font-size: 12px;
  letter-spacing: 0.3px;
}

.trading-swipe-strip .swipe-hint .dots {
  width: 38px;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0.04)
  );
  position: relative;
  overflow: hidden;
}

.trading-swipe-strip .swipe-hint .dots::before {
  content: "";
  position: absolute;
  left: -20%;
  top: 0;
  width: 20%;
  height: 100%;
  background: rgba(255, 255, 255, 0.38);
  border-radius: 4px;
  animation: swipe-glint 1.6s infinite;
}

@keyframes swipe-glint {
  0% {
    left: -20%;
  }
  60% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

.trading-swipe-strip .arrow {
  font-size: 14px;
  opacity: 0.8;
}

/* Leclerc */

#leclerc {
  background-color: var(--background-moyen-dark);
  /* Responsive sizing tokens for the Leclerc section */
  --leclerc-gap: clamp(10px, 2.4vw, 18px);
  --fruit-size: clamp(42px, 7vw, 58px);
  --plate-h: clamp(110px, 18vw, 140px);
  --readout-h: clamp(70px, 12vw, 96px);
  --ticket-w: clamp(220px, 46vw, 280px);
  --balance-w: clamp(290px, 48vw, 360px);
}
#leclerc .leclerc-demo {
  display: flex;
  flex-direction: column;
  gap: var(--leclerc-gap);
}

#leclerc .leclerc-header {
  /* Minimal, modern strip header */
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 18px 20px;
  /* Span full inner width of content-section and stick to top */
  margin: -20px -20px 12px -20px; /* cancels .content-section padding (20px) */
  /* Subtle divider to separate from content */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

#leclerc .leclerc-header .titre-section {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.35;
  color: var(--text-light);
  letter-spacing: 0.3px;
  position: relative;
  padding-left: 0; /* centered layout */
  display: inline-block;
}
#leclerc .leclerc-grid {
  display: flex;
  flex-direction: column; /* stack fruits above balance */
  align-items: flex-start;
  gap: var(--leclerc-gap);
  /* Enable container queries for child sizing on mobile */
  container-type: inline-size;
  container-name: leclerc;
}

/* Order: fruits first, then balance */
#leclerc .fruit-list-container {
  order: 1;
}

#leclerc .balance-container {
  order: 2;
}

/* Balance card container */
#leclerc .balance-container {
  background: var(--background-leger-dark);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 3px solid var(--leclerc-accent);
  border-radius: 12px;
  box-shadow: var(--shadow-main);
  padding: 10px 12px 12px 12px;
  /* width handled by layout; inner scale column uses --balance-w */
}

#leclerc .balance-desc {
  color: var(--text-light);
  margin: 2px 2px 6px 2px;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* Balance layout: arm on top, plate left, readout right, base across */
#leclerc .balance {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  grid-template-areas:
    "arm arm"
    "plate readout"
    "base base";
  gap: 10px 12px;
  align-items: center;
}

#leclerc .balance-arm {
  grid-area: arm;
  height: 4px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.25),
    rgba(255, 255, 255, 0.05)
  );
  position: relative;
}

#leclerc .balance-arm::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.35),
    rgba(255, 255, 255, 0.08)
  );
}

#leclerc .balance-plate {
  grid-area: plate;
  height: var(--plate-h);
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(0, 0, 0, 0.12)
  );
  border: 2px dashed rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 -8px 16px rgba(0, 0, 0, 0.15);
  position: relative;
}

/* Subtle ticks inside plate */
#leclerc .balance-plate::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  height: 8px;
  background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.14) 1px,
      transparent 1px
    )
    repeat-x;
  background-size: 6px 8px;
  opacity: 0.7;
}

#leclerc .balance-plate.dropzone:hover,
#leclerc .balance-plate.dropzone:focus-within {
  border-color: var(--leclerc-accent);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(60, 140, 60, 0.15);
}

#leclerc .balance-readout {
  grid-area: readout;
  height: var(--readout-h);
  border-radius: 10px;
  /* LCD glass feel */
  background: linear-gradient(180deg, #0b140b, #0f2010);
  border: 1px solid rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  color: var(--text-light);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -2px 8px rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

/* scanlines and subtle vignette */
#leclerc .balance-readout::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      120% 120% at 50% 0%,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0) 60%
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.06) 0 1px,
      rgba(0, 0, 0, 0) 1px 3px
    );
  opacity: 0.35;
  pointer-events: none;
}

/* small green LED indicator */
#leclerc .balance-readout::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    #b8ffb8,
    #3ab83a 60%,
    #0a300a 100%
  );
  box-shadow:
    0 0 6px #68ff68,
    0 0 12px rgba(104, 255, 104, 0.4);
}

#leclerc .balance-readout .balance-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.8;
  color: #9ed39e;
  text-shadow: 0 0 3px rgba(152, 255, 152, 0.35);
  font-feature-settings:
    "tnum" 1,
    "zero" 1;
}

#leclerc .balance-readout .balance-experience {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #bfffbf;
  text-shadow:
    0 0 6px #86ff86,
    0 0 14px rgba(43, 229, 43, 0.45),
    0 0 24px rgba(43, 229, 43, 0.25);
  font-variant-numeric: tabular-nums;
  font-feature-settings:
    "tnum" 1,
    "zero" 1;
}

#leclerc .balance-base {
  grid-area: base;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18),
    rgba(0, 0, 0, 0.2)
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 6px rgba(0, 0, 0, 0.3);
}

/* Printer housing: use ticket-output as the printer body */
#leclerc .ticket-output {
  margin-top: 10px;
  background: var(--background-leger-dark);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: var(--shadow-main);
  padding: 12px 12px 6px 12px;
  position: relative;
}

/* Printer slot */
#leclerc .ticket-output::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 10px;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2));
}

/* Prepare the printer body to clip the ticket during future print animation */
#leclerc .ticket-output {
  overflow: hidden;
}

/* Classic receipt look */
#leclerc .ticket {
  width: var(--ticket-w);
  margin: 6px auto 12px auto;
  padding: 14px 14px 46px 14px; /* bottom space for barcode */
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.03) 0 1px,
      transparent 1px 5px
    ),
    linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  color: #222;
  border-radius: 6px 6px 10px 10px;
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    "Courier New", monospace;
  line-height: 1.35;
  position: relative;
  transform: translateY(-2px);
}

/* Perforation line near the top */
#leclerc .ticket::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.6) 0 6px,
    rgba(0, 0, 0, 0) 6px 12px
  );
  opacity: 0.25;
}

/* Fake barcode at the bottom */
#leclerc .ticket::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 26px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.88) 0 2px,
      transparent 2px 4px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.95) 0 1px,
      transparent 1px 3px
    );
  border-radius: 2px;
  opacity: 0.9;
}

/* Ticket blocks */
#leclerc .ticket-header {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin: 2px 0 8px 0;
}

#leclerc .ticket-experience {
  border-top: 1px dashed rgba(0, 0, 0, 0.25);
  border-bottom: 1px dashed rgba(0, 0, 0, 0.25);
  padding: 8px 0;
  margin: 6px 0;
}

#leclerc .ticket-experience-title {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.9rem;
  font-weight: 700;
  margin: 4px 0 4px 0;
}

#leclerc .ticket-experience-text {
  font-size: 0.85rem;
  color: #222;
}

#leclerc .ticket-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  margin-top: 8px;
  padding-top: 6px;
}

#leclerc .ticket-msg {
  text-transform: uppercase;
  font-weight: 600;
}

/* Future animation: when printing, the ticket slides out of the slot */
#leclerc .ticket.is-printing {
  animation: ticket-print 1.4s ease-out forwards;
}

@keyframes ticket-print {
  0% {
    transform: translateY(-115%);
  }
  60% {
    transform: translateY(-6%);
  }
  100% {
    transform: translateY(0);
  }
}

/* Light mode: keep paper white, maintain same contrast */
body.light #leclerc .ticket {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.035) 0 1px,
      transparent 1px 5px
    ),
    linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
  color: #222;
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
#leclerc .fruit-list-container {
  position: relative;
  display: block;
  background: var(--background-leger-dark);
  padding: 10px 12px; /* compact interior */
  margin: 6px 0; /* stick just below header */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 3px solid var(--leclerc-accent);
  border-radius: 12px;
  box-shadow: var(--shadow-main);
  width: var(--balance-w); /* match balance width */
}

/* Subtle supermarket-scale cues: thin top bar and tiny ticks */
#leclerc .fruit-list-container::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 10px;
  right: 10px;
  height: 3px; /* continues the accent bar visually */
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--leclerc-accent) 15%,
    var(--leclerc-accent-alt) 50%,
    var(--leclerc-accent) 85%,
    transparent 100%
  );
  opacity: 0.55;
  border-top-left-radius: 2px;
  border-top-right-radius: 2px;
}

#leclerc .fruit-list-container::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 12px;
  right: 12px;
  height: 8px;
  background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.14) 1px,
      transparent 1px
    )
    repeat-x;
  background-size: 6px 8px; /* small ticks */
  mask: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
  -webkit-mask: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
}

body.light #leclerc .fruit-list-container::after {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18) 1px, transparent 1px)
    repeat-x;
}

/* Light mode variants for balance */
body.light #leclerc .balance-container {
  background: var(--background-leger-light);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--leclerc-accent);
}

body.light #leclerc .balance-desc {
  color: var(--text-dark);
}

body.light #leclerc .balance-arm {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.06));
}

body.light #leclerc .balance-plate {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.08));
  border-color: rgba(0, 0, 0, 0.15);
}

body.light #leclerc .balance-plate::before {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.22) 1px, transparent 1px)
    repeat-x;
}

body.light #leclerc .balance-readout {
  background: linear-gradient(180deg, #e7f3e7, #dbe9db);
  border: 1px solid rgba(0, 0, 0, 0.18);
  color: var(--text-dark);
}

body.light #leclerc .balance-readout .balance-experience {
  color: #1b5e1b;
  text-shadow:
    0 0 2px rgba(27, 94, 27, 0.25),
    0 0 8px rgba(27, 94, 27, 0.15);
}

body.light #leclerc .balance-base {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.06));
}

body.light #leclerc .ticket-output {
  background: var(--background-leger-light);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

#leclerc .fruit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-top: 5px;
  display: flex;
  justify-content: center; /* center row */
  gap: 6px;
  width: 100%; /* full width of container */
}

#leclerc .fruit-item {
  background: var(--background-leger-dark);
  border-radius: 10px;
  box-shadow:
    var(--shadow-main),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  width: var(--fruit-size);
  height: var(--fruit-size); /* enforce square */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  transition:
    transform 0.16s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
  flex: 0 0 auto; /* prevent shrinking/wrapping */
}

#leclerc .fruit-item:active {
  cursor: grabbing;
}

#leclerc .fruit-item:hover,
#leclerc .fruit-item:focus {
  transform: translateY(-2px);
  outline: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#leclerc .fruit-emoji {
  font-size: calc(var(--fruit-size) * 0.58); /* scale with fruit size */
  line-height: 1;
}

#leclerc .balance-plate .plate-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* don't block drops */
  font-size: clamp(32px, 10cqh, 72px);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

/* OVERFLOW */
#leclerc {
  overflow-y: auto;
}
/* Make all cards full-width of the main container */
#leclerc .fruit-list-container,
#leclerc .balance-container,
#leclerc .ticket-output {
  width: 100%;
  max-width: none;
  /* Make each card its own container for cq* units */
  container-type: inline-size;
  container-name: leclerc-card;
}
/* Stretch the layout container so children expand fully */
#leclerc .leclerc-grid {
  align-items: stretch;
}
/* Wrap fruits on small widths to prevent horizontal scroll */
#leclerc .fruit-list {
  flex-wrap: wrap;
}
/* Make sizes scale with the container width using container query units */
#leclerc {
  --balance-w: 100%;
  --ticket-w: 100%;
  --fruit-size: clamp(40px, 12cqw, 72px);
  --plate-h: clamp(120px, 40cqw, 260px);
  --readout-h: clamp(70px, 18cqw, 160px);
}
/* Scale readout typography with container */
#leclerc .balance-readout .balance-label {
  font-size: clamp(0.68rem, 2.2cqw, 0.9rem);
}
#leclerc .balance-readout .balance-experience {
  font-size: clamp(0.95rem, 3.6cqw, 1.4rem);
}
/* Scale ticket typography with container */
#leclerc .ticket-header {
  font-size: clamp(0.9rem, 4cqw, 1.1rem);
}
#leclerc .ticket-experience-title {
  font-size: clamp(0.85rem, 3.4cqw, 1rem);
}
#leclerc .ticket-experience-text {
  font-size: clamp(0.8rem, 3cqw, 0.95rem);
}
#leclerc .ticket-footer {
  font-size: clamp(0.75rem, 2.6cqw, 0.9rem);
}

/* Lightmode variants: isolated container + items */
body.light #leclerc .fruit-list-container {
  background: var(--background-leger-light);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--leclerc-accent);
  box-shadow: var(--shadow-main);
}

/* Lightmode variants for fruit list */
body.light #leclerc .fruit-item {
  background: var(--background-leger-light);
  box-shadow:
    var(--shadow-main),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Small accent dot + gentle underline for a clean, branded cue */
#leclerc .leclerc-header .titre-section::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--leclerc-accent);
  box-shadow: 0 0 0 3px rgba(60, 140, 60, 0.18);
}

#leclerc .leclerc-header .titre-section::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -6px;
  width: 76px;
  height: 2px;
  background: linear-gradient(90deg, var(--leclerc-accent), transparent);
  opacity: 0.9;
}

/* Wide layout ≥1024px: switch to horizontal flow with height-driven responsiveness */
@media (min-width: 1024px) {
  /* Section scroll becomes horizontal */
  #leclerc {
    overflow-x: auto;
    overflow-y: hidden;
  }

  /* Ensure the Leclerc inner wrappers stretch to available height */
  #leclerc,
  #leclerc .contenu-principal {
    height: 100%;
    min-height: 0;
  }
  /* Make the main content act as a column: header auto, grid fills the rest */
  #leclerc .contenu-principal {
    display: flex;
    flex-direction: column;
  }
  #leclerc .leclerc-grid {
    min-height: 0; /* allow children to size without forcing overflow */
    flex: 1 1 auto; /* occupy remaining height under the header */
  }

  /* Two main columns: fruits (fixed column) | balance container (flex column) */
  #leclerc .leclerc-grid {
    display: grid;
    grid-template-columns: var(--fruit-col-w) minmax(560px, 1fr);
    grid-auto-rows: 1fr; /* single row filling height */
    align-items: stretch;
    /* Slightly reduced gap between fruit column and balance card */
    gap: clamp(8px, 2vw, 14px);
  }

  /* Wide tokens for columns */
  #leclerc {
    /* ~30% narrower fruit column */
    --fruit-col-w: clamp(49px, 12.6vw, 70px);
  }

  /* Make the two main cards fill the section's height and not overflow */
  #leclerc .fruit-list-container,
  #leclerc .balance-container {
    height: 100%;
    margin-top: 0;
    overflow: hidden;
  }

  /* Switch cards to two-axis container queries so cqh works */
  #leclerc .fruit-list-container,
  #leclerc .balance-container,
  #leclerc .ticket-output {
    container-type: size;
  }

  /* Scale internals using container height instead of width */
  #leclerc {
    --balance-w: auto;
    --ticket-w: clamp(220px, 40cqh, 320px);
    --fruit-size: clamp(42px, 12cqh, 84px);
    /* Increase heights for a more imposing balance */
    --plate-h: clamp(180px, 56cqh, 460px);
    --readout-h: clamp(90px, 24cqh, 220px);
    /* Fixed header (desk) heights: title row + description row */
    --balance-desk-title-h: clamp(28px, 6cqh, 38px);
    --balance-desk-desc-h: clamp(22px, 6cqh, 34px);
  }

  /* Fruit list becomes a vertical column on the left */
  #leclerc .fruit-list {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: space-evenly; /* spread along the column height */
    align-items: center;
    height: 100%;
    overflow-y: auto; /* scroll inside if items exceed available height */
    padding-block: 6px;
    overscroll-behavior: contain;
  }

  /* Keep fruit size coherent with narrow column: cap by inline width */
  #leclerc .fruit-list-container {
    /* fruit box size: limited by height-based token and by column inline size */
    --fruit-box: min(var(--fruit-size), 85cqi);
  }
  #leclerc .fruit-item {
    width: var(--fruit-box);
    height: var(--fruit-box);
  }
  #leclerc .fruit-emoji {
    font-size: calc(var(--fruit-box) * 0.58);
  }

  /* Balance container becomes two columns: balance | ticket */
  #leclerc .balance-container {
    display: grid;
    /* Stronger reduction: ~27% balance | 73% ticket (≈40% less than 45%) */
    grid-template-columns: minmax(240px, 0.54fr) minmax(280px, 1.46fr);
    /* Fixed header row (desc) + flexible content row */
    grid-template-rows: var(--balance-desk-desc-h, 28px) 1fr;
    align-items: stretch;
    column-gap: var(--leclerc-gap);
    row-gap: 6px;
  }

  #leclerc .balance-desc {
    grid-column: 1 / -1; /* desc spans both columns */
    grid-row: 1;
    margin: 0; /* keep header height stable */
    align-self: center; /* vertically center within its fixed row */
  }

  #leclerc .balance {
    grid-column: 1;
    grid-row: 2; /* place in content row under fixed header row */
    align-self: stretch; /* fill available height */
    /* Rework grid: arm left, base right, plate above readout */
    display: grid;
    height: 100%;
    min-height: 0; /* allow shrinking inside grid container */
    grid-template-columns: var(--arm-w, clamp(10px, 3cqh, 22px)) 1fr var(
        --base-w,
        clamp(10px, 3cqh, 22px)
      );
    grid-template-rows: 2.4fr 1fr; /* plate row taller than readout row */
    grid-template-areas:
      "arm plate base"
      "arm readout base";
    gap: 12px;
  }

  #leclerc .ticket-output {
    grid-column: 2;
    grid-row: 2; /* place in content row under fixed header row */
    margin-top: 0; /* remove top gap in grid */
    display: flex;
    /* Stretch vertically so the ticket can use the column height */
    align-items: stretch;
    justify-content: flex-start; /* let the ticket occupy full inline space */
    height: 100%; /* fill remaining vertical space */
    min-height: 0; /* allow shrinking to avoid overflow */
  }

  /* Make the ticket occupy more vertical space and layout its blocks */
  #leclerc .ticket-output .ticket {
    display: flex;
    flex-direction: column;
    /* Fill the entire ticket-output container */
    width: 100%;
    height: 100%;
    box-sizing: border-box; /* include internal padding in the full size */
    margin: 0;
  }

  /* Ensure header/footer stay fixed while the content grows */
  #leclerc .ticket-header,
  #leclerc .ticket-footer {
    flex-shrink: 0;
  }

  /* Let the middle block expand and scroll if needed */
  #leclerc .ticket-experience {
    flex: 1 1 auto;
    overflow-y: auto;
  }

  /* Vertical arm on the left */
  #leclerc .balance-arm {
    grid-area: arm;
    width: 100%;
    height: 100%;
    align-self: stretch;
    border-radius: 6px;
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.25),
      rgba(255, 255, 255, 0.05)
    );
    position: relative;
  }
  #leclerc .balance-arm::after {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
  }

  /* Vertical base on the right */
  #leclerc .balance-base {
    grid-area: base;
    width: 100%;
    height: 100%;
    align-self: stretch;
    border-radius: 6px;
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.18),
      rgba(0, 0, 0, 0.2)
    );
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.25),
      inset 0 -2px 6px rgba(0, 0, 0, 0.3);
  }

  /* Plate and readout areas per new grid */
  #leclerc .balance-plate {
    grid-area: plate;
    height: auto;
    align-self: stretch;
  }

  #leclerc .balance-readout {
    grid-area: readout;
    height: auto;
    align-self: stretch;
    min-height: clamp(90px, 20cqh, 260px);
  }

  /* Height-based typography scaling inside readout and ticket */
  #leclerc .balance-readout .balance-label {
    font-size: clamp(0.68rem, 2.2cqh, 0.9rem);
  }
  #leclerc .balance-readout .balance-experience {
    font-size: clamp(0.95rem, 3.6cqh, 1.4rem);
  }
  #leclerc .ticket-header {
    font-size: clamp(0.9rem, 4cqh, 1.1rem);
    /* Reduce vertical footprint on wide screens */
    margin: 0 0 2px 0;
    line-height: 1.1;
  }
  #leclerc .ticket-experience-title {
    font-size: clamp(0.85rem, 3.4cqh, 1rem);
  }
  #leclerc .ticket-experience-text {
    font-size: clamp(0.8rem, 3cqh, 0.95rem);
  }
  #leclerc .ticket-footer {
    font-size: clamp(0.75rem, 2.6cqh, 0.9rem);
    /* Reduce vertical footprint on wide screens */
    margin-top: 2px;
    padding-top: 1px;
    line-height: 1.1;
  }

  /* Desktop: print animation should slide from left to right */
  #leclerc .ticket.is-printing {
    animation: ticket-print-horizontal 1.4s ease-out forwards;
  }

  @keyframes ticket-print-horizontal {
    0% {
      /* start fully off-canvas to the left, keep slight vertical offset */
      transform: translateX(-115%) translateY(-2px);
    }
    60% {
      /* brief overshoot for a natural ease */
      transform: translateX(-6%) translateY(-2px);
    }
    100% {
      transform: translateX(0) translateY(-2px);
    }
  }
}

/* DEV */

#dev {
  background-color: #ccebff;
  padding: 0px;
}

/* DEV console layout: make the console fill the slide */
#dev .contenu-principal {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  height: 100%;
  min-height: 0; /* allow shrink inside slider */
}

#dev-terminal {
  flex: 1 1 auto;
  min-height: 0; /* fix flexbox overflow */
  min-width: 0;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  background: var(--background-general-dark, #0b0d16);
  box-shadow:
    var(--shadow-main, 0 6px 24px rgba(0, 0, 0, 0.4)),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

/* Basic Xterm colors tuned to site theme */
#dev-terminal .xterm {
  height: 100% !important;
}

#dev-terminal .xterm-viewport,
#dev-terminal .xterm-screen {
  height: 100% !important;
}

/* Harmonize with theme toggle if body.light */
body.light #dev-terminal {
  background: var(--background-general-light, #f7f7fb);
  box-shadow:
    var(--shadow-main, 0 6px 24px rgba(0, 0, 0, 0.18)),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* COMPETENCES */

.competences-section {
  flex: 0 0 7.5%;
  width: 7.5%;
  padding: 20px 14px;
  box-sizing: border-box;
  background: var(--background-leger-dark);
  border: none;
  border-radius: var(--radius-main);
  box-shadow:
    var(--shadow-main),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    8px 8px 0 0 var(--background-general-dark);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  overflow: hidden;
}

.competences-section .competence-titre {
  align-self: flex-start;
}

.competences-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 1px;
  width: 100%;
  background: linear-gradient(
    90deg,
    var(--background-surface-dark) 0%,
    var(--text-light) 50%,
    var(--background-surface-dark) 100%
  );
  opacity: 0.6;
}

.competence-titre {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--background-surface-dark);
  padding-bottom: 6px;
  width: 100%;
  position: relative;
}

.competence-titre::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40%;
  height: 2px;
  background: var(--text-light);
  transition: width 0.3s ease;
}

.liste-competences {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-competence {
  font-size: 0.98rem;
  color: var(--text-light);
  margin-bottom: 0;
  gap: 10px;
  padding: 8px 12px;
  position: relative;
  background: var(--background-moyen-dark);
  border-radius: var(--radius-small);
  transition:
    transform 0.2s,
    background-color 0.2s;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.item-competence.interactive {
  cursor: pointer;
}

.item-competence.interactive:focus-visible {
  outline: 2px solid rgba(104, 171, 255, 0.8);
  outline-offset: 2px;
}

.item-competence:hover {
  transform: translateX(5px);
  background: var(--background-surface-dark);
}

@media (min-width: 715px) {
  .competences-section .liste-competences {
    width: 100%;
    align-items: stretch;
  }

  .competences-section .item-competence {
    width: 100%;
  }
}

.competence-nom {
  margin-left: 8px;
}

/* COMPETENCES BOUTON MOBILE */
.competences-mobile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: fixed;
  bottom: 0;
  z-index: 990;
  width: 100%;
  padding: 2px 2px 0 2px;
  background: rgba(30, 30, 54, 0.98);
  border-radius: var(--radius-main) var(--radius-main) 0 0;
  box-shadow:
    var(--shadow-main),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    8px 8px 0 0 var(--background-general-dark);
  /* Slide animation: start closed (only le grab handle + titre visible) */
  --panel-collapsed-height: 44px; /* handle + titre approx */
  transform: translateY(calc(100% - var(--panel-collapsed-height)));
  /* Transition plus lente pour le snap (ouverture/fermeture) */
  transition: transform 0.55s cubic-bezier(0.3, 0.85, 0.25, 1);
  cursor: grab;
  will-change: transform;
  /* Empêcher la sélection de texte sur la zone bouton / handle (mobile) */
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  /* Neutraliser les gestuelles implicites (double tap zoom / scroll initial) pour fiabiliser le drag vertical d'ouverture/fermeture */
  touch-action: none;
}

/* Open state */
.competences-mobile-btn.open {
  transform: translateY(0);
  cursor: default;
}

/* While dragging, disable transition for direct transform control */
.competences-mobile-btn.dragging {
  transition: none !important;
  cursor: grabbing;
}

/* Visuelle zone de drag (facultative) : accent léger sur survol desktop */
@media (hover: hover) and (pointer: fine) {
  .competences-mobile-btn::before {
    transition: background 0.25s;
  }
  .competences-mobile-btn:hover::before {
    background: linear-gradient(
      90deg,
      var(--background-general-light),
      var(--background-surface-light),
      var(--background-general-light)
    );
  }
}

/* Style adjustment of the main mobile title when panel is open */
.competences-mobile-btn .competences-mobile-titre {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin: 6px 0 4px 0;
  transition:
    font-size 0.25s ease,
    padding 0.25s ease,
    opacity 0.25s ease;
  /* Empêcher la sélection de texte sur la zone bouton / handle (mobile) */
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  /* Neutraliser les gestuelles implicites (double tap zoom / scroll initial) pour fiabiliser le drag vertical d'ouverture/fermeture */
  touch-action: none;
}

.competences-mobile-btn.open .competences-mobile-titre {
  font-size: 1.15rem;
  padding-top: 2px;
  padding-bottom: 4px;
  opacity: 0.95;
}

/* Inner dynamic content container inside the sliding panel */
#competences-dynamiques {
  width: 100%;
  padding: 6px 10px 14px 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(var(--app-vh, 1vh) * 60); /* limit height to leave context */
  scrollbar-width: thin;
  overscroll-behavior: contain; /* éviter pull-to-refresh sur certains navigateurs */
  touch-action: pan-y; /* autorise scroll vertical interne sans déclencher navigation globale */
  /* Réactiver la sélection de texte à l'intérieur de la liste dynamique */
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  /* Réautoriser le scroll/pan vertical interne du contenu */
  touch-action: pan-y;
}

/* When closed: visually hide dynamic list but keep layout height minimal */
.competences-mobile-btn:not(.open) #competences-dynamiques {
  pointer-events: none;
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  transition:
    opacity 0.25s ease 0.05s,
    max-height 0.3s ease;
}

.competences-mobile-btn.open #competences-dynamiques {
  opacity: 1;
  transition: opacity 0.35s ease 0.05s;
}

.competences-mobile-btn::before {
  content: "";
  display: block;
  width: 44px;
  height: 5px;
  background: var(--text-light);
  border-radius: 3px;
  margin: 6px auto 2px auto;
  opacity: 0.7;
}

.competences-mobile-btn::after {
  content: "";
  position: absolute;
  top: 0;
  height: 3px;
  width: 96%;
  background: linear-gradient(
    90deg,
    var(--background-surface-dark) 0%,
    var(--text-light) 50%,
    var(--background-surface-dark) 100%
  );
  opacity: 0.6;
}

.competences-mobile-titre {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding-bottom: 2px;
}

/* =============================================
   Search Overlay (modal ≥715px, fullscreen <715px)
   ============================================= */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  clip-path: inset(50%);
}

body.search-overlay-open {
  overflow: hidden;
}

body.download-overlay-open {
  overflow: hidden;
}

.download-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.75rem;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3050;
}

.download-overlay[aria-hidden="false"] {
  display: flex;
}

.download-modal {
  width: min(460px, 92vw);
  background: var(--background-general-dark);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.46);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem 1.5rem;
  position: relative;
}

.download-overlay-header {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
}

.download-overlay-close {
  position: absolute;
  top: 0.5rem !important;
  right: 0.5rem !important;
  transform: none !important;
}

.download-overlay-texts {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: center;
  text-align: center;
}

.download-overlay-title {
  font-size: clamp(1.1rem, 1.9vw, 1.35rem);
  font-weight: 600;
  color: var(--text-light);
  margin: 0;
}

.download-overlay-description {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-light);
  opacity: 0.78;
}

.download-overlay-actions {
  display: flex;
  justify-content: center;
}

.download-overlay-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.85rem 2.25rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-main);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.download-overlay-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(58, 149, 255, 0.15),
    rgba(39, 113, 239, 0.08)
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 0;
}

.download-overlay-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(58, 149, 255, 0.45);
  box-shadow: 0 10px 24px rgba(58, 149, 255, 0.25);
  transform: translateY(-2px);
}

.download-overlay-button:hover::before {
  opacity: 1;
}

.download-overlay-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.download-overlay-button:focus-visible {
  outline: 2px solid rgba(58, 149, 255, 0.6);
  outline-offset: 3px;
}

.download-icon {
  flex-shrink: 0;
  transition: transform 0.25s ease;
  position: relative;
  z-index: 1;
  will-change: transform;
}

.download-overlay-button:hover .download-icon {
  transform: translateY(-1px);
  animation: download-bounce 0.6s ease-in-out;
}

@keyframes download-bounce {
  0%,
  100% {
    transform: translateY(-3px);
  }
  50% {
    transform: translateY(-2px);
  }
}

body.light .download-modal {
  background: var(--background-general-light, #f5f7fb);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 22px 60px rgba(10, 16, 26, 0.18);
}

body.light .download-overlay-title {
  color: #1a1f2b;
}

body.light .download-overlay-description {
  color: rgba(26, 31, 43, 0.76);
}

body.light .download-overlay-button {
  color: var(--text-dark);
  background: rgba(26, 31, 43, 0.04);
  border-color: rgba(26, 31, 43, 0.12);
  box-shadow: 0 6px 16px rgba(26, 31, 43, 0.1);
}

body.light .download-overlay-button::before {
  background: linear-gradient(
    135deg,
    rgba(58, 149, 255, 0.12),
    rgba(39, 113, 239, 0.06)
  );
}

body.light .download-overlay-button:hover {
  background: rgba(26, 31, 43, 0.06);
  border-color: rgba(58, 149, 255, 0.35);
  box-shadow: 0 10px 24px rgba(58, 149, 255, 0.2);
}

body.light .download-overlay-close {
  color: #1a1f2b;
}

@media (max-width: 715px) {
  .download-overlay {
    padding: 1.25rem;
  }

  .download-modal {
    width: min(380px, 90vw);
    padding: 1.35rem 1.5rem 1.35rem;
    gap: 1.25rem;
  }

  .download-overlay-title {
    font-size: 1.15rem;
  }

  .download-overlay-description {
    font-size: 0.9rem;
  }

  .download-overlay-button {
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
    gap: 0.55rem;
  }

  .download-icon {
    width: 19px;
    height: 19px;
  }

  .download-overlay-close {
    top: 0.4rem !important;
    right: 0.4rem !important;
    width: 2rem !important;
    height: 2rem !important;
    font-size: 1.15rem !important;
  }
}

@media (max-width: 520px) {
  .download-modal {
    width: min(340px, 92vw);
    padding: 1.25rem 1.15rem 1.25rem;
    gap: 1.15rem;
  }

  .download-overlay-title {
    font-size: 1.05rem;
  }

  .download-overlay-description {
    font-size: 0.88rem;
  }

  .download-overlay-button {
    padding: 0.7rem 1.65rem;
    font-size: 0.9rem;
    gap: 0.5rem;
  }

  .download-icon {
    width: 17px;
    height: 17px;
  }

  .download-overlay-close {
    top: 0.35rem !important;
    right: 0.35rem !important;
    width: 1.85rem !important;
    height: 1.85rem !important;
    font-size: 1.1rem !important;
  }
}

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 3000; /* above header (1100), competences panel (1050), and landing brand (1600) */
}

.search-overlay[aria-hidden="false"] {
  display: flex;
}

.search-modal {
  width: min(1100px, 92vw);
  max-height: min(82vh, 900px);
  background: var(--background-general-dark);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-overlay-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  padding-right: 2.75rem; /* room for the close button */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-overlay-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  position: absolute;
  top: 50%;
  right: 0.25rem;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-overlay-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.search-overlay-search-slot {
  display: flex;
  align-items: center;
  width: 100%;
}

/* Ensure the search form fills available width only inside overlay */
.search-overlay-search-slot .header-search-bar.in-overlay {
  flex: 1 1 auto;
}
.header-search-bar.in-overlay .search-btn {
  flex-shrink: 0;
}

/* When the header search form is moved into the overlay, stretch it */
.header-search-bar.in-overlay {
  width: 100%;
  margin: 0; /* override header spacing */
  max-width: none; /* remove header cap */
  min-width: 0; /* allow full stretch */
}
.header-search-bar.in-overlay .search-input {
  width: 100%;
  max-width: none;
}
.header-search-bar.in-overlay .search-btn {
  flex-shrink: 0;
}
.search-overlay-search-slot .header-search-bar.in-overlay {
  flex: 1 1 auto;
}

.search-overlay-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem;
  overflow: auto;
}

.search-overlay-results {
  flex: 1 1 auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 1rem;
  background: var(--background-moyen-dark);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  position: relative;
}

.search-overlay-placeholder {
  color: var(--text-light);
  opacity: 0.62;
  font-size: 0.95rem;
  text-align: center;
  margin: auto;
  max-width: 28rem;
  line-height: 1.5;
}

/* Search history block */
.search-history-block {
  padding: 0 0 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--background-moyen-dark);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-light);
  opacity: 0.85;
  font-size: 0.92rem;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: rgba(55, 110, 220, 0.15);
  transform: translateX(4px);
  color: var(--text-light);
  opacity: 1;
}

.autocomplete-icon {
  font-size: 1.1rem;
  opacity: 0.7;
  flex-shrink: 0;
}

.autocomplete-item:hover .autocomplete-icon {
  opacity: 1;
}

.search-history-title {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-left: 0;
  opacity: 0.8;
}

.search-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.search-history-item {
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  font-size: 0.8rem;
  color: var(--text-light);
  opacity: 0.75;
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

.search-history-item:hover,
.search-history-item:focus-visible {
  background: rgba(55, 110, 220, 0.18);
  border-color: rgba(55, 110, 220, 0.35);
  transform: translateY(-2px);
  color: var(--text-light);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(55, 110, 220, 0.2);
}

.search-history-item:focus-visible {
  outline: 2px solid rgba(55, 110, 220, 0.6);
  outline-offset: 2px;
}

.search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.search-result-item {
  background: var(--background-leger-dark);
  opacity: 0.85;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.95rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  transition:
    transform 0.15s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
}

.search-result-item:hover,
.search-result-item:focus-within {
  transform: translateY(-2px);
  border-color: rgba(104, 171, 255, 0.55);
  box-shadow: 0 16px 36px rgba(31, 80, 170, 0.25);
}

.search-result-item mark {
  background: rgba(55, 110, 220, 0.25);
  color: inherit;
  border-radius: 3px;
  padding: 2px 4px;
  font-weight: 600;
}

.search-result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.search-result-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-light);
}

.search-result-periode {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(92, 147, 255, 0.2);
  border: 1px solid rgba(92, 147, 255, 0.35);
  color: var(--text-light);
  opacity: 0.9;
  font-weight: 600;
  white-space: nowrap;
}

.search-result-description {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-light);
  opacity: 0.82;
}

.search-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.search-result-tag {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-light);
  opacity: 0.88;
}

.search-result-link {
  align-self: flex-start;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  background: rgba(94, 162, 255, 0.18);
  border: 1px solid rgba(94, 162, 255, 0.4);
  color: var(--text-light);
  text-decoration: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.search-result-link:hover,
.search-result-link:focus-visible {
  background: rgba(94, 162, 255, 0.32);
  border-color: rgba(94, 162, 255, 0.6);
  color: var(--text-light);
}

/* Search result counter */
.search-result-counter {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.25rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-light);
  opacity: 0.92;
  text-align: center;
  animation: counterFadeIn 0.3s ease-out;
}

@keyframes counterFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 714px) {
  .search-result-counter {
    font-size: 0.8rem;
    padding: 0.55rem 0.85rem;
    margin-bottom: 0.85rem;
  }
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%; /* Juste en dessous de l'input */
  left: 0;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: var(--background-moyen-dark);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-top: 4px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: rgba(55, 110, 220, 0.15);
}

.autocomplete-item.active {
  background: rgba(55, 110, 220, 0.25);
  border-left: 3px solid rgba(55, 110, 220, 0.8);
  padding-left: calc(1rem - 3px); /* Compenser la bordure */
}

/* Light mode autocomplete */
body.light .autocomplete-dropdown {
  background: var(--background-surface-light);
  opacity: 0.98;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body.light .autocomplete-item {
  border-bottom-color: rgba(0, 0, 0, 0.06);
  color: var(--text-dark);
  opacity: 0.85;
}

body.light .autocomplete-item:hover {
  background: rgba(55, 110, 220, 0.08);
  color: var(--text-dark);
}

body.light .autocomplete-item.active {
  background: rgba(55, 110, 220, 0.15);
  border-left-color: rgba(55, 110, 220, 1);
}

/* Light mode variants */
body.light .search-modal {
  background: var(--background-general-light);
  border-color: rgba(0, 0, 0, 0.06);
}
body.light .search-overlay-close {
  color: var(--text-dark);
}
body.light .search-overlay-close:hover {
  background: rgba(0, 0, 0, 0.06);
}
body.light .search-overlay-results {
  border-color: rgba(0, 0, 0, 0.1);
  background: var(--background-leger-light);
  opacity: 0.86;
}
body.light .search-overlay-results::after {
  box-shadow:
    inset 0 12px 18px -12px rgba(0, 0, 0, 0.18),
    inset 0 -12px 18px -12px rgba(0, 0, 0, 0.18);
}
body.light .search-overlay-placeholder {
  color: var(--text-dark);
  opacity: 0.6;
}

/* Light mode - search history */
body.light .search-history-block {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.light .search-history-title {
  color: var(--text-dark);
}

body.light .search-history-item {
  background: rgba(55, 110, 220, 0.05);
  border-color: rgba(55, 110, 220, 0.12);
  color: var(--text-dark);
  opacity: 0.85;
}

body.light .search-history-item:hover,
body.light .search-history-item:focus-visible {
  background: rgba(55, 110, 220, 0.12);
  border-color: rgba(55, 110, 220, 0.3);
  color: var(--text-dark);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(55, 110, 220, 0.15);
}

body.light .search-result-item {
  background: var(--background-surface-light);
  opacity: 0.92;
  border-color: rgba(0, 0, 0, 0.08);
}
body.light .search-result-item mark {
  background: rgba(55, 110, 220, 0.15);
  color: var(--text-dark);
}
body.light .search-result-item:hover,
body.light .search-result-item:focus-within {
  border-color: rgba(61, 125, 224, 0.4);
}
body.light .search-result-title {
  color: var(--text-dark);
}
body.light .search-result-description {
  color: var(--text-dark);
  opacity: 0.78;
}
body.light .search-result-tag {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--text-dark);
  opacity: 0.72;
}
body.light .search-result-periode {
  background: rgba(55, 110, 220, 0.15);
  border-color: rgba(55, 110, 220, 0.3);
  color: var(--text-dark);
  opacity: 0.85;
}
body.light .search-result-link {
  background: rgba(55, 110, 220, 0.18);
  border-color: rgba(55, 110, 220, 0.4);
  color: var(--text-dark);
  opacity: 0.85;
}
body.light .search-result-link:hover,
body.light .search-result-link:focus-visible {
  background: rgba(55, 110, 220, 0.3);
  border-color: rgba(55, 110, 220, 0.5);
  color: var(--text-dark);
  opacity: 0.94;
}

body.light .search-result-counter {
  background: rgba(55, 110, 220, 0.08);
  border-color: rgba(55, 110, 220, 0.2);
  color: var(--text-dark);
  opacity: 0.92;
}

/* Fullscreen behavior on small screens (<715px) */
@media (max-width: 714px) {
  .search-overlay {
    padding: 0;
    background: var(--background-general-dark);
  }
  .search-modal {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
  .search-overlay-header {
    display: flex;
    padding: 0.75rem 0.75rem 0.5rem;
    padding-right: 2.75rem; /* room for the close button */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .search-overlay-close {
    font-size: 1.4rem;
  }
  .search-overlay-body {
    padding: 0.75rem;
  }
  body.light .search-overlay {
    background: var(--background-general-light);
  }
  /* Force visibility of search bar when moved into overlay on mobile */
  .search-overlay-search-slot .header-search-bar.in-overlay {
    display: flex !important;
  }
}

/* Extra guard for very small screens ≤430px: keep overlay fully on top */
@media (max-width: 430px) {
  .search-overlay {
    z-index: 4000;
  }
}

/* =============================================
   PAGE CONTACT
   ============================================= */
.contact-bg-container {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  width: 100%;
  gap: 12px;
  padding: 8px 8px;
  height: 100%;
  min-height: 0;
}

.contact-main {
  flex: 0 1 70%;
  height: 100%;
  min-height: 0;
  background: var(--background-leger-dark);
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-main);
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-side {
  flex: 0 1 30%;
  height: 100%;
  min-height: 0;
  background: var(--background-moyen-dark);
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-main);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

/* CONTACT SIDE */
.contact-side-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 16px 0 0 0;
  gap: 12px;
}

.portrait-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 8px;
}

.portrait-image {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--background-leger-dark);
  border: 3px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 0;
}

.contact-name {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0;
  text-align: center;
  margin-top: 0;
  width: 100%;
}

.contact-details {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-text {
  display: flex;
  align-items: center;
  font-size: 1rem;
  color: var(--text-light);
  gap: 10px;
  font-weight: 400;
}

.contact-icon {
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex-shrink: 0;
}

.zoom {
  transform: scale(2);
}

.contact-links {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  margin-bottom: 10px;
}

.social-icon {
  width: 44px;
  height: 44px;
  transition: filter 0.2s;
}

.social-icon:hover {
  filter: brightness(1.5);
  transform: scale(1.2);
  z-index: 2;
}

/* CONTACT MAIN */
.contact-form {
  width: 100%;
  max-width: 98vw;
  background: var(--background-leger-dark);
  border-radius: var(--radius-main);
  padding: 18px 8px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.contact-form h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
  text-align: center;
  letter-spacing: 1px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group label {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 500;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea {
  background: var(--background-moyen-dark);
  color: var(--text-light);
  border: 1.5px solid var(--background-surface-dark);
  border-radius: var(--radius-small);
  font-size: 1rem;
  padding: 8px 8px;
  outline: none;
  transition:
    border 0.18s,
    background 0.18s;
  resize: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--background-general-light);
  background: var(--background-surface-dark);
}

.contact-form textarea {
  min-height: 60px;
}

.contact-submit-btn {
  background: var(--background-surface-dark);
  color: var(--text-light);
  border: none;
  border-radius: var(--radius-small);
  font-size: 1.08rem;
  font-weight: 600;
  padding: 9px 0;
  cursor: pointer;
  box-shadow: var(--shadow-main);
  transition:
    background 0.18s,
    color 0.18s,
    transform 0.18s;
  margin-top: 4px;
  width: 50%;
}

.contact-submit-btn:hover,
.contact-submit-btn:focus {
  background: var(--background-general-light);
  color: var(--background-surface-dark);
  transform: scale(1.04);
}

/* Placeholder et IMG */
.form-group.input-face {
  position: relative;
}
.form-group.input-face input {
  padding-left: 38px;
}
.form-group.input-face::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 71%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: url("../img/contact/darkmode/face-blanc.png") no-repeat center
    center;
  background-size: contain;
  pointer-events: none;
  opacity: 0.7;
}

.form-group.input-contact {
  position: relative;
}
.form-group.input-contact input {
  padding-left: 38px;
}
.form-group.input-contact::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 71%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: url("../img/contact/darkmode/contact-blanc.png") no-repeat center
    center;
  background-size: contain;
  pointer-events: none;
  opacity: 0.7;
}

.form-group.input-bulle {
  position: relative;
}
.form-group.input-bulle textarea {
  padding-left: 38px;
}
.form-group.input-bulle::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 6%;
  width: 70px;
  height: 70px;
  background: url("../img/contact/darkmode/bulle-blanc.png") no-repeat center
    center;
  background-size: contain;
  pointer-events: none;
  opacity: 0.7;
}

/* webkit-autofill */
.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:focus,
.form-group input:-webkit-autofill:hover,
.form-group input:-webkit-autofill:active {
  background: var(--background-moyen-dark) !important;
  -webkit-text-fill-color: var(--text-light) !important;
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
  -webkit-box-shadow: 0 0 0 1000px var(--background-moyen-dark) inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* =============================================
   LIGHTMODE
   ============================================= */
html.light,
body.light {
  background-color: var(--background-general-light);
}

/* Header lightmode*/
body.light .header-row {
  background: var(--background-surface-light);
  box-shadow: var(--shadow-main);
}

body.light .main-title-paul,
body.light .main-title-alessandrini {
  color: var(--text-dark);
}

/* search bar lightmode*/
body.light .header-search-bar {
  background: var(--background-general-dark);
}

body.light .search-btn,
body.light .search-input {
  color: var(--text-light);
}

body.light .search-btn:hover {
  color: var(--background-surface-light);
}

/* link navbar lightmode*/
body.light .header-row nav a {
  color: var(--text-dark);
}

body.light .header-row nav a:hover {
  background: var(--background-general-dark);
  color: var(--background-surface-light);
}

/* Range slider lightmode */
body.light .range-slider-container {
  background: var(--background-surface-light);
}

body.light .range-slider {
  background: var(--text-dark);
  --thumb-img: url("../img/rangeslider/lightmode/etudes-beige.png");
}

/* Thumb light mode */
body.light .range-slider::-webkit-slider-thumb {
  background: var(--text-dark)
    var(--thumb-img, url("../img/rangeslider/lightmode/etudes-beige.png"))
    center center no-repeat;
  border: 3px solid var(--background-surface-light);
  background-size: 50px 50px !important;
}

body.light .range-slider:focus::-webkit-slider-thumb {
  background: var(--background-surface-light)
    var(--thumb-img, url("../img/rangeslider/lightmode/etudes-noir.png")) center
    center no-repeat;
  border: 3px solid var(--text-dark);
  background-size: 56px 56px !important;
}

body.light .range-slider::-webkit-slider-thumb,
body.light .range-slider::-moz-range-thumb,
body.light .range-slider::-ms-thumb {
  width: 70px;
  height: 38px;
  border-radius: 19px;
}

/* Firefox lightmode*/
body.light .range-slider::-moz-range-thumb {
  background: var(--text-dark);
  border: 3px solid var(--background-surface-light);
  background-size: 50px 50px !important;
}

body.light .range-slider:focus::-moz-range-thumb {
  background: var(--background-surface-light);
  border: 3px solid var(--text-dark);
  background-size: 56px 56px !important;
}

/* Edge/IE lightmode*/
body.light .range-slider::-ms-thumb {
  background: var(--text-dark);
  border: 3px solid var(--background-surface-light);
  background-size: 50px 50px !important;
}

body.light .range-slider:focus::-ms-thumb {
  background: var(--background-surface-light);
  border: 3px solid var(--text-dark);
  background-size: 56px 56px !important;
}

/* CONTENUE CHANGEANT*/
/* content section */
body.light .content-section {
  border-left-color: var(--background-general-light);
  border-right-color: var(--background-general-light);
  border-bottom-color: var(--background-general-light);
}

/* etudes lightmode*/
body.light #etudes {
  background-color: var(--background-general-light);
  background-image:
    linear-gradient(
      color-mix(in srgb, var(--background-surface-dark) 15%, transparent) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--background-surface-dark) 15%, transparent) 1px,
      transparent 1px
    );
  color: var(--text-dark);
  border: 1px solid
    color-mix(in srgb, var(--background-surface-dark) 20%, transparent);
}

body.light #etudes::before {
  background-color: rgba(220, 53, 69, 0.7);
}

body.light #etudes .titre-section {
  color: var(--text-dark);
}

body.light #etudes .titre-section::after {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--background-surface-dark) 40%, transparent),
    transparent
  );
}
/* graph ligtmode */

body.light .dark-mode-img {
  display: none;
}

body.light .light-mode-img {
  display: block;
}

body.light .trading-chart::before {
  background: color-mix(
    in srgb,
    var(--background-surface-dark) 5%,
    transparent
  );
}

/* LIGHTMODE CHART*/
body.light .trading-live-chart {
  background-color: var(--background-moyen-light);
}

/* Thème clair pour la bande de swipe */
body.light .trading-swipe-strip {
  border-top-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.45);
}

body.light .trading-swipe-strip .swipe-hint {
  color: var(--text-dark);
}

body.light .trading-swipe-strip .swipe-hint .dots {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.06));
}

body.light .trading-swipe-strip .swipe-hint .dots::before {
  background: rgba(0, 0, 0, 0.45);
}

/* LIGHMODE LECLERC */
/* Lightmode overrides for header */
body.light #leclerc .leclerc-header {
  background: transparent;
  box-shadow: none;
  border-bottom-color: color-mix(in srgb, var(--text-dark) 12%, transparent);
}

/* Lightmode background for Leclerc container */
body.light #leclerc {
  background-color: var(--background-moyen-light);
}

body.light #leclerc .leclerc-header .titre-section {
  color: var(--text-dark);
}

body.light #leclerc .leclerc-header .titre-section::before {
  box-shadow: 0 0 0 3px rgba(60, 140, 60, 0.14);
}

body.light #leclerc .leclerc-instructions {
  color: var(--text-dark);
  opacity: 0.9;
}

/* COMPETENCE */
body.light .competences-section {
  background: var(--background-leger-light);
  border-left-color: var(--background-surface-light);
  border-right-color: var(--background-surface-light);
  border-bottom-color: var(--background-surface-light);
  box-shadow:
    var(--shadow-main),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05),
    0 0 0 1px var(--background-surface-light);
}

body.light .competences-section::before {
  background: linear-gradient(
    90deg,
    var(--background-surface-light) 0%,
    var(--text-dark) 50%,
    var(--background-surface-light) 100%
  );
}

body.light .competence-titre {
  color: var(--text-dark);
  border-bottom-color: var(--background-surface-light);
}

body.light .competence-titre::after {
  background: var(--text-dark);
}

body.light .item-competence {
  color: var(--text-dark);
  background: var(--background-moyen-light);
}

body.light .item-competence:hover {
  background: var(--background-surface-light);
}

body.light .item-competence::before {
  color: var(--text-dark);
}

/* competences btn */
body.light .competences-mobile-btn {
  background: var(--background-leger-light);
  opacity: 0.98;
  box-shadow:
    var(--shadow-main),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05),
    8px 8px 0 0 var(--background-general-light);
}

body.light .competences-mobile-btn::before {
  background: var(--text-dark);
}

body.light .competences-mobile-btn::after {
  background: linear-gradient(
    90deg,
    var(--background-surface-light) 0%,
    var(--text-dark) 50%,
    var(--background-surface-light) 100%
  );
}

body.light .competences-mobile-titre {
  color: var(--text-dark);
}

/* Contact lightmode */
body.light .contact-main {
  background: var(--background-leger-light);
}

body.light .contact-side {
  background: var(--background-moyen-light);
}

body.light .contact-name {
  color: var(--text-dark);
}

body.light .contact-details li {
  color: var(--text-dark);
}

/* contact-form lightmode */
body.light .contact-form {
  background: var(--background-leger-light);
  color: var(--text-dark);
}

body.light .contact-form h2 {
  color: var(--text-dark);
}

body.light .form-group label {
  color: var(--text-dark);
}

body.light .form-group input,
body.light .form-group textarea {
  background: var(--background-moyen-light);
  color: var(--text-dark);
  border: 1.5px solid var(--background-surface-light);
}

body.light .form-group input:focus,
body.light .form-group textarea:focus {
  border-color: var(--background-general-dark);
  background: var(--background-surface-light);
}

body.light .contact-submit-btn {
  background: var(--background-surface-light);
  color: var(--text-dark);
}

body.light .contact-submit-btn:hover,
body.light .contact-submit-btn:focus {
  background: var(--background-general-dark);
  color: var(--background-surface-light);
}

/* logo placholder lightmode */
body.light .form-group.input-face::before {
  background: url("../img/contact/lightmode/face-noir.png") no-repeat center
    center;
  background-size: contain;
  opacity: 0.7;
}
body.light .form-group.input-contact::before {
  background: url("../img/contact/lightmode/contact-noir.png") no-repeat center
    center;
  background-size: contain;
  opacity: 0.7;
}
body.light .form-group.input-bulle::before {
  background: url("../img/contact/lightmode/bulle-noir.png") no-repeat center
    center;
  background-size: contain;
  opacity: 0.7;
}

/* Forcing autofill style in lightmode */
body.light .form-group input:-webkit-autofill,
body.light .form-group input:-webkit-autofill:focus,
body.light .form-group input:-webkit-autofill:hover,
body.light .form-group input:-webkit-autofill:active {
  background: var(--background-moyen-light) !important;
  -webkit-text-fill-color: var(--text-dark) !important;
  font-family: "Inter", Arial, Helvetica, sans-serif !important;
  -webkit-box-shadow: 0 0 0 1000px var(--background-moyen-light) inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* =============================================
   MEDIA QUERIES
   ============================================= */
/* ----------- MOBILE < 430px ----------- */
@media (max-width: 430px) {
  /* HEADER */
  /* Pour toutes les pages par défaut */
  .header-row nav {
    gap: 2px;
  }
  /* Comportement mobile général: header bas */
  .header-row {
    position: fixed;
    bottom: 0;
    left: 0;
    top: auto;
    z-index: 1100;
    width: 100%;
    margin-bottom: 0;
    box-shadow: 0 -2px 8px rgba(30, 30, 60, 0.15);
    padding: 5px 8px;
    justify-content: space-around;
  }
  body {
    padding-bottom: calc(87px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Exception: page index (landing) -> header reste en haut */
  body.landing .header-row {
    position: sticky;
    top: 0;
    bottom: auto;
    box-shadow: var(--shadow-main);
    padding: 6px 10px;
  }
  body.landing {
    padding-bottom: 0 !important;
  }

  .content-container,
  .fix-container {
    margin-bottom: 10px;
  }

  /* LOGO CV */
  .cv-logo {
    width: 41.8px !important;
    height: 41.8px !important;
  }

  /* TITRE */
  .main-title-group {
    min-width: 66px !important;
    height: 35.2px !important;
  }

  .main-title-paul {
    font-size: 0.88rem;
    margin-left: 5.5px;
  }

  .main-title-alessandrini {
    font-size: 0.825rem;
    margin-left: 5.5px;
  }

  /* NAVBAR ICON BLOCKS */
  .nav-search-btn,
  .contact-info-block,
  .classic-cv-block {
    width: 35.2px !important;
    height: 35.2px !important;
    min-width: 35.2px !important;
    min-height: 35.2px !important;
    max-width: 35.2px !important;
    max-height: 35.2px !important;
  }

  /* Badge favoris responsive */
  .favorites-badge {
    height: 35.2px !important;
    padding: 0 8px !important;
    font-size: 0.7rem !important;
    gap: 3px !important;
  }

  .nav-icon,
  .loupe-main,
  .loupe-second {
    width: 30.8px !important;
    height: 30.8px !important;
    min-width: 30.8px !important;
    min-height: 30.8px !important;
    max-width: 30.8px !important;
    max-height: 30.8px !important;
  }

  /* DARK/LIGHT MODE SWITCH */
  .theme-switch .slider {
    width: 41.8px !important;
    height: 24.2px !important;
  }

  .theme-switch .slider::before {
    width: 17.6px !important;
    height: 17.6px !important;
    left: 3px !important;
    top: 3px !important;
  }

  .theme-switch input:checked + .slider::before {
    transform: translateX(17.6px) !important;
  }

  .theme-switch .icon {
    width: 15.4px !important;
    height: 15.4px !important;
    top: 4px !important;
  }

  /* RANGESLIDER */
  .range-slider-container {
    width: 90%;
    padding: 8px 0 4px 0;
    box-shadow: none;
    margin-bottom: 3px;
    margin-top: 8px;
    background: var(--background-surface-dark);
  }

  .range-slider {
    width: 100%;
    height: 7px;
    margin-top: 0px;
  }

  /* Rangeslider Thumb */
  .range-slider::-webkit-slider-thumb {
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background-size: 36px 36px;
    transform-origin: center;
    transition:
      background 0.2s,
      border 0.2s,
      transform 0.15s;
  }

  .range-slider:hover::-webkit-slider-thumb,
  .range-slider:focus:hover::-webkit-slider-thumb,
  .range-slider:active::-webkit-slider-thumb {
    background-size: 40px 40px;
    transform: scale(1.05);
  }

  .range-slider:focus::-webkit-slider-thumb {
    background-size: 40px 40px;
  }

  .range-slider::-moz-range-thumb {
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background-size: 36px 36px;
    transform-origin: center;
    transition:
      background 0.2s,
      border 0.2s,
      transform 0.15s;
  }

  .range-slider:hover::-moz-range-thumb,
  .range-slider:focus:hover::-moz-range-thumb,
  .range-slider:active::-moz-range-thumb {
    background-size: 40px 40px;
    transform: scale(1.05);
  }

  .range-slider::-ms-thumb {
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background-size: 36px 36px;
    transform-origin: center;
    transition:
      background 0.2s,
      border 0.2s,
      transform 0.15s;
  }

  .range-slider:hover::-ms-thumb,
  .range-slider:focus:hover::-ms-thumb,
  .range-slider:active::-ms-thumb {
    background-size: 40px 40px;
    transform: scale(1.05);
  }
  /* CONTENUE CHANHGEANT */
  /* Content-section*/
  .content-container {
    margin-bottom: 0px;
  }
  .content-section {
    border-bottom: 0px;
  }
  /* Etudes */
  #etudes {
    padding: 33px 15px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  #etudes::before {
    left: calc(8px + 8px);
    width: 1.5px;
  }

  #etudes .etudes {
    padding: 8px 8px 12px 20px;
    margin-bottom: 15px;
  }

  #etudes h1.titre-section {
    font-size: 1rem;
    line-height: 2;
    padding-bottom: 0.5px;
  }

  #etudes h2.titre-section {
    font-size: 1rem;
    line-height: 2;
  }

  #etudes .texte-etudes {
    font-size: 0.9rem;
    line-height: 2.2;
  }
  /* etudes graph */

  .trading-chart {
    width: 100%;
    margin: 10px auto;
    padding: 4px;
  }

  .trading-chart-img {
    max-height: 150px;
  }

  .trading-chart::after {
    font-size: 18px;
    top: -8px;
    right: 10px;
  }

  /* competences */
  .competences-mobile-btn {
    bottom: 48px;
    z-index: 1050;
    width: 100%;
    background: rgba(30, 30, 54, 0.98);
    border-radius: 0 0 var(--radius-small) var(--radius-small);
    margin-bottom: 3px;
  }

  .competences-mobile-btn::after {
    width: 99%;
  }

  .competences-mobile-titre {
    font-size: 0.8rem;
  }
}

/* ----------- MOBILE < 715px ----------- */
@media (max-width: 715px) {
  body {
    padding-bottom: 47px;
  }

  /* Empêcher la sélection de texte sur les éléments interactifs */
  button,
  a,
  .nav-btn,
  .nav-search-btn,
  .cta-btn,
  .landing-cta-link,
  .classic-cv-block,
  .download-overlay-close,
  .search-overlay-close,
  .competences-mobile-btn,
  .competence-titre,
  .item-competence,
  .range-slider,
  .snap-marker,
  label[for="theme-toggle"],
  .dots-nav button,
  .search-btn,
  [role="button"],
  [tabindex="0"] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .header-search-bar {
    display: none !important;
  }
  /* Exception: keep the mock search bar visible on landing page */
  body.landing .header-search-bar-mock {
    display: flex !important;
  }
  /* content */
  .content-section {
    flex: 0 0 25% !important;
    width: 25% !important;
  }
  /* etudes graph */
  .trading-chart {
    width: 95%;
    margin: 15px auto;
    padding: 6px;
  }

  .trading-chart-img {
    max-height: 200px;
  }
  /* competence */
  .competences-section {
    display: none !important;
  }
  .header-row {
    height: 48px;
  }
  /* Content-section*/
  .content-container {
    margin-bottom: 0px;
  }
  .content-section {
    border-bottom: 0px;
  }
}

/* ----------- DESKTOP >= 715px ----------- */
@media (min-width: 715px) {
  .nav-search-btn {
    display: none !important;
  }
  .competences-mobile-btn {
    display: none !important;
  }

  /* Allow showing the mobile competences panel on desktop when explicitly opened */
  body.competences-panel-open .competences-mobile-btn {
    display: flex !important;
  }
  /* Avoid overlap with bottom content when the panel is open on desktop */
  body.competences-panel-open {
    padding-bottom: 47px;
  }
}

/* ----------- RESPONSIVE CONTACT (HAUTEUR FAIBLE) ----------- */
@media (max-width: 430px) {
  /* Structure globale */
  .contact-bg-container {
    flex-direction: column !important;
    height: 100vh !important;
    gap: 12px !important;
    padding: 8px 8px !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: 0 !important;
  }

  .contact-side {
    flex: 0 1 30% !important;
    padding: 0 !important;
  }

  .contact-side-content {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    padding: 10px !important;
    width: 100% !important;
    height: 100%;
  }

  .portrait-container,
  .contact-details,
  .contact-links {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
  }

  /* Portrait */
  .portrait-container {
    margin-bottom: 0 !important;
    margin-top: 8px;
    margin-right: 0px !important;
    flex-shrink: 0 !important;
    margin-left: 8px;
    width: 60px !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
  }

  .portrait-image {
    width: 80px !important;
    height: 80px !important;
    margin-bottom: 0 !important;
  }

  .contact-name {
    display: none !important;
  }

  /* Détails de contact */
  .contact-details {
    font-size: 0.85rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    flex: 1 1 0 !important;
  }

  .contact-text {
    font-size: 0.85rem !important;
    margin-bottom: 0 !important;
    text-align: center !important;
    width: 100%;
  }

  .contact-icon {
    width: 44px !important;
    height: 44px !important;
    margin-right: -8px !important;
  }

  /* Liens sociaux */
  .contact-links {
    flex-direction: column !important;
    gap: 6px !important;
    margin: 0;
    width: 100% !important;
  }

  .social-icon {
    width: 36px;
    height: 36px;
  }
}

/* ----------- CONTACT FORM ADAPTATION POUR PETITE HAUTEUR ----------- */
@media (max-height: 670px) {
  .contact-form {
    padding: 10px 4px 8px 4px;
    gap: 8px;
    max-width: 98vw;
  }
  .contact-form h2 {
    font-size: 1.05rem;
    margin-bottom: 2px;
  }
  .form-group label {
    font-size: 0.92rem;
    margin-bottom: 1px;
  }
  .form-group input,
  .form-group textarea {
    font-size: 0.92rem;
    padding: 6px 6px;
  }
  .contact-form textarea {
    min-height: 40px;
    max-height: 80px;
  }
  .contact-submit-btn {
    font-size: 0.95rem;
    padding: 7px 0;
    margin-top: 2px;
    width: 60%;
  }
}

@media (max-height: 500px) {
  .contact-main,
  .contact-side {
    min-height: 250px !important;
    height: 250px !important;
  }
  /* contact-main */
  .contact-form {
    padding: 4px 2px 4px 2px;
    gap: 5px;
  }
  .contact-form h2 {
    font-size: 0.92rem;
    margin-bottom: 1px;
  }
  .form-group label {
    font-size: 0.88rem;
  }
  .form-group input,
  .form-group textarea {
    font-size: 0.88rem;
    padding: 4px 4px;
  }
  .contact-form textarea {
    min-height: 28px;
    max-height: 50px;
  }
  .contact-submit-btn {
    font-size: 0.9rem;
    padding: 5px 0;
    width: 70%;
  }

  /* contact-side  */
  .contact-side-content {
    gap: 6px;
    padding: 4px 0 0 0;
  }
  .portrait-container {
    margin-bottom: 0;
  }
  .portrait-image {
    width: 60px !important;
    height: 60px !important;
    margin-bottom: 0 !important;
  }
  .contact-name {
    font-size: 0.92rem;
  }
  .contact-details {
    gap: 5px;
    margin-bottom: 4px;
  }
  .contact-text {
    font-size: 0.85rem;
    gap: 6px;
  }
  .contact-icon {
    width: 32px !important;
    height: 32px !important;
    margin-right: -6px !important;
  }
  .contact-links {
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 4px;
  }
  .social-icon {
    width: 28px !important;
    height: 28px !important;
  }
}

/* =============================================
  SCROLLBAR PERSONNALISATION
  ============================================= */
/* Scrollbar globale */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(100, 100, 100, 0.4);
  border-radius: 10px;
  transition: background-color 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 100, 100, 0.7);
}

::-webkit-scrollbar-track {
  background: transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 100, 100, 0.4) transparent;
}

/* =============================================
   EXERCICE CSS
   ============================================= */

/* exercice 1 */
.grow {
  transition: transform 0.2s ease;
  transform: scale(1.1);
}

/* exercice 2 */

/* DATE & CLOCK CONTAINER */
.date-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-right: 20px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

body.light .date-container {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

/* LIVE CLOCK (inside container) */
.live-clock {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.5px;
  white-space: nowrap;
  line-height: 1.2;
  transition: opacity 0.5s ease;
}

body.light .live-clock {
  color: var(--text-dark);
}

/* CURRENT DATE (inside container) */
.current-date {
  font-family: "Inter", sans-serif;
  font-size: 0.6rem;
  font-weight: 400;
  opacity: 0.7;
  font-style: italic;
  color: var(--text-light);
  letter-spacing: 0.3px;
  white-space: nowrap;
  line-height: 1.2;
  transition: opacity 1s ease;
}

body.light .current-date {
  color: var(--text-dark);
}

/* GREETING TEXT */
.greeting-text {
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.5px;
  transition: opacity 0.5s ease;
}

body.light .greeting-text {
  color: var(--text-dark);
}

/* Responsive: hide on tablets and mobile */
@media (max-width: 1000px) {
  .date-container {
    display: none;
  }
}

/* exercice 3 */

.email-link:hover {
  cursor: pointer;
}

@keyframes email-copy-effect {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.15) rotate(5deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.email-copied {
  animation: email-copy-effect 1s ease-in-out;
}

/* TOOLTIP */

/* Tooltip base - positioned above parent */
.tooltip {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 6px;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* Show state with smooth fade-in */
.tooltip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* Hover variant (neutral dark) */
.tooltip-hover {
  background: rgba(50, 50, 50, 0.95);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Success variant (accent color) */
.tooltip-success {
  background: var(--background-surface-light);
  color: var(--text-dark);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.tooltip-error {
  background: #d32f2f; /* Rouge mat */
  color: white;
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

/* Light mode variant */
body.light .tooltip-error {
  background: #c62828; /* Rouge un peu plus foncé */
}

/* Arrow pointer below tooltip */
.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: inherit;
}

/* Light mode variants */
body.light .tooltip-hover {
  background: rgba(40, 40, 40, 0.95);
  color: #ffffff;
}

body.light .tooltip-success {
  background: var(--background-surface-dark);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
  color: var(--text-light);
}

/* Parent container needs relative positioning */
.contact-links {
  position: relative;
}

/* Ensure email link can contain tooltip */
#email-link {
  position: relative;
}

/* EXERCICE 5 */

/* Bouton étoile de favori */
.favorite-star {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding-bottom: 5.1px;
  transition:
    transform 0.2s,
    color 0.3s ease;
  color: var(--text-light);
  align-items: center;
  position: relative;
}

.favorite-star:hover {
  transform: scale(1.2);
}

body.light .favorite-star {
  color: var(--text-dark);
}

/* Animation de bounce au toggle */
@keyframes starBounce {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.4);
  }
  50% {
    transform: scale(0.9);
  }
  75% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* Animation de rotation pour l'étoile dorée */
@keyframes starRotate {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.3);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

/* Classe appliquée lors du toggle */
.favorite-star.animating {
  animation: starBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Animation spéciale quand on passe en favori (★) */
.favorite-star.favoriting {
  animation: starRotate 0.5s ease-in-out;
}

/* Badge compteur favoris - s'intègre dans la navbar comme les autres items */
.favorites-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--nav-block-size);
  width: var(--nav-block-size);
  border-radius: var(--radius-main);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  order: -1;
  transition:
    background 0.2s,
    transform 0.2s,
    border 0.2s;
  position: relative;
  cursor: pointer;
  white-space: nowrap;
  border: 2px solid transparent;
  text-decoration: none;
}

/* Badge favoris mobile dans le menu hamburger */
.favorites-link-mobile .hamburger-icon {
  font-size: 1.5rem;
}

.favorites-count {
  font-weight: 700;
  color: var(--count-color);
}

body.light .favorites-count {
  color: var(--count-color);
}

/* Animation pulse pour le badge */
@keyframes badgePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

.favorites-badge.updating {
  animation: badgePulse 0.4s ease-in-out;
}

body.light .favorites-badge {
  color: var(--count-color);
}

.favorites-badge:hover {
  transform: scale(1.05);
  background: var(--background-general-light);
  color: var(--text-dark);
}

body.light .favorites-badge:hover {
  background: var(--background-general-dark);
  color: var(--text-light);
}

/* =============================================
   FAVORITES PAGE
   ============================================= */

/* Stable viewport height - flex pour occuper l'espace restant sans forcer le scroll */
.favorites-page-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 100px; /* Espace pour le header fixe */
  padding-bottom: 2rem;
  background: var(--background-general-dark);
  transition: background 0.3s ease;
}

body.light .favorites-page-container {
  background: var(--background-general-light);
}

.favorites-page-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
}

/* Header section */
.favorites-page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.favorites-page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

body.light .favorites-page-title {
  color: var(--text-dark);
}

.favorites-emoji {
  font-size: 3rem;
  animation: star-pulse 2s ease-in-out infinite;
}

@keyframes star-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.favorites-page-subtitle {
  font-size: 1.1rem;
  color: var(--text-light);
  font-weight: 400;
}

body.light .favorites-page-subtitle {
  color: var(--text-dark);
}

/* Action buttons (Export/Import) */
.favorites-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.favorites-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(58, 149, 255, 0.15);
  color: var(--text-light);
  border: 1.5px solid var(--accent-blue);
  border-radius: var(--radius-main);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.favorites-action-btn:hover {
  background: var(--accent-blue);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(58, 149, 255, 0.3);
}

body.light .favorites-action-btn {
  background: rgba(58, 149, 255, 0.1);
  color: var(--text-dark);
  border-color: var(--accent-blue);
}

body.light .favorites-action-btn:hover {
  background: var(--accent-blue);
  color: dark;
}

/* Responsive: stack buttons on mobile */
@media (max-width: 430px) {
  .favorites-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .favorites-action-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Empty state */
.favorites-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-main);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 600px;
  margin: 0 auto;
}

body.light .favorites-empty-state {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

.empty-state-icon {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  opacity: 0.4;
  color: var(--text-light);
}

body.light .empty-state-icon {
  color: var(--text-dark);
  opacity: 0.3;
}

.empty-state-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 1rem;
}

body.light .empty-state-title {
  color: var(--text-dark);
}

.empty-state-text {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 2rem;
  line-height: 1.6;
}

body.light .empty-state-text {
  color: var(--text-dark);
}

.empty-state-btn {
  display: inline-block;
  padding: 0.85rem 2rem;
  background: rgba(58, 149, 255, 0.15);
  color: var(--text-light);
  border: 1.5px solid var(--accent-blue);
  border-radius: var(--radius-main);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.empty-state-btn:hover {
  background: var(--accent-blue);
  color: var(--text-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(58, 149, 255, 0.3);
}

body.light .empty-state-btn {
  background: rgba(58, 149, 255, 0.1);
  color: var(--text-dark);
}

/* Favorites grid */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.favorite-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-main);
  padding: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

body.light .favorite-card {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

.favorite-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(58, 149, 255, 0.1),
    rgba(39, 113, 239, 0.05)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.favorite-card:hover {
  transform: translateY(-4px);
  border-color: rgba(58, 149, 255, 0.4);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.favorite-card:hover::before {
  opacity: 1;
}

.favorite-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.favorite-card-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-light);
  margin: 0;
  flex: 1;
  padding-right: 0.5rem;
}

body.light .favorite-card-name {
  color: var(--text-dark);
}

.favorite-remove-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: all 0.2s ease;
  color: var(--background-general-light);
  opacity: 0.7;
}

.favorite-remove-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

body.light .favorite-remove-btn {
  color: var(--background-general-dark);
}

.favorite-card-description {
  font-size: 0.95rem;
  color: var(--background-leger-light);
  line-height: 1.5;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

body.light .favorite-card-description {
  color: var(--background-leger-dark);
}

.favorite-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.favorite-card-tag {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: rgba(58, 149, 255, 0.15);
  color: var(--background-leger-light);
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(58, 149, 255, 0.3);
}

body.light .favorite-card-tag {
  background: rgba(58, 149, 255, 0.1);
  color: var(--background-leger-dark);
}

.favorite-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-decoration: none;
  transition: all 0.2s ease;
}

body.light .favorite-card-link {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-dark);
  border-color: rgba(0, 0, 0, 0.15);
}

.favorite-card-link:hover {
  background: var(--background-general-dark);
  color: var(--text-light);
  border-color: var(--background-general-light);
}

body.light .favorite-card-link:hover {
  color: var(--text-dark);
  background: var(--background-general-light);
  border-color: var(--background-general-dark);
}

/* Responsive adjustments */
@media (max-width: 715px) {
  .favorites-page-container {
    padding-top: 80px;
  }

  .favorites-page-title {
    font-size: 2rem;
  }

  .favorites-emoji {
    font-size: 2.5rem;
  }

  .favorites-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .favorite-card {
    padding: 1.25rem;
  }
}

@media (max-width: 430px) {
  .favorites-page-container {
    padding-top: 70px;
  }

  .favorites-page-title {
    font-size: 1.75rem;
  }

  .favorites-page-subtitle {
    font-size: 1rem;
  }

  .empty-state-icon {
    font-size: 4rem;
  }

  .empty-state-title {
    font-size: 1.5rem;
  }
}

/* search overlay filters */

.search-overlay-filters {
  opacity: 0.75;
  padding-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-separator {
  width: 1px;
  align-self: stretch;
  margin: 0.15rem 0.25rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 1px;
}

body.light .filter-separator {
  background: rgba(0, 0, 0, 0.12);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-main);
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

/* État actif (aria-pressed="true") */
.filter-btn[aria-pressed="true"] {
  background: rgba(58, 149, 255, 0.25);
  border-color: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(58, 149, 255, 0.15);
}

.filter-btn[aria-pressed="true"]:hover {
  background: rgba(58, 149, 255, 0.35);
}

/* Light mode */
body.light .filter-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--text-dark);
}

body.light .filter-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.2);
}

body.light .filter-btn[aria-pressed="true"] {
  background: rgba(58, 149, 255, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

body.light .filter-btn[aria-pressed="true"]:hover {
  background: rgba(67, 56, 202, 0.2);
}

/* Mobile: boutons filtres plus compacts */
@media (max-width: 714px) {
  .search-overlay-filters {
    gap: 0.3rem;
    padding-bottom: 0.35rem;
  }

  .filter-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
  }

  .filter-separator {
    margin: 0.1rem 0.15rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================
   COLOR GENERATOR MODAL (Exercice 6)
   ============================================= */

/* Overlay (fond semi-transparent) */
.color-generator-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

body.light .color-generator-overlay {
  background: rgba(255, 255, 255, 0.25);
}

.color-generator-overlay[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

/* Modal container */
.color-generator-modal {
  background: var(--background-surface-dark);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 95%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

body.light .color-generator-modal {
  background: var(--background-surface-light);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.color-generator-overlay[aria-hidden="false"] .color-generator-modal {
  transform: scale(1);
}

/* Header */
.color-generator-header {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 12px;
  padding-right: 60px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.light .color-generator-header {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.color-generator-header-texts {
  flex: 1;
  text-align: center;
}

.color-generator-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-light);
  margin: 0 0 8px 0;
}

body.light .color-generator-title {
  color: var(--text-dark);
}

.color-generator-description {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-light);
  margin: 0;
}

body.light .color-generator-description {
  color: var(--text-dark);
}

/* Close button */
.color-generator-close {
  position: absolute;
  top: 4px;
  right: 4px;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition:
    background 0.2s,
    color 0.2s;
  z-index: 1;
}

.color-generator-close:hover {
  background: var(--background-general-dark);
  color: var(--text-light);
}

body.light .color-generator-close {
  color: var(--text-dark);
}

body.light .color-generator-close:hover {
  background: var(--background-general-light);
  color: var(--text-dark);
}

/* Body */
.color-generator-body {
  padding: 20px 24px;
}

/* Input section */
.color-input-section {
  margin-bottom: 24px;
}

.color-input-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 12px;
}

body.light .color-input-label {
  color: var(--text-dark);
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-hash {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-light);
  font-family: monospace;
}

body.light .color-input-hash {
  color: var(--text-dark);
}

.color-hex-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 1.1rem;
  font-family: monospace;
  background: var(--background-general-dark);
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--text-light);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  outline: none;
}

body.light .color-hex-input {
  background: var(--background-general-light);
  color: var(--text-dark);
}

.color-hex-input:focus {
  border-color: var(--background-general-light);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

body.light .color-hex-input:focus {
  border-color: var(--background-general-dark);
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.1);
}

.color-hex-input::placeholder {
  color: var(--text-light);
  opacity: 0.6;
}

body.light .color-hex-input::placeholder {
  color: var(--text-dark);
}

/* Native Color Picker */
.color-picker {
  height: 48px;
  padding: 4px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--background-general-dark);
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

.color-picker:hover {
  border-color: var(--primary-main);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.color-picker:focus {
  border-color: var(--primary-main);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 6px;
  overflow: hidden;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.color-picker::-moz-color-swatch {
  border: none;
  border-radius: 6px;
}

body.light .color-picker {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light .color-picker:hover {
  border-color: var(--primary-main);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.analyze-color-btn {
  padding: 12px 24px;
  background: var(--background-leger-dark);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
  white-space: nowrap;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.analyze-color-btn:hover {
  background: var(--background-leger-light);
  transform: translateY(-2px);
  color: var(--text-dark);
}

.analyze-color-btn:active {
  transform: translateY(0);
}

body.light .analyze-color-btn {
  background: var(--background-leger-light);
  color: var(--text-dark);
}

body.light .analyze-color-btn:hover {
  background: var(--background-leger-dark);
  color: var(--text-light);
}

/* Random color button */
.random-color-btn {
  padding: 12px 24px;
  background: rgba(155, 89, 182, 0.1);
  border: 2px solid rgba(155, 89, 182, 0.3);
  border-radius: 8px;
  color: #9b59b6;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
}

.random-color-btn:hover {
  background: rgba(155, 89, 182, 0.2);
  border-color: #9b59b6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

.random-color-btn:active {
  transform: translateY(0);
}

body.light .random-color-btn {
  background: rgba(155, 89, 182, 0.08);
  border-color: rgba(155, 89, 182, 0.25);
  color: #8e44ad;
}

body.light .random-color-btn:hover {
  background: rgba(155, 89, 182, 0.15);
  border-color: #8e44ad;
  box-shadow: 0 4px 12px rgba(155, 89, 182, 0.2);
}

/* Color Palette Section */
.color-palette {
  margin-top: 24px;
  padding: 20px;
  background: rgba(52, 152, 219, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(52, 152, 219, 0.2);
}

body.light .color-palette {
  background: rgba(52, 152, 219, 0.03);
  border-color: rgba(52, 152, 219, 0.15);
}

.color-palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.color-palette-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-light);
  margin: 0;
}

body.light .color-palette-title {
  color: var(--text-dark);
}

.palette-mode-select {
  padding: 8px 12px;
  background: var(--background-leger-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

.palette-mode-select:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(52, 152, 219, 0.4);
}

.palette-mode-select:focus {
  border-color: var(--primary-main);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

body.light .palette-mode-select {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-dark);
}

body.light .palette-mode-select:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(52, 152, 219, 0.3);
}

.palette-colors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* Theme action buttons */
.palette-theme-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.palette-theme-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.apply-theme-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
}

.apply-theme-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.apply-theme-btn:active {
  transform: translateY(0);
}

.reset-theme-btn {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.3);
}

.reset-theme-btn:hover {
  background: rgba(231, 76, 60, 0.2);
  border-color: #e74c3c;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

.reset-theme-btn:active {
  transform: translateY(0);
}

body.light .apply-theme-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.light .reset-theme-btn {
  background: rgba(231, 76, 60, 0.08);
  border-color: rgba(231, 76, 60, 0.25);
  color: #c0392b;
}

body.light .reset-theme-btn:hover {
  background: rgba(231, 76, 60, 0.15);
  border-color: #c0392b;
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.2);
}

/* Responsive */
@media (max-width: 640px) {
  .palette-theme-actions {
    flex-direction: column;
  }

  .palette-theme-btn {
    width: 100%;
  }
}

.palette-color-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  overflow: hidden;
}

.palette-color-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

body.light .palette-color-item:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.3);
}

.palette-color-hex {
  position: absolute;
  top: 0px;
  left: 0px;
  right: 0px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 11px;
  text-align: center;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.palette-color-item:hover .palette-color-hex {
  opacity: 1;
}

.palette-color-name {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 0px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 10px;
  text-align: center;
  font-weight: 500;
  border-radius: 4px;
}

/* Effet de brillance au survol */
.palette-color-item::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.palette-color-item:hover::after {
  left: 100%;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .color-palette-header {
    flex-direction: column;
    align-items: stretch;
  }

  .palette-mode-select {
    width: 100%;
  }

  .palette-colors {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
  }

  .palette-color-hex {
    font-size: 10px;
  }

  .palette-color-name {
    font-size: 9px;
  }
}

/* Color History Section */
.color-history {
  margin-top: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light .color-history {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

.color-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.color-history-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-light);
  margin: 0;
}

body.light .color-history-title {
  color: var(--text-dark);
}

.clear-history-btn {
  padding: 6px 12px;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 6px;
  color: #e74c3c;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.clear-history-btn:hover {
  background: rgba(231, 76, 60, 0.2);
  border-color: #e74c3c;
  transform: translateY(-1px);
}

.clear-history-btn:active {
  transform: translateY(0);
}

body.light .clear-history-btn {
  background: rgba(231, 76, 60, 0.08);
  border-color: rgba(231, 76, 60, 0.25);
}

body.light .clear-history-btn:hover {
  background: rgba(231, 76, 60, 0.15);
  border-color: #c0392b;
}

.color-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 12px;
}

.color-history-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  overflow: hidden;
}

.color-history-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

body.light .color-history-item:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.2);
}

.color-history-item-hex {
  position: absolute;
  top: 0px;
  left: 0px;
  right: 0px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 11px;
  text-align: center;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.color-history-item:hover .color-history-item-hex {
  opacity: 1;
}

.color-history-item-name {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 0px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 10px;
  text-align: center;
  font-weight: 500;
  border-radius: 4px;
}

.color-history-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  padding: 20px;
  font-style: italic;
}

body.light .color-history-empty {
  color: rgba(0, 0, 0, 0.4);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .color-history-list {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
  }

  .color-history-item-hex {
    font-size: 10px;
    padding: 3px;
  }
}

/* Loading state */
.color-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 16px;
}

.color-loading p {
  color: var(--text-light);
  font-size: 0.95rem;
  margin: 0;
}

body.light .color-loading p {
  color: var(--text-dark);
}

.color-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--background-general-dark);
  border-top-color: var(--background-general-light);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

body.light .color-spinner {
  border-color: var(--background-general-light);
  border-top-color: var(--background-general-dark);
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

/* Results section */
.color-results {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Color preview */
.color-preview {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.color-preview:hover {
  transform: scale(1.02);
}

/* Color info grid */
.color-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.color-info-item {
  background: var(--background-general-dark);
  padding: 16px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.light .color-info-item {
  background: var(--background-general-light);
}

.color-info-label {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.light .color-info-label {
  color: var(--text-dark);
}

.color-info-value {
  font-size: 1.1rem;
  color: var(--text-light);
  font-weight: 600;
  font-family: monospace;
}

body.light .color-info-value {
  color: var(--text-dark);
}

/* Error state */
.color-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 16px;
  text-align: center;
}

.error-icon {
  font-size: 3rem;
}

.error-message {
  color: #ef4444;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .color-generator-modal {
    width: 95%;
    max-height: 95vh;
  }

  .color-generator-header {
    padding: 20px;
  }

  .color-generator-body {
    padding: 20px;
  }

  .color-input-wrapper {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 8px;
  }

  .color-input-hash {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
  }

  .color-hex-input {
    grid-column: 2;
    grid-row: 2;
  }

  .color-picker {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
  }

  .analyze-color-btn {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
  }

  .random-color-btn {
    grid-column: 1 / -1;
    grid-row: 4;
    width: 100%;
  }

  .color-info {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   TOAST NOTIFICATIONS SYSTEM
   ============================================= */
.toast-container {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

/* BONUS 3: Positions personnalisables */
.toast-position-top-right {
  top: 20px;
  right: 20px;
}

.toast-position-top-left {
  top: 20px;
  left: 20px;
}

.toast-position-bottom-right {
  bottom: 20px;
  right: 20px;
}

.toast-position-bottom-left {
  bottom: 20px;
  left: 20px;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  padding: 16px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: default;
  pointer-events: all;
  transition: all 0.3s ease;
  will-change: transform, opacity;
}

.toast:hover {
  transform: translateX(-5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* BONUS 4: Wrapper pour le contenu principal (sans les actions) */
.toast-content-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-info {
  background: #2196f3;
  color: white;
}

.toast-success {
  background: #4caf50;
  color: white;
}

.toast-warning {
  background: #ff9800;
  color: white;
}

.toast-error {
  background: #f44336;
  color: white;
}

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  font-weight: bold;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
}

/* BONUS 4: Actions (boutons dans les toasts) */
.toast-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-action-btn {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.toast-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.toast-action-primary {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

.toast-action-primary:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.7);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.3);
  transition: width linear; /* La durée sera définie en JS */
}

/* Responsive : adapter position sur mobile */
@media (max-width: 500px) {
  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* =============================================
   STATS PAGE - Analytics Dashboard
   ============================================= */

.stats-dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  padding-top: 100px;
  min-height: 100vh;
  background: var(--background-general-dark);
  color: var(--text-light);
}

body.light .stats-dashboard {
  background: var(--background-general-light);
  color: var(--text-dark);
}

.stats-header {
  text-align: center;
  margin-bottom: 3rem;
}

.stats-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

body.light .stats-header h1 {
  color: var(--text-dark);
}

.stats-subtitle {
  font-size: 1.1rem;
  opacity: 0.7;
  color: var(--text-light);
}

body.light .stats-subtitle {
  color: var(--text-dark);
}

/* Stats actions (export buttons) */
.stats-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.export-btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-small);
  background: var(--background-surface-dark);
  color: var(--text-light);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s,
    opacity 0.2s;
}

.export-btn:hover:not(:disabled) {
  background: var(--background-moyen-dark);
  transform: translateY(-2px);
}

.export-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.light .export-btn {
  background: var(--background-surface-light);
  color: var(--text-dark);
}

body.light .export-btn:hover:not(:disabled) {
  background: var(--background-moyen-light);
}

/* Stats filters */
.stats-filters {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-right: 0.5rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 2px solid var(--background-surface-dark);
  border-radius: 20px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: var(--background-surface-dark);
}

.filter-btn.active {
  background: var(--background-surface-dark);
  color: var(--text-light);
  border-color: var(--background-surface-dark);
}

body.light .filter-btn {
  border-color: var(--background-surface-light);
  color: var(--text-dark);
}

body.light .filter-btn:hover {
  background: var(--background-surface-light);
}

body.light .filter-btn.active {
  background: var(--background-surface-light);
  color: var(--text-dark);
}

/* Loading state */
.stats-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 1rem;
  color: var(--text-light);
}

body.light .stats-loading {
  color: var(--text-dark);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--background-surface-dark);
  border-top-color: var(--background-surface-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

body.light .loading-spinner {
  border-color: var(--background-surface-light);
  border-top-color: var(--background-surface-dark);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

/* Chart section (card container) */
.chart-section {
  background: var(--background-moyen-dark);
  border-radius: var(--radius-main);
  padding: 1.5rem;
  box-shadow: var(--shadow-main);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.chart-section:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

body.light .chart-section {
  background: var(--background-moyen-light);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

body.light .chart-section:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Chart titles */
.chart-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--background-surface-dark);
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.light .chart-section h3 {
  border-bottom-color: var(--background-surface-light);
  color: var(--text-dark);
}

/* Stat card (if used) */
.stat-card {
  background: var(--background-moyen-dark);
  border-radius: var(--radius-main);
  padding: 1.5rem;
  box-shadow: var(--shadow-main);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--background-surface-dark);
}

.stat-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-light);
}

.stat-card-icon {
  font-size: 1.3rem;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--background-surface-light);
}

.stat-card-body {
  min-height: 150px;
}

/* Bar chart styles */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bar-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.bar-label {
  min-width: 120px;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-light);
  text-transform: capitalize;
}

body.light .bar-label {
  color: var(--text-dark);
}

.bar-wrapper {
  flex: 1;
  height: 26px;
  background: var(--background-leger-dark);
  border-radius: 13px;
  overflow: hidden;
  position: relative;
}

body.light .bar-wrapper {
  background: var(--background-leger-light);
}

.bar-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--background-surface-dark),
    var(--background-surface-light)
  );
  border-radius: 13px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0; /* Animation starts from 0 */
}

body.light .bar-fill {
  background: linear-gradient(
    90deg,
    var(--background-surface-light),
    var(--background-surface-dark)
  );
}

.bar-value {
  min-width: 40px;
  text-align: right;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-light);
}

body.light .bar-value {
  color: var(--text-dark);
}

/* GitHub section */
.github-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--background-surface-dark);
}

body.light .github-section {
  border-top-color: var(--background-surface-light);
}

.github-section h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-light);
}

body.light .github-section h2 {
  color: var(--text-dark);
}

.github-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Light mode adjustments for stat-card */
body.light .stat-card {
  background: var(--background-moyen-light);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

body.light .stat-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

body.light .stat-card-header {
  border-bottom-color: var(--background-surface-light);
}

body.light .stat-card-title {
  color: var(--text-dark);
}

body.light .stat-card-value {
  color: var(--background-surface-dark);
}

/* Responsive */
@media (max-width: 768px) {
  .stats-dashboard {
    padding: 1rem;
    padding-top: 90px;
  }

  .stats-header h1 {
    font-size: 1.8rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .bar-label {
    min-width: 90px;
    font-size: 0.85rem;
  }

  .bar-wrapper {
    height: 22px;
  }

  .chart-section {
    padding: 1.25rem;
  }
}

/* Pie Chart Section */
.pie-chart-section {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--background-moyen-dark);
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-main);
}

body.light .pie-chart-section {
  background: var(--background-moyen-light);
}

.pie-chart-section h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text-light);
}

body.light .pie-chart-section h2 {
  color: var(--text-dark);
}

.pie-chart-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

#pie-chart-canvas {
  max-width: 100%;
  height: auto;
}

.pie-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-light);
}

body.light .legend-item {
  color: var(--text-dark);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-label {
  text-transform: capitalize;
}

.legend-value {
  font-weight: 600;
  margin-left: auto;
}

/* =============================================
   GITHUB COMPARE SECTION
   ============================================= */
.github-compare-section {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--background-moyen-dark);
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-main);
}

body.light .github-compare-section {
  background: var(--background-moyen-light);
}

.github-compare-section h2 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

body.light .github-compare-section h2 {
  color: var(--text-dark);
}

.compare-subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  opacity: 0.8;
}

body.light .compare-subtitle {
  color: var(--text-dark);
}

/* Inputs container */
.compare-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.compare-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.compare-input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  text-align: center;
}

body.light .compare-input-group label {
  color: var(--text-dark);
}

.compare-input {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--background-leger-dark);
  color: var(--text-light);
  font-size: 1rem;
  width: 180px;
  text-align: center;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

body.light .compare-input {
  background: var(--background-leger-light);
  color: var(--text-dark);
}

.compare-input:focus {
  outline: none;
  border-color: var(--count-color);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.compare-input::placeholder {
  color: var(--text-light);
  opacity: 0.5;
}

body.light .compare-input::placeholder {
  color: var(--text-dark);
  opacity: 0.5;
}

/* VS separator */
.compare-vs {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--count-color);
  padding: 0.5rem;
}

/* Compare button */
.compare-btn {
  display: block;
  margin: 0 auto 1.5rem;
  padding: 0.875rem 2rem;
  border-radius: 8px;
  border: none;
  background: var(--count-color);
  color: var(--text-light);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.compare-btn:hover:not(:disabled) {
  background: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.compare-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Compare results */
.compare-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.compare-profile {
  padding: 1.25rem;
  background: var(--background-leger-dark);
  border-radius: 12px;
  border: 2px solid transparent;
}

body.light .compare-profile {
  background: var(--background-leger-light);
}

.compare-profile.user1 {
  border-color: var(--count-color);
}

.compare-profile.user2 {
  border-color: var(--leclerc-accent);
}

.compare-profile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--text-light);
}

body.light .compare-profile-header {
  border-bottom-color: var(--text-dark);
}

.compare-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.compare-username {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-light);
}

body.light .compare-username {
  color: var(--text-dark);
}

.compare-lang-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.compare-lang-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compare-lang-name {
  min-width: 80px;
  font-size: 0.9rem;
  color: var(--text-light);
}

body.light .compare-lang-name {
  color: var(--text-dark);
}

.compare-lang-bar {
  flex: 1;
  height: 20px;
  background: var(--background-surface-dark);
  border-radius: 4px;
  overflow: hidden;
}

body.light .compare-lang-bar {
  background: var(--background-surface-light);
}

.compare-lang-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}

.compare-profile.user1 .compare-lang-fill {
  background: var(--count-color);
}

.compare-profile.user2 .compare-lang-fill {
  background: var(--leclerc-accent);
}

.compare-lang-count {
  min-width: 30px;
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-light);
}

body.light .compare-lang-count {
  color: var(--text-dark);
}

/* Loading state for compare */
.compare-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

body.light .compare-loading {
  color: var(--text-dark);
}

/* Responsive */
@media (max-width: 600px) {
  .compare-inputs {
    flex-direction: column;
  }

  .compare-vs {
    margin: 0.5rem 0;
  }

  .compare-results {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   EXERCICE 9 : NAVIGATION HISTORY CONTROLS
   ============================================= */

/* Desktop: Boutons ← → dans la navbar */
.nav-history-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
}

.nav-history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-small);
  background: var(--background-surface-dark);
  color: var(--text-light);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    opacity 0.2s,
    transform 0.15s;
}

.nav-history-btn:hover:not(:disabled) {
  background: var(--accent-color);
  color: white;
  transform: scale(1.05);
}

.nav-history-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.nav-history-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Light mode */
body.light .nav-history-btn {
  background: var(--background-surface-light);
  color: var(--text-dark);
}

body.light .nav-history-btn:hover:not(:disabled) {
  background: var(--accent-color);
  color: white;
}

/* Masquer sur mobile (≤1000px) - on utilise la version hamburger */
@media (max-width: 1000px) {
  .nav-history-controls {
    display: none;
  }
}

/* Mobile: Version hamburger menu */
.nav-history-controls-mobile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  width: 100%;
  background: transparent;
  border: none;
  cursor: default;
}

.nav-history-btns-mobile {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.nav-history-btn-mobile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-small);
  background: var(--background-surface-dark);
  color: var(--text-light);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    opacity 0.2s,
    transform 0.15s;
}

.nav-history-btn-mobile:hover:not(:disabled) {
  background: var(--accent-color);
  color: white;
}

.nav-history-btn-mobile:active:not(:disabled) {
  transform: scale(0.95);
}

.nav-history-btn-mobile:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

body.light .nav-history-btn-mobile {
  background: var(--background-surface-light);
  color: var(--text-dark);
}

body.light .nav-history-btn-mobile:hover:not(:disabled) {
  background: var(--accent-color);
  color: white;
}
