{% extends "core/base.html" %}
{% load static %}

{% block title %}{{ project.title }} - Portfolio{% endblock %}

{% block extra_css %}
<style>
/* ===== VARIABLES CYBERPUNK 2077 ===== */
:root {
  --neon-cyan: #00f3ff;
  --neon-pink: #ff006e;
  --neon-magenta: #ff00ea;
  --neon-purple: #b026ff;
  --neon-yellow: #ffff00;
  --neon-green: #00ff41;
  --electric-blue: #00d4ff;
  --dark-bg: #0a0a0f;
  --card-bg: rgba(15, 15, 25, 0.85);
  --glass-border: rgba(0, 243, 255, 0.3);
}

/* ===== FIX SCROLL HORIZONTAL ===== */
html,
body {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100vw;
}

* {
  box-sizing: border-box;
}

.container {
  max-width: 100%;
  overflow-x: hidden;
  padding-left: 15px;
  padding-right: 15px;
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
    margin: 0 auto;
  }
}

/* ===== BACKGROUND CYBERPUNK ===== */
body {
  background: #0a0a0f;
  color: #e0e0e0;
  position: relative;
}

/* Particules animées style Cyberpunk 2077 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, var(--neon-cyan), transparent),
    radial-gradient(2px 2px at 60% 70%, var(--neon-pink), transparent),
    radial-gradient(1px 1px at 50% 50%, var(--neon-yellow), transparent),
    radial-gradient(2px 2px at 80% 10%, var(--neon-cyan), transparent),
    radial-gradient(1px 1px at 90% 60%, var(--neon-magenta), transparent);
  background-size: 200% 200%;
  animation: particles-float 25s ease-in-out infinite;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

@keyframes particles-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-30px, -30px); }
}

/* Grid style Cyberpunk */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 243, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 0, 110, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
  animation: grid-slide 20s linear infinite;
}

@keyframes grid-slide {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

/* ===== BACK BUTTON STYLE CP2077 - CORRIGÉ ===== */
.back-navigation {
  position: fixed;
  top: 100px;
  left: 2rem;
  z-index: 1000;
  animation: slide-in-left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Correction pour PC - s'assurer que le bouton reste visible */
@media (min-width: 1400px) {
  .back-navigation {
    left: calc((100vw - 1140px) / 2 - 200px);
  }
}

@media (min-width: 992px) and (max-width: 1399px) {
  .back-navigation {
    left: 1.5rem;
  }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-80px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: rgba(15, 15, 25, 0.95);
  border: 2px solid var(--neon-cyan);
  border-radius: 10px;
  color: var(--neon-cyan);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-decoration: none;
  backdrop-filter: blur(15px);
  transition: all 0.3s ease;
  box-shadow: 
    0 0 30px rgba(0, 243, 255, 0.3),
    inset 0 0 20px rgba(0, 243, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.back-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.4), transparent);
  transition: left 0.5s;
}

.back-btn:hover::before {
  left: 100%;
}

.back-btn:hover {
  background: linear-gradient(135deg, var(--neon-cyan), var(--electric-blue));
  color: #0a0a0f;
  transform: translateX(-8px) scale(1.05);
  box-shadow: 
    0 0 50px rgba(0, 243, 255, 0.6),
    0 10px 40px rgba(0, 243, 255, 0.4);
  border-color: #fff;
}

/* ===== HERO BANNER STYLE CYBERPUNK 2077 - CORRIGÉ ===== */
.hero-banner {
  position: relative;
  height: 80vh;
  min-height: 500px;
  max-height: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 4rem;
  width: 100%;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.4);
  animation: image-breathe 8s ease-in-out infinite;
}

@keyframes image-breathe {
  0%, 100% { transform: scale(1); filter: brightness(0.4); }
  50% { transform: scale(1.05); filter: brightness(0.5); }
}

