/* ===== Design tokens ===== */
:root {
  --bg: #f7f8fb;
  --bg-alt: #eef1f7;
  --surface: #ffffff;
  --text: #141a2b;
  --muted: #4d5872;
  --border: #dbe1ec;
  --primary: #1a3f8f;
  --primary-contrast: #ffffff;
  --accent: #0e8f7e;
  --accent-soft: #d7f2ee;
  --wip: #a35b00;
  --wip-soft: #fdecd3;
  --next-soft: #e6e9f2;
  --shadow: 0 1px 2px rgba(20, 26, 43, .06), 0 8px 24px rgba(20, 26, 43, .06);
  --radius: 14px;
  --max-width: 1120px;
  --header-height: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1220;
    --bg-alt: #121a2c;
    --surface: #172036;
    --text: #e8ecf5;
    --muted: #a3aec6;
    --border: #26314b;
    --primary: #7aa2ff;
    --primary-contrast: #0d1220;
    --accent: #3fd2bd;
    --accent-soft: #123a37;
    --wip: #f5b35c;
    --wip-soft: #3a2a12;
    --next-soft: #222c44;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 8px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 750; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--primary); }
code { font-size: .9em; background: var(--bg-alt); padding: .1em .35em; border-radius: 4px; }

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

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 32px; } }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--primary); color: var(--primary-contrast);
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .75em 1.4em; border-radius: 999px;
  background: var(--primary); color: var(--primary-contrast);
  font-weight: 650; text-decoration: none; border: 2px solid var(--primary);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-small { padding: .4em 1em; font-size: .95rem; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: .85rem; letter-spacing: .04em;
}

.site-nav ul { display: flex; align-items: center; gap: 22px; list-style: none; margin: 0; padding: 0; }
.site-nav a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 550; font-size: .97rem; }
.site-nav a:not(.btn):hover, .site-nav a.is-active:not(.btn) { color: var(--text); }
.site-nav a.is-active:not(.btn) { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 6px; text-decoration-thickness: 2px; }

.nav-toggle { display: none; background: none; border: 0; width: 44px; height: 44px; cursor: pointer; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  display: block; width: 22px; height: 2px; background: var(--text); margin: 0 auto; position: relative;
  transition: transform .2s ease;
}
.nav-toggle-bar::before, .nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bar::before { top: -7px; }
.nav-toggle-bar::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1100px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: var(--header-height); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 8px 16px 16px; }
  .site-nav li a:not(.btn) { display: block; padding: 12px 0; }
  .site-nav .btn { margin-top: 8px; }
}

/* ===== Hero ===== */
.hero { padding: 72px 0 64px; overflow: hidden; }
.hero-inner { display: grid; gap: 48px; align-items: center; }
@media (min-width: 900px) { .hero-inner { grid-template-columns: 1.25fr 1fr; } }

.eyebrow {
  color: var(--accent); font-weight: 700; font-size: .85rem;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: .8em;
}
.accent { color: var(--accent); }
.lead, .section-lead { color: var(--muted); font-size: 1.12rem; max-width: 62ch; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0; }
.hero-tags, .tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.hero-tags li, .tags li {
  padding: .3em .8em; border-radius: 999px; font-size: .88rem; font-weight: 600;
  background: var(--accent-soft); color: var(--text);
}

.hero-visual { margin: 0; max-width: 420px; justify-self: center; width: 100%; }
.hero-visual svg { width: 100%; height: auto; }
.svg-links line { stroke: var(--border); stroke-width: 2; stroke-dasharray: 5 5; animation: dash 30s linear infinite; }
.svg-node circle, .svg-node rect { fill: var(--surface); stroke: var(--primary); stroke-width: 2; }
.svg-core circle { fill: var(--primary); stroke: var(--accent); stroke-width: 4; }
.svg-dir rect { stroke: var(--accent); }
.svg-node text { fill: var(--text); font: 700 13px var(--font); text-anchor: middle; }
.svg-core text { fill: var(--primary-contrast); font-size: 16px; }
.svg-core .svg-sub { font-size: 11px; font-weight: 600; opacity: .85; }
@keyframes dash { to { stroke-dashoffset: -200; } }

