/* ========== GLOBAL & RESET ========== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');

:root {
  --bg-light: #ffffff;
  --text-light: #0b1c2f;
  --bg-dark: #0a0f1e;
  --text-dark: #edf2fb;
  --primary: #1d658b;
  --primary-glow: #427974;
  --secondary: #71b1cc;
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow: 0 8px 32px rgba(0,0,0,0.1);
  --neon-blue: #1d658b;
  --neon-purple: #71b1cc;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-light);
  color: var(--text-light);
  line-height: 1.65;
  transition: background 0.4s, color 0.3s;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.dark {
  background: var(--bg-dark);
  color: var(--text-dark);
}

body.dark .glass {
  background: rgba(10, 15, 30, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

/* ========== TYPO & UTILS ========== */
.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title h2 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.18;
}

.underline {
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  margin: 0.5rem auto 0;
  border-radius: 2px;
}

.btn {
  display: inline-block;
  padding: 12px 30px;
  border-radius: 50px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.neon-btn {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(74,108,247,0.3);
}

.neon-btn:hover {
  background: var(--primary);
  color: rgb(254, 254, 254);
  box-shadow: 0 0 20px var(--primary-glow);
  transform: translateY(-2px);
}

.dark .neon-btn {
  border-color: var(--secondary);
  color: var(--secondary);
}

.dark .neon-btn:hover {
  background: var(--secondary);
  color: #0a0f1e;
  box-shadow: 0 0 25px var(--secondary);
}

/* ========== DARK MODE TOGGLE ========== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 30px;
  z-index: 1101;
}

.checkbox {
  opacity: 0;
  position: absolute;
}

.label {
  background: #111;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px;
  border-radius: 50px;
  width: 60px;
  height: 30px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.label .fa-moon {
  color: #f1c40f;
  margin-left: 5px;
}

.label .fa-sun {
  color: #f39c12;
  margin-right: 5px;
}

.ball {
  background: white;
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: transform 0.2s linear;
}

.checkbox:checked + .label .ball {
  transform: translateX(30px);
}

body.dark .label {
  background: #2c3e50;
}

/* ========== NAVIGATION ========== */
header {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 1100;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  transition: background 0.3s;
}

body.dark header {
  background: rgba(10,15,30,0.8);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 5%;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-brand {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  text-decoration: none;
  color: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary);
}

.hamburger {
  display: none;
  cursor: pointer;
}

.bar {
  display: block;
  width: 25px;
  height: 3px;
  margin: 5px auto;
  background-color: var(--text-light);
  transition: all 0.3s;
}

body.dark .bar {
  background-color: var(--text-dark);
}

/* ========== HERO SECTION ========== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 0 1.5rem;
}

.hero-content {
  padding: 3rem 2.5rem;
  max-width: 800px;
  z-index: 2;
}

.hero h1 {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  background: linear-gradient(145deg, #fff, var(--primary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.dark .hero h1 {
  background: linear-gradient(145deg, #f8fafc, var(--secondary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.typed-container {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  min-height: 70px;
  color: var(--primary);
}

.cursor {
  opacity: 1;
  animation: blink 0.7s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero p {
  font-size: 1.15rem;
  font-weight: 400;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2rem;
  opacity: 0.92;
  line-height: 1.55;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 50%, rgba(74,108,247,0.05) 0%, transparent 50%);
  pointer-events: none;
}

/* ========== ABOUT ========== */
.about {
  padding: 6rem 5%;
  max-width: 1180px;
  margin: 0 auto;
}

.about-container {
  display: flex;
  gap: 3.25rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.about-img {
  flex: 0 0 auto;
  width: min(100%, 480px);
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.65rem;
}

.about-img img {
  /* Grande photo lisible au premier regard (anciennement ~260px) */
  width: min(440px, 100%);
  max-width: 100%;
  aspect-ratio: 1;
  height: auto;
  display: block;
  margin-inline: auto;
  object-fit: cover;
  object-position: center 22%;
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(29, 101, 139, 0.15),
    0 12px 24px rgba(13, 40, 64, 0.1),
    0 28px 52px rgba(13, 40, 64, 0.14);
  border: none;
}

body.dark .about-img img {
  box-shadow:
    0 0 0 1px rgba(113, 177, 204, 0.25),
    0 14px 28px rgba(0, 0, 0, 0.35),
    0 32px 56px rgba(0, 0, 0, 0.5);
}

.about-text {
  flex: 1 1 min(100%, 32rem);
  max-width: 36rem;
  padding: 2rem 2rem 2rem 0.5rem;
}

.about-text p {
  margin-bottom: 1.15rem;
  font-size: 1.0625rem;
  max-width: 60ch;
  line-height: 1.7;
}

.about-text p:first-of-type {
  font-size: 1.11rem;
  font-weight: 500;
}

.about-social {
  display: flex;
  gap: 1.25rem;
  margin-top: 1.35rem;
}

.about-social a {
  font-size: 1.65rem;
  color: var(--primary);
  transition: transform 0.2s, color 0.2s;
}

.about-social a:hover {
  transform: translateY(-2px);
  color: var(--secondary);
}

/* ========== SKILLS ========== */
.skills {
  padding: 6rem 5%;
  max-width: 1000px;
  margin: 0 auto;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.8rem;
}

.skill-card {
  padding: 1.5rem 1.8rem;
}

.skill-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.7rem;
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(0,0,0,0.1);
  border-radius: 20px;
  overflow: hidden;
}

.dark .progress-bar {
  background: rgba(255,255,255,0.1);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 20px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px var(--primary-glow);
}

/* ========== PROJECTS ========== */
.projects {
  padding: 6rem 5%;
  max-width: 1300px;
  margin: 0 auto;
}

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

.project-card {
  padding: 2rem 1.5rem;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
}

.project-card:hover {
  transform: translateY(-15px);
  box-shadow: 0 20px 40px rgba(74,108,247,0.2);
}

.project-img i {
  font-size: 3.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
  background: rgba(74,108,247,0.1);
  padding: 1.2rem;
  border-radius: 30px;
}

.project-card h3 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin: 1.2rem 0;
}

