/**
 * Dioqa Core - CSS Principal
 * Tous les styles custom du thème (concaténés pour la performance).
 *
 * Bootstrap 5.3 est chargé en premier (via enqueue.php).
 * Ce fichier ne contient QUE les styles custom qui n'existent pas dans Bootstrap.
 *
 * @package Dioqa_Core
 */

/* ========================================
   CORE : VARIABLES
   ======================================== */

:root {
  /* Couleurs principales - Définies dynamiquement via helpers.php (CSS inline)
     * Les variables --bs-primary, --bs-primary-rgb, --bs-secondary, --bs-secondary-rgb
     * sont injectées via wp_add_inline_style() avec les couleurs de l'admin WP.
     * Ne PAS les définir ici pour éviter d'écraser les couleurs custom.
     */

  /* Couleurs neutres */
  --color-white: #ffffff;
  --color-gray-light: #f1f1f1;
  --color-gray-medium: #6b687d;
  --color-gray-dark: #3b3949;
  --color-gray-darker: #34333c;
  --color-black: #000000;

  /* Espacement */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 3rem;
  --spacing-xl: 5rem;
  --spacing-xxl: 8rem;

  /* Typographie - Tailles de texte */
  --text-xs: 0.75rem; /* 12px */
  --text-sm: 0.875rem; /* 14px */
  --text-md: 1rem; /* 16px */
  --text-lg: 1.125rem; /* 18px */
  --text-xl: 1.25rem; /* 20px */

  /* Typographie - Tailles de texte mobile */
  --text-xs-mobile: 0.625rem; /* 10px */
  --text-sm-mobile: 0.75rem; /* 12px */
  --text-md-mobile: 0.875rem; /* 14px */
  --text-lg-mobile: 1rem; /* 16px */
  --text-xl-mobile: 1.125rem; /* 18px */

  /* Typographie - Tailles display (titres) */
  --display-xs: 1.5rem; /* 24px */
  --display-sm: 1.75rem; /* 28px */
  --display-2sm: 2rem; /* 32px */
  --display-md: 2.25rem; /* 36px */
  --display-2md: 2.5rem; /* 40px */
  --display-lg: 3rem; /* 48px */
  --display-2lg: 3.5rem; /* 56px */
  --display-xl: 4rem; /* 64px */
  --display-2xl: 4.5rem; /* 72px */

  /* Typographie - Tailles display mobile */
  --display-xs-mobile: 1.25rem; /* 20px */
  --display-sm-mobile: 1.5rem; /* 24px */
  --display-2sm-mobile: 1.75rem; /* 28px */
  --display-md-mobile: 2rem; /* 32px */
  --display-2md-mobile: 2.25rem; /* 36px */
  --display-lg-mobile: 2.5rem; /* 40px */
  --display-2lg-mobile: 3rem; /* 48px */
  --display-xl-mobile: 3.5rem; /* 56px */
  --display-2xl-mobile: 4rem; /* 64px */

  /* Typographie - Polices */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  --font-secondary: var(--font-primary);
  --font-size-base: 1rem;
  --line-height-base: 1.5;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Ombres */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* ========================================
   CORE : TYPOGRAPHIE
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-secondary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--color-gray-darker);
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h3 {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
}

h4 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

