/* Identité de wpflow (celle de la démo WPF) : atelier sombre, marine, menthe (signal) et bleu ciel (réglage). */
:root {
    --ink: #0B1A2B;
    --panel: #10263F;
    --panel-border: #1F456B;
    --navy: #163C61;
    --blue: #1B96E6;
    --sky: #5FBDF8;
    --mint: #57DFA9;
    --text: #EAF3FC;
    --muted: #90ADCB;
    --code-bg: #071320;
    --display: Bahnschrift, "DIN Alternate", "Segoe UI", system-ui, sans-serif;
    --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
    --bar: 56px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--bar) + 16px); }
body { margin: 0; background: var(--ink); color: var(--text); font: 15px/1.65 "Segoe UI", system-ui, sans-serif; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.25; }
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
kbd { border: 1px solid var(--panel-border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
[hidden] { display: none !important; }

.loading { padding: 64px 24px; text-align: center; color: var(--muted); }
#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; padding: 12px 24px; background: #5c1f2e; }

/* ---- Bandeau ---- */
.site-bar {
    position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 24px; height: var(--bar);
    padding: 0 24px; background: rgba(11, 26, 43, .96); border-bottom: 1px solid var(--panel-border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--muted); font: 20px var(--display); }
.brand:hover { text-decoration: none; color: var(--text); }
/* Pastille claire : le carré marine du logo, transparent, se perdrait sur le fond. */
.brand-logo { display: flex; padding: 3px; border-radius: 7px; background: var(--text); }
.site-bar nav { display: flex; gap: 20px; margin-left: auto; overflow-x: auto; white-space: nowrap; }
.site-bar nav a { color: var(--muted); font-family: var(--display); }
.site-bar nav a.active { color: var(--mint); }

/* ---- Accueil ---- */
.home { max-width: 1200px; margin: 0 auto; padding: 0 24px 32px; }
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 40px; padding: 32px 0 20px; }
.hero h1 { margin: 0; font-size: clamp(30px, 4.4vw, 46px); }
.hero h1 span { color: var(--mint); }
.hero > :first-child { flex: 1 1 460px; }
.hero-side { flex: 0 1 310px; color: var(--muted); }
.hero-side p { margin: 0 0 12px; }
.button { display: inline-block; margin: 0 8px 8px 0; padding: 7px 16px; border: 1.5px solid var(--sky); border-radius: 6px; font-family: var(--display); }
.button:hover { background: rgba(95, 189, 248, .12); text-decoration: none; }
.button.quiet { border-color: var(--panel-border); color: var(--text); }
.hero-note { color: var(--muted); font-size: 13px; text-align: center; }

.hero-flow { position: relative; height: min(600px, 74vh); min-height: 380px; border: 1px solid var(--panel-border); border-radius: 12px; overflow: hidden; }
.hero-reconnect {
    position: absolute; right: 14px; top: 14px; z-index: 10; padding: 6px 14px; border: 0; border-radius: 6px;
    background: var(--mint); color: var(--ink); font: 600 13px var(--display); cursor: pointer;
}
.hero-flow .wf-edge .wf-edge-path { stroke-width: 2; stroke-dasharray: 10 6; }
.hero-flow .wf-edge.wf-selected .wf-edge-path { stroke: var(--sky); stroke-width: 3; }
.hero-flow .wf-edge-animated .wf-edge-path { animation-name: hero-dash; animation-duration: .8s; }
@keyframes hero-dash { to { stroke-dashoffset: -16; } }
.hero-flow .wf-handle { width: 11px; height: 11px; background: var(--ink); border: 2.5px solid var(--mint); }
.hero-flow .wf-node.wf-selected::after { border-color: var(--sky); border-radius: 12px; }

.hero-card {
    position: relative; box-sizing: border-box; width: 180px; height: 82px; border: 1px solid var(--panel-border); border-radius: 10px; background: var(--panel);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .35); color: var(--text);
}
.hero-card header { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-bottom: 1px solid var(--panel-border); font: 600 11px var(--display); }
.hero-card header i { width: 6px; height: 6px; border-radius: 50%; background: var(--sky); }
.hero-card header i.mint { background: var(--mint); }
.hero-card header output { margin-left: auto; color: var(--muted); font: 10px var(--mono); }
.hero-body { display: flex; align-items: center; justify-content: center; gap: 2px; height: 52px; padding: 0 8px; }
.swatch { width: 17px; height: 17px; flex: none; padding: 0; border: 2px solid transparent; border-radius: 50%; cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--text); }
.segments { gap: 0; }
.segments button { flex: 1; padding: 4px 0; border: 0; background: var(--ink); color: var(--muted); font-size: 11px; cursor: pointer; }
.segments button:first-child { border-radius: 6px 0 0 6px; }
.segments button:last-child { border-radius: 0 6px 6px 0; }
.segments button[aria-pressed="true"] { background: var(--mint); color: var(--ink); font-weight: 600; }
.hero-body input[type="range"] { width: 100%; accent-color: var(--mint); }
.hero-render { display: flex; flex-direction: column; width: 100%; height: 100%; }
.hero-inputs { position: relative; flex: none; height: 18px; color: var(--muted); font-size: 8px; }
.hero-inputs span { position: absolute; width: 60px; margin-left: -31px; text-align: center; }
.hero-inputs span:nth-child(1) { left: 120px; }
.hero-inputs span:nth-child(2) { left: 180px; }
.hero-inputs span:nth-child(3) { left: 240px; }

