/* Composants du site, écrits uniquement avec les jetons Signature (assets/vendor/signature). */
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("../fonts/inter-tight-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/plex-mono-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 112px; color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 24px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cote); outline-offset: 2px; }
.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 16px; border-radius: var(--radius-md); z-index: 60; }
.skip:focus { left: 16px; }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; line-height: 20px; }
.lead { font-size: 18px; line-height: 28px; max-width: 62ch; margin: 0; }

/* Zone sous le pointeur : sur toute la page, jamais sur écran tactile ni en contraste fort */
.spot { position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: 0; background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--cote) 13%, transparent), transparent 70%); transition: opacity var(--dur-settle) var(--ease-settle); }
.spot.on { opacity: 1; }
@media (pointer: coarse) { .spot { display: none; } }
html[data-theme="contrast"] .spot { display: none; }

/* En-tête */
.site-head { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line-subtle); padding-top: env(safe-area-inset-top, 0px); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 24px; position: relative; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 24px; text-decoration: none; min-height: 48px; display: inline-flex; align-items: center; }
.nav { display: flex; flex-wrap: wrap; gap: 0 4px; order: 3; width: 100%; padding-bottom: 4px; }
.nav a { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 10px; text-decoration: none; font-weight: 500; font-size: 15px; white-space: nowrap; }
.nav a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 6px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-base) var(--ease-settle); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav .sep { align-self: center; flex: none; width: 1px; height: 20px; margin-left: auto; margin-right: 6px; background: var(--line-subtle); }
.nav a.ext { gap: 6px; color: var(--ink-muted); }
.nav a.ext:hover { color: var(--ink); }
.tools { display: flex; gap: 12px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-paper); }
.seg button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-muted); cursor: pointer; transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard); }
.seg button + button { border-left: 1px solid var(--line-subtle); }
.seg button:first-child { border-radius: 3px 0 0 3px; } .seg button:last-child { border-radius: 0 3px 3px 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg button:hover:not([aria-pressed="true"]) { background: var(--surface-sunken); color: var(--ink); }
.lang { font: 500 13px/16px var(--font-mono); display: inline-flex; gap: 2px; }
.lang a, .lang span { min-height: 40px; min-width: 32px; display: inline-grid; place-items: center; text-decoration: none; }
.lang span { color: var(--accent); border-bottom: 2px solid var(--accent); }
.lang a { color: var(--ink-muted); }
.lang a:hover { color: var(--ink); }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--cote); transform-origin: left; transform: scaleX(0); }

/* Titres de section en cote */
.sec { padding-block: 48px 8px; }
.sec h2, .hero h1, .prose h1 { margin: 0; text-wrap: balance; }
.sec .cote-rule { margin-bottom: 24px; }

/* Atomes */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: 600 15px/20px var(--font-ui); text-decoration: none; box-shadow: var(--shadow-paper); cursor: pointer; transition: border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard), box-shadow var(--dur-base) var(--ease-settle); }
.btn:hover { border-color: var(--cote); box-shadow: var(--shadow-lift); }
.btn svg { transition: transform var(--dur-base) var(--ease-settle); }
.btn:hover svg { transform: translateX(3px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.sm { font-size: 14px; padding: 0 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.stamp { --st: var(--inactif); --st-fond: var(--inactif-fond); display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; margin: 3px; border: 1px solid var(--st); outline: 1px solid var(--st); outline-offset: 2px; border-radius: var(--radius-sm); color: var(--st); background: var(--st-fond); font: 600 13px/16px var(--font-ui); }
.stamp.ok { --st: var(--ok); --st-fond: var(--ok-fond); }
.stamp.attn { --st: var(--attention); --st-fond: var(--attention-fond); }
.tag { display: inline-block; padding: 0 8px; border: 1px solid var(--line-subtle); border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-muted); font: 500 12px/20px var(--font-mono); }
.chip { min-height: 40px; padding: 0 14px; border: 1px solid var(--line-subtle); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); font: 500 14px/20px var(--font-ui); cursor: pointer; transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard); }
.chip:hover { border-color: var(--cote); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-paper); padding: 24px; transition: border-color var(--dur-base) var(--ease-settle), box-shadow var(--dur-base) var(--ease-settle), transform var(--dur-base) var(--ease-settle); }
.card.hover:hover { border-color: var(--cote); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.hatch { background: repeating-linear-gradient(135deg, var(--line-subtle) 0 1px, transparent 1px 7px), var(--surface-sunken); }

/* Hero */
.hero { position: relative; padding-block: 48px 24px; }
.hero h1 { margin: 0 0 16px; font-size: clamp(34px, 6vw, 48px); line-height: 1.1; }
.hero .eyebrow { display: block; color: var(--ink-muted); }
.hero-sm { padding-block: 40px 0; }
.hero-sm h1 { margin: 8px 0 16px; font-size: clamp(30px, 5vw, 36px); }
.hero .row { margin-top: 24px; }
.split .w { display: inline-block; }
.id-block { display: flex; align-items: center; gap: 24px; margin-bottom: 20px; }
.id-text { min-width: 0; }
.id-text h1 { margin: 0 0 6px; font-size: clamp(26px, 5.2vw, 48px); }
.hero .id-text .eyebrow { margin: 0; }
.avatar { position: relative; margin: 0; width: clamp(80px, 12vw, 112px); aspect-ratio: 1; flex: none; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; transform: scale(1.03); }
.avatar .cotes { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); fill: none; stroke: var(--cote); stroke-width: 2; pointer-events: none; stroke-dasharray: 1; }
.fiche { margin: 32px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 24px; max-width: 720px; }
.fiche div { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line-subtle); }
.fiche dt { color: var(--ink-muted); } .fiche dd { margin: 0; }