h5 {
    font-size: clamp(1.125rem, 2.5vw, 1.25rem);
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.lead {
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1.5;
}

/* ========================================
   NOTE : Classes utilitaires Bootstrap
   ========================================

   Les classes suivantes sont fournies par Bootstrap 5.3 :

   Couleurs : .text-primary, .text-secondary, .text-white, .text-muted, etc.
   Alignement : .text-start, .text-center, .text-end
   Poids : .fw-light, .fw-normal, .fw-medium, .fw-semibold, .fw-bold

   Documentation : https://getbootstrap.com/docs/5.3/utilities/text/
   ======================================== */

/* ========================================
   CORE : UTILITIES
   ======================================== */

/* TYPOGRAPHY UTILITIES (basées sur variables custom) */

/* Text sizes - utilisent les variables CSS du design system */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

/* Display sizes - pour les titres */
.display-xs { font-size: var(--display-xs); line-height: 1.2; }
.display-sm { font-size: var(--display-sm); line-height: 1.2; }
.display-2sm { font-size: var(--display-2sm); line-height: 1.2; }
.display-md { font-size: var(--display-md); line-height: 1.2; }
.display-2md { font-size: var(--display-2md); line-height: 1.2; }
.display-lg { font-size: var(--display-lg); line-height: 1.1; }
.display-2lg { font-size: var(--display-2lg); line-height: 1.1; }
.display-xl { font-size: var(--display-xl); line-height: 1.1; }
.display-2xl { font-size: var(--display-2xl); line-height: 1.1; }

/* Responsive font sizes */
@media (max-width: 767px) {
  .text-xs { font-size: var(--text-xs-mobile); }
  .text-sm { font-size: var(--text-sm-mobile); }
  .text-md { font-size: var(--text-md-mobile); }
  .text-lg { font-size: var(--text-lg-mobile); }
  .text-xl { font-size: var(--text-xl-mobile); }
  .display-xs { font-size: var(--display-xs-mobile); }
  .display-sm { font-size: var(--display-sm-mobile); }
  .display-2sm { font-size: var(--display-2sm-mobile); }
  .display-md { font-size: var(--display-md-mobile); }
  .display-2md { font-size: var(--display-2md-mobile); }
  .display-lg { font-size: var(--display-lg-mobile); }
  .display-2lg { font-size: var(--display-2lg-mobile); }
  .display-xl { font-size: var(--display-xl-mobile); }
  .display-2xl { font-size: var(--display-2xl-mobile); }
}

/* COLOR UTILITIES (couleurs custom du design system) */

/* Text colors - grays custom (Bootstrap n'a pas ces nuances exactes) */
.text-gray-light { color: var(--color-gray-light) !important; }
.text-gray-medium { color: var(--color-gray-medium) !important; }
.text-gray-dark { color: var(--color-gray-dark) !important; }
.text-gray-darker { color: var(--color-gray-darker) !important; }

/* Background colors - grays custom */
.bg-gray-light { background-color: var(--color-gray-light) !important; }
.bg-gray-medium { background-color: var(--color-gray-medium) !important; }
.bg-gray-dark { background-color: var(--color-gray-dark) !important; }
.bg-gray-darker { background-color: var(--color-gray-darker) !important; }

/* TEXT UTILITIES (multi-line truncate) */

/* Truncate text avec ellipsis sur plusieurs lignes (Bootstrap n'a que .text-truncate pour 1 ligne) */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CUSTOM EFFECTS (non-Bootstrap) */

/* Overlay */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.overlay-light {
  background-color: rgba(255, 255, 255, 0.9);
}

/* Glassmorphism */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ANIMATIONS CUSTOM */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-in-out;
}

.animate-slideUp {
  animation: slideUp 0.5s ease-out;
}

/* ========================================
   COMPONENT : BACK TO TOP
   ======================================== */

/* Container du bouton */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bs-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  padding: 0;
}

/* État visible */
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Hover */
.back-to-top:hover {
  background: var(--bs-secondary);
  color: var(--bs-primary);
  transform: translateY(-5px);
}

/* Icône flèche */
.back-to-top-icon {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 2;
}

/* SVG Progress Circle */
.back-to-top-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 50px;
  height: 50px;
  transform: rotate(-90deg);
  z-index: 1;
}

.back-to-top-progress-circle {
  fill: none;
  stroke: var(--bs-secondary);
  stroke-width: 3;
  stroke-linecap: round;
  /* Circonférence du cercle = 2 * π * rayon */
  /* rayon = 22 (50/2 - stroke-width/2 - 3 pour marge) */
  stroke-dasharray: 138.23; /* 2 * π * 22 ≈ 138.23 */
  stroke-dashoffset: 138.23; /* Commence vide */
  transition: stroke-dashoffset 0.1s linear;
}

/* Responsive */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }

  .back-to-top-icon {
    width: 18px;
    height: 18px;
  }

  .back-to-top-progress {
    width: 45px;
    height: 45px;
  }
}

/* ========================================
   COMPONENT : ACCESSIBILITY
   ======================================== */

/* FOCUS VISIBLE */

/* Focus personnalisé pour tous les éléments interactifs */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.btn:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--bs-primary, #0d6efd);
  outline-offset: 2px;
  border-radius: var(--radius-sm, 0.25rem);
}

/* Focus pour les liens sans supprimer le soulignement au hover */
a:focus-visible {
  text-decoration: underline;
}

/* Supprimer le outline par défaut seulement si :focus-visible est supporté */
@supports selector(:focus-visible) {
  a:focus,
  button:focus,
  input:focus,
  textarea:focus,
  select:focus,
  .btn:focus,
  [tabindex]:focus {
    outline: none;
  }
}

