/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --black: #0a0a0a;
  --white: #ffffff;
  --gray: #999;
  --light: #f2f2f2;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

html, body {
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 36px 40px;
  z-index: 100;
  background: transparent;
  mix-blend-mode: difference;
}

.brand-name {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--white);
}

.nav-links {
  display: flex;
  gap: 30px;
}

.nav-link {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
  cursor: pointer;
  transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--white);
}

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative;
  width: 100%;
  height: auto;
  overflow: hidden;
  background: var(--white);
}

.hero-img {
  width: 100%;
  height: auto;
  display: block;
  will-change: opacity;
}

.hero-img-mobile  { display: none; }
.hero-img-desktop { display: block; }

.hero-arrow {
  position: fixed;
  top: 78vh;
  left: 50%;
  transform: translateX(-50%);
  font-size: 38px;
  font-weight: 100;
  color: var(--black);
  cursor: pointer;
  z-index: 98;
  opacity: 0.6;
  padding: 20px;
  transition: transform 0.3s ease, opacity 0.2s ease;
  will-change: opacity, transform;
}

.hero-arrow:hover {
  opacity: 1;
  transform: translate(-50%, 5px);
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.layout {
  display: block;
  position: relative;
  background: var(--white);
  padding-top: 0;
}

.content {
  width: 100%;
  padding: 40px;
}

/* ==========================================================================
   GRILLE PROJETS
   ========================================================================== */
.grid {
  columns: 3;
  column-gap: 30px;
  animation: softFade 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  /* Force la carte graphique à isoler la grille pour interdire le flash */
  transform: translateZ(0);
  will-change: transform;
}

.project {
  break-inside: avoid;
  margin-bottom: 30px;
  cursor: pointer;
  /* Stabilise le rendu de chaque bloc dans les colonnes */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.thumb {
  width: 100%;
  overflow: hidden;
  background: var(--light);
}

.thumb img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.6s ease;
  will-change: transform;
}

.project:hover .thumb img {
  transform: scale(1.02);
  opacity: 0.92;
}

.project-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--black);
  opacity: 0;
  transform: translateY(3px);
  padding: 12px 0;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.project:hover .project-title {
  opacity: 0.8;
  transform: translateY(0);
}

/* ==========================================================================
   SECTION ABOUT
   ========================================================================== */
#section-about {
  min-height: 100vh;
  padding: 0;
}

#section-about.flash-active {
  animation: flashFade 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.about-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.about-photo-col {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.about-photo-col img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.about-img-mobile  { display: none; }
.about-img-desktop { display: block; }

.about-text-col {
  padding: 80px 60px 80px 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.about-bio {
  margin-bottom: 60px;
}

.bio-lead {
  font-size: 18px !important;
  font-weight: 300 !important;
  line-height: 1.55 !important;
  color: var(--black) !important;
  margin-bottom: 32px !important;
  letter-spacing: -0.01em;
}

.about-bio p {
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.85;
  color: #666;
  margin-bottom: 20px;
}

.about-meta {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-top: 48px;
  border-top: 1px solid #e8e8e8;
}

.meta-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gray);
  margin-bottom: 4px;
}

.meta-link, .meta-value {
  font-size: 13px;
  font-weight: 300;
  color: var(--black);
  line-height: 1.6;
}

.meta-link {
  width: fit-content;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.meta-link:hover { border-color: var(--black); }

/* ==========================================================================
   LIGHTBOX & SLIDER
   ========================================================================== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--white);
  padding: 90px 40px 40px;
  flex-direction: column;
}

.lightbox.open { display: flex; }

.lightbox-meta {
  position: fixed;
  top: 36px;
  left: 40px;
  right: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1002;
}

.lightbox-counter {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--gray);
}

.lightbox-close {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--gray);
  transition: color 0.2s;
}

.lightbox-close:hover { color: var(--black); }

.lightbox-title {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 20px;
}

.slider-container {
  position: relative; /* INDISPENSABLE : Force le loader à s'aligner sur le centre des flèches */
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.slider-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  max-height: 75vh;
}

.slider-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  
  /* L'image commence totalement invisible et un poil plus grande */
  opacity: 0;
  transform: scale(1.01);
  
  /* Transition ultra-propre uniquement sur l'opacité et la taille */
  transition: opacity 0.4s ease-out, transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: opacity, transform;
}