/* Overlay multi-couches style CP2077 */
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(180deg, 
      rgba(10, 10, 15, 0.3) 0%, 
      rgba(10, 10, 15, 0.7) 50%,
      rgba(10, 10, 15, 0.95) 100%
    ),
    radial-gradient(circle at 30% 50%, rgba(0, 243, 255, 0.15), transparent 50%),
    radial-gradient(circle at 70% 50%, rgba(255, 0, 110, 0.15), transparent 50%);
  z-index: 1;
  animation: overlay-pulse 6s ease-in-out infinite;
}

@keyframes overlay-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}

/* Scanlines animées */
.hero-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 243, 255, 0.03) 0px,
    transparent 2px,
    transparent 4px,
    rgba(255, 0, 110, 0.03) 6px
  );
  animation: scanlines-scroll 12s linear infinite;
  pointer-events: none;
}

@keyframes scanlines-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(6px); }
}

/* Glitch bars occasionnels */
.hero-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(90deg, transparent 0%, rgba(0, 243, 255, 0.1) 50%, transparent 100%);
  opacity: 0;
  animation: glitch-bar 8s infinite;
}

@keyframes glitch-bar {
  0%, 90%, 100% { opacity: 0; transform: translateX(0); }
  92% { opacity: 1; transform: translateX(-100%); }
  94% { opacity: 1; transform: translateX(100%); }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
  animation: hero-content-reveal 1s ease both;
}

@keyframes hero-content-reveal {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Badge catégorie style CP2077 */
.project-category-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-magenta));
  color: #fff;
  padding: 0.6rem 1.8rem;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 2rem;
  box-shadow: 
    0 0 40px rgba(255, 0, 110, 0.6),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
  animation: badge-glow-pulse 3s ease-in-out infinite;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

@keyframes badge-glow-pulse {
  0%, 100% { 
    box-shadow: 
      0 0 40px rgba(255, 0, 110, 0.6),
      inset 0 0 20px rgba(255, 255, 255, 0.2);
  }
  50% { 
    box-shadow: 
      0 0 60px rgba(255, 0, 110, 0.9),
      inset 0 0 30px rgba(255, 255, 255, 0.3);
  }
}

/* Titre EPIC style CP2077 */
.project-title {
  font-size: clamp(2rem, 5vw, 4.5rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-pink) 50%, var(--neon-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  margin-bottom: 2.5rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  line-height: 1.2;
  text-shadow: 
    0 0 30px rgba(0, 243, 255, 0.5),
    0 0 60px rgba(255, 0, 110, 0.3);
  animation: 
    title-gradient-shift 8s ease infinite,
    title-glitch 10s infinite;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@keyframes title-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes title-glitch {
  0%, 94%, 100% { 
    text-shadow: 
      0 0 30px rgba(0, 243, 255, 0.5),
      0 0 60px rgba(255, 0, 110, 0.3);
  }
  95% { 
    text-shadow: 
      -5px 0 var(--neon-cyan),
      5px 0 var(--neon-pink),
      0 0 30px rgba(0, 243, 255, 0.5);
    transform: skew(1deg);
  }
  97% { 
    text-shadow: 
      5px 0 var(--neon-cyan),
      -5px 0 var(--neon-pink),
      0 0 30px rgba(255, 0, 110, 0.5);
    transform: skew(-1deg);
  }
}

/* ===== BOUTONS D'ACTION - ENTIÈREMENT REFAITS ===== */
.project-actions {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 3rem;
  animation: actions-reveal 1.2s ease 0.3s both;
}

@keyframes actions-reveal {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Nouvelle animation simplifiée et stable */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.2rem 2.5rem;
  background: rgba(15, 15, 25, 0.9);
  border: 2px solid var(--neon-cyan);
  border-radius: 12px;
  color: var(--neon-cyan);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 243, 255, 0.2);
  /* Empêcher les animations pendant le scroll */
  will-change: transform;
  transform: translateZ(0);
}

/* Animation au hover uniquement - pas d'effets pendant le scroll */
.action-btn:hover {
  background: rgba(0, 243, 255, 0.1);
  border-color: var(--neon-cyan);
  color: #fff;
  transform: translateY(-4px) translateZ(0);
  box-shadow: 
    0 8px 30px rgba(0, 243, 255, 0.4),
    0 0 40px rgba(0, 243, 255, 0.3),
    inset 0 0 20px rgba(0, 243, 255, 0.1);
}

/* Effet de brillance au hover */
.action-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 243, 255, 0.3), transparent);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
  pointer-events: none;
}

