/* -------------------------------------------------------------------------- */
/* 1. VARIABLES & RESET                                                      */
/* -------------------------------------------------------------------------- */
:root {
  --primary: #000000;
  --accent: #0071e3; /* Bleu Apple */
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --text: #1d1d1f;
  --text-muted: #86868b;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------------------- */
/* 2. LAYOUT                                                                 */
/* -------------------------------------------------------------------------- */
.site-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 100px 0;
}

.section-heading {
  margin-bottom: 48px;
  max-width: 700px;
}

.eyebrow {
  text-transform: uppercase;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

h1, h2, h3 {
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 8vw, 4.5rem); margin-bottom: 24px; }
h2 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 16px; }

/* -------------------------------------------------------------------------- */
/* 3. HEADER & NAV                                                           */
/* -------------------------------------------------------------------------- */
.site-header {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  background: var(--primary);
  color: white;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-weight: 800;
  border-radius: 8px;
}

.primary-nav {
  display: flex;
  gap: 32px;
}

.primary-nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 15px;
  transition: var(--transition);
}

.primary-nav a:hover { color: var(--accent); }

/* Menu Mobile Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: var(--transition);
}

/* -------------------------------------------------------------------------- */
/* 4. HERO                                                                   */
/* -------------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 48px;
  min-height: 80vh;
}

.hero-photo-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-photo-img {
  width: 100%;
  display: block;
  object-fit: cover;
}

/* -------------------------------------------------------------------------- */
/* 5. GRILLES & CARDS                                                        */
/* -------------------------------------------------------------------------- */
.intro-grid, .skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.card {
  background: var(--bg-soft);
  padding: 40px;
  border-radius: var(--radius);
  transition: var(--transition);
}

.card h3 { margin-bottom: 12px; font-size: 20px; }

.chip {
  display: inline-block;
  background: #e8e8ed;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin: 0 4px 8px 0;
}

/* -------------------------------------------------------------------------- */
/* 6. PORTFOLIO                                                              */
/* -------------------------------------------------------------------------- */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.filter-button {
  background: var(--bg-soft);
  border: none;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.filter-button.is-active {
  background: var(--primary);
  color: white;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
}

.project-card {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
}

.project-open {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  cursor: pointer;
}

.project-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.project-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-align: left;
}

.project-card:hover .project-overlay { opacity: 1; }
.project-card:hover img { transform: scale(1.05); }

/* -------------------------------------------------------------------------- */
/* 7. ANIMATIONS (REVEAL)                                                    */
/* -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.2, 0, 0.2, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* -------------------------------------------------------------------------- */
/* 8. LIGHTBOX & MODALS                                             */
/* -------------------------------------------------------------------------- */
.lightbox {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 800px; /* Un peu plus petit pour le confort visuel */
  width: 90%;
  background: white;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
  
  /* Pour forcer le centrage parfait */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0; 
}

.lightbox-media img {
  width: 100%;
  max-height: 70vh; /* Évite que l'image soit trop haute sur les petits écrans */
  display: block;
  object-fit: contain;
  background: #000; /* Fond noir derrière l'image si elle ne remplit pas tout */
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
}

.lightbox-copy {
  padding: 24px 32px;
  background: white;
}

.lightbox-title {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.lightbox-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.lightbox-close {
  position: absolute;
  top: -15px;
  right: -15px;
  background: var(--accent);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.lightbox-close:hover {
  transform: scale(1.1);
  background: var(--primary);
}

/* Empêcher le scroll du body quand le dialog est ouvert */
body:has(dialog[open]) {
  overflow: hidden;
}

/* -------------------------------------------------------------------------- */
/* 9. RESPONSIVE                                    */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  
  /* 1. Fix du Header et du Menu */
  .nav-toggle { 
    display: flex; 
    z-index: 2000; /* Toujours au-dessus */
  }

  .primary-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #ffffff; /* Fond blanc solide pour la lisibilité */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    
    /* Animation d'entrée */
    clip-path: circle(0% at 90% 5%); /* Effet d'ouverture circulaire depuis le bouton */
    transition: clip-path 0.5s ease-in-out;
    visibility: hidden;
    z-index: 1500;
  }

  .primary-nav.is-open {
    clip-path: circle(150% at 90% 5%);
    visibility: visible;
  }

  .primary-nav a {
    font-size: 1.8rem;
    font-weight: 700;
  }

  /* 2. Adaptation des Sections (À propos & Démarche) */
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 20px;
    min-height: auto;
    gap: 2rem;
  }

  .hero-photo-card {
    order: -1;
    max-width: 300px;
    margin: 0 auto;
  }

  .section {
    padding: 60px 0; /* Réduction des marges sur mobile */
  }

  .intro-grid, .skills-grid, .portfolio-grid {
    grid-template-columns: 1fr; /* On empile tout sur une colonne */
    gap: 1.5rem;
  }

  .card {
    padding: 24px; /* Plus compact */
  }

  .section-heading {
    text-align: center;
    margin-bottom: 32px;
  }

  /* Animation du Burger */
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}