/* ─────────────────────────────────────────
   FONTS
───────────────────────────────────────── */
@font-face {
  font-family: 'Share Tech Mono';
  src: url('ShareTechMono-Regular.ttf') format('truetype');
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'Minecraft';
  src: url('Minecraft.ttf') format('truetype');
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}
/* ─────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────── */
@keyframes blink {0%, 100% {opacity: 1;}50% {opacity: 0;}}
@keyframes flicker {0%, 95%, 100% {opacity: 1;}96% { opacity: 0.7;}97% {opacity: 1;} 98% {  opacity: 0.6;  }99% {opacity: 1; }}

/* ─────────────────────────────────────────
   ROOT
───────────────────────────────────────── */
:root {
  --green: #00ff41;
  --green-dim: #00cc33;
  --green-dark: #003b00;
  --green-glow: rgba(0, 255, 65, 0.15);
  --bg: #000000;
  --card-bg: rgba(0, 10, 0, 0.85);
  --border: rgba(0, 255, 65, 0.3);

  /* Espacements fluides réutilisés partout : s'adaptent automatiquement
     entre mobile et desktop sans avoir besoin de multiplier les media queries */
  --section-pad-y: clamp(36px, 16vw, 70px);
  --section-pad-x: clamp(14px, 4vw, 20px);
  --card-pad-y: clamp(18px, 4vw, 28px);
  --card-pad-x: clamp(16px, 5vw, 32px);

  /* Hauteur réelle de la navbar, mise à jour en JS (nav-scroll.js)
     via ResizeObserver. La valeur ci-dessous n'est qu'un fallback si le
     JS n'a pas encore tourné (premier paint) ou est désactivé. */
  --nav-height: 90px;
}

/* ─────────────────────────────────────────
   SELECTION
───────────────────────────────────────── */
::selection {
  background: var(--green);
  color: var(--bg);
}

/* ─────────────────────────────────────────
   RESET
───────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  margin: 0;
  font-family: monospace;
  scroll-behavior: smooth;
  /* iOS stabilisation */
  height: 100%;
  -webkit-overflow-scrolling: touch;
  /* Empêche le zoom-texte auto de Safari iOS en paysage */
  -webkit-text-size-adjust: 100%;
}


body {
  background: var(--bg);
  color: var(--green);
  font-family: 'Share Tech Mono', monospace;
  overflow-x: hidden;
  background: var(--bg);
  margin: 0;
  -webkit-overflow-scrolling: touch;
  /* Base fluide : 15px sur petit mobile jusqu'à 17px sur grand écran */
  font-size: clamp(15px, 0.95vw + 12px, 17px);
}

/* Respecte les préférences d'accessibilité (réduction des animations) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  header h1 { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─────────────────────────────────────────
   MATRIX
───────────────────────────────────────── */
#matrix{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
}

/* ─────────────────────────────────────────
   GLOBAL
───────────────────────────────────────── */

#about .stats-text {
  margin-top: 10px;
  margin-bottom: 20px;
  color: var(--green-dim);
  font-size: 1rem;
  opacity: 0.8;
  letter-spacing: 0.15em;
}
#about .stats-text::before {
  content: '> ';
  opacity: 0.5;
}
#contact {
  /* Marge basse fluide au lieu d'un vh fixe qui prenait trop de place sur mobile */
  margin-bottom: clamp(40px, 10vh, 43.5vh);
}
/* ─────────────────────────────────────────
   HEADER
───────────────────────────────────────── */
header {
  text-align: center;
  padding: clamp(12px, 4vw, 15px) clamp(14px, 5vw, 25px);
}
header h1 {
  font-family: 'VT323', monospace;
  font-size: clamp(2rem, 9vw, 5rem);
  color: var(--green);
  letter-spacing: 0.08em;
  text-shadow:
    0 0 10px var(--green),
    0 0 30px var(--green),
    0 0 60px var(--green-dim);
  animation: flicker 6s infinite;
  word-break: break-word;
}
header .subtitle {
  color: var(--green-dim);
  font-size: clamp(0.75rem, 2.2vw, 0.9rem);
  opacity: 0.8;
  letter-spacing: 0.15em;
}
header .subtitle::before {
  content: '> ';
  opacity: 0.5;
}
header,
footer{
  position:relative;
  z-index:9999;
}

