/* =============================================================
   style_trace.css — page de détail d'un projet (/projets/{slug})
   Toutes les sections : nav top, hero, galerie, tags, infos,
   apprentissages critiques, commentaires.
   ============================================================= */

body {
  font-family: "Poppins", sans-serif;
  margin: 0;
  background: #0c0c0c;
  color: #e5e5e5;
}

.layout-main {
  background: #0c0c0c;
  min-height: 100dvh;
}

/* ========= CONTAINER ========= */
.container.trace-detail,
.trace-detail.container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 32px;
  background: #111;
  border-radius: 16px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6);
}

/* ========= TOP NAV (retour + précédent/suivant) ========= */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 15px 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(17, 17, 17, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin: -32px -32px 30px -32px;
  padding: 15px 32px;
}

.top-nav .back-link {
  color: #888;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s ease;
}
.top-nav .back-link:hover {
  color: #fff;
}
.top-nav .back-link .material-symbols-outlined {
  font-size: 1.2rem;
}

.nav-arrows {
  display: flex;
  gap: 10px;
}
.nav-btn {
  background: #1a1a1a;
  padding: 8px 16px;
  border-radius: 30px;
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid #333;
  transition: all 0.2s;
}
.nav-btn:hover:not(.disabled) {
  background: #4f52ba;
  border-color: #4f52ba;
}
.nav-btn.disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ========= HERO ========= */
.trace-hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 40px;
}

.hero-media-container {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid #2a2a2a;
  position: relative;
}
.hero-media-container img,
.hero-media-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-media-container.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
}
.hero-media-container.empty .material-symbols-outlined {
  font-size: 4rem;
  color: #333;
}

.trace-hero .hero-content h1 {
  font-size: 2.8rem;
  line-height: 1.1;
  margin: 0 0 15px 0;
  color: #fff;
  font-weight: 700;
}
.trace-hero .trace-type {
  font-size: 1.1rem;
  /* WCAG AA : #a5a8e6 sur fond #111 = ratio ~7.5:1 (vs 3.6:1 avant) */
  color: #a5a8e6;
  font-weight: 600;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.trace-hero time {
  font-size: 1rem;
  color: #888;
  display: block;
  margin-top: 10px;
}

/* ========= GALERIE ========= */
.gallery-slider-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 40px;
  gap: 10px;
}
.gallery-slider {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 10px 2px;
  width: 100%;
  scroll-snap-type: x mandatory;
}
.gallery-slider::-webkit-scrollbar {
  display: none;
}
.slider-item {
  flex: 0 0 280px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid #333;
  transition:
    transform 0.2s,
    border-color 0.2s;
  background: #000;
  scroll-snap-align: center;
}
.slider-item:hover {
  transform: scale(1.02);
  border-color: #4f52ba;
}
.slider-item img,
.slider-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slider-nav {
  background: rgba(20, 20, 20, 0.8);
  color: white;
  border: 1px solid #444;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slider-nav:hover {
  background: #4f52ba;
  border-color: #4f52ba;
}

.gallery-simple {
  display: flex;
  gap: 15px;
  width: 100%;
  margin-bottom: 40px;
  flex-wrap: nowrap;
}
.simple-item {
  flex: 1;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid #333;
  transition:
    transform 0.2s,
    border-color 0.2s;
  background: #000;
  min-width: 0;
}
.simple-item:hover {
  transform: scale(1.02);
  border-color: #4f52ba;
}
.simple-item img,
.simple-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  transition: opacity 0.2s;
}
.simple-item:hover .video-play-icon,
.slider-item:hover .video-play-icon {
  opacity: 0;
}

/* ========= TAGS ========= */
.trace-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 25px;
}
.tag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  background: #512da8;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.tag-badge.tag-type-pole {
  background: #311b92;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid #673ab7;
}
.tag-badge.tag-type-outil {
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
}
.tag-badge:hover {
  filter: brightness(1.2);
  transform: translateY(-2px);
}

