@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono&family=Lexend:wght@400;700&family=Rowdies&display=swap");
/* Atelier Douze — composants ds-* du site (docs/design/design-system.md §10-12).
   Les valeurs viennent toutes de tokens.css (copie générée de design/tokens/build/tokens.css). */

/* ---------- Polices : fichiers officiels (OFL) servis par Google Fonts, aucune copie du client ---------- */

:root {
    color-scheme: dark;
    --gutter: var(--ds-space-5);
    --page: 1120px;
    --ring: 0 0 0 var(--ds-border-strong) var(--ds-color-semantic-focus);
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { color-scheme: light; } }
:root[data-theme="light"] { color-scheme: light; }
@media (min-width: 720px) { :root { --gutter: var(--ds-space-7); } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--ds-color-semantic-bg);
    color: var(--ds-color-semantic-text);
    font-family: var(--ds-font-family-text);
    font-size: var(--ds-font-size-lg);
    line-height: var(--ds-font-line-height-normal);
    overflow-x: hidden;
}
/* Motif « plan technique » : gabarit de cellule 86 × 43 en traits blueprint (§7). */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(26.565deg, transparent 0 37.46px, var(--ds-color-semantic-blueprint) 37.46px 38.46px),
        repeating-linear-gradient(-26.565deg, transparent 0 37.46px, var(--ds-color-semantic-blueprint) 37.46px 38.46px);
    -webkit-mask-image: radial-gradient(ellipse 90% 60% at 70% 0%, #000 0%, transparent 75%);
    mask-image: radial-gradient(ellipse 90% 60% at 70% 0%, #000 0%, transparent 75%);
}
main { flex: 1; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--ds-color-semantic-primary); text-underline-offset: 0.18em; }
a:hover { color: var(--ds-color-semantic-primary-hover); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--ds-radius-md); }
h1, h2, h3 {
    font-family: var(--ds-font-family-display);
    font-weight: 400;
    line-height: var(--ds-font-line-height-tight);
    letter-spacing: -0.01em;
    margin: 0 0 var(--ds-space-4);
    color: var(--ds-color-semantic-title);
}
h1 { font-size: clamp(var(--ds-font-size-3xl), 7vw, var(--ds-font-size-5xl)); }
h2 { font-size: clamp(var(--ds-font-size-2xl), 4vw, var(--ds-font-size-3xl)); }
h3 { font-size: var(--ds-font-size-xl); color: var(--ds-color-semantic-text); }
p { margin: 0 0 var(--ds-space-5); }
code, .mono { font-family: var(--ds-font-family-mono); font-size: 0.9em; }
code { background: var(--ds-color-semantic-surface-2); padding: 0 var(--ds-space-2); border-radius: var(--ds-radius-xs); overflow-wrap: anywhere; }
.muted { color: var(--ds-color-semantic-text-muted); }
.measure { max-width: var(--ds-size-measure); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: var(--gutter); top: -100px; z-index: 100; }
.skip-link:focus { top: var(--ds-space-3); }

.wrap { width: 100%; max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--ds-space-8) 0; }
@media (min-width: 720px) { .section { padding: var(--ds-space-9) 0; } }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--ds-space-3) var(--ds-space-5); margin-bottom: var(--ds-space-6); }
.section__head h2 { margin: 0; }
.eyebrow { display: flex; align-items: center; gap: var(--ds-space-3); margin-bottom: var(--ds-space-4); }

/* ---------- Signature « règle » graduée (§6) ---------- */
.ds-ruler {
    height: 4px;
    border-top: 1px solid var(--ds-color-semantic-border-subtle);
    background-image: repeating-linear-gradient(90deg, var(--ds-color-semantic-border-subtle) 0 1px, transparent 1px 8px);
    background-size: 100% 3px;
    background-repeat: no-repeat;
}

