/* ===================================
   Base + Variables (alignées avec Compétences)
=================================== */
:root{
  --bg-dark: #000;
  --text: #fff;

  --glass: rgba(255,255,255,0.06);
  --glass-strong: rgba(255,255,255,0.09);
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);

  --shadow: 0 18px 40px rgba(0,0,0,0.45);

  --max-width: 1200px;
  --page-x: clamp(16px, 3vw, 56px);

  --gradient-primary: linear-gradient(135deg, rgba(70,72,255,0.95), rgba(255,114,98,0.9), rgba(255,174,165,0.7));
}

/* ------------------------------------------------------ */
/* Reset + typo                                            */
/* ------------------------------------------------------ */
*{ margin:0; padding:0; box-sizing:border-box; }

html, body{
  font-family: 'Epilogue', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
}

html{ scroll-behavior: smooth; }
a{ color: inherit; }

/* Fond discret comme Compétences */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(70,72,255,0.18), transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(255,114,98,0.14), transparent 45%),
    radial-gradient(circle at 55% 85%, rgba(255,174,165,0.12), transparent 50%),
    linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,1));
}

/* S'assurer que tout passe au-dessus du fond */
body > *{
  position: relative;
  z-index: 1;
}

/* APRÈS : padding global sur la page (comme .skills-page) */
main{
  margin-top: 50px; /* tu le gardes si ton header est fixed */
  padding-inline: var(--page-x);
}