/* Mesures */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.metric { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.metric .val { display: flex; align-items: baseline; gap: 6px; }
.metric .unit { font: 400 14px/20px var(--font-ui); color: var(--ink-muted); }
.metrics-sm { margin-bottom: 24px; grid-template-columns: repeat(2, minmax(110px, 160px)) 1fr; align-items: stretch; }
.metrics-sm .note { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 0 0 0 8px; }
@media (max-width: 640px) { .metrics-sm { grid-template-columns: 1fr 1fr; } .metrics-sm .note { grid-column: 1 / -1; padding: 0; } }

/* Parcours */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-subtle); }
.timeline li { display: grid; grid-template-columns: 1fr; gap: 4px 16px; padding: 14px 8px; border-bottom: 1px solid var(--line-subtle); align-items: center; transition: background var(--dur-base) var(--ease-settle); }
.timeline li:hover { background: var(--surface); }
.timeline .where { color: var(--ink-muted); }
.timeline .stamp { justify-self: start; }
.timeline .heading { font-weight: 600; }
@media (min-width: 640px) { .timeline li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; } }

/* Publications et projets */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.grid3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.pub { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pub-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pub h3, .proj h3 { margin: 0; font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 600; text-wrap: balance; overflow-wrap: anywhere; }
.pub .meta { color: var(--ink-muted); margin: 0; overflow-wrap: anywhere; }
.pub .row { margin-top: auto; }
.year { margin: 32px 0 12px; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-weight: 500; font-size: 16px; }
.level { margin: 32px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); font: 600 18px/24px var(--font-ui); }
.proj { padding: 0; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.proj .shot { height: 140px; display: grid; place-items: center; border-bottom: 1px solid var(--line-subtle); color: var(--ink-muted); overflow: hidden; }
.proj .shot img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.proj .shot.logo { background: var(--surface); }
.proj .shot.logo img { width: auto; max-width: 78%; height: auto; max-height: 38%; object-fit: contain; }
.shot .t-dark { display: none; }
html[data-theme="dark"] .shot .t-light { display: none; }
html[data-theme="dark"] .shot .t-dark { display: block; }
.thumb .lk-bg { fill: var(--surface); } .thumb .lk-ln { stroke: var(--consommation); stroke-width: 1.5; }
.thumb .lk-neg2 rect { fill: url(#lk-h); stroke: var(--consommation); stroke-width: 1; }
.thumb .lk-neg1 rect { fill: var(--consommation); fill-opacity: .35; stroke: var(--consommation); stroke-width: 1; }
.thumb .lk-neu rect { fill: var(--surface-sunken); stroke: var(--line); stroke-width: 1; }
.thumb .lk-pos1 rect { fill: var(--production); fill-opacity: .35; stroke: var(--production); stroke-width: 1; }
.thumb .lk-pos2 rect { fill: var(--production); fill-opacity: .85; stroke: var(--production); stroke-width: 1; }
.thumb { display: block; width: 100%; height: 100%; }
.thumb .ln { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.thumb .ln.fl { fill: var(--surface); }
.thumb .gd { fill: none; stroke: var(--line-subtle); stroke-width: 1; }
.thumb .ct { fill: none; stroke: var(--cote); stroke-width: 1; }
.thumb .bus { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 2 4; }
.thumb .tx { font: 500 10px var(--font-mono); fill: var(--ink-muted); stroke: none; }
.thumb .acc { stroke: var(--accent); }
.thumb .ok { stroke: var(--ok); }
.thumb .prod { stroke: var(--production); }
.thumb .cons { stroke: var(--consommation); }
.thumb .stock { stroke: var(--stockage); }
.thumb .fx { fill: none; stroke-width: 2; stroke-linecap: round; }
.thumb .fx.prod { stroke-dasharray: 7 5; }
.thumb .fx.stock { stroke-dasharray: 1.5 6; stroke-width: 2.5; }
.thumb .mk { stroke: none; }
.thumb .mk.prod { fill: var(--production); } .thumb .mk.cons { fill: var(--consommation); } .thumb .mk.stock { fill: var(--stockage); }
.thumb .band { fill: color-mix(in srgb, var(--cote) 14%, transparent); stroke: none; }
.thumb .band2 { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: var(--accent); stroke-width: 1.5; }
.thumb .dsh1 { stroke-dasharray: 6 4; } .thumb .dsh2 { stroke-dasharray: 2 4; } .thumb .dsh3 { stroke-dasharray: 10 3 2 3; } .thumb .w2 { stroke-width: 2.5; }
.proj .body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.proj .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.proj .row { margin-top: auto; }
[hidden] { display: none !important; }

/* Enseignement, interventions */
.courses { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-subtle); }
.courses li { display: grid; grid-template-columns: 1fr; gap: 2px 24px; padding: 14px 8px 14px 12px; border-bottom: 1px solid var(--line-subtle); position: relative; transition: background var(--dur-base) var(--ease-settle); }
.courses li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform var(--dur-base) var(--ease-settle); }
.courses li:hover { background: var(--surface); }
.courses li:hover::before { transform: scaleY(1); }
.courses .yr { color: var(--ink-muted); }
.courses .t { font-weight: 600; }
@media (min-width: 640px) { .courses li { grid-template-columns: 110px minmax(0, 1fr) minmax(0, 0.8fr); align-items: baseline; } }

@media (min-width: 640px) { .courses-vol li { grid-template-columns: 56px minmax(0, 1fr) minmax(0, 0.7fr); } }
.vol { display: flex; flex-wrap: wrap; gap: 6px; }

/* Thèse */
.video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border: 1px solid var(--line-subtle); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-sunken); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Texte courant (pages de cours) */
.prose { padding-block: 40px 16px; max-width: 820px; }
.prose h1 { font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 600; margin: 40px 0 12px; }
.prose h1.page-title { font-size: clamp(30px, 5vw, 36px); line-height: 1.15; margin: 0 0 24px; }
.prose h2 { font-family: var(--font-display); font-size: 24px; line-height: 30px; font-weight: 600; margin: 32px 0 8px; }
.prose h3 { font-size: 18px; line-height: 24px; margin: 24px 0 8px; }
.prose p, .prose li { max-width: 72ch; }
.prose a { color: var(--cote); text-underline-offset: 3px; }
.prose a:hover { color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose img { height: auto; border-radius: var(--radius-md); }
.prose blockquote { margin: 16px 0; padding: 4px 16px; border-left: 2px solid var(--line); color: var(--ink-muted); }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line-subtle); padding: 6px 12px; text-align: left; }
.prose th { background: var(--surface-sunken); }
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-sunken); padding: 1px 5px; border-radius: var(--radius-sm); }
.prose pre { background: var(--surface-sunken); border: 1px solid var(--line-subtle); border-radius: var(--radius-md); padding: 12px 16px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.highlight .c, .highlight .c1, .highlight .cm { color: var(--ink-muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kt { color: var(--accent-strong); }
.highlight .s, .highlight .s1, .highlight .s2 { color: var(--production); }
.highlight .m, .highlight .mi, .highlight .mf { color: var(--consommation); }
.highlight .nf, .highlight .nc { color: var(--stockage); }
.highlight .o, .highlight .p { color: var(--ink); }

/* Pied de page */
.site-foot { margin-top: 64px; border-top: 1px solid var(--line); background: var(--surface-wood); }
.site-foot .wrap { padding-block: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px 32px; }
.site-foot .links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-foot .links a { display: inline-flex; align-items: center; min-height: 40px; }

/* Mouvement : décélère, ne rebondit jamais. Sous prefers-reduced-motion tout est immobile. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .card:hover .thumb .fx { animation: flow var(--dur-flow) linear infinite; }
  .rise { animation: settle-in var(--dur-settle) var(--ease-settle) both; animation-delay: calc(var(--i, 0) * 80ms); }
  .split .w { opacity: 0; animation: settle-in var(--dur-settle) var(--ease-settle) both; animation-delay: calc(var(--i) * 70ms + 120ms); }
  .avatar .cotes { stroke-dashoffset: 1; animation: trace calc(var(--dur-settle) * 3) var(--ease-settle) 500ms both; }
  @supports (animation-timeline: view()) {
    .reveal { animation: settle-in linear both; animation-timing-function: var(--ease-settle); animation-timeline: view(); animation-range: entry 0% entry 40%; }
    .cote-rule::after { transform-origin: left; animation: draw linear both; animation-timeline: view(); animation-range: entry 10% entry 70%; }
    .progress { animation: grow linear both; animation-timeline: scroll(root); }
  }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--dur-settle); animation-timing-function: var(--ease-settle); }
}
@keyframes flow { to { stroke-dashoffset: -24; } }
@keyframes settle-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes trace { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-settle: 0ms; --dur-flow: 0ms; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .avatar .cotes { stroke-dashoffset: 0; }
  .spot { display: none; }
}
@media print { .site-head, .spot, .site-foot .links, .skip { display: none; } .reveal, .rise { animation: none; } }