/* ---------- En-tête ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--ds-color-semantic-band-strong);
    border-bottom: 1px solid var(--ds-color-semantic-border-subtle);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.site-header__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-3) var(--ds-space-5); padding-top: var(--ds-space-3); padding-bottom: var(--ds-space-3); }
.brand { display: flex; align-items: center; gap: var(--ds-space-4); color: var(--ds-color-semantic-text); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--ds-color-semantic-text); }
.brand__logo { width: 150px; height: auto; flex: none; --brand-accent: var(--ds-color-semantic-title); }
.brand__sig { font-size: var(--ds-font-size-xs); color: var(--ds-color-semantic-text-muted); line-height: var(--ds-font-line-height-snug); max-width: 22ch; display: none; }
@media (min-width: 900px) { .brand__sig { display: block; } }
.site-nav { order: 3; width: 100%; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--ds-space-1); }
.site-nav a {
    display: flex; align-items: center; min-height: var(--ds-size-control-lg);
    padding: 0 var(--ds-space-4);
    color: var(--ds-color-semantic-text-muted);
    text-decoration: none; font-size: var(--ds-font-size-md); font-weight: 700;
    border-bottom: 2px solid transparent;
    transition: color var(--ds-motion-duration-fast) var(--ds-motion-easing-out), border-color var(--ds-motion-duration-fast) var(--ds-motion-easing-out);
}
.site-nav a:hover { color: var(--ds-color-semantic-text); }
.site-nav a[aria-current="page"] { color: var(--ds-color-semantic-text); border-bottom-color: var(--ds-color-semantic-primary); }
.site-header__tools { margin-left: auto; display: flex; gap: var(--ds-space-3); }
@media (max-width: 719px) {
    .site-nav ul { justify-content: space-between; }
    .site-nav a { padding: 0 var(--ds-space-3); }
}
@media (min-width: 720px) {
    .site-nav { order: 0; width: auto; margin-left: auto; }
    .site-header__tools { margin-left: 0; }
}

/* ---------- Bouton (§10) ---------- */
.ds-button {
    --b-bg: var(--ds-color-semantic-surface-3);
    --b-bg-hover: var(--ds-color-semantic-border);
    --b-fg: var(--ds-color-semantic-text);
    --b-bd: var(--ds-color-semantic-border);
    display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-3);
    min-height: var(--ds-size-control-lg); min-width: 96px;
    padding: 6px var(--ds-space-5);
    font: 700 var(--ds-font-size-md) / 1 var(--ds-font-family-text);
    color: var(--b-fg); background: var(--b-bg);
    border: 1px solid var(--b-bd); border-radius: var(--ds-radius-md);
    text-decoration: none; cursor: pointer;
    transition: background-color var(--ds-motion-duration-fast) var(--ds-motion-easing-out), scale var(--ds-motion-duration-fast) var(--ds-motion-easing-out);
}
.ds-button:hover { background: var(--b-bg-hover); color: var(--b-fg); scale: 1.02; }
.ds-button:active { scale: 0.97; transition-duration: var(--ds-motion-duration-instant); }
.ds-button:disabled, .ds-button[aria-disabled="true"] { opacity: var(--ds-opacity-disabled); pointer-events: none; }
.ds-button--primary { --b-bg: var(--ds-color-semantic-primary); --b-bg-hover: var(--ds-color-semantic-primary-hover); --b-fg: var(--ds-color-semantic-primary-text); --b-bd: var(--ds-color-semantic-primary-pressed); }
.ds-button--primary:active { background: var(--ds-color-semantic-primary-pressed); }
.ds-button--ghost { --b-bg: transparent; --b-bg-hover: var(--ds-color-semantic-focus-soft); --b-bd: transparent; }
.ds-button--lg { min-height: 52px; padding: 0 var(--ds-space-6); font-size: var(--ds-font-size-lg); }
.ds-icon-button { min-width: var(--ds-size-control-lg); width: var(--ds-size-control-lg); padding: 0; }
.ds-icon-button svg { width: var(--ds-size-icon); height: var(--ds-size-icon); fill: currentColor; }
.button-row { display: flex; flex-wrap: wrap; gap: var(--ds-space-3); }

