/* ==========================================================================
   nathan-labbe.fr — feuille de style unique
   Couleurs : modifier les variables dans :root (clair) et dans le bloc
   prefers-color-scheme: dark (sombre). Rien d'autre n'est codé en dur.
   ========================================================================== */

/* ---------- Polices (auto-hébergées, aucun appel externe) ---------- */
@font-face {
  font-family: "B612";
  src: url("../fonts/b612-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "B612";
  src: url("../fonts/b612-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "B612";
  src: url("../fonts/b612-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- Variables ---------- */
:root {
  --paper: #ECEFF1;      /* fond de page */
  --surface: #F7F8F9;    /* carte profil */
  --ink: #13212E;        /* texte principal, barres */
  --ink-2: #4A5866;      /* texte secondaire */
  --ink-62: #656F78;     /* nuances de la barre de répartition */
  --ink-38: #9AA1A7;
  --rule: #C5CDD4;       /* filets */
  --grid: #D8DEE3;       /* quadrillage, fond des jauges */
  --signal: #D9440C;     /* « maintenant » : rôle en cours, section active */
  --plate: #FFFFFF;      /* fond des logos et badges (lisibles dans les 2 thèmes) */

  --font: "B612", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.3125rem;
  --fs-xl: clamp(1.625rem, 1.15rem + 1.3vw, 2.125rem);
  --fs-2xl: clamp(2.125rem, 1.1rem + 2.9vw, 3.375rem);

  --card-w: 320px;
  --rail-w: 128px;
  --gap: 64px;
  --section-gap: clamp(104px, 11vw, 152px);
  --topbar-h: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1822;
    --surface: #14212D;
    --ink: #E3E8EC;
    --ink-2: #9DABB7;
    --ink-62: #92999F;
    --ink-38: #5F676F;
    --rule: #2C3B49;
    --grid: #1C2A37;
    --signal: #FF6B2C;
    --plate: #F4F6F7;
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
a:hover { text-decoration-color: var(--signal); }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 2px;
}

h2 {
  font-size: var(--fs-xl);
  line-height: 1.2;
  font-weight: 700;
  max-width: 24ch;
  text-wrap: balance;
}

section { scroll-margin-top: 32px; }

.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 50;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: 700 var(--fs-sm)/1.2 var(--font);
  text-decoration: none;
  transition: box-shadow 0.15s ease;
}
.btn:hover { box-shadow: inset 0 -3px 0 var(--signal); }
.btn-ink {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Mise en page ---------- */
.layout {
  max-width: 1328px;
  margin: 0 auto;
  padding: 32px;
  display: grid;
  grid-template-columns: var(--card-w) minmax(0, 1fr) var(--rail-w);
  gap: var(--gap);
  align-items: start;
}

.main {
  min-width: 0;
  display: grid;
  gap: var(--section-gap);
  padding-bottom: 96px;
}

/* ---------- Barre mobile (cachée sur grand écran) ---------- */
.topbar { display: none; }

/* ---------- Carte profil ---------- */
.card {
  position: sticky;
  top: 32px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  display: grid;
  gap: 20px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  scrollbar-width: thin;
}

.card-name {
  font-size: 1.125rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.card-name strong { font-weight: 700; }

.card-photo {
  aspect-ratio: 1420 / 1298;
  border-radius: 8px;
  overflow: hidden;
  background: var(--grid);
}
.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%; /* photo en portrait : on garde le haut (le visage) */
}
/* Photo absente (le JS pose .img-missing) : le bloc disparaît, pas d'icône cassée */
.card-photo.img-missing { display: none; }

.card-roles {
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.5;
}

.card-place {
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.card-links {
  display: grid;
  gap: 10px;
}

.card-copy {
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

/* ---------- Accueil ---------- */
.hero { padding-top: clamp(16px, 9vh, 112px); }

.hero h1 { font-weight: 700; }
.hero-hi {
  display: block;
  margin-bottom: 14px;
  font-size: var(--fs-lg);
  font-weight: 400;
  color: var(--ink-2);
}
.hero-role {
  display: block;
  max-width: 17ch;
  font-size: var(--fs-2xl);
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.hero-text {
  margin-top: 32px;
  max-width: 58ch;
  font-size: 1.125rem;
  color: var(--ink-2);
}

.readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
  margin-top: 40px;
}
.readout {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  padding-left: 16px;
  border-left: 2px solid var(--ink);
}
.readout dd {
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1;
}
.readout dt {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* ---------- Profil ---------- */
.prose {
  display: grid;
  gap: 18px;
  margin-top: 28px;
  max-width: 62ch;
  color: var(--ink-2);
}

/* ---------- Parcours (diagramme de Gantt) ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 20px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sw {
  display: inline-block;
  width: 22px;
  height: 10px;
  border-radius: 2px;
}
.sw-exp { background: var(--ink); }
.sw-form,
.g-row[data-kind="form"] .g-bar {
  border: 1.5px solid var(--ink);
  background: repeating-linear-gradient(-45deg, var(--ink) 0 1.5px, transparent 1.5px 5px);
}
.sw-now { background: var(--signal); }

.gantt {
  --years: 7;
  --label-w: 18rem;
  margin-top: 32px;
}

.gantt-axis {
  display: grid;
  grid-template-columns: var(--label-w) minmax(0, 1fr);
}
.gantt-years {
  display: grid;
  grid-template-columns: repeat(var(--years), minmax(0, 1fr));
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-xs);
  color: var(--ink-2);
}
.gantt-years span {
  padding: 0 0 8px 6px;
  border-left: 1px solid var(--rule);
}

.g-row {
  display: grid;
  grid-template-columns: var(--label-w) minmax(0, 1fr);
  border-bottom: 1px solid var(--grid);
}
.g-label { padding: 14px 20px 14px 0; }
.g-label h3 {
  font-size: var(--fs-sm);
  line-height: 1.35;
}
.g-label p {
  margin-top: 3px;
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--ink-2);
}
/* La période est lue par les lecteurs d'écran, affichée seulement sur mobile */
.g-period {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.g-track {
  position: relative;
  min-height: 28px;
  background:
    linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0 / calc(100% / var(--years)) 100% repeat-x;
  box-shadow: inset -1px 0 0 var(--grid);
}
.g-bar {
  position: absolute;
  top: 50%;
  left: calc(var(--s) / var(--years) * 100%);
  width: calc((var(--e) - var(--s)) / var(--years) * 100%);
  height: 12px;
  margin-top: -6px;
  border-radius: 2px;
  transform-origin: left center;
}
.g-row[data-kind="exp"] .g-bar { background: var(--ink); }
.g-row[data-kind="now"] .g-bar {
  background: linear-gradient(to right, var(--signal) 0 62%, transparent);
}
.g-row[data-kind="now"] h3::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--signal);
  vertical-align: 0.05em;
}

/* Animation unique de la page : les barres se tracent à l'arrivée à l'écran.
   La classe will-draw n'est posée que par le JS : sans JS, tout est visible. */
.gantt.will-draw .g-bar {
  transform: scaleX(0);
  transition: transform 0.8s cubic-bezier(0.22, 0.8, 0.24, 1);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.gantt.will-draw.is-drawn .g-bar { transform: scaleX(1); }

/* ---------- Domaines ---------- */
.split {
  display: flex;
  gap: 3px;
  height: 14px;
  margin-top: 36px;
}
.split-seg {
  flex: var(--n) 1 0%;
  border-radius: 2px;
  background: var(--seg);
}
.seg-1 { --seg: var(--ink); }
.seg-2 { --seg: var(--ink-62); }
.seg-3 { --seg: var(--ink-38); }

.services { margin-top: 8px; }
.svc {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  column-gap: 16px;
  row-gap: 6px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}
.svc::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  width: 14px;
  height: 14px;
  margin-top: 0.42em;
  border-radius: 2px;
  background: var(--seg);
}
.svc h3 {
  grid-column: 2;
  grid-row: 1;
  font-size: var(--fs-lg);
  line-height: 1.3;
}
.svc-count {
  grid-column: 3;
  grid-row: 1;
  padding-top: 0.3em;
  font-size: var(--fs-sm);
  font-weight: 700;
  white-space: nowrap;
}
.svc-desc {
  grid-column: 2 / 4;
  grid-row: 2;
  max-width: 60ch;
  color: var(--ink-2);
}

/* ---------- Compétences (jauges graduées) ---------- */
.skills { margin-top: 32px; }
.sk {
  display: grid;
  grid-template-columns: 36px minmax(9.5rem, 12.5rem) minmax(0, 1fr) 4rem;
  align-items: center;
  column-gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--grid);
}
.sk-logo {
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 8px;
  background: var(--plate);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.sk-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sk-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.3;
}
.sk-gauge {
  position: relative;
  height: 12px;
  background: var(--grid);
}
.sk-gauge::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--v) * 1%);
  background: var(--ink);
}
/* 20 graduations de 5 % : on « découpe » la barre avec la couleur du fond */
.sk-gauge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to right, transparent 0 calc(5% - 2px), var(--paper) calc(5% - 2px) 5%);
}
.sk-val {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

/* ---------- Citations ---------- */
.quotes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
  margin-top: 88px;
  padding-block: 40px;
  border-block: 1px solid var(--rule);
}
.quote blockquote p {
  font-size: var(--fs-lg);
  font-style: italic;
  line-height: 1.4;
  text-wrap: balance;
}
.quote figcaption {
  margin-top: 14px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* ---------- Certifications ---------- */
.certs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 16px;
  margin-top: 32px;
}
.cert {
  display: grid;
  gap: 12px;
  align-content: start;
}
.cert-plate {
  display: grid;
  place-items: center;
  height: 128px;
  padding: 18px;
  border-radius: 10px;
  background: var(--plate);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.cert-plate img {
  width: auto;
  max-width: 100%;
  max-height: 88px;
  object-fit: contain;
}
.cert-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.35;
}

