/*    VARIABLES — les couleurs et réglages du site, au même endroit
   pour pouvoir tout changer facilement depuis un seul fichier. */
:root {
  --bg:         #FAF7F1;   /* fond principal : papier clair */
  --bg-alt:     #F1ECE1;   /* fond alterné des sections */
  --ink:        #1E2A38;   /* texte principal : bleu nuit */
  --ink-muted:  #5B6B79;   /* texte secondaire, gris-bleu */
  --accent:     #C7601C;   /* accent : ocre / terre cuite (Photoshop, artisanat) */
  --accent-2:   #1F6F5C;   /* accent secondaire : vert sapin (code) */
  --border:     #E1D9C8;
  --white:      #ffffff;

  --font-title: 'Space Grotesk', sans-serif;
  --font-body:  'Inter', sans-serif;

  --radius: 8px;
  --max-width: 1080px;

  /* Vitesse de transition lors du changement de thème */
  --transition-theme: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/*    THÈME SOMBRE — mêmes variables, valeurs différentes.
   Activé quand <html data-theme="dark">. */
[data-theme="dark"] {
  --bg:         #14181D;
  --bg-alt:     #1B2027;
  --ink:        #EDEBE6;
  --ink-muted:  #9BA5AF;
  --accent:     #E08641;
  --accent-2:   #37B08C;
  --border:     #2B313A;
  --white:      #1E242B;
}

body {
  transition: var(--transition-theme);
}

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

html {
  scroll-behavior: smooth;
}

/* Respecte les personnes sensibles aux animations */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

ul { list-style: none; }

/* Focus visible au clavier : obligatoire pour l'accessibilité */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

/* Classe utilitaire : cache visuellement mais garde pour les lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

h1, h2, h3 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.15;
}

/*    MISE EN PAGE GÉNÉRALE */
.section {
  padding: 5rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-alt {
  background: var(--bg-alt);
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.section-alt > * {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.section-header { margin-bottom: 2.5rem; }

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

/*    BOUTONS */
.btn {
  display: inline-block;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}

.btn-primary:hover { background: #a94f16; }

.btn-ghost {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.btn-ghost:hover { 
  background: var(--ink);
   color: var(--white);
}

.btn:hover { transform: translateY(-2px); }

/*    NAVIGATION */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: var(--transition-theme);
}

.navbar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.nav-logo {
  font-family: var(--font-title);
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
}

.nav-logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

/* Bouton menu mobile : caché par défaut sur grand écran */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform 0.2s ease;
}

.menu-icon::before,
.menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.menu-icon::before { top: -7px; }
.menu-icon::after  { top: 7px; }

/*    HERO */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 4rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0.75rem 0 1.25rem;
}

.hero .align {
  display: flex;
  gap: 5rem;
  align-items: center;
}

.hero .align img {
  max-width: 300px;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.hero h1 .accent { color: var(--accent); }

.hero-desc {
  max-width: 560px;
  color: var(--ink-muted);
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.hero-stats li {
  background: var(--white);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}

.stat-value {
  display: block;
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-2);
}

.stat-suffix {
  margin-left: 1px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/*    À PROPOS */
.about-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  align-items: start;
}

.about-avatar { text-align: center; }

.avatar-image {
  width: 180px;
  height: 200px;
  border-radius: 50%;
  background: var(--accent-2);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}

.avatar-badge {
  font-size: 0.8rem;
  color: var(--accent-2);
  font-weight: 600;
}

.about-text p {
  color: var(--ink-muted);
  margin-bottom: 1rem;
}

.about-text strong { color: var(--ink); }

.about-text .btn { margin-top: 0.5rem; }

/*    COMPÉTENCES */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.skill-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: var(--transition-theme);
}

.skill-icons {
  display: flex;
  gap: 0.5rem;
  font-size: 1.8rem;
  margin-bottom: 0.6rem;
}

.skill-name {
  font-family: var(--font-title);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.skill-desc {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 0.9rem;
}

.skill-bar {
  height: 6px;
  background: var(--bg-alt);
  border-radius: 99px;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 1s ease;
}

/*   PROJETS */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition-theme);
}

.project-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
  border-radius: 99px;
  padding: 0.2rem 0.6rem;
}

.project-title {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

/*    CONTACT */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 3rem;
}

.contact-info p { color: var(--ink-muted); margin-bottom: 1.25rem; }

.contact-email {
  display: inline-block;
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.social-link {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 1.1rem;
  text-decoration: none;
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.social-link:hover,
.social-link:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-alt);
  transform: translateY(-3px);
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--white);
  color: var(--ink);
}

.form-group input:invalid[aria-invalid="true"],
.form-group textarea:invalid[aria-invalid="true"] {
  border-color: #c0392b;
}

.error-msg {
  display: block;
  color: #c0392b;
  font-size: 0.8rem;
  min-height: 1.1em;
  margin-top: 0.3rem;
}

.form-feedback {
  margin-top: 1rem;
  font-weight: 600;
}

.form-feedback.success { color: var(--accent-2); }
.form-feedback.error   { color: #c0392b; }

/*    BOUTON RETOUR EN HAUT
   Caché par défaut (opacity 0 + pointer-events none), affiché par
   JS en ajoutant la classe .visible une fois qu'on a assez scrollé. */
.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--white);
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.back-to-top:hover {
  background: #a94f16;
}

/*   FOOTE */
footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--ink-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/*    ANIMATION D'APPARITION AU SCROLL (légère, respecte prefers-reduced-motion) */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

.email-copy-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.copy-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.copy-btn:hover,
.copy-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.copied {
  color: var(--accent-2);
  border-color: var(--accent-2);
  transform: scale(1.1);
}

.copy-feedback {
  font-size: 0.8rem;
  color: var(--accent-2);
  min-height: 1.1em;
  margin-top: 0.3rem;
}

/*    RESPONSIVE — 2 points de rupture minimum */

.menu-toggle {
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation; /* évite le délai de 300ms sur certains navigateurs mobiles */
}

/*    ANIMATION D'APPARITION AU SCROLL (légère, respecte prefers-reduced-motion) */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/*   RESPONSIVE — 2 points de rupture minimum */

/* Tablette */
@media (max-width: 900px) {
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .about-avatar { order: -1; }

  .menu-toggle { display: block; }

  .nav-links {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1.5rem;
    width: min(240px, 80vw);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
  }

  .nav-links.open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .nav-links li:not(:first-child) {
    border-top: 1px solid var(--border);
  }

  .nav-links a {
    display: block;
    padding: 0.85rem 1.25rem;
  }

  .nav-links li:last-child {
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
  }

   .hero .align {
  flex-direction: column;
  gap: 1.5rem;
  align-items: stretch;
}

.hero .align img {
  max-width: 100%;
  order: -1;
}
}

/* Mobile */
@media (max-width: 600px) {
  .navbar { padding: 1rem; }

  .hero { padding-top: 3rem; }

  .hero-stats { gap: 1.5rem; }

  .section { padding: 3.5rem 1.25rem; }
}

