/* ==============================
   RESET + THEME
============================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-color: #0a0a0a;
  --text-color: #e0e0e0;
  --accent-color: #b00020;
  --accent-glow: rgba(176,0,32,0.18);
  --link-hover: #ff4d4d;
  --header-bg: #1c0d0d;
  --header-border: #330000;
  --card-bg: #111;
  --shadow-accent: rgba(176,0,32,0.4);
}

/* Curseur personnalisé */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  border: 2px solid white;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease-out, width 0.2s ease, height 0.2s ease;
  z-index: 9999;
  mix-blend-mode: difference;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-cursor::before {
  content: "";
  width: 4px;
  height: 4px;
  background-color: white;
  border-radius: 50%;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: "Poppins", sans-serif;
  overflow: auto;
}

/* ==============================
   NAVBAR
============================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  z-index: 1000;
  transition: transform 0.3s ease, background-color 0.3s ease;
  padding: 0 20px;
}

header.hide {
  transform: translateY(-100%);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.logo a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 700;
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 30px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--link-hover);
}

/* ==============================
   SECTION PROJETS (ROUE)
============================== */
.projets-section {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, #141414, #1b1b1b, #141414);
  animation: bgMove 20s ease-in-out infinite;
  padding-top: 60px;
}

@keyframes bgMove {
  0%, 100% { background-position: 0 50%; }
  50% { background-position: 100% 50%; }
}

.projets-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 60px;
  width: 85%;
  max-width: 1200px;
}

.projets-text h1 {
  color: var(--accent-color);
  font-size: 2.5rem;
  margin-bottom: 25px;
}

.projets-text p {
  font-size: 1.1rem;
  line-height: 1.7;
  text-align: justify;
}

/* ==============================
   ROUE INTERACTIVE (SVG)
============================== */
.projets-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.red-halo {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176,0,32,0.3) 0%, transparent 70%);
  filter: blur(80px);
  z-index: 0;
}

svg {
  position: relative;
  z-index: 1;
  width: 400px;
  height: 400px;
}

text {
  font-size: 14px;
  fill: #fff;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.center-text {
  font-size: 16px;
  font-weight: 700;
}

.sub-text {
  font-size: 13px;
  fill: #ccc;
  font-weight: 500;
}

path {
  cursor: pointer;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

path:hover {
  filter: brightness(1.3);
  transform: scale(1.02);
}

/* ==============================
   SECTIONS PROJETS (DÉTAILS)
============================== */
.project1, .project2, .project3, 
.project4, .project5, .project6 {
  display: none;
}

.project-detail {
  width: 100%;
  background: var(--card-bg);
  padding: 60px 10%;
  border-top: 1px solid var(--accent-color);
}

.project-detail h2 {
  color: var(--accent-color);
  text-align: center;
  font-size: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.project-detail .center {
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.project-detail h3.sommaire-title {
  text-align: center;
  color: var(--accent-color);
  font-size: 1.3rem;
  margin: 1.5rem 0 1rem 0;
  font-weight: 600;
}

.project-detail > ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.project-detail > ul li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 1rem;
}

.project-detail > ul li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent-color);
}

/* ==============================
   CLASSES RÉUTILISABLES SOUS-PROJETS
============================== */
.subproject-container {
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 2rem;
}

.subproject-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: center;
}

