:root {
  --first-color: white;
  --first-color-transparent: rgba(255, 255, 255, 0.5);
  --second-color: black;
}
[data-theme='dark'] {
  --first-color: black;
  --first-color-transparent: rgba(0, 0, 0, 0.5);
  --second-color: white;
}

/* Reset de base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: Arial, sans-serif;
  background-color: var(--first-color);
  color: var(--second-color);
  transition: background 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: #333;
  color: white;
  gap: 20px;
  flex-wrap: wrap;
}

nav {
  width: auto;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

nav a:hover {
  color: #d0d0d0;
}

nav a {
  color: white;
  text-decoration: none;
}

/* éléments spécifiques */
#AD {
  font-size: 1.8rem;
  font-weight: 900;
}

#webdev {
  font-size: 1.6rem;
}

/* Hamburger menu pour mobile */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  height: 24px;
  width: 30px;
  cursor: pointer;
}

.menu-toggle span {
  height: 3px;
  width: 100%;
  background-color: white;
  border-radius: 2px;
}

/* Photo animée */
.flip-card {
  background-color: transparent;
  width: 100px;
  height: 100px;
  perspective: 1000px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s;
  border-radius: 50%;
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  background: #444;
  color: white;
  border-radius: 50%;
  border: 4px solid white;
}

.flip-card-back {
  transform: rotateY(180deg);
  z-index: 1;
}

.flip-card-front::before,
.flip-card-back::before {
  content: '';
  position: absolute;
  top: -15%;
  left: -15%;
  width: 130%;
  height: 130%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(0, 0, 0, 0.5),
    transparent
  );
  animation: rotateHalo 4s linear infinite;
  z-index: 0;
}

.flip-card-back img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

@keyframes rotateHalo {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* main */
.main-content {
  background-image: url('./images/programming-code.webp');
  background-size: 100%;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.main-content::before {
  position: absolute;
  top: 0;
  left: 0;
  content: '';
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  position: fixed;
}

/* Thème sombre → filtre noir */
html[data-theme='dark'] .main-content::before {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Thème clair → filtre blanc */
html:not([data-theme='dark']) .main-content::before {
  background-color: rgba(255, 255, 255, 0.8);
}

.main-content > *,
header {
  position: relative;
  z-index: 2;
}

/* Accueil */
#accueil {
  text-align: center;
  padding: 4rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

#accueil a {
  display: inline-block;
  margin-top: 60px;
  font-size: 20px;
  padding: 20px;
  background-color: var(--first-color-transparent);
  color: var(--second-color);
  text-decoration: none;
  border-radius: 20px;
}

h1 {
  margin-bottom: 20px;
  font-size: 1.8rem;
}

/* Effet de typewriter */
@keyframes typing {
  0% {
    width: 0;
  }
  100% {
    width: 20ch;
  }
}

.animated-title {
  font-size: 3rem;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
  border-right: 2px solid;
  width: 0;
  animation: typing 2s steps(20) 0.5s forwards, blink 0.75s step-end infinite;
  max-width: 100%;
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* Structure principale */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 2rem;
}

/* Sections */
section {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  position: relative;
  padding: 2rem 1rem;
  margin: 0 auto;
  width: 80%;
  max-width: 1200px;
}

section p {
  margin-top: 14px;
}

section.visible {
  display: block;
  opacity: 1;
}

h2 {
  margin-bottom: 1rem;
  font-size: 2rem;
}

section a {
  color: var(--second-color);
  transition: color 0.3s;
}

section a.dark {
  color: #f4f4f4;
}

/* présentation */
.bloc {
  display: flex;
  justify-content: flex-start;
}

.bloc.droite {
  justify-content: flex-end;
}

.bloc p {
  max-width: 450px;
  padding: 1em;
}

/* compétences */
#competences .grid {
  display: grid;
  gap: 2rem;
  /* grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); */
  grid-template-columns: 1fr;
}

.competences-type {
  background: #ffffffbb;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.competences-type:hover {
  transform: translateY(-5px);
}

.competences-type h3 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: #333;
}

.logos {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
}

.tooltip-wrapper {
  position: relative;
}

.tooltip-wrapper img {
  width: 150px;
  max-width: 100%;
  height: auto;
  transition: transform 0.2s ease;
}

.methodologie img {
  width: 300px;
  max-width: 100%;
}

.tooltip-wrapper:hover img {
  transform: scale(1.1);
}

/* CV */
#cv img {
  width: 100%;
  height: auto;
}

/* Tooltip */
.tooltip-wrapper::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 0.75rem;
  border-radius: 0.5rem;
  opacity: 0;
  white-space: pre-line;
  pointer-events: none;
  transition: opacity 0.3s;
  width: 220px;
  max-width: 80vw;
  text-align: center;
  font-size: 0.8rem;
  z-index: 10;
}

.tooltip-wrapper:hover::after {
  opacity: 1;
}

/* Styles pour le carrousel de projets */
.carousel-container {
  position: relative;
  overflow: hidden;
  max-width: 100%;
  margin: auto;
}

.carousel {
  display: flex;
  transition: transform 0.5s ease-in-out;
  will-change: transform;
}

.carousel-card {
  flex: 0 0 100%;
  box-sizing: border-box;
  padding: 1rem;
}

.carousel-card-image img {
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  background-color: rgba(0, 0, 0, 0.3);
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 10;
}

.carousel-btn.prev {
  left: 10px;
}

.carousel-btn.next {
  right: 10px;
}

.carousel-btn:hover {
  background-color: rgba(0, 0, 0, 0.6);
}

.carousel-card-links {
  margin-top: 20px;
}

.carousel-card-links a {
  margin: 20px;
}

/* Formulaire */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  width: 100%;
  margin: auto;
}

input,
textarea {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
}

button {
  padding: 0.75rem;
  border: none;
  background-color: #333;
  color: white;
  cursor: pointer;
}

/* Footer */
footer {
  background: #222;
  color: white;
  text-align: center;
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  position: sticky;
  bottom: 0;
  width: 100%;
  z-index: 10;
}

footer a {
  color: #aaa;
  text-decoration: none;
}

/* Bouton thème */
.settings {
  margin-left: auto;
}

#themeToggle {
  padding: 0.5rem 1rem;
  background: #555;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Media Queries */
@media (max-width: 992px) {
  section {
    width: 90%;
    left: 0;
  }

  .animated-title {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: center;
  }

  .header-left {
    margin-bottom: 1rem;
  }

  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .settings {
    margin: 1rem 0 0;
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .animated-title {
    font-size: 1.5rem;
  }

  section {
    width: 95%;
    padding: 1.5rem 1rem;
  }
  .tooltip-wrapper img {
    width: 100px;
  }

  .methodologie img {
    width: 200px;
  }

  #AD {
    font-size: 1.5rem;
  }

  #webdev {
    font-size: 1.2rem;
  }

  .carousel-btn {
    top: 20%;
  }

  .carousel-card-links a {
    margin: 2px;
  }

  /* Menu hamburger pour mobile */
  .menu-toggle {
    display: flex;
  }

  nav {
    width: 100%;
    display: none;
  }

  nav.open {
    display: block;
  }
}

@media (max-width: 480px) {
  .animated-title {
    font-size: 1.2rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  .tooltip-wrapper img {
    width: 80px;
  }

  .methodologie img {
    width: 200px;
  }
}