.ring { display: block; flex: 1; width: 100%; min-height: 0; }
@media (prefers-reduced-motion: reduce) {
    .hero-flow .wf-edge-animated .wf-edge-path { animation: none; }
}

.packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 32px; }
.packages article { min-width: 0; padding: 4px 20px 20px; border: 1px solid var(--panel-border); border-radius: 10px; background: var(--panel); }
.packages h2 { font-size: 20px; }
.packages p { color: var(--muted); }
.packages pre { overflow-x: auto; padding: 8px 12px; border-radius: 6px; background: var(--code-bg); }
.home footer { margin-top: 32px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---- Documentation et exemples : menu à gauche ---- */
.doc, .examples { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; max-width: 1360px; margin: 0 auto; padding: 0 24px; }
.doc { grid-template-columns: 250px minmax(0, 1fr) 210px; }
.side, .doc-toc { position: sticky; top: var(--bar); align-self: start; max-height: calc(100vh - var(--bar)); overflow-y: auto; padding: 20px 0 32px; }
.side h2, .doc-toc h2 { margin: 18px 0 4px; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.side h2:first-child, .doc-toc h2:first-child { margin-top: 0; }
.side ul, .doc-toc ul { margin: 0; padding: 0; list-style: none; }
.side a { display: block; padding: 3px 10px; border-left: 2px solid var(--panel-border); color: var(--text); font-size: 14px; line-height: 1.45; }
.side a.active { border-left-color: var(--mint); background: var(--panel); color: var(--mint); }
.side-toggle { display: none; }
.doc-toc { font-size: 13px; line-height: 1.45; }
.doc-toc li { padding: 3px 0; }
.doc-toc li.level-3 { padding-left: 12px; }
.doc-toc a { color: var(--muted); }
.doc-body, .examples-body { min-width: 0; padding: 20px 0 64px; }

.markdown h1 { font-size: 32px; margin: 12px 0 16px; }
.markdown h2 { margin: 36px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--panel-border); font-size: 23px; }
.markdown h3 { margin: 26px 0 8px; font-size: 18px; }
.markdown code, .note code, .hint code, .hero-note code { padding: 1px 5px; border-radius: 4px; background: var(--panel); overflow-wrap: anywhere; }
.markdown pre, .example-code { overflow: auto; padding: 14px 16px; border: 1px solid var(--panel-border); border-radius: 8px; background: var(--code-bg); line-height: 1.5; }
.markdown pre code { padding: 0; background: none; overflow-wrap: normal; }
.markdown img { max-width: 100%; height: auto; border: 1px solid var(--panel-border); border-radius: 8px; }
.markdown blockquote { margin: 12px 0; padding: 0 16px; border-left: 3px solid var(--sky); color: var(--muted); }
.table-scroll { overflow-x: auto; margin: 12px 0; }
.markdown table, .ex-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.markdown th, .markdown td, .ex-table th, .ex-table td { padding: 6px 10px; border: 1px solid var(--panel-border); text-align: left; vertical-align: top; }
.markdown th, .ex-table th { background: var(--panel); }

.note { margin-bottom: 20px; padding: 2px 16px; border: 1px solid var(--panel-border); border-left: 3px solid var(--sky); border-radius: 6px; background: var(--panel); font-size: 14px; }
.note p { margin: 10px 0; }
.note-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.chip { padding: 2px 10px; border: 1px solid var(--panel-border); border-radius: 999px; background: var(--ink); }

.examples-body h1 { margin: 0; font-size: 30px; }
.lead { margin: 6px 0 0; font-size: 17px; }
.hint { color: var(--muted); font-size: 13px; }
.page-simple { max-width: 640px; margin: 0 auto; padding: 48px 24px; }

/* ---- Cadre d'un exemple ---- */
.example { margin: 18px 0; border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; }
.example-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px; background: var(--panel); font-size: 13px; }
.example-tabs { display: flex; gap: 4px; }
.example-bar button { padding: 3px 12px; border: 1px solid var(--panel-border); border-radius: 5px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.example-tabs button[aria-selected="true"] { border-color: var(--mint); background: var(--mint); color: var(--ink); font-weight: 600; }
.example-title { margin-right: auto; font-family: var(--display); }
.example-title em { margin-left: 6px; padding: 0 7px; border: 1px solid var(--sky); border-radius: 999px; color: var(--sky); font-size: 11px; font-style: normal; }
.example-stage { height: min(560px, 72vh); min-height: 420px; }
.example-stage.compact { height: 440px; min-height: 0; }
.example-code { max-height: min(560px, 72vh); margin: 0; border: 0; border-radius: 0; }

/* Les graphes des exemples prennent les couleurs du site ; « lib-theme » (exemple des thèmes) garde celles de la bibliothèque.
   Les mêmes valeurs servent au graphe de l'accueil. */
.example-stage .wf-flow:not(.lib-theme), .hero-flow .wf-flow {
    --wf-bg: var(--ink); --wf-dot: #1C3D60; --wf-node-bg: var(--panel); --wf-node-border: #2A5784; --wf-node-text: var(--text);
    --wf-node-selected: var(--sky); --wf-edge: var(--mint); --wf-edge-selected: var(--sky); --wf-handle: var(--mint);
    --wf-handle-bg: var(--ink); --wf-connect: var(--sky); --wf-panel-bg: var(--panel); --wf-panel-border: var(--panel-border);
    --wf-minimap-bg: #0E2137; --wf-minimap-node: #2A5784; --wf-minimap-node-selected: var(--sky); --wf-minimap-mask: rgba(6, 18, 32, .7);
    --wf-resize-accent: var(--sky);
}
.example-stage .wf-node-group { background: rgba(95, 189, 248, .07); }
.example-stage .wf-node-default, .example-stage .ex-card { border-radius: 8px; }

.ex { display: flex; flex-direction: column; height: 100%; }
.ex-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 12px; border-bottom: 1px solid var(--panel-border); font-size: 13px; }
.ex-toolbar button, .wf-toolbar button, .wf-selection-toolbar button {
    padding: 3px 10px; border: 1px solid var(--panel-border); border-radius: 5px; background: var(--panel); color: var(--text); font: inherit; cursor: pointer;
}
.ex-toolbar button:hover:not(:disabled) { border-color: var(--sky); }
.ex-toolbar button[aria-pressed="true"] { border-color: var(--mint); color: var(--mint); }
.ex-toolbar button:disabled { opacity: .5; cursor: default; }
.ex select, .ex textarea, .ex input:not([type="range"]):not([type="checkbox"]) {
    border: 1px solid var(--panel-border); border-radius: 5px; background: var(--code-bg); color: var(--text); font: inherit;
}
.ex input, .ex-card input { accent-color: var(--mint); }
.ex-flow { flex: 1; min-width: 0; min-height: 0; height: 100%; }
.ex .wf-flow { min-height: 0; }
.ex-split { display: flex; flex: 1; min-height: 0; height: 100%; }
.ex-log { width: 270px; margin: 0; padding: 8px 12px 8px 12px; overflow: auto; border-left: 1px solid var(--panel-border); list-style: none; font: 11px/1.5 var(--mono); }
.ex-log li { padding: 3px 0; border-bottom: 1px solid var(--panel); overflow-wrap: anywhere; }
.ex-text { width: 42%; padding: 8px; resize: none; font: 11px/1.45 var(--mono) !important; }
.ex-table { width: 42%; padding: 0 12px; overflow: auto; border-left: 1px solid var(--panel-border); font-size: 12px; }
.ex-table caption { padding: 8px 0; text-align: left; color: var(--muted); }
.ex-table input { width: 100%; min-width: 70px; }
.ex-status { margin: 0; padding: 6px 12px; border-top: 1px solid var(--panel-border); color: var(--muted); font-size: 12px; }
.ex-palette { width: 170px; padding: 0 12px; border-right: 1px solid var(--panel-border); font-size: 13px; }
.ex-chip { margin-bottom: 8px; padding: 8px 10px; border: 1px solid var(--navy); border-left: 3px solid var(--mint); border-radius: 6px; background: var(--panel); cursor: grab; }

