/* ==========================================================================
   Portfolio — feuille de style unique
   Pour changer les couleurs du site, modifie seulement les variables ci-dessous.
   ========================================================================== */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #1c2128;
  --muted: #59636e;
  --border: #d8dee4;
  --accent: #c2410c;          /* orange "industriel" : liens, boutons, chiffres clés */
  --accent-soft: #fff1e8;
  --accent-text: #ffffff;
  --todo-bg: #fff3bf;          /* surlignage des textes à remplir */
  --todo-border: #f08c00;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 4px 16px rgba(16, 24, 32, .06);
  --radius: 12px;
  --max: 1100px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1f252d;
    --text: #e6edf3;
    --muted: #9aa5b1;
    --border: #2d343d;
    --accent: #ff8a3d;
    --accent-soft: #2a1d14;
    --accent-text: #1a0f07;
    --todo-bg: #3d3110;
    --todo-border: #f59f00;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}
img, video, iframe { max-width: 100%; display: block; }
img, video { height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
ul { padding-left: 1.2em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.section { padding: 72px 0; }
.section + .section { border-top: 1px solid var(--border); }
.eyebrow {
  font-family: var(--mono);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: .6em;
  display: block;
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; }

/* Texte à remplir : bien visible tant que tu ne l'as pas remplacé.
   Quand tu remplis un passage, enlève le mot todo de class="…" en gardant les autres mots
   (ex. class="todo" disparaît, class="kpi todo" devient class="kpi"). */
.todo {
  background: var(--todo-bg);
  outline: 1px dashed var(--todo-border);
  border-radius: 3px;
  padding: 0 .2em;
}

/* ---------- En-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { color: var(--text); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--accent); }
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 6px 10px; font: inherit; cursor: pointer;
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .nav {
    display: none;
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px 20px 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 0; width: 100%; }
}

/* ---------- Boutons & tags ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px;
  font-weight: 600; font-size: .95rem; text-decoration: none;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.tags li {
  font-family: var(--mono); font-size: .75rem;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}

/* ---------- Accueil : hero ---------- */
.hero { padding: 88px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 48px; align-items: center; }
.hero-photo { width: 100%; max-width: 300px; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 4px solid var(--surface); box-shadow: var(--shadow); justify-self: center; }
@media (max-width: 760px) {
  .hero { padding: 48px 0; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-photo { max-width: 180px; order: -1; justify-self: start; }
}

/* ---------- Cartes projets ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; margin-top: 32px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-2); }
.card-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h3 { margin: 0; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; } /* toute la carte est cliquable */
.card { position: relative; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .kpi { font-family: var(--mono); font-size: .85rem; color: var(--accent); font-weight: 600; }
.card .tags { margin-top: auto; padding-top: 6px; }

/* Carte "secondaire" (projet moins mis en avant) */
.card.compact img { aspect-ratio: 16 / 7; }

/* ---------- Compétences & formations ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-top: 28px; }
.skill-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.skill-box h3 { font-size: 1rem; margin-bottom: .7em; }
.skill-box ul { margin: 0; padding-left: 1.1em; color: var(--muted); font-size: .95rem; }

.timeline { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.timeline li {
  display: grid; grid-template-columns: 130px 1fr; gap: 16px;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.timeline .when { font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.timeline .status { font-family: var(--mono); font-size: .75rem; color: var(--accent); margin-left: 6px; }
@media (max-width: 560px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Contact & pied de page ---------- */
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .88rem; }
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ==========================================================================
   Pages projet
   ========================================================================== */
.project-head { padding: 48px 0 24px; }
.breadcrumb { font-size: .9rem; margin-bottom: 20px; display: inline-block; }
.project-head .lead { margin-bottom: 20px; }
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  margin: 28px 0 0;
}
.facts div { background: var(--surface); padding: 14px 18px; }
.facts dt { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-weight: 600; }

/* --- Visionneuse 3D --- */
.viewer {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); margin: 24px 0 8px;
}
.viewer model-viewer {
  display: block;
  width: 100%; height: clamp(320px, 60vh, 560px);
  background: radial-gradient(ellipse at center, var(--surface) 0%, var(--surface-2) 100%);
  --poster-color: transparent;
  --progress-bar-color: var(--accent);
}
model-viewer:not(:defined) > * { visibility: hidden; }
.viewer-bar {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted);
}
.viewer-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.viewer-switch button {
  font: inherit; font-size: .82rem; cursor: pointer;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.viewer-switch button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.viewer-error {
  display: none; padding: 16px; margin: 0; font-size: .9rem;
  background: var(--todo-bg); border-top: 1px dashed var(--todo-border);
}
.viewer.has-error .viewer-error { display: block; }

/* --- Contenu --- */
.project-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; padding: 40px 0 72px; }
@media (max-width: 900px) { .project-body { grid-template-columns: 1fr; gap: 24px; } }
.prose h2 { margin-top: 2em; font-size: 1.5rem; }
.prose h2:first-child { margin-top: 0; }
.prose ul li { margin-bottom: .35em; }

.aside { position: sticky; top: 88px; align-self: start; display: grid; gap: 16px; }
@media (max-width: 900px) { .aside { position: static; } }
.aside-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.aside-box h3 { font-size: .8rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 12px; }
.doc-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.doc-links a { display: flex; gap: 10px; align-items: baseline; text-decoration: none; font-weight: 500; }
.doc-links a:hover { text-decoration: underline; }
.doc-links .ext { font-family: var(--mono); font-size: .7rem; color: var(--muted); border: 1px solid var(--border); padding: 0 5px; border-radius: 4px; }

/* Chiffres clés */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 20px 0 8px; }
.kpi-tile { background: var(--accent-soft); border-radius: 10px; padding: 16px 18px; }
.kpi-tile strong { display: block; font-size: 1.6rem; line-height: 1.1; color: var(--accent); font-family: var(--mono); }
.kpi-tile span { font-size: .85rem; color: var(--muted); }

/* Figures & galerie */
figure { margin: 24px 0; }
figure img { border-radius: 10px; border: 1px solid var(--border); width: 100%; background: var(--surface-2); }
figure img[data-zoom] { cursor: zoom-in; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; }

/* Vidéo */
.video { aspect-ratio: 16 / 9; width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.video iframe, .video video { width: 100%; height: 100%; border: 0; }
.video.placeholder {
  display: grid; place-items: center; text-align: center; padding: 20px;
  background: var(--surface-2); color: var(--muted); border-style: dashed;
}

/* Projets précédent / suivant */
.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 28px 0; border-top: 1px solid var(--border); }
.pager a { text-decoration: none; font-weight: 600; }
.pager small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }

/* Zoom sur image (lightbox) */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.lightbox::backdrop { background: rgba(0, 0, 0, .85); }
.lightbox img { max-width: 96vw; max-height: 90vh; object-fit: contain; border-radius: 8px; background: #fff; }
.lightbox button {
  position: fixed; top: 14px; right: 14px; font: inherit; font-size: 1.4rem; line-height: 1;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .9); color: #111;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
  .card:hover { transform: none; }
}

/* Étiquettes posées sur le modèle 3D (hotspots, optionnel, voir GUIDE-3D.md) */
.hotspot {
  font: 600 .75rem/1 var(--font);
  padding: 5px 9px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  cursor: default; white-space: nowrap;
}