/* ─────────────────────────────────────────
   FOOTER
───────────────────────────────────────── */
footer {
  /* padding-top explicite pour ne pas dépendre de l'ordre du shorthand ci-dessous */
  padding: clamp(120px, 30vw, 350px) clamp(16px, 5vw, 30px) clamp(16px, 5vw, 30px);
  text-align: center;
  color: var(--green-dark);
  font-size: clamp(0.7rem, 2vw, 0.8rem);
  letter-spacing: 0.15em;
}

/* ─────────────────────────────────────────
   SECTIONS
───────────────────────────────────────── */
section {
  max-width: 860px;
  width: min(950px, calc(100% - 30px));
  margin: 0 auto;
  padding: var(--section-pad-y) var(--section-pad-x);
  /* La distance jusqu'à l'ancre suit maintenant la vraie hauteur de la
     navbar (--nav-height, mise à jour en JS) + une petite marge d'air,
     au lieu d'une valeur fixe qui se désynchronisait dès que la navbar
     changeait de taille (mobile, retour à la ligne des liens, etc.) */
  position: relative;
  z-index: 1;
  overflow: visible; /* la grille projets peut dépasser */
}
section h2 {
  margin-bottom: clamp(16px, 4vw, 25px);
  font-size: clamp(1.6rem, 6vw, 2.5rem);
  color: var(--green);
  letter-spacing: 0.1em;
  text-shadow: 0 0 8px var(--green);
  z-index: 100;
  word-break: break-word;
}

/* ─────────────────────────────────────────
   CARDS
───────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: var(--card-pad-y) var(--card-pad-x);
  backdrop-filter: blur(6px);
  box-shadow:
    0 0 20px rgba(0,255,65,0.05),
    inset 0 0 40px rgba(0,255,65,0.02);
}
.card p {
  color: var(--green-dim);
  font-size: clamp(0.85rem, 2.4vw, 0.92rem);
  line-height: 1.9;
}

.card p:hover {
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
  transition: all 0.2s;
}

/* ─────────────────────────────────────────
   SKILLS - Correction structure
───────────────────────────────────────── */
.card.skills {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 2vw, 12px);
  list-style: none;
}

.card.skills li {
  padding: clamp(5px, 1.5vw, 6px) clamp(12px, 3vw, 18px);
  border: 1px solid var(--border);
  background: rgba(0,255,65,0.03);
  color: var(--green-dim);
  font-size: clamp(0.75rem, 2.2vw, 0.85rem);
  letter-spacing: 0.12em;
  cursor: default;
  transition: all 0.2s;
  border-radius: 2px; /* Cohérence avec .card */
}

.card.skills span:hover {
  color: var(--green);
  border-color: var(--green);
  background: rgba(0,255,65,0.1);
  text-shadow: 0 0 8px var(--green);
  box-shadow: 0 0 12px rgba(0,255,65,0.15);
  transform: translateY(-2px);
}

.card.skills a {
  color: inherit;
  text-decoration: none;
}

/* ─────────────────────────────────────────
   SCROLLBAR - Consolidé
───────────────────────────────────────── */
.scrollable {
  scrollbar-width: thin;
  scrollbar-color: #00ff41 #003b00;
}

.scrollable::-webkit-scrollbar {
  width: 6px;
  height: 3px;
}

.scrollable::-webkit-scrollbar-track {
  background: #003b00;
}

.scrollable::-webkit-scrollbar-thumb {
  background: #00ff41;
  border-radius: 999px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
  background: #00cc33;
}

/* ─────────────────────────────────────────
   RESPONSIVE — Breakpoints spécifiques
   (au-delà de ce que les clamp() gèrent déjà)
───────────────────────────────────────── */

/* Tablettes */
@media (max-width: 768px) {
  section {
    width: 100%;
  }

  .card.skills {
    gap: 8px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  /* scroll-margin-top n'est plus fixé ici : --nav-height (mis à jour
     en JS) s'occupe déjà de suivre la vraie taille de la navbar sur
     mobile, même si elle passe sur 2 lignes. */

  .card {
    border-radius: 4px;
  }

  .card.skills {
    justify-content: center;
  }

  #contact {
    margin-bottom: 40px;
  }
}

/* Petits mobiles (ex: iPhone SE) */
@media (max-width: 360px) {
  header h1 {
    letter-spacing: 0.04em;
  }
}

/* Écrans très larges : on borne la taille pour éviter un effet "perdu" */
@media (min-width: 1600px) {
  section {
    max-width: 1000px;
  }
}

/* Mode paysage sur mobile : le footer prenait trop de hauteur */
@media (max-width: 900px) and (orientation: landscape) {
  footer {
    padding-top: clamp(60px, 15vw, 150px);
  }
}