:root {
  --primary-blue: #1c5fa8;
  --dark-blue: #14396b;
  --light-blue-bg: #dbe6f3;
  --text-dark: #1c2733;
  --white: #ffffff;
  --off-white: #f6f9fc;
  --border-color: #c7d6e8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  color: var(--text-dark);
  background: var(--off-white);
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Masquage fiable, quel que soit le type d'affichage de l'élément (bloc, grille, flex...). */
.lang-hidden { display: none !important; }

/* ===================== HERO ===================== */
.hero {
  position: relative;
  background: url('images/datacenter.jpg') center/cover no-repeat;
  color: var(--white);
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(20,57,107,0.62) 0%, rgba(28,95,168,0.44) 100%);
  z-index: 0;
}

.lang-switch {
  position: absolute;
  top: 16px;
  right: 24px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.lang-btn {
  background: transparent;
  border: 1px solid var(--white);
  color: var(--white);
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.lang-btn.active,
.lang-btn:hover {
  background: var(--white);
  color: var(--dark-blue);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 36px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 40px 44px;
}

/* --- Photo : agrandie, bordure très fine --- */
.hero-photo-wrap {
  position: relative;
  flex: 0 0 auto;
  width: clamp(160px, 18vw, 235px);
  height: clamp(160px, 18vw, 235px);
}

.hero-photo-wrap::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.22) 0%, rgba(28,95,168,0.3) 55%, rgba(20,57,107,0) 76%);
  z-index: 0;
}

.hero-photo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 10px 26px rgba(8,16,28,0.45);
}

/* --- Infos centrales --- */
.hero-main {
  flex: 1 1 300px;
  min-width: 240px;
}

.hero-main h1 {
  font-size: 2.1rem;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.job-title {
  font-size: 1.1rem;
  color: var(--light-blue-bg) !important;
  margin-bottom: 14px;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.contact-info a {
  color: var(--white);
  text-decoration: underline;
  width: fit-content;
}

.key-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-pill {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.4);
  color: var(--white);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
}

/* --- Stats --- */
.hero-stats {
  flex: 0 0 250px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 22px;
  align-self: stretch;
  align-content: center;
  border-left: 1px solid rgba(255,255,255,0.28);
  padding-left: 28px;
}

.stat { text-align: left; }

.stat:last-child {
  grid-column: 1 / -1;
}

.stat-number {
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--light-blue-bg);
  margin-top: 2px;
}

/* --- Navbar --- */
.navbar {
  position: relative;
  z-index: 1;
  background: var(--dark-blue);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 10px;
}