/* ---------- Contact ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.foot {
  display: none;
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

/* ---------- Images absentes (le JS pose .img-missing) ---------- */
.img-missing img { visibility: hidden; }
.cert-plate.img-missing { display: none; }
/* Compétence sans logo : la colonne du logo disparaît */
.sk-logo.img-missing { display: none; }
.sk:has(.sk-logo.img-missing) { grid-template-columns: minmax(9.5rem, 12.5rem) minmax(0, 1fr) 4rem; }

/* ---------- Navigation : règle graduée ---------- */
.rail {
  position: sticky;
  top: 32px;
  height: calc(100vh - 64px);
  display: flex;
  align-items: center;
}
.rail ol {
  display: grid;
  gap: 18px;
  padding: 6px 0 6px 22px;
  border-left: 1px solid var(--rule);
  /* graduations mineures le long de la règle */
  background: repeating-linear-gradient(to bottom, var(--rule) 0 1px, transparent 1px 8px) 0 0 / 5px 100% no-repeat;
}
.rail a {
  position: relative;
  display: block;
  padding: 2px 0;
  font-size: var(--fs-xs);
  line-height: 1.25;
  color: var(--ink-2);
  text-decoration: none;
}
.rail a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -23px;
  width: 11px;
  height: 1px;
  background: var(--ink-2);
  transition: width 0.2s ease, background-color 0.2s ease;
}
.rail a:hover { color: var(--ink); }
.rail a[aria-current="true"] {
  color: var(--ink);
  font-weight: 700;
}
.rail a[aria-current="true"]::before {
  width: 17px;
  height: 2px;
  margin-top: -0.5px;
  background: var(--signal);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Écran moyen : pas de place pour la règle, la carte reste fixe */
@media (max-width: 1279px) {
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 56px;
  }
  .rail { display: none; }
}

