/* ========= Minimal Pro Clair (refonte) ========= */
/* Reset */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a{ color: inherit; text-decoration: none; }
img{ max-width:100%; display:block; }
strong{ font-weight: 700; }
::selection{ background: rgba(37, 99, 235, .18); }

:root{
  --bg: #f8fafc;
  --bg-2:#f1f5f9;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --stroke:#e2e8f0;

  --accent:#2563eb;
  --accent-2:#0ea5e9;

  --radius: 16px;
  --radius-sm: 12px;

  --shadow-sm: 0 1px 2px rgba(2, 6, 23, .06), 0 6px 24px rgba(2, 6, 23, .06);
  --shadow-md: 0 2px 6px rgba(2, 6, 23, .08), 0 12px 38px rgba(2, 6, 23, .10);

  --container: 1100px;
}

/* Background polish */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events:none;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(37,99,235,.10), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(14,165,233,.10), transparent 60%),
    radial-gradient(900px 600px at 60% 90%, rgba(37,99,235,.06), transparent 55%);
  opacity: .9;
  z-index:-1;
}

/* Utilities */
.container{
  width: min(var(--container), calc(100% - 2rem));
  margin-inline:auto;
}
.muted{ color: var(--muted); }
.small{ font-size: .92rem; }
.accent{ color: var(--accent); }

.link{
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration: underline;
  text-decoration-color: rgba(37,99,235,.35);
}
.link:hover{ text-decoration-color: rgba(37,99,235,.75); }

