/* ============================================================
   TOKENS & VARIABLES
   ============================================================ */
:root {
  --paper: #F7F5F1;
  --paper-alt: #FFFFFF;
  --ink: #1C1B29;
  --ink-soft: #5A5870;
  --indigo: #4F46E5;
  --indigo-deep: #3730A3;
  --indigo-light: #EDEBFC;
  --citron: #F5C344;
  --corail: #FF7A5C;
  --line: #E4E1D8;
  --radius: 16px;
  --shadow: 0 12px 30px -14px rgba(28,27,41,0.18);
  --shadow-lg: 0 25px 50px -12px rgba(28,27,41,0.25);
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
  --bg-body: var(--paper);
  --bg-card: var(--paper-alt);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-soft);
  --border-color: var(--line);
  --nav-bg: rgba(247,245,241,0.88);
}

/* ============================================================
   DARK MODE
   ============================================================ */
body.dark {
  --bg-body: #1C1B29;
  --bg-card: #2A2942;
  --text-primary: #F7F5F1;
  --text-secondary: #A8A6C0;
  --border-color: #3A3955;
  --nav-bg: rgba(28,27,41,0.92);
}

body.dark nav { background: var(--nav-bg) !important; }
body.dark .modal-content { background: #2A2942; }

/* ============================================================
   SQUIGGLE
   ============================================================ */
.squiggle-wrap { position: relative; display: inline-block; }
.squiggle-wrap svg { position: absolute; left: 0; bottom: -8px; width: 100%; height: 12px; }
@media (max-width: 480px) {
  .squiggle-wrap svg { bottom: -4px; height: 10px; }
}

/* ============================================================
   AVATAR BLOB
   ============================================================ */
.avatar-blob {
  border-radius: 44% 56% 61% 39% / 47% 40% 60% 53%;
  background: linear-gradient(155deg, #E9E6FB, #FCEBD8);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0px) rotate(0deg); } 50% { transform: translateY(-12px) rotate(2deg); } }

/* ============================================================
   FLOAT ICONS
   ============================================================ */
.float-icon {
  position: absolute;
  background: var(--bg-card, #FFFFFF);
  border-radius: 14px;
  box-shadow: var(--shadow, 0 12px 30px -14px rgba(28,27,41,0.18));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  animation: float-icon 4s ease-in-out infinite;
  padding: 10px;
  font-size: 1rem;
  color: var(--text-secondary, #5A5870);
  width: 44px;
  height: 44px;
}

.fi-1 { top: 6%; left: 2%; --rotation: -8deg; }
.fi-2 { bottom: 12%; left: -4%; --rotation: 10deg; }
.fi-3 { top: 58%; right: -2%; --rotation: -6deg; }
.fi-4 { top: 2%; right: 14%; --rotation: 14deg; }
.fi-5 { bottom: 4%; right: 8%; --rotation: -4deg; }
.fi-6 { top: 35%; left: -8%; --rotation: 6deg; }

@keyframes float-icon {
  0%, 100% { transform: translateY(0px) rotate(var(--rotation, 0deg)); }
  50% { transform: translateY(-8px) rotate(calc(var(--rotation, 0deg) + 2deg)); }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .float-icon { width: 38px; height: 38px; padding: 8px; font-size: 0.85rem; }
  .fi-1 { top: 4%; left: 1%; }
  .fi-2 { bottom: 10%; left: -3%; }
  .fi-3 { top: 55%; right: -1%; }
  .fi-4 { top: 1%; right: 12%; }
  .fi-5 { bottom: 3%; right: 6%; }
  .fi-6 { top: 32%; left: -6%; }
}

@media (max-width: 640px) {
  .float-icon {
    width: 32px !important;
    height: 32px !important;
    padding: 6px !important;
    font-size: 0.75rem !important;
    border-radius: 10px !important;
  }
  .fi-1 { top: 2%; left: 0%; }
  .fi-2 { bottom: 8%; left: -2%; }
  .fi-3 { top: 52%; right: -1%; }
  .fi-4 { top: 0%; right: 10%; }
  .fi-5 { bottom: 2%; right: 4%; }
  .fi-6 { top: 30%; left: -5%; }
}

@media (max-width: 400px) {
  .float-icon {
    width: 26px !important;
    height: 26px !important;
    padding: 4px !important;
    font-size: 0.65rem !important;
    border-radius: 8px !important;
  }
  .fi-1 { top: 0%; left: -2%; }
  .fi-2 { bottom: 6%; left: -4%; }
  .fi-3 { top: 48%; right: -2%; }
  .fi-4 { top: -2%; right: 6%; }
  .fi-5 { bottom: 0%; right: 2%; }
  .fi-6 { top: 28%; left: -8%; }
}

/* ============================================================
   STATUS DOT
   ============================================================ */
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: pulse-dot 2s ease-in-out infinite; display: inline-block; }
@keyframes pulse-dot { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--indigo);
  color: #fff;
  padding: 12px 22px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  padding: 12px 22px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid var(--border-color);
  transition: border-color 0.3s, background 0.3s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-secondary:hover { border-color: var(--text-primary); background: var(--bg-card); }

/* ============================================================
   EYEBROW
   ============================================================ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--indigo-deep);
  background: var(--indigo-light);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
}

/* ============================================================
   FILTERS
   ============================================================ */
.filter-btn {
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}
.filter-btn:hover, .filter-btn.active { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-light); }
.project-card.hidden { display: none; }

/* ============================================================
   MODAL GENERALE
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 500px;
  width: 92%;
  padding: 32px 24px;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s;
  max-height: 85vh;
  overflow-y: auto;
  margin: 16px;
}
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.3s;
}
.modal-close:hover { color: var(--text-primary); }

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .section { padding: 48px 0; }
  .hero { padding: 32px 0 40px; }
  .hero h1 { font-size: 2rem; }
  .hero p.lead { font-size: 1rem; }
  .btn-primary, .btn-secondary { font-size: 0.85rem; padding: 10px 18px; }
  .avatar-container { width: 140px; height: 140px; }
  .eyebrow { font-size: 0.65rem; padding: 4px 10px; }
  .section-head h2 { font-size: 1.6rem; }
  .section-head p { font-size: 0.95rem; }
  .project-body h3 { font-size: 1rem; }
  .project-body p { font-size: 0.85rem; }
  .service-card { padding: 24px 16px; }
  .service-card h3 { font-size: 1rem; }
  .service-card p { font-size: 0.85rem; }
  .stat-number { font-size: 2rem; }
  .stat-label { font-size: 0.8rem; }
  .testimonial-card { padding: 20px; }
  .testimonial-card blockquote { font-size: 0.9rem; }
  .cert-card { padding: 14px 16px; }
  .cert-info h3 { font-size: 0.9rem; }
  .cert-org { font-size: 0.7rem; }
  .cta-banner { padding: 32px 20px !important; }
  .cta-banner h2 { font-size: 1.4rem; }
  .cta-banner p { font-size: 0.9rem; }
  .footer-inner { flex-direction: column; text-align: center; gap: 16px; }
  .footer-links { justify-content: center; flex-wrap: wrap; gap: 12px; }
  .modal-content { padding: 24px 16px; }
  .modal-icon { font-size: 2.5rem; }
  .modal-content h3 { font-size: 1.2rem; }
  .xs\:inline { display: none; }
}

@media (max-width: 768px) {
  .hero-grid { grid-template-columns: 1fr !important; gap: 24px; }
  .hero-visual { order: -1; min-height: unset; justify-content: center; }
  .projects-grid, .services-grid, .testimonials-grid, .certifications-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
  .contact-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .project-filters { gap: 8px; }
  .filter-btn { font-size: 0.75rem; padding: 5px 12px; }
  .status-badge { font-size: 0.75rem; padding: 4px 12px; }
  .hero-ctas { gap: 10px; }
  .stack-tag { font-size: 0.75rem; padding: 6px 12px; }
  .stack-icons { gap: 8px; }
  .contact-item { font-size: 0.9rem; }
  .contact-social .social-link { font-size: 0.8rem; padding: 6px 14px; }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .services-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .testimonials-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .certifications-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stats-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .hero-grid { gap: 32px; }
}

.xs\:inline { display: none; }
@media (min-width: 480px) { .xs\:inline { display: inline; } }
.hidden { display: none !important; }

/* ============================================================
   ANIMATION DE ROTATION LENTE
   ============================================================ */
@keyframes spin-slow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.animate-spin-slow {
  animation: spin-slow 10s linear infinite;
}

/* ============================================================
   MODALE PROJET
   ============================================================ */
#projectModal .modal-content {
  max-width: 900px;
}

#projectModalGallery {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  #projectModalGallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  #projectModalGallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================================
   REDIMENSIONNEMENT DES IMAGES - SOLUTION FINALE
   ============================================================ */
.screenshot-item {
  position: relative;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--bg-body, #F7F5F1);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color, #E4E1D8);
  width: 100% !important;
  height: 120px !important; /* Hauteur FIXE */
  flex-shrink: 0;
}

.screenshot-item img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important; /* L'image reste proportionnelle */
  display: block !important;
  transition: transform 0.3s ease;
}

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

/* Bouton d'agrandissement */
.screenshot-item .expand-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: var(--indigo, #4F46E5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 0.65rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 2;
}

.screenshot-item:hover .expand-btn {
  opacity: 1;
}

.screenshot-item .expand-btn:hover {
  transform: scale(1.1);
}

/* Responsive pour les images */
@media (max-width: 768px) {
  .screenshot-item {
    height: 90px !important;
  }
}

@media (max-width: 480px) {
  .screenshot-item {
    height: 70px !important;
  }
}

/* Pour les images normales (non longues) */
.screenshot-item:has(img[data-normal="true"]) {
  height: auto !important;
  max-height: 120px;
}

.screenshot-item:has(img[data-normal="true"]) .expand-btn {
  display: none !important;
}

/* ============================================================
   AGRANDISSEMENT D'IMAGE - FADE IN
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   STYLE POUR L'IMAGE - INDICATEUR DE CLIC
   ============================================================ */
.screenshot-item {
  position: relative;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--bg-body, #F7F5F1);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color, #E4E1D8);
  width: 100% !important;
  height: 120px !important;
  flex-shrink: 0;
  cursor: pointer !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.screenshot-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.screenshot-item img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  transition: transform 0.3s ease;
  pointer-events: none; /* Empêche le clic sur l'image de bloquer le clic du parent */
}

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

/* Indicateur "Cliquer pour agrandir" */
.screenshot-item::after {
  content: '🔍 Cliquer pour agrandir';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 2px 10px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.3s;
  border: 1px solid var(--border-color);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

.screenshot-item:hover::after {
  opacity: 0.8;
}

/* Bouton d'agrandissement */
.screenshot-item .expand-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: var(--indigo, #4F46E5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 2;
  pointer-events: auto; /* Important pour que le bouton reste cliquable */
}

.screenshot-item:hover .expand-btn {
  opacity: 1;
}

.screenshot-item .expand-btn:hover {
  transform: scale(1.15);
  background: var(--indigo-deep, #3730A3);
}

/* Responsive */
@media (max-width: 768px) {
  .screenshot-item {
    height: 90px !important;
  }
  .screenshot-item::after {
    font-size: 0.45rem;
    padding: 1px 8px;
  }
  .screenshot-item .expand-btn {
    width: 22px;
    height: 22px;
    font-size: 0.55rem;
  }
}

@media (max-width: 480px) {
  .screenshot-item {
    height: 70px !important;
  }
  .screenshot-item::after {
    content: '🔍';
    font-size: 0.8rem;
    padding: 0 6px;
  }
  .screenshot-item .expand-btn {
    width: 18px;
    height: 18px;
    font-size: 0.45rem;
    bottom: 3px;
    right: 3px;
  }
}

/* ============================================================
   MODALE DE CONFIRMATION ÉLÉGANTE
   ============================================================ */

/* Animation d'apparition de la modale */
.modal-confirmation {
  animation: modalFadeIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 420px;
}

@keyframes modalFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Cercle de succès */
.success-circle {
  position: relative;
  width: 80px;
  height: 80px;
}

.success-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.success-circle-bg {
  stroke: var(--border-color);
}

.success-circle-progress {
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  animation: circleProgress 0.8s ease forwards;
}

.success-check {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: checkDraw 0.6s ease forwards 0.3s;
}

@keyframes circleProgress {
  0% {
    stroke-dashoffset: 226;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes checkDraw {
  0% {
    stroke-dashoffset: 50;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Animation du cercle extérieur (pulsation) */
.success-circle::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(34, 197, 94, 0.2);
  animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 480px) {
  .modal-confirmation {
    padding: 32px 20px !important;
  }
  .success-circle {
    width: 60px;
    height: 60px;
  }
  .modal-confirmation h3 {
    font-size: 1.3rem;
  }
}