@import url('https://fonts.googleapis.com/css2?family=Playfair+Display&display=swap');

/* ==========================================================================
   FONTS
   ========================================================================== */
@font-face {
  font-family: "Manosque";
  src: url("./assets/fonts/Manosque/Manosque-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Glacier";
  src: url("./assets/fonts/Glacier/Glacier-Bold.woff") format("woff");
  font-weight: bold;
  font-style: normal;
}

.krona-one-regular {
  font-family: "Krona One", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.archivo {
  font-family: "Archivo", sans-serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-style: normal;
  font-variation-settings: "wdth" 100;
}

.space-grotesk {
  font-family: "Space Grotesk", sans-serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-style: normal;
}

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

:root {
  --font-ui: "Manosque", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-title: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --bg: #f5f6f3;
  --ink: #1a1a1a;
  --bg-color: #0b0d12;
  --text-main: #f3f4f6;
  --accent-cyan: #00f2fe;
  --accent-purple: #4facfe;
  --glow-color: rgba(0, 242, 254, 0.4);
  --g: 10px;               
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background-color: var(--bg);
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   PORTFOLIO (TITRE CENTRAL ACCUEIL)
   ========================================================================== */
.container {
  text-align: center;
}

.scramble-title {
  font-family: var(--font-title);
  font-size: clamp(4rem, 10vw, 8rem);
  letter-spacing: -2px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--ink);
}

/* ==========================================================================
   HEADER TOP (HAUT GAUCHE)
   ========================================================================== */
.header-top-container {
  position: fixed;
  top: 30px;
  left: 30px;
  z-index: 1000;
}

.header-top-container ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  gap: 30px;
  align-items: center;
}

.header {
  text-decoration: none;
  color: var(--ink);
}

.header.top {
  font-family: var(--font-title);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  /* L'animation d'apparition est maintenant gérée par le TextScramble en JS */
}

/* ==========================================================================
   BOUTONS LANGUE (HAUT DROITE)
   ========================================================================== */
.langue {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 1000;
  display: flex;
  gap: 8px;
}

.langue button {
  background: transparent;
  border: none;
  font-family: var(--font-title);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  transition: opacity 0.2s ease;
}

.langue button:hover {
  opacity: 0.6;
}

/* ==========================================================================
   MENU PRINCIPAL (BAS GAUCHE)
   ========================================================================== */
.main-nav {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 1000;
}

.main-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.active-nav {
  color: #1a73e8 !important;
}

/* ==========================================================================
   ROLLING TEXT ANIMATION
   ========================================================================== */
.rolling-text {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  overflow: hidden;
  color: var(--ink);
}

.rolling-text a {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* ==========================================================================
   VUE PROJETS (LA GRILLE HORIZONTALE ET IMAGES)
   ========================================================================== */
.projects-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg);
  z-index: 50;          
  visibility: hidden;   
  opacity: 0;
}

.projects-scroll-container {
  width: 100vw;
  height: 100vh;
  overflow: hidden; 
  display: flex;
  align-items: center;
}

.projects-track {
  display: flex;
  gap: 40px; 
  width: max-content;
  padding-left: 60px;
  cursor: grab;
}

.projects-track:active {
  cursor: grabbing; 
}

.projects-grid {
  display: grid;
  grid-template-rows: repeat(2, min-content); 
  grid-auto-flow: column dense;               
  gap: 40px 40px;                             
  width: max-content;
}

.project-card {
  width: 320px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.project-card.hidden-card {
  display: none !important; 
}

/* CONTENEUR DE L'IMAGE */
.project-image {
  width: 100%;
  height: 200px;
  background-color: #d8d8d8;     
  position: relative;
  overflow: hidden; 
  transition: transform 0.3s ease;
  cursor: pointer;
}

/* BALISE IMG À L'INTÉRIEUR DU CONTENEUR */
.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; 
  display: block;
}

.project-image:hover {
  transform: scale(1.02);
}

.project-info {
  margin-top: 12px;
  font-family: var(--font-title);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--ink);
}

/* ==========================================================================
   FILTRES (PILULE CENTRÉE EN BAS)
   ========================================================================== */
.projects-filter {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #e5e5e5; 
  border-radius: 50px;
  display: flex;
  padding: 4px;
  gap: 4px;
  z-index: 60;
}

.projects-filter button {
  background: transparent;
  border: none;
  padding: 8px 24px;
  border-radius: 50px;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  color: #888;
  cursor: pointer;
  transition: color 0.3s;
}

.projects-filter button.active {
  color: #1a73e8; 
}

/* ==========================================================================
   POP-UP CONTACT (LA LETTRE)
   ========================================================================== */
.contact-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none; 
  visibility: hidden;   
}

.contact-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(245, 246, 243, 0.8); 
  backdrop-filter: blur(4px);
  opacity: 0;
}

.contact-letter {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 40px;
  width: 90%;
  max-width: 450px;
  opacity: 0;
  font-family: var(--font-title);
  box-shadow: 10px 10px 0px rgba(26, 26, 26, 0.1);
}

.contact-letter h2 {
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 24px;
  color: var(--ink);
}

.contact-letter form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.contact-letter input,
.contact-letter textarea {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--ink);
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  resize: none;
}