.project-tags span {
  background: rgba(74,108,247,0.1);
  padding: 0.3rem 1rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

.dark .project-tags span {
  background: rgba(157,123,245,0.2);
  color: var(--secondary);
}

.project-link {
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: gap 0.2s;
}

.project-link:hover {
  gap: 10px;
}

/* ========== CONTACT ========== */
.contact {
  padding: 6rem 5%;
  max-width: 1100px;
  margin: 0 auto;
}

.contact-container {
  display: flex;
  flex-wrap: wrap;
  padding: 2.5rem;
  gap: 2rem;
}

.contact-info {
  flex: 1 1 250px;
}

.contact-info h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.contact-details p {
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-form {
  flex: 2 1 350px;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.input-group {
  position: relative;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 16px 12px;
  border: 2px solid rgba(0,0,0,0.05);
  border-radius: 16px;
  background: rgba(255,255,255,0.4);
  font-size: 1rem;
  outline: none;
  transition: 0.2s;
  color: inherit;
}

.dark .input-group input,
.dark .input-group textarea {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: white;
}

.input-group label {
  position: absolute;
  left: 14px;
  top: 14px;
  background: transparent;
  padding: 0 5px;
  transition: 0.2s;
  pointer-events: none;
  color: #5a6b7a;
}

.dark .input-group label {
  color: #b0c4de;
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label,
.input-group textarea:focus ~ label,
.input-group textarea:not(:placeholder-shown) ~ label {
  top: -12px;
  left: 12px;
  font-size: 0.8rem;
  background: var(--bg-light);
  padding: 0 8px;
  border-radius: 20px;
  color: var(--primary);
}

.dark .input-group input:focus ~ label,
.dark .input-group input:not(:placeholder-shown) ~ label,
.dark .input-group textarea:focus ~ label,
.dark .input-group textarea:not(:placeholder-shown) ~ label {
  background: var(--bg-dark);
  color: var(--secondary);
}

.form-feedback {
  margin-top: 5px;
  font-weight: 600;
  color: #27ae60;
}

/* ========== FOOTER ========== */
footer {
  background: rgba(0,0,0,0.03);
  backdrop-filter: blur(5px);
  padding: 2rem;
  margin-top: 3rem;
}

.dark footer {
  background: rgba(0,0,0,0.3);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-social a {
  color: inherit;
  margin-left: 1.5rem;
  font-size: 1.4rem;
  transition: color 0.2s;
}

.footer-social a:hover {
  color: var(--primary);
}

/* ========== REVEAL ANIMATION ========== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s, transform 0.7s;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}


/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
  .hero h1 { font-size: 3.2rem; }
  .typed-container { font-size: 1.5rem; }

  .about-text {
    padding: 2rem 1.25rem;
  }
}

@media (max-width: 768px) {
  /* Navigation */
  .hamburger {
    display: block;
    position: relative;
    z-index: 1102;
  }

  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
  }
  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Menu glisse depuis la droite */
  .nav-menu {
    position: fixed;
    right: -100%;
    left: auto;
    top: 0;
    width: 75%;
    max-width: 300px;
    height: 100vh;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -5px 0 30px rgba(0,0,0,0.15);
    transition: right 0.3s ease-in-out;
    z-index: 1100;
    padding: 0;
  }

  body.dark .nav-menu {
    background: rgba(10, 15, 30, 0.98);
  }

  .nav-menu.active {
    right: 0;
  }

  /* Overlay sombre derrière le menu */
  .nav-menu.active::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

  .nav-link {
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
  }

  .nav-brand {
    font-size: 1.5rem;
  }

  .navbar {
    padding: 0.8rem 1.2rem;
  }

  /* Dark mode toggle : décalé à gauche du hamburger */
  .theme-toggle {
    position: fixed;
    top: 13px;
    right: 75px;
    z-index: 1101;
  }

  /* Décalage pages projet : voir bloc PROJECT DETAIL (body.project-page) */

  /* Bloquer le scroll quand menu ouvert */
  body.menu-open {
    overflow: hidden;
  }

  /* Hero : plus de 100vh sur mobile → évite le grand vide sous « Voir mes projets » */
  .hero {
    min-height: 0;
    align-items: flex-start;
    justify-content: center;
    padding: max(5.75rem, calc(env(safe-area-inset-top, 0px) + 4.25rem)) 1.5rem 2rem;
  }

  .hero h1 { font-size: 2.5rem; }
  .typed-container {
    font-size: 1.2rem;
    min-height: 52px;
    margin-bottom: 0.65rem;
  }
  .hero p {
    font-size: 1rem;
    margin-bottom: 1.15rem;
  }
  .hero-content {
    padding: 0.75rem 1.25rem 0.25rem;
    max-width: 100%;
  }

  /* Sections : espacement vertical plus serré */
  .section-title {
    margin-bottom: 1.65rem;
  }
  .section-title h2 { font-size: 1.9rem; }
  .about { padding: 2.75rem 4% 3rem; }
  .skills { padding: 2.75rem 4%; }
  .projects { padding: 2.75rem 4%; }
  .contact { padding: 2.75rem 4%; }

  /* About — photo plus visible qu’une petite vignette */
  .about-container { flex-direction: column; align-items: center; gap: 1.5rem; }
  .about-img {
    flex: none;
    width: 100%;
    max-width: min(400px, 96vw);
  }
  .about-img img {
    width: min(100%, 360px);
    border-radius: 22px;
  }
  .about-text {
    flex: none;
    width: 100%;
    max-width: 40rem;
    padding: 0.75rem 1rem 1.25rem;
  }

  /* Contact */
  .contact-container {
    flex-direction: column;
    padding: 1.35rem;
    gap: 1.35rem;
  }

  .contact-form {
    gap: 1.35rem;
  }

  footer {
    margin-top: 1.75rem;
    padding: 1.5rem 1.25rem;
  }

  /* Footer */
  .footer-content { flex-direction: column; text-align: center; gap: 1rem; }
  .footer-social a { margin: 0 0.75rem; }
}

@media (max-width: 480px) {
  .hero {
    padding: max(5.25rem, calc(env(safe-area-inset-top, 0px) + 3.75rem)) 1rem 1.5rem;
  }

  .hero h1 { font-size: 2rem; }
  .typed-container { font-size: 1rem; min-height: 46px; margin-bottom: 0.5rem; }
  .hero p { margin-bottom: 1rem; }
  .hero-content { padding: 0.35rem 0.85rem 0; }
  .btn { padding: 10px 20px; font-size: 0.9rem; }

  .section-title { margin-bottom: 1.35rem; }
  .section-title h2 { font-size: 1.6rem; }
  .about-img {
    max-width: min(380px, 97vw);
  }
  .about-img img {
    width: min(100%, 340px);
    border-radius: 20px;
  }
  .theme-toggle {
    top: 12px;
    right: 70px;
  }
  .contact-container { padding: 1rem; }

  .about { padding: 2.25rem 3% 2.5rem; }
  .skills { padding: 2.25rem 3%; }
  .projects { padding: 2.25rem 3%; }
  .contact { padding: 2.25rem 3%; }

  .skills-grid {
    gap: 1.2rem;
  }

  .projects-grid {
    gap: 1.5rem;
  }

  footer {
    margin-top: 1.25rem;
    padding: 1.25rem 1rem;
  }
}

/* ========== PROJECT DETAIL PAGES ========== */
a.nav-brand {
  text-decoration: none;
}

/*
  Pages projet : le header est fixed → un bloc-spacer DANS le flux (main) évite que le hero / l’icône
  remontent sous la barre (souvent plus fiable que padding sur body une fois hébergé).
*/
body.project-page {
  padding-top: 0;
}

.project-page main {
  padding-top: 0;
  min-height: calc(100vh - 120px);
  position: relative;
  z-index: 0;
}

/* Réserve la hauteur de la barre fixe + marge (évite toute icône sous l’en-tête) */
.project-page .project-header-spacer {
  display: block;
  width: 100%;
  flex-shrink: 0;
  height: calc(5rem + env(safe-area-inset-top, 0px));
  min-height: 5rem;
  pointer-events: none;
}

@media (max-width: 768px) {
  .project-page .project-header-spacer {
    min-height: 6rem;
    height: calc(6rem + env(safe-area-inset-top, 0px));
  }
}

.project-detail-hero {
  padding: 0.75rem 5% 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 0;
  clear: both;
}

.project-detail-icon-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  margin: 0 auto 1rem;
  position: relative;
  z-index: 0;
  box-sizing: border-box;
  text-align: center;
}

.project-detail-icon-wrap i {
  margin-bottom: 0;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 0;
  flex-shrink: 0;
}

/* Icône de projet sur les pages détail — taille fixe et visible */
.project-page .project-img.project-detail-icon-wrap {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 1.5rem;
}

.project-page .project-img.project-detail-icon-wrap i {
  font-size: 2.8rem;
  color: white;
}

.project-detail-hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}

.project-detail-hero .project-lead {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 640px;
  margin: 0 auto 1.25rem;
  line-height: 1.65;
}

.project-detail-hero .project-tags {
  justify-content: center;
}

.project-detail-body {
  max-width: 800px;
  margin: 0 auto 4rem;
  padding: 2rem 2.25rem;
}

.project-detail-section {
  margin-bottom: 1.75rem;
}

.project-detail-section:last-of-type {
  margin-bottom: 0;
}

.project-detail-section h2 {
  font-size: 1.2rem;
  margin-bottom: 0.65rem;
  color: var(--primary);
}

.dark .project-detail-section h2 {
  color: var(--secondary);
}

.project-detail-section p {
  line-height: 1.7;
}

.project-detail-section ul {
  margin: 0.5rem 0 0 1.25rem;
  line-height: 1.7;
}

.project-detail-section li {
  margin-bottom: 0.45rem;
}

.project-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.dark .project-detail-actions {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.back-to-projects {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  opacity: 0.85;
  transition: opacity 0.2s, color 0.2s;
}

.back-to-projects:hover {
  opacity: 1;
  color: var(--primary);
}

.dark .back-to-projects:hover {
  color: var(--secondary);
}

@media (max-width: 480px) {
  .project-detail-hero h1 {
    font-size: 1.75rem;
  }
  .project-detail-body {
    padding: 1.5rem 1.25rem;
    margin-left: 3%;
    margin-right: 3%;
  }
}