/* ---------- Étiquette d'expérience, pastilles (§10) ---------- */
.ds-tag {
    display: inline-block; padding: 1px 6px;
    font: 700 var(--ds-font-size-xs) / 1.4 var(--ds-font-family-text);
    letter-spacing: 0.08em; text-transform: uppercase;
    background: var(--ds-color-semantic-surface-3); color: var(--ds-color-semantic-text);
    border-radius: var(--ds-radius-xs);
}
.ds-badge {
    display: inline-flex; align-items: center; gap: var(--ds-space-2);
    padding: 1px 7px; border-radius: var(--ds-radius-pill);
    font: 700 var(--ds-font-size-2xs) / 1.5 var(--ds-font-family-text);
    background: var(--ds-color-semantic-surface-3); color: var(--ds-color-semantic-text);
}
.ds-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ds-badge--success { color: var(--ds-color-semantic-success); background: color-mix(in srgb, var(--ds-color-semantic-success) 14%, transparent); }
.ds-badge--muted { color: var(--ds-color-semantic-text-muted); }
.ds-badge--info { color: var(--ds-color-semantic-info); background: color-mix(in srgb, var(--ds-color-semantic-info) 14%, transparent); }
.ds-badge--accent { color: var(--ds-color-semantic-text-inverse); background: var(--ds-color-semantic-title); }
.ds-badge--accent::before { display: none; }

/* ---------- Carte, panneau (§10) ---------- */
.ds-card {
    position: relative; display: flex; flex-direction: column; gap: var(--ds-space-4);
    padding: var(--ds-space-6);
    background: var(--ds-color-semantic-surface);
    border: 1px solid var(--ds-color-semantic-border);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-elevation-sm);
    transition: border-color var(--ds-motion-duration-fast) var(--ds-motion-easing-out), box-shadow var(--ds-motion-duration-fast) var(--ds-motion-easing-out);
}
.ds-card:hover { box-shadow: var(--ds-elevation-md); }
.ds-card--link:hover { border-color: var(--ds-color-semantic-focus); }
.ds-card h3 { margin: 0; }
.ds-card p { margin: 0; color: var(--ds-color-semantic-text-muted); }
.ds-card__top { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-3); }
.ds-card__foot { margin-top: auto; padding-top: var(--ds-space-3); }
.ds-card ul { margin: 0; padding-left: 1.1em; color: var(--ds-color-semantic-text-muted); font-size: var(--ds-font-size-md); }
.ds-panel {
    padding: var(--ds-space-5) var(--ds-space-6);
    background: var(--ds-color-semantic-surface);
    border: 1px solid var(--ds-color-semantic-border);
    border-left: 3px solid var(--ds-color-semantic-info);
    border-radius: var(--ds-radius-lg);
}
.ds-panel--accent { border-left-color: var(--ds-color-semantic-title); }
.ds-panel p:last-child { margin-bottom: 0; }
.grid { display: grid; gap: var(--ds-space-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }

/* ---------- Écran d'atelier (cadre de capture, §7) ---------- */
.ds-screen {
    position: relative; aspect-ratio: 16 / 9; overflow: hidden;
    background-color: var(--ds-color-semantic-bg-deep);
    background-image:
        repeating-linear-gradient(26.565deg, transparent 0 18.23px, var(--ds-color-semantic-blueprint) 18.23px 19.23px),
        repeating-linear-gradient(-26.565deg, transparent 0 18.23px, var(--ds-color-semantic-blueprint) 18.23px 19.23px);
    border: 1px solid var(--ds-color-semantic-border);
    border-radius: var(--ds-radius-xl);
    display: grid; place-items: center;
}
.ds-screen > .ds-tag { position: absolute; top: var(--ds-space-4); left: var(--ds-space-4); z-index: 1; }
.ds-screen__label {
    padding: var(--ds-space-2) var(--ds-space-4); border-radius: var(--ds-radius-sm);
    background: var(--ds-color-semantic-band-strong); color: var(--ds-color-semantic-text-muted);
    font-size: var(--ds-font-size-sm); text-align: center;
}
.ds-screen svg.blueprint { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--ds-color-semantic-primary); opacity: 0.55; }
figure { margin: 0; }
figcaption { margin-top: var(--ds-space-3); font-size: var(--ds-font-size-sm); color: var(--ds-color-semantic-text-muted); }