.action-btn:hover::after {
  width: 300px;
  height: 300px;
}

.action-btn:active {
  transform: translateY(-2px) scale(0.98) translateZ(0);
}

.action-btn.github-btn {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  box-shadow: 0 4px 20px rgba(255, 0, 110, 0.2);
}

.action-btn.github-btn:hover {
  background: rgba(255, 0, 110, 0.1);
  border-color: var(--neon-pink);
  color: #fff;
  box-shadow: 
    0 8px 30px rgba(255, 0, 110, 0.4),
    0 0 40px rgba(255, 0, 110, 0.3),
    inset 0 0 20px rgba(255, 0, 110, 0.1);
}

.action-btn.github-btn::after {
  background: radial-gradient(circle, rgba(255, 0, 110, 0.3), transparent);
}

/* Icônes dans les boutons */
.action-btn i {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.action-btn:hover i {
  transform: scale(1.2);
}

/* ===== MAIN CONTENT SECTION ===== */
.project-content-section {
  padding: 3rem 0 6rem;
  position: relative;
  z-index: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 3rem;
  align-items: start;
}

/* ===== LEFT COLUMN - CONTENT BLOCKS ===== */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.content-block {
  background: var(--card-bg);
  border: 2px solid rgba(0, 243, 255, 0.2);
  border-radius: 18px;
  padding: 3rem;
  backdrop-filter: blur(20px);
  box-shadow: 
    0 15px 50px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(0, 243, 255, 0.03);
  position: relative;
  overflow: hidden;
  animation: block-reveal 0.8s ease both;
}

@keyframes block-reveal {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Bordure animée */
.content-block::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  animation: border-scan 3s infinite;
}

@keyframes border-scan {
  0% { left: -100%; }
  100% { left: 200%; }
}

.block-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid rgba(0, 243, 255, 0.2);
  position: relative;
}

.block-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100px;
  height: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), transparent);
  box-shadow: 0 0 10px var(--neon-cyan);
  animation: header-line-expand 2s ease-in-out infinite;
}

@keyframes header-line-expand {
  0%, 100% { width: 80px; }
  50% { width: 150px; }
}

.block-icon {
  font-size: 2.2rem;
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 15px var(--neon-cyan));
  animation: icon-pulse 2s ease-in-out infinite;
}

