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

/* Variables CSS - identiques à formation.css */
:root {
  --accent-color: #7b61ff;
  --text-color: #ffffff;
  --header-bg: rgba(0, 0, 0, 0.9);
  --card-bg: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.2);
}

body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #000;
  overflow-x: hidden;
  overflow-y: auto; /* Force le scroll vertical */
}

/* Page expériences avec fond et opacité */
.page-experiences {
  position: relative;
  min-height: 100vh;
  color: #fff;
}

/* ===== Header (copie conforme de Compétences avec tweaks) ===== */
.page-experiences .site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 2000;
  width: 100%;
  background: var(--header-bg, rgba(0, 0, 0, 0.9));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: saturate(1.05) blur(4px);
}
.page-experiences .header-nav {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  align-items: center;
  gap: 16px;
  grid-template-columns: auto 1fr auto auto;
  height: 45px;
  min-height: 45px;
}
.page-experiences .logo { line-height: 45px; transition: color .2s ease; font-size: 0.95rem; }
.page-experiences .logo:hover, .page-experiences .logo:focus-visible { color: var(--accent-color); }
.page-experiences .nav-menu { list-style: none; display: flex; gap: 22px; white-space: nowrap; justify-self: end; min-width: 0; }
.page-experiences .nav-menu a { position: relative; display: inline-block; color: var(--text-color); text-decoration: none; font-weight: 600; letter-spacing: .2px; padding-bottom: 0; line-height: 45px; border-bottom: 2px solid transparent; transition: color .2s ease, border-color .2s ease; outline: none; }
.page-experiences .nav-menu a::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--accent-color); transition: width .22s ease; }
.page-experiences .nav-menu a:hover::after, .page-experiences .nav-menu a:focus-visible::after { width: 100%; }
.page-experiences .nav-menu a.is-active { border-bottom: 2px solid var(--accent-color); }
.page-experiences .nav-menu a.is-active:hover, .page-experiences .nav-menu a.is-active:focus { border-bottom-color: transparent; }
.page-experiences .nav-menu a.is-active:hover::after, .page-experiences .nav-menu a.is-active:focus::after { width: 0; opacity: 0; }

.page-experiences::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("../img/fond.jpg") center/cover no-repeat fixed;
  z-index: -2;
  opacity: 0.2;
}

/* Supprime tout overlay qui pourrait recouvrir le contenu */
.page-experiences::after {
  display: none;
}

/* Harmonisation header mobile (hauteur + alignement logo) */
@media (max-width: 900px) {
  .page-experiences .header-nav { height: 90px; min-height: 90px; }
  .page-experiences .logo { line-height: 90px; }
}

/* Contenu principal */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 140px 20px 60px; /* espace pour header fixe + barre langue */
}

.page-title {
  text-align: center;
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-color);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease forwards;
}

/* Timeline en zigzag (géométrie complète, indépendante) */
.timeline {
  position: relative;
  width: 100%;
  margin: 150px auto 0; /* espace entre le titre et la timeline */
  padding-top: var(--timeline-top-offset, 0px);
}

/* Ligne centrale */
.timeline::before {
  content: "";
  position: absolute;
  top: 100px;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: white;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Items */
.timeline-item {
  position: relative;
  margin: -20px 0;
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease forwards;
}

.timeline-item:nth-child(1) {
  animation-delay: 0.2s;
}
.timeline-item:nth-child(2) {
  animation-delay: 0.4s;
}
.timeline-item:nth-child(3) {
  animation-delay: 0.6s;
}
.timeline-item:nth-child(4) {
  animation-delay: 0.8s;
}

/* Point central */
.timeline-point {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.timeline-item:hover .timeline-point {
  background: var(--accent-color);
  box-shadow: 0 0 0 6px rgba(123, 97, 255, 0.3);
  transform: translate(-50%, -50%) scale(1.2);
}

/* Barres de connexion (juste jusqu'au bord carte) */
.timeline-item.left .timeline-line {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 90px;
  height: 3px;
  background: white;
  transform: translate(-100%, -50%);
  transition: all 0.3s ease;
}

.timeline-item.right .timeline-line {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100px;
  height: 3px;
  background: white;
  transform: translateY(-50%);
  transition: all 0.3s ease;
}

.timeline-item:hover .timeline-line {
  background: var(--accent-color);
  box-shadow: 0 0 8px rgba(123, 97, 255, 0.4);
}

/* Cartes */
.timeline-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 20px 24px;
  border-radius: 12px;
  color: white;
  width: min(700px, calc(50vw - 180px));
  transition: all 0.3s ease;
  text-align: left;
}

/* Réserve de l'espace pour le badge période en bas à droite */
.timeline-card {
  padding-bottom: 56px;
}

/* Entête de carte: Société (gauche) + badge contrat (droite) */
.timeline-card .card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.timeline-card h3 {
  margin: 0 0 4px 0;
}

/* Badge contrat en haut à droite, style similaire au badge year */
.timeline-card .contract {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Rôle sous le nom d'entreprise: même taille/gras, en italique */
.timeline-card .role {
  font-size: 1.3rem;
  font-weight: 600;
  font-style: italic;
  margin: 4px 0 10px 0;
  color: var(--text-color);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Espace avant les missions */
.timeline-card .missions {
  margin-top: 6px;
  padding-left: 18px;
}

/* Aligne les cartes de gauche pour qu'elles touchent la ligne horizontale */
.timeline-item.left .timeline-card {
  /* La valeur 100px rapproche la carte du centre (ligne = 90px) */
  margin-left: calc(50% - 90px - min(700px, calc(50vw - 180px)));
}

.timeline-item.right .timeline-card {
  margin-left: calc(50% + 100px);
}

.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Ajustements spécifiques à la page Expériences */
.page-experiences .timeline {
  padding-top: var(--timeline-top-offset, 0px);
}

/* Centre le point et la barre horizontale au milieu de la carte */
.page-experiences .timeline-item .timeline-point {
  top: 50%;
}

.page-experiences .timeline-item.left .timeline-line {
  top: 50%;
  transform: translate(-100%, -50%);
  width: 90px; /* jusqu'au bord de la carte (aligné formation) */
}

.page-experiences .timeline-item.right .timeline-line {
  top: 50%;
  transform: translateY(-50%);
  width: 100px; /* jusqu'au bord de la carte (aligné formation) */
}

/* Contenu des cartes */
.timeline-content h3 {
  color: var(--text-color);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.company {
  color: var(--text-color);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-style: normal;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Badge de durée (même style que .year dans formation) */
.timeline-card .period {
  position: absolute;
  right: 16px;
  bottom: 16px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
  margin: 0;
  font-style: normal;
}

.timeline-content p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

/* Animations */
@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  /* Supprimer la timeline et empiler les cartes */
  .timeline::before { display: none; }
  .timeline-point, .timeline-line { display: none !important; }
  .timeline { margin: 0 auto; padding-top: 0; }
  .timeline-item { margin: 16px 0; }
  .timeline-item.left .timeline-card,
  .timeline-item.right .timeline-card,
  .timeline-card {
    width: 100% !important;
    max-width: 700px;
    margin: 0 auto !important;
    text-align: left;
  }
  .main-content { padding: 120px 15px 40px; }
  .page-title { font-size: 2.2rem; margin-bottom: 2rem; }
  .timeline-card { padding: 1.25rem; }
  /* Espace anti-chevauchement: badge .period (~32px) + offset bas (16px) + 15px */
  .timeline-card { padding-bottom: 63px; }
}

/* Réduire la taille du nom dans le header (mobile) */
@media (max-width: 900px) {
  .page-experiences .logo { font-size: 1.2rem; }
}