/* ---------- Héros ---------- */
.hero { padding: var(--ds-space-8) 0 var(--ds-space-7); }
.hero__grid { display: grid; gap: var(--ds-space-7); align-items: center; }
@media (min-width: 900px) { .hero__grid { grid-template-columns: 1.05fr 1fr; } }
.hero h1 { margin-bottom: var(--ds-space-5); }
.hero h1 span { color: var(--ds-color-semantic-text); }
.lead { font-size: var(--ds-font-size-xl); color: var(--ds-color-semantic-text); max-width: 46ch; }
.hero .button-row { margin-top: var(--ds-space-6); }
.facts { display: flex; flex-wrap: wrap; gap: var(--ds-space-3) var(--ds-space-6); margin: var(--ds-space-6) 0 0; padding: 0; list-style: none; font-size: var(--ds-font-size-sm); color: var(--ds-color-semantic-text-muted); }
.facts strong { display: block; font: 400 var(--ds-font-size-2xl) / 1.1 var(--ds-font-family-display); color: var(--ds-color-semantic-title); }

/* ---------- Barre de progression (§10) ---------- */
.ds-progress { position: relative; height: 12px; background: var(--ds-color-game-bar-bg); border: 1px solid var(--ds-color-semantic-border-subtle); border-radius: var(--ds-radius-lg); overflow: hidden; }
.ds-progress__fill { height: 100%; width: 0%; background: var(--ds-color-semantic-primary); border-radius: inherit; transition: width var(--ds-motion-duration-base) var(--ds-motion-easing-out); }
.ds-progress--thin { height: 4px; border-radius: var(--ds-radius-xs); }

/* ---------- Lecteur WebGL ---------- */
.player { display: flex; flex-direction: column; gap: var(--ds-space-4); }
.player__frame {
    position: relative; aspect-ratio: 16 / 9; width: 100%;
    background: var(--ds-color-semantic-bg-deep);
    border: 1px solid var(--ds-color-semantic-border);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-elevation-lg);
    overflow: hidden;
}
.player__frame canvas { width: 100%; height: 100%; background: #000; }
.player__frame:fullscreen { border-radius: 0; border: 0; }
.player__overlay {
    position: absolute; inset: 0; z-index: 2;
    display: grid; place-items: center; padding: var(--ds-space-5);
    background-color: var(--ds-color-semantic-bg-deep);
    background-image:
        repeating-linear-gradient(26.565deg, transparent 0 18.23px, var(--ds-color-semantic-blueprint) 18.23px 19.23px),
        repeating-linear-gradient(-26.565deg, transparent 0 18.23px, var(--ds-color-semantic-blueprint) 18.23px 19.23px);
    text-align: center;
}
.player__overlay[hidden] { display: none; }
.player__card {
    width: min(100%, 440px);
    display: flex; flex-direction: column; align-items: center; gap: var(--ds-space-4);
    padding: var(--ds-space-6);
    background: var(--ds-color-semantic-band-strong);
    border: 1px solid var(--ds-color-semantic-border-strong);
    border-radius: var(--ds-radius-lg);
}
.player__card .ds-ruler { align-self: stretch; }
.player__card h2 { margin: 0; font-size: var(--ds-font-size-2xl); }
.player__card p { margin: 0; font-size: var(--ds-font-size-md); color: var(--ds-color-semantic-text-muted); }
.player__card .ds-progress { align-self: stretch; }
.player__mark { width: 56px; height: 56px; --brand-accent: var(--ds-color-semantic-title); color: var(--ds-color-semantic-text); }
.player__state { font-family: var(--ds-font-family-mono); font-size: var(--ds-font-size-xs); color: var(--ds-color-semantic-text-muted); min-height: 1.5em; }
.player__error { color: var(--ds-color-semantic-danger-text) !important; }
.player__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ds-space-3); }
.player__meta { font-size: var(--ds-font-size-sm); color: var(--ds-color-semantic-text-muted); }
@media (max-width: 559px) {
    .player__frame { aspect-ratio: 4 / 5; }
    .player__card { padding: var(--ds-space-5) var(--ds-space-4); }
}
.keys { display: grid; gap: var(--ds-space-2) var(--ds-space-5); grid-template-columns: auto 1fr; margin: 0; font-size: var(--ds-font-size-md); }
.keys dt { justify-self: start; }
.keys dd { margin: 0; color: var(--ds-color-semantic-text-muted); }
kbd {
    display: inline-block; min-width: 2em; padding: 1px 6px; text-align: center;
    font: 700 var(--ds-font-size-xs) / 1.5 var(--ds-font-family-text);
    background: var(--ds-color-semantic-surface-2); color: var(--ds-color-semantic-text);
    border: 1px solid var(--ds-color-semantic-border); border-bottom-width: 2px; border-radius: var(--ds-radius-md);
}