.navbar a {
  color: var(--white);
  text-decoration: none;
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.navbar a:hover { background: var(--primary-blue); }

/* ===================== SECTIONS ===================== */
.section {
  padding: 50px 0;
  background: var(--white);
}

.section.alt-bg { background: var(--off-white); }

.section-title {
  color: var(--white);
  background: var(--primary-blue);
  display: inline-block;
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 1.1rem;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.intro-text {
  font-size: 1.03rem;
  color: #33404d;
  max-width: 760px;
  margin-bottom: 26px;
}

/* ===================== ENTRIES (experience / encadrement / formation) ===================== */
.entry {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.entry:last-child { border-bottom: none; }

.entry-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.entry-header h3 {
  color: var(--dark-blue);
  font-size: 1.1rem;
}

.entry .date {
  color: var(--primary-blue);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.entry-sub {
  font-style: italic;
  color: #4a5a6a;
  margin: 4px 0 10px;
}

.entry-sub a {
  font-style: normal;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary-blue);
  text-decoration: none;
  margin-left: 6px;
}

.entry-sub a:hover { text-decoration: underline; }

.entry ul { padding-left: 20px; }
.entry li { margin-bottom: 4px; }

/* ===================== PROJETS (grandes cartes) ===================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}

.project-card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(20, 57, 107, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(20, 57, 107, 0.16);
}

.project-card h3 {
  color: var(--dark-blue);
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  background: var(--light-blue-bg);
  color: var(--dark-blue);
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.project-card .summary {
  font-size: 0.9rem;
  color: #4a5a6a;
  flex-grow: 1;
  margin-bottom: 16px;
}

.btn-details {
  align-self: flex-start;
  background: var(--primary-blue);
  color: var(--white);
  border: none;
  padding: 8px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s ease;
}

.btn-details:hover { background: var(--dark-blue); }

/* ===================== TILES (profil / competences / certifications) ===================== */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.tile-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(20,57,107,0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tile-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(20,57,107,0.15);
}

.tile-index {
  display: inline-block;
  background: var(--light-blue-bg);
  color: var(--dark-blue);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.tile-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.tile-head h3 {
  flex: 1;
  font-size: 0.95rem;
  color: var(--dark-blue);
  line-height: 1.35;
}

.tile-subtitle {
  font-size: 0.78rem;
  color: #5c6b7a;
  margin-top: 8px;
}

.btn-more {
  flex-shrink: 0;
  white-space: nowrap;
  background: none;
  border: none;
  color: var(--primary-blue);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s ease;
}

.btn-more:hover { color: var(--dark-blue); text-decoration: underline; }

.skills-tiles .tile-card { border-top: 3px solid var(--primary-blue); }
.cert-tiles .tile-card { border-top: 3px solid var(--dark-blue); }

/* ===================== MODALE ===================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 35, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open { display: flex; }

.modal-box {
  background: var(--white);
  max-width: 620px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  border-radius: 8px;
  padding: 32px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--dark-blue);
}

.modal-box h3 {
  color: var(--dark-blue);
  margin-bottom: 12px;
  padding-right: 24px;
}

.modal-box .tag-list { margin-bottom: 16px; }

.modal-box p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-dark);
}

/* ===================== LANGUES (cartes détaillées) ===================== */
.lang-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.lang-detail-card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--primary-blue);
  border-radius: 8px;
  padding: 18px 20px;
}

.lang-detail-card h3 {
  color: var(--dark-blue);
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.lang-skill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.lang-skill-row:last-child { border-bottom: none; }

.lang-skill-name {
  font-size: 0.88rem;
  color: #4a5a6a;
}

.lang-skill-level {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--dark-blue);
  background: var(--light-blue-bg);
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
}

/* ===================== REFERENCES ===================== */
.refs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.ref-card {
  background: var(--light-blue-bg);
  padding: 18px;
  border-radius: 6px;
}

.ref-card h3 { color: var(--dark-blue); margin-bottom: 6px; }
.ref-card p { font-size: 0.9rem; margin-bottom: 4px; }
.ref-card a { color: var(--primary-blue); }

/* ===================== DOCUMENTS ===================== */
.cv-viewer {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 16px;
}

.cv-viewer iframe { width: 100%; height: 100%; border: none; }

.btn-download {
  display: inline-block;
  background: var(--primary-blue);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease;
}

.btn-download:hover { background: var(--dark-blue); }

/* ===================== FOOTER ===================== */
.footer {
  background: var(--dark-blue);
  color: var(--white);
  text-align: center;
  padding: 40px 0;
}

.footer .section-title { background: var(--primary-blue); }
.footer a { color: var(--light-blue-bg); }

.footer .copyright {
  margin-top: 16px;
  font-size: 0.8rem;
  color: #a9bbd4;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 780px) {
  .hero-inner {
    flex-direction: column;
    text-align: center;
    padding: 60px 24px 32px;
    gap: 24px;
  }
  .hero-main { text-align: center; }
  .contact-info { align-items: center; }
  .key-skills { justify-content: center; }
  .hero-stats {
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.28);
    padding-left: 0;
    padding-top: 18px;
    width: 100%;
  }
  .stat { text-align: center; }
}

@media (max-width: 700px) {
  .refs-grid { grid-template-columns: 1fr; }
  .hero-main h1 { font-size: 1.7rem; }
  .cv-viewer { height: 400px; }
  .navbar a { font-size: 0.8rem; padding: 6px 8px; }
}