/* ========= ARGUMENTAIRE ========= */
.trace-argumentaire h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 40px 0 20px 0;
  color: #fff;
}
.trace-argumentaire p {
  max-width: 85ch;
  line-height: 1.8;
  font-size: 1.05rem;
  color: #d1d5db;
  margin-bottom: 40px;
}

/* ========= INFOS COMPLÉMENTAIRES ========= */
.trace-infos {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin: 30px 0;
}
.info-box {
  background: rgba(21, 21, 21, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 15px 20px;
  flex: 1 1 calc(50% - 15px);
  min-width: 200px;
  color: #e5e5e5;
}
.info-box.full {
  flex: 1 1 100%;
}
.info-box.cta {
  background: transparent;
  border: none;
  padding: 0;
  text-align: center;
}
.info-box strong {
  display: block;
  /* WCAG AA : #c9b6ff sur fond #111 = ratio ~9:1 (vs ~4:1 avant) */
  color: #c9b6ff;
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.info-box-value {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 500;
}

.ac-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}
.ac-badge {
  background: rgba(124, 77, 255, 0.15);
  color: #b388ff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  border: 1px solid rgba(124, 77, 255, 0.3);
  font-family: "Courier New", monospace;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ac-badge small {
  font-family: "Poppins", sans-serif;
  font-weight: 400;
  color: #d1c4e9;
  font-size: 0.8rem;
}

.portfolio-btn {
  background: #4f52ba;
  color: #fff;
  padding: 14px 28px;
  font-size: 1rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition:
    background 0.3s,
    transform 0.1s;
  width: 100%;
}
.portfolio-btn:hover {
  background: #3b41a1;
  transform: translateY(-1px);
}
.info-box.cta a {
  display: block;
}

/* Liste de liens externes : grille fluide */
.trace-liens {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.trace-liens .portfolio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  padding: 12px 20px;
  font-size: 0.95rem;
}
.trace-liens .portfolio-btn span {
  font-size: 0.85em;
  opacity: 0.85;
}

/* ========= COMMENTAIRES (override style_app pour s'intégrer ici) ========= */
.comments-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #2a2a2a;
}

/* ========= RESPONSIVE ========= */
@media (max-width: 900px) {
  .container.trace-detail {
    margin: 20px;
    padding: 20px;
    border-radius: 0;
  }
  .top-nav {
    margin: -20px -20px 20px -20px;
    padding: 10px 15px;
  }
  .trace-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .hero-media-container {
    aspect-ratio: 16 / 9;
  }
  .trace-hero .hero-content h1 {
    font-size: 1.8rem;
  }
  .slider-nav {
    display: none;
  }
  .gallery-slider {
    padding-right: 20%;
    scroll-padding-left: 0;
  }
  .slider-item {
    flex: 0 0 80%;
    scroll-snap-align: start;
  }
  .gallery-simple {
    flex-wrap: wrap;
  }
  .simple-item {
    flex: 1 1 100%;
    margin-bottom: 10px;
  }
  .info-box {
    flex: 1 1 100%;
  }
}

/* ── Mobile : position fixed sous la topbar.
   Sélecteur `.trace-detail .top-nav` pour matcher la spécificité (0,2,0) de
   style_app.css qui définit aussi cette règle (sinon notre override est ignoré). ── */
@media (max-width: 768px) {
  .trace-detail .top-nav {
    position: fixed;
    top: 56px;            /* juste sous la mobile-topbar (56px) */
    left: 0;
    right: 0;
    margin: 0;            /* override des marges négatives desktop */
    padding: 10px 16px;
    background: #111;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  /* Compense la hauteur de la top-nav fixée (~58px) pour que le contenu de
     l'article ne soit pas caché dessous. */
  .container.trace-detail {
    padding-top: 70px;
  }
  /* Libellés tronqués : "Retour aux projets" → "Retour", "← Préc." → "←", "Suiv. →" → "→".
     L'accessibilité reste assurée par aria-label sur les liens. */
  .back-link__suffix,
  .nav-btn__label {
    display: none;
  }
}