.subproject-stack {
  display: grid;
  grid-template-areas: 
    "text logo"
    "bottom bottom";
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.subproject-text {
  border-left: 4px solid var(--accent-color);
  padding-left: 1rem;
}

.subproject-text h3,
.subproject-text h4 {
  color: var(--accent-color);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.subproject-text h4 {
  font-size: 1.3rem;
}

.subproject-text p {
  line-height: 1.6;
  margin-bottom: 1rem;
}

.subproject-text a,
.center a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.3s;
}

.subproject-text a:hover {
  color: var(--link-hover);
}

.subproject-image {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 8px;
  justify-self: center;
  align-self: center;
}

.subproject-large-image {
  width: 100%;
  max-width: 1100px;
  border-radius: 12px;
  box-shadow: 0 0 20px var(--shadow-accent);
  justify-self: center;
  margin-top: 1rem;
}

.subproject-bottom {
  grid-area: bottom;
}

.subproject-clickable {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.subproject-clickable:hover {
  transform: scale(1.03);
}

.subproject-clickable img {
  width: 180px;
  border-radius: 10px;
  box-shadow: 0 0 10px var(--shadow-accent);
}

.subproject-clickable p {
  font-size: 0.95rem;
  margin-top: 0.5rem;
  text-align: center;
}

/* ==============================
   MODALS (GÉNÉRAL)
============================== */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  position: relative;
  background: #121212;
  padding: 1rem;
  border-radius: 12px;
  width: 80%;
  height: 90vh;
  max-width: 900px;
  box-shadow: 0 0 30px rgba(255,0,0,0.4);
}

.modal-content embed {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-btn:hover {
  color: #ef4444;
}

/* ==============================
   MODAL CODE (SYNTAX HIGHLIGHTING)
============================== */
.modal-code {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  max-width: 1000px;
  width: 85%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #333;
}

.modal-header h3 {
  color: var(--accent-color);
  margin: 0;
  font-size: 1.3rem;
}

.modal-code .close-btn {
  position: static;
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-container {
  flex: 1;
  overflow-y: auto;
  background: #1e1e1e;
  border-radius: 8px;
  padding: 1rem;
  max-height: calc(90vh - 120px);
}

.code-container::-webkit-scrollbar {
  width: 10px;
}

.code-container::-webkit-scrollbar-track {
  background: #2d2d2d;
  border-radius: 5px;
}

.code-container::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 5px;
}

.code-container pre[class*="language-"] {
  margin: 0;
  background: transparent !important;
  font-size: 14px;
  line-height: 1.6;
}

.code-container code[class*="language-"] {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.loading {
  text-align: center;
  color: #aaa;
  padding: 2rem;
}

.loading::after {
  content: "...";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

/* ==============================
   CAROUSEL D'IMAGES
============================== */
.carousel-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  justify-self: center;
  align-self: center;
}

.carousel-wrapper {
  position: relative;
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 20px var(--shadow-accent);
}

.carousel-slides {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  cursor: pointer;
}

.carousel-slide.active {
  opacity: 1;
  z-index: 1;
}

.carousel-slide:hover .carousel-image {
  transform: scale(1.05);
}

.carousel-image {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: transform 0.3s ease;
}

.carousel-caption {
  color: var(--text-color);
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem;
  background: rgba(0,0,0,0.5);
  border-radius: 6px;
  margin-bottom: 0.3rem;
}

.zoom-hint {
  font-size: 0.75rem;
  color: var(--accent-color);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.carousel-slide:hover .zoom-hint {
  opacity: 1;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(176,0,32,0.8);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.carousel-btn:hover {
  background: var(--accent-color);
  transform: translateY(-50%) scale(1.1);
}

.prev-btn {
  left: 10px;
}

.next-btn {
  right: 10px;
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--accent-color);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.indicator.active {
  background: var(--accent-color);
  transform: scale(1.2);
}

.indicator:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
}

/* ==============================
   MODAL IMAGE ZOOM
============================== */
.modal-image {
  background: rgba(0,0,0,0.95);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90vw;
  height: 90vh;
  max-width: none;
}

.modal-image #modal-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(176,0,32,0.5);
}

.modal-image-caption {
  color: var(--text-color);
  font-size: 1.1rem;
  margin-top: 1rem;
  text-align: center;
  background: rgba(0,0,0,0.7);
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
}

.modal-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(176,0,32,0.8);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.modal-nav-btn:hover {
  background: var(--accent-color);
  transform: translateY(-50%) scale(1.1);
}

.modal-prev {
  left: 2rem;
}

.modal-next {
  right: 2rem;
}

/* ==============================
   FOOTER
============================== */
.footer {
  background-color: #181818;
  padding: 40px 10%;
  color: var(--text-color);
  font-size: 0.95rem;
  border-top: 1px solid var(--accent-color);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-left {
  flex: 1;
}

.footer-center {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 25px;
}

.footer-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 25px;
}

.footer-center a,
.footer-right a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-center a:hover,
.footer-right a:hover {
  color: var(--accent-color);
}

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 900px) {
  .projets-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .projets-visual {
    margin-top: 40px;
  }

  .subproject-grid,
  .subproject-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .subproject-text {
    text-align: center;
    padding-left: 0.5rem;
    margin-bottom: 1rem;
  }

  .subproject-image {
    max-width: 200px;
    margin-bottom: 1rem;
  }

  .subproject-large-image {
    min-width: 500px;
  }

  .subproject-clickable img {
    width: 150px;
  }

  .carousel-container {
    max-width: 100%;
    margin-top: 2rem;
  }

  .carousel-slides {
    height: 300px;
  }

  .carousel-image {
    max-height: 220px;
  }

  .carousel-btn {
    width: 35px;
    height: 35px;
  }

  .modal-nav-btn {
    width: 40px;
    height: 40px;
  }

  .modal-prev {
    left: 0.5rem;
  }

  .modal-next {
    right: 0.5rem;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-center,
  .footer-right {
    justify-content: center;
  }
}