.slider-wrapper img.loaded { 
  /* Devient opaque et reprend sa taille normale au pixel près */
  opacity: 1; 
  transform: scale(1);
}

.slider-arrow {
  font-size: 44px;
  font-weight: 100;
  color: var(--black);
  cursor: pointer;
  padding: 20px;
  user-select: none;
  opacity: 0.3;
  transition: opacity 0.2s, transform 0.2s;
}

.slider-arrow:hover { opacity: 1; }
.slider-arrow.prev:hover { transform: translateX(-4px); }
.slider-arrow.next:hover { transform: translateX(4px); }

/* Centrage du conteneur du loader dans la lightbox */
#organic-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99;
  transition: opacity 0.2s ease;
  pointer-events: none;
  opacity: 0;
}

/* Style du logo et animation de pulsation */
#organic-loader img {
  width: 100px; /* Ajuste la taille en pixels de ton logo ici */
  height: auto;
  animation: pulseLogo 1.5s infinite ease-in-out;
}

/* L'aller-retour d'opacité (de 20% à 100% de visibilité) */
@keyframes pulseLogo {
  0%, 100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes softFade {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes flashFade {
  0%   { opacity: 0; background-color: var(--white); }
  20%  { opacity: 0.3; }
  100% { opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE — TABLETTE (max 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .grid { columns: 2; }
}

/* ==========================================================================
   RESPONSIVE — MOBILE (max 768px)
   ========================================================================== */
@media (max-width: 768px) {

  /* Header */
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 24px 20px;
    z-index: 999;
  }

  .brand-name {
    font-size: 9px;
    letter-spacing: 0.14em;
  }

  .nav-link {
    font-size: 9px;
    letter-spacing: 0.14em;
  }

  /* Hero plein écran (Mis à jour avec le dégradé d'opacité) */
  .hero {
    position: relative; /* Indispensable pour caler le dégradé par-dessus */
    height: 100vh; 
    width: 100vw;
    overflow: hidden;
    margin-bottom: 0; 
  }

  /* Le dégradé smooth en haut et en bas (uniquement sur mobile) */
  .hero::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none; /* Permet de continuer à cliquer sur la flèche dessous */
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 1) 0%,    /* Blanc pur tout en haut */
      rgba(255, 255, 255, 0) 12%,   /* Disparaît doucement après 12% de l'image */
      rgba(255, 255, 255, 0) 88%,   /* Reste transparent au milieu */
      rgba(255, 255, 255, 1) 100%   /* Devient blanc pur tout en bas */
    );
    z-index: 5;
  }

  .hero-img {
    width: 100%;
    height: 100%; 
    object-fit: cover; 
    object-position: center;
    transform: scale(1.02); 
  }

  .hero-img-desktop { display: none; }
  .hero-img-mobile  { display: block; }

  /* Flèche */
  .hero-arrow {
    position: absolute;
    top: auto;
    bottom: 75px; 
    left: 50%;
    transform: translateX(-50%);
    font-size: 26px;
    z-index: 10;
    color: var(--white);
    mix-blend-mode: difference;
    padding: 15px; 
  }

  /* Grille */
  .grid {
    columns: 1;
    column-gap: 0;
  }

  .project {
    position: relative;
    margin-bottom: 16px;
  }

  .project-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 12px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
    color: var(--white);
    opacity: 1;
    transform: none;
    font-size: 9px;
    letter-spacing: 0.14em;
  }

  .project.touch-active .thumb img {
    transform: scale(1.02);
    opacity: 0.92;
  }

  /* Content */
  .content { padding: 20px; }

  /* About */
  .about-img-desktop { display: none; }
  .about-img-mobile  { display: block; }

  .about-wrapper { grid-template-columns: 1fr; }

  .about-photo-col {
    position: relative;
    height: 100vw;
    min-height: 300px;
  }

  .about-text-col { padding: 36px 20px 50px; }

  .bio-lead { font-size: 16px !important; }

  /* Lightbox */
  .lightbox {
    padding: 60px 0 0 0;
  }

  .lightbox-meta {
    top: 24px;
    left: 20px;
    right: 20px;
  }

  .lightbox-title { 
    font-size: 9px; 
    padding-left: 20px;
    padding-right: 20px;
  }
  .lightbox-counter { font-size: 9px; }
  .lightbox-close { font-size: 9px; }

  .slider-arrow { font-size: 32px; padding: 10px; }

  .slider-wrapper { max-height: 85vh; }
}