@keyframes icon-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.block-title {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
  background: linear-gradient(135deg, var(--neon-cyan), var(--electric-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.block-content {
  font-size: 1.15rem;
  line-height: 2;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 300;
}

.block-content p {
  margin-bottom: 1.8rem;
}

/* Results Block - Style succès */
.results-block {
  border-color: rgba(0, 255, 65, 0.3);
  background: linear-gradient(135deg, 
    rgba(0, 255, 65, 0.05) 0%,
    rgba(15, 15, 25, 0.85) 100%
  );
}

.results-block::before {
  background: linear-gradient(90deg, transparent, var(--neon-green), transparent);
}

.results-block .block-header::after {
  background: linear-gradient(90deg, var(--neon-green), transparent);
  box-shadow: 0 0 10px var(--neon-green);
}

.results-block .block-icon {
  color: var(--neon-green);
  filter: drop-shadow(0 0 15px var(--neon-green));
}

.results-block .block-title {
  background: linear-gradient(135deg, var(--neon-green), var(--neon-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 15px;
  cursor: pointer;
  aspect-ratio: 16 / 9;
  border: 2px solid rgba(0, 243, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: #000;
}

.gallery-item:hover {
  border-color: var(--neon-cyan);
  transform: translateY(-10px) scale(1.02);
  box-shadow: 
    0 20px 50px rgba(0, 243, 255, 0.4),
    0 0 50px rgba(0, 243, 255, 0.2);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.4s ease;
  filter: brightness(0.9);
}

.gallery-item:hover img {
  transform: scale(1.12);
  filter: brightness(1.1);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.95));
  color: #fff;
  padding: 1.5rem;
  font-size: 0.95rem;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(10px);
}

.gallery-item:hover .gallery-caption {
  transform: translateY(0);
}

/* ===== RIGHT COLUMN - SIDEBAR ===== */
.sidebar-sticky {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.sidebar-block {
  background: var(--card-bg);
  border: 2px solid rgba(255, 0, 110, 0.2);
  border-radius: 18px;
  padding: 2.5rem;
  backdrop-filter: blur(20px);
  box-shadow: 
    0 15px 50px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(255, 0, 110, 0.03);
  position: relative;
  overflow: hidden;
  animation: sidebar-reveal 0.8s ease 0.2s both;
}

@keyframes sidebar-reveal {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Effet de lumière rose */
.sidebar-block::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 0, 110, 0.15), transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}

.sidebar-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-title i {
  filter: drop-shadow(0 0 10px var(--neon-pink));
  color: var(--neon-pink);
}

/* Tech Stack Grid */
.tech-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.tech-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem;
  background: rgba(255, 0, 110, 0.05);
  border: 2px solid rgba(255, 0, 110, 0.2);
  border-radius: 12px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.tech-item::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255, 0, 110, 0.3), transparent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.tech-item:hover::before {
  width: 300px;
  height: 300px;
}

.tech-item:hover {
  background: rgba(255, 0, 110, 0.15);
  border-color: var(--neon-pink);
  transform: translateY(-8px);
  box-shadow: 
    0 15px 40px rgba(255, 0, 110, 0.4),
    0 0 40px rgba(255, 0, 110, 0.2);
}

.tech-icon {
  font-size: 2.5rem;
  color: var(--neon-pink);
  position: relative;
  z-index: 1;
  transition: all 0.4s ease;
}

.tech-item:hover .tech-icon {
  transform: scale(1.2) rotateY(360deg);
  filter: drop-shadow(0 0 20px var(--neon-pink));
}

.tech-name {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

/* Metadata */
-item:hover {
  background: rgba(0, 243, 255, 0.08);
  transform: translateX(5px);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}

.metadata-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.metadata-value {
  font-size: 1.05rem;
  color: #fff;
  font-weight: 800;
}

/* ===== RELATED PROJECTS ===== */
.related-section {
  padding: 6rem 0 4rem;
  border-top: 2px solid rgba(0, 243, 255, 0.2);
  position: relative;
  z-index: 1;
}

.related-header {
  text-align: center;
  margin-bottom: 4rem;
}

.related-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink), var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
  letter-spacing: 3px;
  animation: related-glow 4s ease-in-out infinite;
}

@keyframes related-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.related-title::after {
  content: '';
  display: block;
  width: 200px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-pink), transparent);
  margin: 1.5rem auto 0;
  box-shadow: 0 0 15px var(--neon-cyan);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
}

.related-card {
  background: var(--card-bg);
  border: 2px solid rgba(0, 243, 255, 0.2);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  display: block;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  position: relative;
}

.related-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(0, 243, 255, 0.1) 50%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.5s;
  animation: hologram-spin 6s linear infinite;
  pointer-events: none;
}

@keyframes hologram-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.related-card:hover::before {
  opacity: 1;
}

.related-card:hover {
  transform: translateY(-15px) scale(1.02);
  border-color: var(--neon-cyan);
  box-shadow: 
    0 25px 70px rgba(0, 243, 255, 0.4),
    0 0 60px rgba(0, 243, 255, 0.3);
}

.related-card-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.5s ease;
  filter: brightness(0.8);
}

.related-card:hover .related-card-image {
  transform: scale(1.15);
  filter: brightness(1);
}

.related-card-body {
  padding: 2rem;
  position: relative;
}

.related-card-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.8rem;
  transition: color 0.3s ease;
}

.related-card:hover .related-card-title {
  color: var(--neon-cyan);
  text-shadow: 0 0 15px rgba(0, 243, 255, 0.8);
}