/* Écran d'ordinateur peu haut : photo recadrée pour que la carte tienne sans défiler */
@media (min-width: 1024px) and (max-height: 780px) {
  .card { gap: 16px; padding: 20px; }
  .card-photo { aspect-ratio: 16 / 10; }
}

/* Tablette et mobile : carte en haut, menu dans une barre fixe */
@media (max-width: 1023px) {
  :root { --topbar-h: 56px; }

  section { scroll-margin-top: calc(var(--topbar-h) + 16px); }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 20px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .topbar-name {
    font-weight: 700;
    text-decoration: none;
  }
  .topbar-btn {
    display: none;
    min-height: 40px;
    padding: 8px 14px;
    border: 1.5px solid var(--ink);
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: 700 var(--fs-sm)/1 var(--font);
    cursor: pointer;
  }
  .has-menu .topbar-btn { display: inline-flex; align-items: center; }

  .layout {
    display: block;
    padding: 20px 20px 0;
  }

  .card {
    position: static;
    max-height: none;
    overflow: visible;
    grid-template-columns: 112px minmax(0, 1fr);
    column-gap: 20px;
    row-gap: 16px;
  }
  .card-photo {
    grid-column: 1;
    grid-row: 1 / span 2;
    aspect-ratio: 1;
  }
  .card-name {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }
  .card-roles {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
  }
  .card-place,
  .card-links { grid-column: 1 / -1; }
  .card-copy { display: none; }
  /* Sans photo : une seule colonne */
  .card:has(.card-photo.img-missing) { grid-template-columns: minmax(0, 1fr); }
  .card:has(.card-photo.img-missing) > * { grid-column: 1; grid-row: auto; }

  .main { padding-top: 24px; }
  .hero { padding-top: 24px; }

  .foot {
    display: block;
    padding-top: 32px;
    border-top: 1px solid var(--rule);
  }
  .main { padding-bottom: 40px; }

  /* Le menu réutilise la même <nav> */
  .rail {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    z-index: 29;
    display: none;
    height: auto;
    padding: 16px 20px 24px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .rail.is-open { display: block; }
  .rail ol { gap: 2px; }
  .rail a {
    padding: 10px 0;
    font-size: var(--fs-md);
  }
}

/* Mobile */
@media (max-width: 719px) {
  .card { grid-template-columns: 96px minmax(0, 1fr); }

  .quotes {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .certs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .svc { grid-template-columns: 14px minmax(0, 1fr); }
  .svc-count {
    grid-column: 2;
    grid-row: 2;
    padding-top: 0;
  }
  .svc-desc {
    grid-column: 2;
    grid-row: 3;
  }

  .sk {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    row-gap: 8px;
  }
  .sk-logo { grid-row: 1 / span 2; }
  .sk-name { grid-column: 2; }
  .sk-val { grid-column: 3; grid-row: 1; }
  .sk-gauge {
    grid-column: 2 / 4;
    grid-row: 2;
  }
  .sk:has(.sk-logo.img-missing) { grid-template-columns: minmax(0, 1fr) auto; }
  .sk:has(.sk-logo.img-missing) .sk-name { grid-column: 1; }
  .sk:has(.sk-logo.img-missing) .sk-val { grid-column: 2; }
  .sk:has(.sk-logo.img-missing) .sk-gauge { grid-column: 1 / 3; }

  /* Gantt : libellé au-dessus, barre en dessous sur toute la largeur */
  .gantt { --label-w: 0px; }
  .gantt-axis,
  .g-row { grid-template-columns: minmax(0, 1fr); }
  .gantt-spacer { display: none; }
  .g-label { padding: 14px 0 6px; }
  .g-period {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }
  .g-track {
    min-height: 22px;
    margin-bottom: 12px;
  }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gantt.will-draw .g-bar {
    transform: none;
    transition: none;
  }
  .btn,
  .rail a::before { transition: none; }
}

/* ---------- Impression ---------- */
@media print {
  .topbar,
  .rail,
  .skip { display: none !important; }
  .layout { display: block; padding: 0; }
  .card { position: static; max-height: none; margin-bottom: 32px; break-inside: avoid; }
  .main { gap: 48px; }
  .gantt.will-draw .g-bar { transform: none; }
  .g-row, .svc, .sk, .cert { break-inside: avoid; }
}
