
:root {
  --bg: #f9fafb;
  --text: #111827;
  --secondary: #6b7280;
  --accent: #2563eb;
  --card: #ffffff;
}

body.dark {
  --bg: #0f172a;
  --text: #e5e7eb;
  --secondary: #9ca3af;
  --accent: #38bdf8;
  --card: #020617;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Inter, sans-serif;
}

/* Clamp layout to viewport width to avoid overflow issues */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--card);
  position: sticky;
  top: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  gap: 1rem;
  flex-wrap: wrap;
  z-index: 1000;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

nav strong {
  font-size: 1.2rem;
  cursor: pointer;
  transition: opacity 0.2s;
  color: var(--accent);
}

nav strong:hover {
  opacity: 0.7;
}

.logo {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}

.logo:hover strong {
  opacity: 0.7;
}

@media (max-width: 768px) {
  nav {
    padding: 1rem;
  }
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  position: relative;
  font-weight: 500;
}

.nav-links a:hover {
  background-color: var(--accent);
  color: white;
}

.nav-links a.active {
  background-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.burger {
  display: none;
  cursor: pointer;
  font-size: 1.5rem;
  margin-right: -0.5rem;
  padding: 0.5rem;
  transition: opacity 0.3s ease;
}

.burger:hover {
  opacity: 0.7;
}

.theme-toggle {
  cursor: pointer;
  font-size: 1.3rem;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: rotate(20deg);
}

@media (max-width: 900px) {
  .nav-center {
    flex: 0;
    position: static;
  }

  .nav-links {
    display: none !important;
    flex-direction: column;
    position: fixed;
    top: 60px;
    right: 0;
    background: var(--card);
    padding: 0.5rem 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 0 8px;
    min-width: 250px;
    z-index: 100;
    border-left: 3px solid var(--accent);
  }

  .nav-links.active {
    display: flex !important;
    animation: slideDown 0.3s ease-out;
  }

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

  .nav-links a {
    padding: 1rem 1.5rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
  }

  .nav-links a:hover {
    padding-left: 2rem;
    border-left-color: var(--accent);
  }

  .nav-links a.active {
    background-color: rgba(37, 99, 235, 0.1);
    border-left-color: var(--accent);
  }

  .burger {
    display: block;
  }
}

main.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 3rem;
  flex: 1;
}

.card {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 1;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

h1 {
  margin-bottom: 0.5rem;
  font-size: 2.5rem;
}

main.container p {
  color: var(--secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 4rem;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(16, 185, 129, 0.05));
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.1);
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--accent), #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.description {
  font-size: 1.1rem;
  color: var(--secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-block;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent);
  color: white;
}

/* Index Content Wrapper */
.index-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Grid Links */
.quick-access {
  margin-top: 2rem;
}

.quick-access h2 {
  margin-bottom: 2rem;
  font-size: 2rem;
  text-align: center;
}

.grid-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  width: 100%;
}

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

.card-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 2rem;
  border-radius: 12px;
  background: var(--card);
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 2px solid transparent;
  min-height: 220px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.card-link:hover {
  transform: translateY(-12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.02), rgba(16, 185, 129, 0.02));
}

.card-link .icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
  transition: transform 0.3s ease;
}

.card-link:hover .icon {
  transform: scale(1.15);
}