/* ---------- Texte long (mentions, carnet) ---------- */
.prose > * { max-width: var(--ds-size-measure); } /* lines capped, block stays left-aligned with the page grid (.wrap keeps its width) */
.prose h2 { margin-top: var(--ds-space-8); }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2em; margin: 0 0 var(--ds-space-5); }
.prose li { margin-bottom: var(--ds-space-2); }
.page-head { padding: var(--ds-space-8) 0 var(--ds-space-6); }
.page-head p { max-width: var(--ds-size-measure); color: var(--ds-color-semantic-text-muted); font-size: var(--ds-font-size-xl); margin: 0; }
.todo { color: var(--ds-color-semantic-warning); font-style: normal; font-weight: 700; }

/* Carnet d'atelier */
.log { list-style: none; margin: 0; padding: 0; max-width: var(--ds-size-measure); }
.log__entry { position: relative; padding: 0 0 var(--ds-space-7) var(--ds-space-6); border-left: 1px solid var(--ds-color-semantic-border); }
.log__entry:last-child { padding-bottom: 0; }
.log__entry::before {
    content: ""; position: absolute; left: -7px; top: 6px; width: 13px; height: 13px;
    background: var(--ds-color-semantic-bg); border: 2px solid var(--ds-color-semantic-title);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.log__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--ds-space-2) var(--ds-space-4); margin-bottom: var(--ds-space-3); }
.log__version { font-family: var(--ds-font-family-mono); font-size: var(--ds-font-size-xl); color: var(--ds-color-semantic-title); }
.log__date { font-family: var(--ds-font-family-mono); font-size: var(--ds-font-size-sm); color: var(--ds-color-semantic-text-muted); }
.log__entry h2 { font-size: var(--ds-font-size-2xl); color: var(--ds-color-semantic-text); margin-bottom: var(--ds-space-3); }
.log__entry ul { margin: 0; padding-left: 1.2em; color: var(--ds-color-semantic-text-muted); }
.log__entry li { margin-bottom: var(--ds-space-2); }

/* ---------- Pied de page ---------- */
.site-footer { margin-top: var(--ds-space-8); background: var(--ds-color-semantic-bg-deep); border-top: 1px solid var(--ds-color-semantic-border-subtle); font-size: var(--ds-font-size-sm); color: var(--ds-color-semantic-text-muted); }
.site-footer__grid { display: grid; gap: var(--ds-space-6); padding-top: var(--ds-space-7); padding-bottom: var(--ds-space-7); }
@media (min-width: 720px) { .site-footer__grid { grid-template-columns: 2fr 1fr; } }
.site-footer p { margin: 0 0 var(--ds-space-3); max-width: 70ch; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--ds-space-2) var(--ds-space-5); }
.site-footer__mark { width: 40px; height: 40px; margin-bottom: var(--ds-space-4); --brand-accent: var(--ds-color-semantic-title); color: var(--ds-color-semantic-text); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; scroll-behavior: auto !important; }
}

/* ---------- Logo en ligne (couleurs pilotées par les jetons, §2) ---------- */
.lg { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lg-m { stroke: currentColor; stroke-width: 3.33333; }
.lg-a { stroke: var(--brand-accent, var(--ds-color-semantic-title)); stroke-width: 3.33333; }
.lg-h { stroke: currentColor; stroke-width: 3; }
.lg-r { stroke: currentColor; stroke-width: 2; }
.lg-t { stroke: currentColor; stroke-width: 1.5; }