.related-card-summary {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.7;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .content-grid {
    grid-template-columns: 1fr 320px;
    gap: 2.5rem;
  }
  
  .tech-stack {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 991px) {
  .back-navigation {
    position: static;
    margin: 2rem 1rem;
    animation: none;
  }
  
  .hero-banner {
    height: 70vh;
    min-height: 500px;
  }
  
  .project-title {
    font-size: 2.5rem;
    letter-spacing: 2px;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
  }
  
  .sidebar-sticky {
    position: static;
  }
  
  .tech-stack {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .related-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .back-navigation {
    margin: 1.5rem 1rem;
  }
  
  .back-btn {
    padding: 0.9rem 1.5rem;
    font-size: 0.85rem;
  }
  
  .hero-banner {
    height: 60vh;
    min-height: 400px;
  }
  
  .hero-content {
    padding: 1.5rem;
  }
  
  .project-title {
    font-size: 1.75rem;
    letter-spacing: 1px;
    margin-bottom: 2rem;
  }
  
  .project-category-badge {
    font-size: 0.8rem;
    padding: 0.5rem 1.2rem;
    margin-bottom: 1.5rem;
  }
  
  .project-actions {
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 2rem;
  }
  
  .action-btn {
    width: 100%;
    max-width: 100%;
    padding: 1rem 2rem;
    font-size: 0.9rem;
    justify-content: center;
  }
  
  .content-block {
    padding: 2rem;
  }
  
  .block-title {
    font-size: 1.6rem;
  }
  
  .block-content {
    font-size: 1rem;
    line-height: 1.8;
  }
  
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  
  .tech-stack {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .related-title {
    font-size: 2rem;
  }
}

@media (max-width: 576px) {
  .hero-banner {
    height: 50vh;
    min-height: 350px;
  }
  
  .project-title {
    font-size: 1.5rem;
  }
  
  .action-btn {
    padding: 0.9rem 1.5rem;
    font-size: 0.85rem;
  }
  
  .sidebar-block {
    padding: 2rem;
  }
  
  .tech-stack {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .tech-item {
    padding: 1rem;
  }
  
  .tech-icon {
    font-size: 2rem;
  }
}

/* Correction spécifique pour iOS Safari */
@supports (-webkit-touch-callout: none) {
  .action-btn {
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
  }
  
  .hero-banner {
    -webkit-transform: translateZ(0);
  }
}
</style>
{% endblock %}

{% block content %}

<!-- BACK NAVIGATION -->
<div class="back-navigation">
  <a href="{% url 'projects:list' %}" class="back-btn">
    <i class="fa-solid fa-arrow-left"></i>
    Retour aux Archives
  </a>
</div>

<!-- HERO BANNER -->
<section class="hero-banner">
  <div class="hero-background">
    <img src="{{ project.cover_image.url }}" alt="{{ project.title }}">
  </div>
  <div class="hero-overlay"></div>
  
  <div class="hero-content">
    {% if project.category %}
    <div class="project-category-badge">
      {{ project.category.name }}
    </div>
    {% endif %}
    
    <h1 class="project-title">{{ project.title }}</h1>
    
    <div class="project-actions">
      {% if project.external_url %}
      <a href="{{ project.external_url }}" target="_blank" rel="noopener noreferrer" class="action-btn">
        <i class="fa-solid fa-globe"></i>
        Voir le Site
      </a>
      {% endif %}
      
      {% if project.repo_url %}
      <a href="{{ project.repo_url }}" target="_blank" rel="noopener noreferrer" class="action-btn github-btn">
        <i class="fa-brands fa-github"></i>
        Code Source
      </a>
      {% endif %}
    </div>
  </div>
</section>

<!-- MAIN CONTENT -->
<section class="project-content-section">
  <div class="container">
    <div class="content-grid">
      
      <!-- LEFT COLUMN -->
      <div class="main-content">
        
        <!-- DESCRIPTION -->
        <div class="content-block">
          <div class="block-header">
            <i class="fa-solid fa-file-lines block-icon"></i>
            <h2 class="block-title">/// RAPPORT DE MISSION</h2>
          </div>
          <div class="block-content">
            {{ project.description|safe }}
          </div>
        </div>
        
        <!-- RESULTS -->
        {% if project.results %}
        <div class="content-block results-block">
          <div class="block-header">
            <i class="fa-solid fa-trophy block-icon"></i>
            <h2 class="block-title">/// SUCCÈS DE MISSION</h2>
          </div>
          <div class="block-content">
            {{ project.results|safe }}
          </div>
        </div>
        {% endif %}
        
        <!-- GALLERY -->
        {% if project.gallery.all %}
        <div class="content-block">
          <div class="block-header">
            <i class="fa-solid fa-images block-icon"></i>
            <h2 class="block-title">/// ARCHIVES VISUELLES</h2>
          </div>
          <div class="gallery-grid">
            {% for image in project.gallery.all %}
            <div class="gallery-item" data-bs-toggle="modal" data-bs-target="#imageModal{{ forloop.counter }}">
              <img src="{{ image.image.url }}" alt="{{ image.caption|default:'Image du projet' }}">
              {% if image.caption %}
              <div class="gallery-caption">{{ image.caption }}</div>
              {% endif %}
            </div>
            
            <div class="modal fade" id="imageModal{{ forloop.counter }}" tabindex="-1">
              <div class="modal-dialog modal-xl modal-dialog-centered">
                <div class="modal-content bg-dark border-0">
                  <div class="modal-header border-0">
                    {% if image.caption %}
                    <h5 class="modal-title text-white">{{ image.caption }}</h5>
                    {% endif %}
                    <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
                  </div>
                  <div class="modal-body p-0">
                    <img src="{{ image.image.url }}" alt="{{ image.caption }}" class="w-100">
                  </div>
                </div>
              </div>
            </div>
            {% endfor %}
          </div>
        </div>
        {% endif %}
        
      </div>
      
      <!-- RIGHT COLUMN - SIDEBAR -->
      <aside class="sidebar-sticky">
        
        <!-- TECH STACK -->
        {% if project.skills.all %}
        <div class="sidebar-block">
          <h3 class="sidebar-title">
            <i class="fa-solid fa-microchip"></i>
            Tech Stack
          </h3>
          <div class="tech-stack">
            {% for skill in project.skills.all %}
            <div class="tech-item">
              <i class="{{ skill.icon_class }} tech-icon"></i>
              <span class="tech-name">{{ skill.name }}</span>
            </div>
            {% endfor %}
          </div>
        </div>
        {% endif %}
        
        <!-- METADATA -->
        <div class="sidebar-block">
          <h3 class="sidebar-title">
            <i class="fa-solid fa-info-circle"></i>
            Méta-Données
          </h3>
          <div class="metadata-list">
            <div class="metadata-item">
              <span class="metadata-label">Date</span>
              <span class="metadata-value">{{ project.date|date:"d/m/Y" }}</span>
            </div>
            {% if project.category %}
            <div class="metadata-item">
              <span class="metadata-label">Catégorie</span>
              <span class="metadata-value">{{ project.category.name }}</span>
            </div>
            {% endif %}
            <div class="metadata-item">
              <span class="metadata-label">Statut</span>
              <span class="metadata-value" style="color: var(--neon-green);">Déployé</span>
            </div>
          </div>
        </div>
        
      </aside>
      
    </div>
  </div>
</section>

<!-- RELATED PROJECTS -->
{% if related_projects %}
<section class="related-section">
  <div class="container">
    <div class="related-header">
      <h2 class="related-title">/// AUTRES MISSIONS</h2>
    </div>
    
    <div class="related-grid">
      {% for related in related_projects %}
      <a href="{% url 'projects:detail' related.slug %}" class="related-card">
        <img src="{{ related.cover_image.url }}" 
             alt="{{ related.title }}" 
             class="related-card-image">
        <div class="related-card-body">
          <h3 class="related-card-title">{{ related.title }}</h3>
          <p class="related-card-summary">{{ related.summary|truncatewords:15 }}</p>
        </div>
      </a>
      {% endfor %}
    </div>
  </div>
</section>
{% endif %}

{% endblock %}