:root {
  --bg: #f8fafc;
  --text: #0f172a;
  --primary: #1e293b;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --secondary: #10b981;
  --muted: #64748b;
  --glass: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(255, 255, 255, 0.6);
  --shadow-subtle: 0 12px 48px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 40px 80px rgba(15, 23, 42, 0.15);
  --radius: 24px;
  --transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: "Poppins", "Montserrat", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  /* Mesh gradient animé et grain subtil */
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(30, 41, 59, 0.07) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(15, 23, 42, 0.05) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(99, 102, 241, 0.06) 0px, transparent 50%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.02'/%3E%3C/svg%3E");
  background-attachment: fixed;
  background-size: 200% 200%, 200% 200%, 200% 200%, 200% 200%, auto;
  animation: mesh-bg 40s ease-in-out infinite alternate;
}

@keyframes mesh-bg {
  0% { background-position: 0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%; }
  50% { background-position: 100% 100%, 0% 100%, 0% 0%, 100% 0%, 0% 0%; }
  100% { background-position: 0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%; }
}

h1, h2, h3 {
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 1rem;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}

header {
  padding: 1.2rem 6vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 1.5rem;
  margin: 0 4vw;
  z-index: 100;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  box-shadow: var(--shadow-subtle), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

nav a {
  margin-left: 1.2rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.6rem 1rem;
  border-radius: 100px;
  position: relative;
}

nav a:hover, nav a:focus-visible {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 1.1rem 2.4rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}

.btn:hover {
  transform: translateY(-5px) scale(1.02);
  background: var(--accent);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
}

.btn:active {
  transform: translateY(-2px) scale(0.98);
}

.hero {
  padding: 10rem 6vw 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 5.2rem);
  max-width: 1000px;
  margin-bottom: 2rem;
}

.hero p {
  font-size: 1.25rem;
  max-width: 700px;
  color: var(--muted);
  margin-bottom: 3.5rem;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2.5rem;
  padding: 2rem 6vw 8rem;
}

.bento-card {
  grid-column: span 4;
  background: var(--glass);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 3rem;
  box-shadow: var(--shadow-subtle), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.bento-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255,255,255,0.4), transparent 70%);
  pointer-events: none;
}

.bento-card:hover {
  transform: translateY(-15px) scale(1.02);
  box-shadow: var(--shadow-hover), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  border-color: var(--accent-light);
  background: rgba(255, 255, 255, 0.6);
}

.bento-card h3 {
  font-size: 1.7rem;
  margin-bottom: 1rem;
  z-index: 1;
}

.bento-card p {
  color: var(--muted);
  font-size: 1.1rem;
  z-index: 1;
}

.badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 0.5rem 1.2rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 2rem;
  align-self: flex-start;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
}

.section {
  padding: 6rem 6vw;
}

.section-title {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 5rem;
}

.card {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 3rem;
  box-shadow: var(--shadow-subtle);
  border: 1px solid rgba(0, 0, 0, 0.02);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(99, 102, 241, 0.15);
}

/* --- Section Démonstration Visuelle & Animations --- */

@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0); }
}

.floating {
  animation: float 6s ease-in-out infinite;
}

.demo-glass-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  transition: var(--transition);
  position: relative;
  z-index: 1;
}

.demo-glass-card:hover {
  transform: translateY(-12px) scale(1.02);
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--accent-light);
  box-shadow: 
    var(--shadow-hover),
    0 0 25px rgba(99, 102, 241, 0.25),
    0 0 50px rgba(99, 102, 241, 0.1);
}

.demo-glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--accent-light), transparent, var(--secondary));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: var(--transition);
}

.demo-glass-card:hover::before {
  opacity: 1;
}

/* --- Portfolio & Filtrage --- */

.portfolio-filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 4rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.8rem 1.8rem;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2.5rem;
  margin-bottom: 8rem;
}

.project-card {
  grid-column: span 4;
  background: var(--glass);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
  display: flex;
  flex-direction: column;
}

.project-card.hidden {
  display: none;
  opacity: 0;
  transform: scale(0.9);
}

.project-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-light);
}

.project-image-wrapper {
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  border-bottom: 1px solid var(--glass-border);
}

.project-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.project-card:hover .project-image-wrapper img {
  transform: scale(1.05);
}

.project-content {
  padding: 2.5rem;
}

.project-content h3 {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
}

.project-content p {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 0;
}

.project-card.wide {
  grid-column: span 8;
}

input, textarea, select {
  width: 100%;
  padding: 1.2rem 1.5rem;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  margin-bottom: 1.5rem;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.12);
  transform: translateY(-3px);
}

footer {
  padding: 5rem 6vw;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--glass);
  backdrop-filter: blur(15px);
  flex-wrap: wrap;
  gap: 3rem;
}

@media (max-width: 1024px) {
  .bento-card, .project-card, .project-card.wide {
    grid-column: span 6;
  }
}

@media (max-width: 768px) {
  .hero {
    padding-top: 8rem;
  }
  .bento-grid, .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .bento-card, .project-card, .project-card.wide {
    grid-column: span 1;
  }
  .bento-card {
    padding: 2rem;
  }
  header {
    top: 1rem;
    padding: 1rem 1.5rem;
    flex-direction: column;
    gap: 1.2rem;
    border-radius: 30px;
  }
  nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  nav a {
    margin: 0.2rem 0.4rem;
    padding: 0.4rem 0.8rem;
  }
  .section-title {
    font-size: 2.4rem;
  }
}