.ex-card {
    position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 150px; max-width: 220px; padding: 10px 14px;
    border: 1px solid var(--wf-node-border); background: var(--wf-node-bg); color: var(--wf-node-text); font-size: 12px; text-align: center;
}
.ex-card input[type="number"] { display: block; width: 90px; margin: 4px auto 0; border: 1px solid var(--panel-border); border-radius: 4px; background: var(--code-bg); color: var(--text); }
.ex-fill { width: 100%; height: 100%; max-width: none; justify-content: center; }
.ex-grip { margin: -10px -14px 0; padding: 4px; background: var(--navy); cursor: grab; }

/* ---- Écrans étroits ---- */
@media (max-width: 1100px) {
    .doc { grid-template-columns: 230px minmax(0, 1fr); }
    .doc-toc { display: none; }
}
@media (max-width: 800px) {
    .hero-flow { height: 440px; }
    .site-bar { gap: 12px; padding: 0 12px; }
    .site-bar .brand-name { display: none; }
    .site-bar nav { gap: 14px; font-size: 13px; }
    .doc, .examples { display: block; padding: 0 12px; }
    .side { position: static; max-height: none; padding: 12px 0 0; }
    .side-toggle { display: block; width: 100%; padding: 8px; border: 1px solid var(--panel-border); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; }
    .side-content { display: none; margin-top: 12px; }
    .side-content.open { display: block; }
    .home { padding: 0 12px 24px; }
    .ex-split { flex-direction: column; }
    .ex-log, .ex-table, .ex-text { width: auto; height: 35%; border-left: 0; border-top: 1px solid var(--panel-border); }
    .ex-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: auto; border-right: 0; }
    .ex-palette p, .ex-chip { margin: 4px 0; }
}

/* ---- Code blocks: syntax colours and copy button ---- */
.markdown pre, .example-code { position: relative; }
.copy-code {
    position: absolute; top: 8px; right: 8px; padding: 3px 10px; font: inherit; font-size: .78em;
    border: 1px solid var(--panel-border); border-radius: 6px; background: var(--panel); color: var(--text);
    cursor: pointer; opacity: .75;
}
.copy-code:hover, .copy-code:focus-visible { opacity: 1; border-color: var(--mint); color: var(--mint); }