.contact-letter input:focus,
.contact-letter textarea:focus {
  background: var(--ink);
  color: var(--bg);
}

.send-btn {
  padding: 14px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  font-family: var(--font-title);
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
}

.send-btn:hover {
  background: #d3a13b;
  border-color: #d3a13b;
  color: var(--ink);
}

#close-contact {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  color: var(--ink);
}

/* ==========================================================================
   COULEURS DES CATÉGORIES (VUE PROJETS)
   ========================================================================== */
.project-card[data-category="3d"] .project-category {
  color: #ff9800; 
}
.project-card[data-category="design"] .project-category {
  color: #e83e8c; 
}
.project-card[data-category="code"] .project-category {
  color: #1a73e8; 
}

/* ==========================================================================
   COULEURS DES BOUTONS DE FILTRE ACTIFS
   ========================================================================== */
.projects-filter button:nth-child(1).active { color: #1a73e8; }
.projects-filter button:nth-child(2).active { color: #e83e8c; }
.projects-filter button:nth-child(3).active { color: #ff9800; }
.projects-filter button:nth-child(4).active { color: #1a73e8; }

.iti { width: 100%; }

/* ==========================================================================
   RESPONSIVE (MOBILE & TABLETTE)
   ========================================================================== */

/* Design du bouton burger (caché par défaut sur PC) */
.burger-btn {
  display: none; 
  position: fixed;
  top: 25px;
  right: 25px;
  z-index: 1002; 
  background: none;
  border: none;
  cursor: pointer;
  width: 30px;
  height: 20px;
  flex-direction: column;
  justify-content: space-between;
}

.burger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--ink, #1a1a1a);
  transition: all 0.3s ease;
}

/* Animation en croix quand la classe .menu-open est active */
.menu-open .burger-btn span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.menu-open .burger-btn span:nth-child(2) { opacity: 0; }
.menu-open .burger-btn span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* Adaptation pour les écrans de téléphone */
@media (max-width: 768px) {
  
  /* Header en haut : passage en colonne */
  .header-top-container ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
  }
  
  /* On cache la 2ème et 3ème ligne sur mobile pour laisser la 1ère faire son animation boucle */
  .header-top-container ul li:nth-child(2),
  .header-top-container ul li:nth-child(3) {
    display: none;
  }

  /* Cacher le header quand le menu burger est ouvert */
  .menu-open .header-top-container {
    opacity: 0;
    pointer-events: none;
  }
  
  .burger-btn {
    display: flex;
  }

  /* Le menu plein écran */
  .main-nav {
    position: fixed;
    top: 0;
    left: -100%; 
    width: 100vw;
    height: 100dvh;
    background-color: var(--bg, #f5f6f3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001; 
    transition: left 0.4s cubic-bezier(0.77, 0, 0.175, 1);
  }
  
  .main-nav ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px; 
  }
  
  .main-nav ul li {
    font-size: 32px;
  }

  /* CORRECTIF DU BUG : Boîte d'animation adaptée au gros texte */
  .rolling-text, .rolling-text .block {
    height: 38px !important;
    line-height: 38px !important;
  }

  /* Choix des langues en bas de l'écran */
  .langue {
    position: fixed; 
    top: auto;       
    bottom: 15%;     
    right: auto;     
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;       
    z-index: 1002;   
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0s 0.4s;
  }

  .langue button {
    font-size: 18px; 
  }

  /* --- ACTIONS QUAND LE MENU EST OUVERT --- */
  .menu-open .main-nav { left: 0; }
  .menu-open .langue {
    opacity: 1; 
    visibility: visible; 
    pointer-events: auto;
    transition: opacity 0.4s ease, visibility 0s 0s; 
  }

  /* --- CORRECTIONS DE LA GRILLE ET DES FILTRES (SAFE ZONE) --- */
  .projects-view {
    height: 100dvh; /* S'adapte exactement aux barres de Safari sur iPhone */
  }

  .projects-scroll-container {
    position: absolute;
    top: 75px;     /* Ligne rouge du haut (sous le header) */
    bottom: 90px;  /* Ligne rouge du bas (au-dessus des filtres) */
    height: auto;  /* Laisse top et bottom définir la zone exacte */
    align-items: center;
  }

  .projects-filter {
    bottom: 20px; 
    width: 90%; 
    justify-content: space-between;
    padding: 10px 20px;
  }
  
  .projects-filter button {
    font-size: 12px;
  }

  .projects-track {
    padding-left: 20px; 
    gap: 20px; 
  }

  .projects-grid {
    gap: 15px 20px; /* Espace réduit entre la ligne du haut et du bas */
  }

  .project-card {
    width: 55vw; /* Largeur de la carte */
  }
  
  .project-image {
    height: 22dvh; /* Garantit que 2 images + 2 textes rentrent toujours dans la zone */
    max-height: 160px; /* Sécurité supplémentaire */
  }
  
  .project-info {
    margin-top: 8px; /* Rapproche un peu le texte de l'image */
    font-size: 12px;
  }

  .project-title {
    font-size: 14px;
  }

  /* Textes Accueil et Modale */
  #scramble-text {
    font-size: 12vw; 
  }
  
  .contact-letter {
    width: 90%;
    padding: 30px 20px;
  }
}