/* ===== Sections ===== */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { margin-bottom: 40px; }

.grid { display: grid; gap: 20px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.card-feature { border-top: 4px solid var(--primary); }
.card p:last-child { margin-bottom: 0; }

.value h3 { color: var(--primary); }
.value p { color: var(--muted); margin: 0; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { position: relative; padding-left: 28px; margin-bottom: .55em; }
.checklist li::before {
  content: ""; position: absolute; left: 4px; top: .5em;
  width: 10px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.offers { list-style: none; padding: 0; margin: 0; }
.offer { position: relative; }
.offer-num { display: block; font-size: 2rem; font-weight: 800; color: var(--accent); opacity: .8; margin-bottom: 4px; }
.offer p, .case p { color: var(--muted); }

.case { border-left: 4px solid var(--accent); }

/* ===== Keycloak ===== */
.keycloak { display: grid; gap: 32px; align-items: start; }
@media (min-width: 900px) { .keycloak { grid-template-columns: 1fr 1fr; } }

.progress-list { list-style: none; padding: 0; margin: 0; }
.progress-list li { display: flex; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); }
.progress-list li:last-child { border-bottom: 0; }
.status { flex: 0 0 auto; font-size: .78rem; font-weight: 700; padding: .2em .7em; border-radius: 999px; min-width: 72px; text-align: center; }
.status-done { background: var(--accent-soft); color: var(--accent); }
.status-wip { background: var(--wip-soft); color: var(--wip); }
.status-next { background: var(--next-soft); color: var(--muted); }

/* ===== Contact & footer ===== */
.section-contact { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; text-align: center; }
.section-contact .section-lead { color: rgba(255, 255, 255, .88); margin-left: auto; margin-right: auto; }
.contact-inner .hero-cta { justify-content: center; }
.section-contact .btn { background: #fff; color: #0d1220; border-color: #fff; }
.section-contact .btn-ghost { background: transparent; color: #fff; }
.section-contact :focus-visible { outline-color: #fff; }

.site-footer { padding: 32px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: .92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner p { margin: 0; }

/* ===== Reveal animation (activée par JS seulement) ===== */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .svg-links line { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn { transition: none; }
}

/* ===== Parcours ===== */
.parcours-layout { display: grid; gap: 32px; align-items: start; }
@media (min-width: 1000px) { .parcours-layout { grid-template-columns: 1.6fr 1fr; } }

.timeline { list-style: none; margin: 0; padding: 0 0 0 24px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding-bottom: 28px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -31px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-alt);
}
.timeline h3 { margin-bottom: .2em; }
.timeline p { margin: 0; color: var(--muted); }
.timeline .timeline-date { font-size: .85rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3em; }
.timeline .timeline-role { font-weight: 650; color: var(--text); margin-bottom: .3em; }

.badge {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  padding: .15em .7em; border-radius: 999px; font-size: .72rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.badge-java { background: var(--wip-soft); color: var(--wip); }

/* ===== Sélecteur de langue ===== */
.site-nav { order: 1; margin-left: auto; }
.lang-switch {
  order: 2; margin-left: 20px; flex: 0 0 auto;
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: var(--bg-alt); border: 1px solid var(--border);
  text-decoration: none; font-size: .8rem; font-weight: 700; letter-spacing: .04em;
}
.lang-option { padding: .3em .75em; border-radius: 999px; color: var(--muted); transition: background .15s ease, color .15s ease; }
.lang-option.is-current { background: var(--primary); color: var(--primary-contrast); }
.lang-switch:hover .lang-option:not(.is-current) { color: var(--text); background: var(--surface); }

@media (max-width: 1100px) {
  .lang-switch { order: 0; margin-left: auto; margin-right: 4px; }
}
@media (prefers-reduced-motion: reduce) { .lang-option { transition: none; } }

/* ===== Portrait ===== */
.portrait {
  display: block; width: 168px; height: 168px; margin-bottom: 24px;
  border-radius: 50%; object-fit: cover;
  border: 4px solid var(--surface); box-shadow: var(--shadow);
}
@media (max-width: 720px) { .portrait { width: 128px; height: 128px; } }