/* Le container centré, sans padding interne */
.project-section{
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ===================================
   Section projets
=================================== */
.project-section{
  max-width: var(--max-width);
  margin: 0 auto;
}

.project-section h1{
  text-align: left;
  margin-bottom: 16px;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ===================================
   Topbar : bouton gauche + super-tags centrés
=================================== */
.filters-topbar{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  margin-bottom: 1rem;
}

/* Base “btn” (sans toucher au HTML) */
.toggle-filters-btn,
.super-tag-btn,
.sort-controls button[type="submit"],
.sort-controls button[type="button"]{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0.7rem 1rem;
  border-radius: 999px;

  color: #fff;
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;

  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);

  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

/* Hover “glass” */
.toggle-filters-btn:hover,
.super-tag-btn:hover,
.sort-controls button:hover{
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.09);
}

/* Bouton toggle (plus “premium” : bordure dégradée + fond glass coloré, propre) */
.toggle-filters-btn{
  cursor: pointer;
  border: 1px solid transparent;

  background:
    linear-gradient(rgba(255,255,255,0.10), rgba(255,255,255,0.04)) padding-box,
    radial-gradient(circle at 20% 30%, rgba(70,72,255,0.28), transparent 58%) padding-box,
    radial-gradient(circle at 80% 45%, rgba(255,114,98,0.22), transparent 62%) padding-box,
    linear-gradient(135deg,
      rgba(70,72,255,0.95),
      rgba(255,114,98,0.80),
      rgba(255,174,165,0.60)
    ) border-box;

  background-origin: border-box;
  background-clip: padding-box, padding-box, padding-box, border-box;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

/* Chevron */
.toggle-filters-btn::after{
  content: '⌃';
  display: inline-block;
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
  font-weight: 900;
}
.toggle-filters-btn.collapsed::after{ transform: rotate(180deg); }

/* Super-tags centrés */
.super-tags{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.8rem;
}

/* Super-tag inactif = glass discret */
.super-tag-btn{
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.88);
}

/* Super-tag actif = gradient border + fond glass plus visible */
.super-tag-btn.active{
  border: 1px solid transparent;
  background:
    linear-gradient(rgba(255,255,255,0.10), rgba(255,255,255,0.04)) padding-box,
    radial-gradient(circle at 30% 30%, rgba(70,72,255,0.22), transparent 60%) padding-box,
    radial-gradient(circle at 80% 60%, rgba(255,114,98,0.18), transparent 65%) padding-box,
    linear-gradient(135deg,
      rgba(70,72,255,0.95),
      rgba(255,114,98,0.85),
      rgba(255,174,165,0.65)
    ) border-box;
  background-origin: border-box;
  background-clip: padding-box, padding-box, padding-box, border-box;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ===================================
   Boîte filtres : glass panel
=================================== */
.sort-controls{
  margin-bottom: 20px;

  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1rem 1.25rem;

  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 1rem 2rem;
  align-items: end;

  transition: max-height 0.35s ease, opacity 0.35s ease, padding 0.35s ease, border-color 0.35s ease;
  max-height: 1000px;
  opacity: 1;
  overflow: hidden;
}

.sort-controls label{
  font-weight: 800;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.78);
}

.sort-controls select,
.sort-controls input[type="date"]{
  width: 100%;
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sort-controls select:focus,
.sort-controls input[type="date"]:focus{
  border-color: rgba(255,114,98,0.55);
  outline: none;
  background: rgba(255,255,255,0.08);
}

.sort-controls select[multiple]{
  resize: vertical;
  min-height: 150px;
}

.sort-controls.collapsed{
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
  pointer-events: none;
}

/* Actions filtres */
.filter-actions{
  grid-column: 1 / -1;
  display: flex;
  gap: 0.8rem;
  justify-content: flex-start;
  align-items: center;
  margin-top: 0.25rem;
}

/* Boutons du form : même logique que toggle (un peu moins “fort”) */
.sort-controls button[type="submit"],
.sort-controls button[type="button"]{
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 14px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ===================================
   Grille projets : cards glass
=================================== */
.project-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}

.project-item{
  position: relative;

  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  padding: 0.9rem;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.project-item:hover{
  transform: translateY(-6px);
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.075);
}

.project-thumb{
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 1rem;

  /* Le cadre 16/9 est ici */
  aspect-ratio: 16 / 9;

  /* évite que du noir “ressorte” derrière */
  background: transparent;
}

/* 16/9 fixe (et override l’inline video) */
.project-item img,
.project-item video{
  width: 100% !important;
  height: 100% !important;
  display: block;

  /* IMPORTANT : supprime les barres noires */
  object-fit: cover;

  object-position: center;
  background: transparent;
  border: none;

  transition: transform 0.25s ease, filter 0.25s ease;
}

.project-thumb:hover img,
.project-thumb:hover video{
  transform: scale(1.06);
  filter: brightness(1.02);
}

.project-item h3{
  text-align: left;
  font-size: 1.1rem;
  font-weight: 800;
  margin-top: 0.75rem;
  margin-bottom: 0.2rem;
}

/* Bouton supprimer (reste visible) */
.delete-project-btn{
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 0, 0, 0.72);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: #fff;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 3;
}
.delete-project-btn:hover{
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ===================================
   Overlay tags au hover (plus “premium”)
=================================== */
.project-tags-overlay{
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-end;
  gap: 0.4rem;
  padding: 0.7rem 0.8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.project-thumb:hover .project-tags-overlay{ opacity: 1; }

/* Pills de tags : style “chip” cohérent */
.tag-pill{
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;

  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
}

.tag-pill:nth-child(3n+1){
  background: rgba(70,72,255,0.14);
  border-color: rgba(70,72,255,0.25);
}
.tag-pill:nth-child(3n+2){
  background: rgba(255,114,98,0.14);
  border-color: rgba(255,114,98,0.25);
}
.tag-pill:nth-child(3n+3){
  background: rgba(255,174,165,0.12);
  border-color: rgba(255,174,165,0.22);
}

/* ===================================
   Section ajout projet : glass (cohérent)
=================================== */
.add-project{
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 2rem;
  margin: 3rem auto;
  max-width: 800px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.add-project h2{
  font-size: 1.8rem;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.add-project form{
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.add-project input[type="text"],
.add-project input[type="file"],
.add-project textarea,
.add-project select{
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.add-project input:focus,
.add-project textarea:focus,
.add-project select:focus{
  border-color: rgba(255,114,98,0.55);
  background: rgba(255,255,255,0.08);
  outline: none;
}

.add-project label{
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: rgba(255,255,255,0.80);
}

.add-project button{
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 999px;

  background:
    linear-gradient(rgba(255,255,255,0.10), rgba(255,255,255,0.04)) padding-box,
    radial-gradient(circle at 20% 30%, rgba(70,72,255,0.22), transparent 60%) padding-box,
    radial-gradient(circle at 80% 50%, rgba(255,114,98,0.18), transparent 62%) padding-box,
    linear-gradient(135deg,
      rgba(70,72,255,0.95),
      rgba(255,114,98,0.85),
      rgba(255,174,165,0.60)
    ) border-box;

  background-origin: border-box;
  background-clip: padding-box, padding-box, padding-box, border-box;

  color: #fff;
  padding: 0.85rem;
  font-size: 1.05rem;
  font-weight: 900;

  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  transition: transform 0.2s ease, opacity 0.2s ease;
}

.add-project button:hover{
  transform: translateY(-2px);
  opacity: 0.96;
}

.add-project select[multiple]{
  resize: vertical;
  min-height: 160px;
}

/* Fieldset origine (radio) */
.origine-fieldset{
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(255,255,255,0.04);
}

.origine-fieldset legend{
  font-weight: 900;
  padding: 0 0.5rem;
  font-size: 1rem;
  color: rgba(255,255,255,0.82);
}

.origine-option{
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
  color: rgba(255,255,255,0.80);
  font-weight: 700;
}

/* ===================================
   Responsive
=================================== */
@media (max-width: 1024px){
  .project-section h1{
    text-align: center;
  }
  .project-grid{
    gap: 18px;
  }
}

@media (max-width: 768px){
  .project-section h1{ font-size: 2.2rem; }
  .project-item h3{ font-size: 1.05rem; }
  .project-grid{ gap: 14px; }

  .sort-controls{
    grid-template-columns: 1fr;
  }

  .filter-actions{
    flex-direction: column;
    align-items: stretch;
  }

  .sort-controls button[type="submit"],
  .sort-controls button[type="button"]{
    width: 100%;
  }

  /* Sur mobile : topbar en stack */
  .filters-topbar{
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .super-tags{
    position: static;
    transform: none;
    margin-top: 0.6rem;
    width: 100%;
    justify-content: center;
  }

  .toggle-filters-btn{
    width: 100%;
  }
}

@media (max-width: 480px){
  .project-section h1{
    font-size: 1.9rem;
    text-align: center;
  }
  .project-item h3{
    font-size: 1rem;
  }
  .project-grid{
    gap: 10px;
  }

  .super-tag-btn{
    width: 100%;
  }
}

/* ===================================
   Accessibilité / perf
=================================== */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{
    transition: none !important;
  }
  .project-item:hover{
    transform: none;
  }
  .project-thumb:hover img,
  .project-thumb:hover video{
    transform: none;
  }
}



/* =========================================================
   ALIGNEMENT EXACT AVEC competences.css (anti double padding)
   ========================================================= */

/* Le padding horizontal DOIT être ici (comme .skills-page) */
.projects-page{
  padding-inline: var(--page-x);
}

/* Le container interne DOIT être sans padding */
.projects-page .project-section{
  padding-inline: 0 !important; /* force si une règle traîne */
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Supprime tout padding mobile qui réintroduit l'écart */
@media (max-width: 480px){
  .projects-page .project-section{
    padding-inline: 0 !important;
  }
}