.section{
  padding: 5.25rem 0;
}
.section--alt{
  background: linear-gradient(180deg, transparent, rgba(15,23,42,.02), transparent);
}
.section__head{
  display:flex;
  align-items:flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.section__head h2{
  margin:0;
  letter-spacing: -0.02em;
  font-size: clamp(1.4rem, 2vw, 1.75rem);
}
.section__head p{ margin: .35rem 0 0; max-width: 62ch; }

/* Scroll offset for sticky header */
[id]:not(#top){ scroll-margin-top: 92px; }
#top{ scroll-margin-top: 0; }

/* Progress bar */
.progress{
  position: fixed;
  top: 0; left:0; right:0;
  height: 3px;
  background: transparent;
  z-index: 50;
}
.progress__bar{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* Header / Nav */
.header{
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.78);
  backdrop-filter: blur(10px);
}
.header__content{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: .9rem 0;
  gap: 1rem;
}
.brand{
  display:flex;
  align-items:center;
  gap: .75rem;
  min-width: 240px;
}
.brand__logo{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: linear-gradient(135deg, rgba(37,99,235,.16), rgba(14,165,233,.14));
  border: 1px solid rgba(37,99,235,.18);
}
.brand__text{
  display:flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand__text strong{ font-size: .98rem; letter-spacing: -0.01em; }
.brand__text span{ font-size: .86rem; color: var(--muted); }

.nav{
  display:flex;
  align-items:center;
  gap: .2rem;
}
.nav a{
  padding: .55rem .8rem;
  border-radius: 999px;
  color: rgba(15,23,42,.84);
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: -0.01em;
}
.nav a:hover{
  background: rgba(15,23,42,.04);
}
.nav a[aria-current="page"]{
  background: rgba(37,99,235,.10);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.18);
}

/* Burger */
.burger{
  display:none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow-sm);
}
.burger:focus-visible{
  outline: 3px solid rgba(37,99,235,.22);
  outline-offset: 2px;
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: .55rem;
  padding: .7rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(37,99,235,.18);
  background: var(--accent);
  color: white;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 2px rgba(2,6,23,.08);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  background: #1d4ed8;
}
.btn:active{ transform: translateY(0); }
.btn:focus-visible{
  outline: 3px solid rgba(37,99,235,.22);
  outline-offset: 2px;
}
.btn--ghost{
  background: rgba(255,255,255,.68);
  color: var(--text);
  border-color: var(--stroke);
}
.btn--ghost:hover{
  background: rgba(15,23,42,.04);
  border-color: rgba(148,163,184,.55);
}
.btn--small{ padding: .5rem .8rem; font-size: .92rem; }

/* Hero */
.hero{
  position: relative;
  padding: 4.75rem 0 3.75rem;
}
.hero__grid{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 2rem;
  align-items: start;
}
.hero h1{
  margin:0 0 .65rem;
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.pill{
  display:inline-flex;
  align-items:center;
  gap: .5rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: rgba(37,99,235,.08);
  color: var(--accent);
  border: 1px solid rgba(37,99,235,.16);
  font-weight: 700;
  font-size: .86rem;
}
.lead{
  margin: .75rem 0 1.35rem;
  color: rgba(15,23,42,.78);
  max-width: 65ch;
}
.hero__cta{ display:flex; gap: .75rem; flex-wrap: wrap; }
.hero__stats{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-top: 1.4rem;
}
.stat{
  padding: .9rem .9rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.70);
  border: 1px solid var(--stroke);
  box-shadow: 0 1px 2px rgba(2,6,23,.05);
}
.stat__num{
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.1rem;
}
.stat .muted{ font-size: .88rem; }

/* Cards */
.card{
  border-radius: var(--radius);
  background: rgba(255,255,255,.88);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.1rem;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(148,163,184,.75);
}
.card__title{
  margin: 0 0 .25rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.card__subtitle{
  margin: 0 0 .85rem;
  color: var(--muted);
}
.card__meta{
  display:flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .9rem;
}
.card__links{ display:flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }

.card--profile{ padding: 1.25rem; }
.avatar{
  width: 86px;
  height: 86px;
  border-radius: 22px;
  overflow: hidden; /* important */
  border: 1px solid rgba(37,99,235,.18);
  background: rgba(255,255,255,.6);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover; /* garde les bonnes proportions */
  display: block;
}

/* Tags / chips */
.tags{ display:flex; flex-wrap: wrap; gap: .5rem; }
.tag, .chip{
  display:inline-flex;
  align-items:center;
  gap: .45rem;
  padding: .35rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(248,250,252,.9);
  color: rgba(15,23,42,.76);
  font-weight: 700;
  font-size: .86rem;
}
.tag:hover, .chip:hover{
  border-color: rgba(37,99,235,.30);
  background: rgba(37,99,235,.06);
}
.mini{
  font-size: .86rem;
  color: var(--muted);
}

/* Layout helpers */
.grid{ display:grid; gap: 1rem; }
.grid--2{ grid-template-columns: repeat(2, 1fr); }
.grid--3{ grid-template-columns: repeat(3, 1fr); }
.list{ margin:0; padding-left: 1.1rem; color: rgba(15,23,42,.82); }
.list li{ margin: .35rem 0; }

/* Timeline */
.timeline{
  display:grid;
  gap: 1rem;
}
.timeline__item{
  display:grid;
  grid-template-columns: 14px 1fr;
  gap: .9rem;
  align-items: start;
}
.timeline__dot{
  width: 14px;
  height: 14px;
  border-radius: 99px;
  background: rgba(37,99,235,.22);
  border: 2px solid rgba(37,99,235,.35);
  margin-top: .35rem;
}
.timeline__content{
  padding: 1rem 1rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,.88);
  border: 1px solid var(--stroke);
  box-shadow: 0 1px 2px rgba(2,6,23,.05);
}
.timeline__top{
  display:flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}

/* Projects */
.project__links{ display:flex; gap: .6rem; flex-wrap: wrap; margin-top: .9rem; }

/* Contact */
.contact__box{ padding: 1.25rem; }
.form{
  display:grid;
  gap: .85rem;
}
.form label{ font-weight: 700; letter-spacing: -0.01em; font-size: .92rem; }
.form input, .form textarea{
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: .75rem .85rem;
  font: inherit;
  background: rgba(255,255,255,.9);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(2,6,23,.03);
}
.form textarea{ min-height: 140px; resize: vertical; }
.form input:focus, .form textarea:focus{
  outline: 3px solid rgba(37,99,235,.18);
  border-color: rgba(37,99,235,.35);
}
#formHint{ margin-top: .35rem; color: var(--muted); }

/* Footer */
.footer{
  border-top: 1px solid rgba(226,232,240,.85);
  background: rgba(248,250,252,.85);
}
.footer__content{
  padding: 1.6rem 0;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer__right{
  display:flex;
  align-items:center;
  gap:.75rem;
  justify-content:flex-end;
  flex-wrap:wrap;
}

/* ===== Bouton flottant "Retour en haut" ===== */
.to-top{
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(17,24,39,.85);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, background .18s ease, border-color .18s ease;
  z-index: 60;
}

.to-top:hover{
  background: rgba(17,24,39,.85);
  border-color: rgba(37,99,235,.35);
}

.to-top:focus-visible{
  outline: 3px solid rgba(37,99,235,.22);
  outline-offset: 2px;
}

.to-top.is-visible{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Mode sombre */
:root[data-theme="dark"] .to-top{
  background: rgba(255,255,255,.95);
}
:root[data-theme="dark"] .to-top:hover{
  background: rgba(255,255,255,.95);
}


/* Reveal animation */
.reveal{
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s ease, transform .5s ease;
}
.reveal.is-visible{
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 960px){
  .hero__grid{ grid-template-columns: 1fr; }
  .brand{ min-width: unset; }
  .grid--3{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px){

  /* Header: logo à gauche, switch + burger à droite */
  .header__content{ flex-wrap: nowrap; }
  .brand{ flex: 1; min-width: 0; }

  /* Menu mobile */
  .nav{
    position: fixed;
    top: 64px;
    right: 1rem;
    left: 1rem;
    display: none;
    flex-direction: column;
    gap: .25rem;
    padding: .6rem;
    border-radius: 18px;
    background: rgba(255,255,255,.92);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow-md);
  }
  .nav.nav--open{ display: flex; }
  .nav a{ width: 100%; justify-content: center; }

  .hero{ padding-top: 3.75rem; }
  .hero__stats{ grid-template-columns: 1fr; }
  .grid--2{ grid-template-columns: 1fr; }
  .grid--3{ grid-template-columns: 1fr; }
}

/* ================== MODE SOMBRE ================== */
:root[data-theme="dark"]{
  --bg: #0b1220;
  --bg-2: #0f172a;
  --panel: #111827;

  --text: #e5e7eb;
  --muted: #9ca3af;
  --stroke: #1f2937;

  --accent: #60a5fa;
  --accent-2: #38bdf8;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.6);
}

:root[data-theme="dark"] body::before{
  opacity: 0.35;
}

:root[data-theme="dark"] .header,
:root[data-theme="dark"] .footer{
  background: rgba(15,23,42,.85);
  border-color: var(--stroke);
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .nav,
:root[data-theme="dark"] .timeline__content{
  background: rgba(17,24,39,.85);
}

:root[data-theme="dark"] .btn--ghost{
  background: rgba(17,24,39,.85);
  color: var(--text);
}

:root[data-theme="dark"] .avatar{
  border-color: rgba(96,165,250,.25);
  background: rgba(15,23,42,.6);
}

/* ================== PATCH CONTRASTE MODE SOMBRE ================== */
/* Certains éléments utilisaient des couleurs "hardcodées" (rgba(15,23,42,...)) prévues pour le mode clair.
   On force ici des couleurs lisibles en mode sombre. */

:root[data-theme="dark"]{
  /* Muted un peu plus clair pour rester lisible sur fond sombre */
  --muted: #cbd5e1;
}

/* Textes */
:root[data-theme="dark"] .lead{
  color: rgba(229,231,235,.85);
}
:root[data-theme="dark"] .nav a{
  color: rgba(229,231,235,.88);
}
:root[data-theme="dark"] .nav a:hover{
  background: rgba(255,255,255,.06);
}
:root[data-theme="dark"] .list{
  color: rgba(229,231,235,.86);
}

/* Tags / chips */
:root[data-theme="dark"] .tag,
:root[data-theme="dark"] .chip{
  background: rgba(15,23,42,.65);
  color: rgba(229,231,235,.86);
  border-color: var(--stroke);
}
:root[data-theme="dark"] .tag:hover,
:root[data-theme="dark"] .chip:hover{
  background: rgba(96,165,250,.12);
  border-color: rgba(96,165,250,.35);
}

/* Avatar + pill */
:root[data-theme="dark"] .avatar{
  color: rgba(229,231,235,.86);
  background: linear-gradient(135deg, rgba(96,165,250,.18), rgba(56,189,248,.12));
  border-color: rgba(96,165,250,.22);
}
:root[data-theme="dark"] .pill{
  background: rgba(96,165,250,.12);
  color: var(--accent);
  border-color: rgba(96,165,250,.22);
}

/* Inputs */
:root[data-theme="dark"] .form input,
:root[data-theme="dark"] .form textarea{
  background: rgba(15,23,42,.55);
  border-color: var(--stroke);
}


/* ===== Switch Jour/Nuit ===== */
.theme-switch{
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.theme-switch input{
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.theme-switch__slider{
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.7);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: background .2s ease, border-color .2s ease;
}

.theme-switch__slider::after{
  content: "🌙";
  position: absolute;
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: left .2s ease, transform .2s ease;
}

/* État "ON" = dark */
:root[data-theme="dark"] .theme-switch__slider{
  background: rgba(15,23,42,.65);
}

:root[data-theme="dark"] .theme-switch__slider::after{
  content: "☀️";
  left: 26px;
}

/* ===== STATS - MODE SOMBRE ===== */
:root[data-theme="dark"] .stat{
  background: rgba(17,24,39,.85); /* même base que les cards */
  border-color: var(--stroke);
  box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .stat__num{
  color: var(--text);
}

:root[data-theme="dark"] .stat__label{
  color: var(--muted);
}

/* ===== BURGER MOBILE + CROIX (FINAL CLEAN) ===== */
@media (max-width: 760px){
  .burger{
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    position: relative;
  }

  .burger span{
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
    display: block;
    transition: transform .2s ease, opacity .2s ease;
  }

  /* État ouvert = croix */
  .burger[aria-expanded="true"] span:nth-child(1){
    transform: translateY(8px) rotate(45deg);
  }
  .burger[aria-expanded="true"] span:nth-child(2){
    opacity: 0;
  }
  .burger[aria-expanded="true"] span:nth-child(3){
    transform: translateY(-8px) rotate(-45deg);
  }
}

/* ===== EPREUVE E4 ===== */
.e4-image{
  width: 100%;
  max-width: 1100px;
  margin: 1.5rem auto 0;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-md);
}
