/* MidiCore — feuille de style commune du site */

:root {
  --paper: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f3f0ea;
  --ink: #1d1b20;
  --ink-2: #4a463f;
  --muted: #6f6a61;
  --line: #e4dfd5;
  --accent: #8a6a2b;
  --accent-ink: #6d5220;
  --accent-soft: #f4ecdc;
  --ok: #2f7d4f;
  --ok-soft: #e8f3ec;
  --warn: #9a6512;
  --warn-soft: #fbf1df;
  --bad: #a23b3b;
  --bad-soft: #f8e7e7;
  --code-bg: #1f1d22;
  --code-ink: #e9e4d8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 27, 32, .04), 0 4px 16px rgba(29, 27, 32, .05);
  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --wrap: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121115; --surface: #19181d; --surface-2: #211f25;
    --ink: #ece8e1; --ink-2: #cdc7bd; --muted: #9c968c; --line: #2e2b31;
    --accent: #c9a84c; --accent-ink: #e2c77f; --accent-soft: #2a2418;
    --ok: #7ec89e; --ok-soft: #17261d; --warn: #e0b060; --warn-soft: #2a2215;
    --bad: #e08a8a; --bad-soft: #2c1a1a; --code-bg: #0d0c0f;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
strong, b { font-weight: 600; color: inherit; }
p { margin: 0 0 .9em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: .3em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- En-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { font: 700 23px/1 var(--font-serif); color: var(--ink); text-decoration: none; letter-spacing: .3px; white-space: nowrap; }
.brand span { color: var(--accent); }
.site-nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 11px; border-radius: 7px; white-space: nowrap;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.lang {
  font-size: 12px; font-weight: 600; letter-spacing: .5px; color: var(--muted);
  text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
}
.lang:hover { color: var(--ink); border-color: var(--ink-2); }
@media (max-width: 820px) {
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 6px; gap: 6px 12px; }
  .brand { order: 1; }
  .header-actions { order: 2; margin-left: auto; }
  .site-nav { order: 3; flex-basis: 100%; margin: 0 -8px; }
  .header-actions .button { display: none; }
}

/* ---------- Boutons ---------- */
.button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 8px;
  border: 1px solid var(--ink); white-space: nowrap;
}
.button:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button.ghost:hover { border-color: var(--ink); color: var(--ink); background: transparent; }
.button.small { font-size: 13px; padding: 7px 13px; }

/* ---------- Bandeau de page ---------- */
.page-hero { padding: 64px 0 40px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface) 0%, var(--paper) 100%); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.page-hero h1 {
  font: 600 clamp(34px, 5.2vw, 54px)/1.08 var(--font-serif);
  margin: 0 0 16px; letter-spacing: -.3px; max-width: 900px;
}
.page-hero .lead { font-size: 19px; color: var(--ink-2); max-width: 760px; margin: 0 0 10px; }
.page-hero .lead + .lead { font-size: 16px; color: var(--muted); }
.page-hero .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

/* Sommaire de page */
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 26px; }
.toc a {
  font-size: 13px; text-decoration: none; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface); padding: 5px 11px; border-radius: 999px;
}
.toc a:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Sections ---------- */
main { display: block; }
.block { padding: 56px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 72px; }
.block:last-child { border-bottom: 0; }
.block.alt { background: var(--surface); }
h2, .h2 {
  font: 600 clamp(28px, 3.4vw, 38px)/1.15 var(--font-serif);
  margin: 0 0 14px; letter-spacing: -.2px; color: var(--ink);
}
h3 { font-size: 18px; line-height: 1.35; font-weight: 600; margin: 1.6em 0 .5em; color: var(--ink); }
h4 { font-size: 15.5px; font-weight: 600; margin: 1.2em 0 .4em; color: var(--ink); }
h2 + h3, .card > h3:first-child, .card > h4:first-child { margin-top: 0; }
.muted, .sub { color: var(--muted); }
.block > .wrap > p.muted:first-of-type, .intro { font-size: 17px; max-width: 780px; }
[id] { scroll-margin-top: 80px; }

/* Article (fiche instrument, catégorie…) */
.entry {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 32px; margin: 0 0 28px; box-shadow: var(--shadow);
}
.entry > h2 { font-size: clamp(24px, 2.8vw, 30px); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.entry > .muted:first-of-type { margin-top: -4px; }
@media (max-width: 600px) { .entry { padding: 22px 18px; } }

/* ---------- Grilles et cartes ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin: 18px 0 22px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 20px 16px; min-width: 0;
}
.entry .card, .block.alt .card { background: var(--paper); }
.card > :last-child { margin-bottom: 0; }
.card h3, .card h4 { margin: 0 0 6px; font-size: 16px; }
.card p, .card li { font-size: 14.5px; color: var(--ink-2); }
.card .muted { font-size: 14px; }
.card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.stat-value { font: 600 30px/1.1 var(--font-serif); color: var(--accent-ink); margin-bottom: 4px; }

/* ---------- Encadrés ---------- */
.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px; margin: 16px 0; font-size: 15px; color: var(--ink-2);
}
.callout > :last-child { margin-bottom: 0; }
.callout.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.bad { border-left-color: var(--bad); background: var(--bad-soft); }
blockquote {
  margin: 16px 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--line);
  font: italic 400 19px/1.5 var(--font-serif); color: var(--ink-2);
}

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 16px 0 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table-wrap table { min-width: 560px; }
th {
  text-align: left; font-size: 12px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; background: var(--surface-2);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }
tr.highlight td, tr.group td { background: var(--accent-soft); }
tr.group td { font-weight: 600; color: var(--ink); }
td.yes { color: var(--ok); font-weight: 600; }
td.no { color: var(--bad); font-weight: 600; }
td.partial { color: var(--warn); font-weight: 600; }

/* ---------- Code ---------- */
pre.code {
  background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; font: 13px/1.6 var(--font-mono); margin: 14px 0 20px;
}
pre.code .c { color: #8d9a86; }
pre.code .k { color: #d8b86a; }
pre.code .n { color: #9fc2e6; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
pre code { background: none; padding: 0; }

/* ---------- Étiquettes ---------- */
.tag {
  display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.4;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); margin: 0 4px 4px 0; white-space: nowrap;
}

/* ---------- Étapes ---------- */
ol.steps { list-style: none; counter-reset: step; padding: 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 0 0 18px 48px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 14px;
  border: 1px solid var(--accent);
}

/* Évaluation par points (guide kazoo) */
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--accent); }
.dot.on-green { background: var(--ok); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ---------- Contact ---------- */
.contact-block { text-align: center; }
.contact-block h2 { margin-bottom: 8px; }
.contact-block p { color: var(--muted); max-width: 620px; margin: 0 auto 22px; }
.contact-block .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Pied de page ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 40px 0 34px; font-size: 14px; color: var(--muted); }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; margin-bottom: 26px; }
.site-footer h4 { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink); margin: 0 0 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--accent-ink); text-decoration: underline; }
.site-footer .legal { border-top: 1px solid var(--line); padding-top: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- Impression ---------- */
@media print {
  .site-header, .site-footer, .toc, .button { display: none !important; }
  body { background: #fff; color: #000; }
  .block { padding: 20px 0; }
  .entry, .card { box-shadow: none; break-inside: avoid; }
}

/* Avant / après */
.card .was { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--bad); margin-bottom: 6px; font-size: 14px; }
.card .now { color: var(--ink); font-weight: 600; margin: 0; }
.card .now::before { content: "→ "; color: var(--accent); }
.block .eyebrow + h2 { margin-top: 0; }

/* Frustration -> réponse */
.card .pain-q { font: italic 500 18px/1.4 var(--font-serif); color: var(--ink-2); margin-bottom: 10px; }
.card .pain-a { font-size: 14.5px; color: var(--ink-2); margin: 0; padding-top: 10px; border-top: 1px solid var(--line); }

/* Encadrés à l'intérieur d'une carte : version allégée */
.card .callout { background: transparent; border: 0; border-left: 2px solid var(--accent); border-radius: 0; padding: 2px 0 2px 12px; margin: 10px 0; font-size: 14px; }
.card .callout.ok { border-left-color: var(--ok); }
.card .callout.warn { border-left-color: var(--warn); }
.card .callout.bad { border-left-color: var(--bad); }
.entry .entry { box-shadow: none; }
p.eyebrow { margin-bottom: 6px; }
.page-hero .tag { margin-top: 6px; }

/* Plan du site */
ul.sitemap { list-style: none; padding: 0; margin: 0; }
ul.sitemap li { padding: 10px 0; border-top: 1px solid var(--line); margin: 0; font-size: 14.5px; }
ul.sitemap li:first-child { border-top: 0; padding-top: 0; }
ul.sitemap a { text-decoration: none; color: var(--ink); }
ul.sitemap a:hover strong { color: var(--accent-ink); }
.sitemap-langs { white-space: nowrap; }
.sitemap-langs .tag { text-decoration: none; margin: 0 0 0 4px; font-size: 11px; }

/* Schémas */
.diagram { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 20px 0; }
.diagram svg { width: 100%; height: auto; display: block; font-family: var(--font-sans); }
.diagram figcaption { font-size: 13.5px; color: var(--muted); text-align: center; margin-top: 10px; }
.dg-box { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; }
.dg-accent { fill: var(--accent-soft); stroke: var(--accent); }
.dg-wheel { fill: none; stroke: var(--accent); stroke-width: 3; }
.dg-hub, .dg-head { fill: var(--accent); }
.dg-line { stroke: var(--accent); stroke-width: 2; fill: none; }
.dg-t { fill: var(--ink); font-size: 13px; font-weight: 600; }
.dg-big { font-size: 15px; }
.dg-s { fill: var(--muted); font-size: 12px; }