.card-link h3 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.card-link p {
  color: var(--secondary);
  font-size: 0.95rem;
  margin: 0;
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-header h2 {
  margin: 0;
  color: var(--accent);
}

.date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  background: var(--accent);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.skill {
  margin-bottom: 1.5rem;
}

.skill-name {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.skill-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

body.dark .skill-bar {
  background: rgba(255, 255, 255, 0.15);
}

.skill-level {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #10b981);
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
  border-radius: 4px;
}

.skills-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  align-items: stretch;
}

.skills-card {
  margin-bottom: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.skills-card h2 {
  margin-bottom: 1rem;
}

.soft-skills-card {
  grid-column: auto;
}

.soft-skills-card .skills-tags {
  margin-top: 0;
}

/* Tags */
.skills-tags,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

/* Interests Grid */
.interests-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.interests-grid .card {
  margin-bottom: 0;
}

.interests-grid .card:nth-child(4) {
  grid-column: 2;
}

/* Contact Section */
.contact-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.contact-container .card:nth-child(3) {
  grid-column: 1 / -1;
}

.contact-info {
  margin-top: 2rem;
}

.contact-item {
  margin-bottom: 2rem;
}

.contact-item h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.contact-item p {
  margin: 0;
  color: var(--secondary);
}

.social-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.social-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Footer */
.footer {
  background: var(--card);
  padding: 2rem;
  text-align: center;
  color: var(--secondary);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: auto;
}

.footer p {
  margin: 0;
  font-size: 0.95rem;
}

.card {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
  main.container {
    padding: 2rem 2rem;
  }
}

@media (max-width: 900px) {
  main.container {
    padding: 1.5rem 1.5rem;
  }
}

@media (max-width: 768px) {
  main.container {
    padding: 1.5rem 1rem;
  }

  nav {
    padding: 1rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .quick-access h2 {
    font-size: 1.5rem;
  }

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

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .skills-layout {
    grid-template-columns: 1fr;
  }

  .soft-skills-card {
    grid-column: auto;
  }

  .interests-grid {
    grid-template-columns: 1fr;
  }

  .interests-grid .card:nth-child(4) {
    grid-column: auto;
  }

  .contact-container {
    grid-template-columns: 1fr;
  }

  .contact-container .card:nth-child(3) {
    grid-column: 1;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .date {
    align-self: flex-start;
  }
}

/* List Styling */
ul, ol {
  margin-left: 1.5rem;
  line-height: 1.8;
}

li {
  margin-bottom: 0.5rem;
  color: var(--secondary);
}

/* Headings */
h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  color: var(--text);
}

h2 {
  font-size: 1.8rem;
}

h3 {
  font-size: 1.3rem;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

/* Social Links with Logos */
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.social-link:hover {
  background-color: rgba(37, 99, 235, 0.1);
  transform: translateX(2px);
}

.social-logo {
  width: 24px;
  height: 24px;
  display: inline-block;
  transition: transform 0.3s ease;
}

.social-link:hover .social-logo {
  transform: scale(1.1);
}

body.dark .social-logo[src*="linkedin"] {
  filter: brightness(0) saturate(100%) invert(59%) sepia(73%) saturate(1247%) hue-rotate(193deg) brightness(105%) contrast(101%);
}

body.dark .social-logo[src*="github"] {
  filter: brightness(0) saturate(100%) invert(100%);
}
/* Styles du formulaire de contact */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
  padding: 0.75rem;
  border: 2px solid var(--secondary);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

body.dark .form-group input:focus,
body.dark .form-group textarea:focus {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.submit-btn {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  align-self: flex-start;
}

.submit-btn:hover {
  background: var(--accent);
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-message {
  padding: 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  display: none;
  margin-top: 0.5rem;
}

.form-message.success {
  background: #dbeafe;
  color: #0c4a6e;
  display: block;
}

.form-message.error {
  background: #fee2e2;
  color: #7f1d1d;
  display: block;
}

body.dark .form-message.success {
  background: rgba(56, 189, 248, 0.2);
  color: #e0f2fe;
}

body.dark .form-message.error {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}
/* Boutons de filtrage */
.filter-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.75rem 1.5rem;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--secondary);
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 2rem auto;
  width: 100%;
  align-items: stretch;
}

.project-item {
  min-width: 0;
  display: flex;
}

.project-item .card {
  margin-bottom: 0;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.project-item .tags {
  margin-top: auto;
}

.project-item .tags .tag {
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.18);
}

.project-item .card .date {
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.18);
}

@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Styles du carrousel de projets */
.carousel-container {
  position: relative;
  max-width: 780px;
  margin: 2rem auto;
  padding: 0 1rem;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.carousel-wrapper {
  overflow: hidden;
  border-radius: 1rem;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
  width: 100%;
  box-sizing: border-box;
}

.carousel-slide {
  flex: 0 0 100%;
  min-width: 100%;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
}

.carousel-slide .card {
  margin: 0;
  width: 100%;
  max-width: 720px;
  height: 100%;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: white;
  border: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.carousel-btn:hover {
  background: var(--accent);
  filter: brightness(1.1);
  transform: translateY(-50%) scale(1.1);
}

.carousel-btn-prev {
  left: -0.75rem;
}

.carousel-btn-next {
  right: -0.75rem;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.carousel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--secondary);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-dot.active {
  background: var(--accent);
  transform: scale(1.2);
}

.carousel-dot:hover {
  background: var(--accent);
  opacity: 0.7;
}

/* Responsive carousel */
@media (max-width: 725px) {
  /* Masquer les boutons de navigation */
  .carousel-btn {
    display: none;
  }

  .carousel-container {
    padding: 0 0.75rem;
    max-width: 100%;
  }

  .carousel-wrapper {
    margin: 0;
  }

  .carousel-slide .card {
    padding: 1.25rem;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .carousel-slide .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .carousel-slide .card h2 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .carousel-slide .card .date {
    align-self: flex-start;
  }

  .carousel-slide .card p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
  }

  .carousel-slide .tags {
    margin-top: auto;
    padding-top: 1rem;
  }

  .carousel-slide .tag {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }
  .filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    padding: 0;
    margin: 1.5rem 0;
  }

  /* CIBLE LE PROBLÈME ICI : On ajoute .active au sélecteur */
  .filter-btn,
  .filter-btn.active { 
    width: 100%;
    max-width: 100%; /* Sécurité supplémentaire */
    box-sizing: border-box; /* Indispensable pour que le padding ne s'ajoute pas à la largeur */
    
    /* On s'assure que le texte ne force pas la largeur */
    white-space: normal; 
    min-width: 0; /* Permet au flex-item de rétrécir sous son contenu si besoin */
    
    /* On garde ton style visuel */
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    text-align: center;
    border-radius: 1.5rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .carousel-dots {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
  }
}

/* @media (max-width: 480px) {
  .carousel-slide .card {
    padding: 1.1rem;
    min-height: 55vh;
  }

  .carousel-slide .card h2 {
    font-size: 1.3rem;
  }

  .carousel-slide .card p {
    font-size: 0.95rem;
  }

  .carousel-slide .tag {
    font-size: 0.85rem;
    padding: 0.35rem 0.7rem;
  }

  .carousel-dot {
    width: 10px;
    height: 10px;
  }
} */

@media (max-width: 480px) {
 /* On cible .filter-btn ET .filter-btn.active pour forcer la priorité */
  .filter-btn,
  .filter-btn.active {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box; /* Crucial pour inclure le padding dans les 100% */
    
    /* On écrase les marges potentielles */
    margin-left: 0;
    margin-right: 0;
    
    /* Sécurité pour les très petits écrans */
    min-width: 0;
  }
}