/* SKIP LINK */

/* Skip link caché par défaut */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--bs-primary, #0d6efd);
  color: #ffffff;
  padding: 0.5rem 1rem;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 var(--radius-md, 0.375rem) 0;
  z-index: var(--z-tooltip, 1070);
  transition: top var(--transition-fast, 0.15s ease);
}

/* Skip link visible au focus */
.skip-link:focus {
  top: 0;
  outline: 2px solid #ffffff;
  outline-offset: -4px;
}

/* ZONES DE CLIC MINIMALES (44x44px - WCAG 2.1 AA) */

/* Boutons */
.btn,
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 1rem;
}

/* Boutons de navigation des sliders */
.swiper-button-next,
.swiper-button-prev {
  min-width: 44px;
  min-height: 44px;
}

/* Liens dans les menus */
.nav-link,
.menu-item a {
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Boutons sociaux */
.social-links a {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* CONTRASTE DES COULEURS */

/* S'assurer que le texte sur fond foncé a un bon contraste */
.bg-dark,
.bg-primary.text-white,
.bg-secondary.text-white {
  color: #ffffff;
}

/* S'assurer que les liens ont un bon contraste */
.bg-dark a:not(.btn),
.bg-primary a:not(.btn),
.text-white a:not(.btn) {
  color: #ffffff;
  text-decoration: underline;
}

.bg-dark a:not(.btn):hover,
.bg-primary a:not(.btn):hover,
.text-white a:not(.btn):hover {
  text-decoration: none;
  opacity: 0.9;
}

/* HIDDEN BUT ACCESSIBLE */

/* Classe pour cacher visuellement mais garder accessible aux lecteurs d'écran */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Variante pour rendre visible au focus (utile pour skip links alternatifs) */
.sr-only-focusable:focus,
.visually-hidden-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ARIA HIDDEN */

/* Assurer que les éléments aria-hidden ne sont pas tabulables */
[aria-hidden="true"] {
  pointer-events: none;
}

/* REDUCED MOTION */

/* Respecter les préférences utilisateur pour les animations */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* AMÉLIORATION DES FORMULAIRES */

/* Labels toujours visibles (pas de placeholder-only) */
label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

/* Indiquer visuellement les champs requis */
input:required,
textarea:required,
select:required {
  border-left: 3px solid var(--bs-primary, #0d6efd);
}

/* États d'erreur clairs */
input:invalid:not(:focus),
textarea:invalid:not(:focus),
select:invalid:not(:focus) {
  border-color: #dc3545;
  background-color: #fff5f5;
}

/* Focus des champs de formulaire */
input:focus,
textarea:focus,
select:focus {
  border-color: var(--bs-primary, #0d6efd);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
  outline: none;
}

/* AMÉLIORATION DES TABLEAUX */

/* Assurer que les tableaux ont des headers appropriés */
table caption {
  padding: 0.5rem;
  font-weight: 600;
  text-align: left;
}

/* Améliorer la lisibilité des tableaux */
table th {
  font-weight: 600;
  text-align: left;
  background-color: var(--color-gray-lighter, #f8f9fa);
}

/* AMÉLIORATION DES LISTES */

/* S'assurer que les listes sans style gardent leur structure sémantique */
ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* HIGH CONTRAST MODE */

/* Support du mode contraste élevé de Windows */
@media (prefers-contrast: high) {
  .btn,
  button,
  a {
    outline: 1px solid;
  }

  .btn:focus-visible,
  button:focus-visible,
  a:focus-visible {
    outline-width: 3px;
  }
}

/* ========================================
   ANIMATIONS ET UTILITAIRES INLINE
   ======================================== */

/* Note : Header et Footer sont stylisés dans les thèmes enfants */
/* Note : Les sections du page builder sont dans les thèmes enfants modèles */
/* Chaque modèle (corporate, vitrine, etc.) a ses propres styles de header/footer/sections */

/* Animations et utilitaires */
.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.slide-in-on-scroll {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-on-scroll.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox-overlay.is-open {
  opacity: 1;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: -40px;
  background: transparent;
  border: none;
  color: white;
  font-size: 40px;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  line-height: 1;
}

/* Focus visible pour accessibilité */
body.user-is-tabbing *:focus {
  outline: 3px solid var(--bs-primary);
  outline-offset: 2px;
}
