/* WDS : schemas electriques BMW, diolum.fr (interface reprise de l'archive EBA) */
:root {
  --bg: #e9ecef;
  --surface: #ffffff;
  --ink: #15202e;
  --muted: #5b6878;
  --line: #cbd2da;
  --line-soft: #e2e6eb;
  --accent: #1f5fae;
  --accent-ink: #ffffff;
  --accent-soft: #dfe9f6;
  --plate-a: #f8f9fa;
  --plate-b: #dde2e7;
  --plate-edge: #a9b3be;
  --rivet: #8f9aa6;
  --focus: #e08a00;
  --din: "DIN Alternate", "DIN Next", "D-DIN", "Bahnschrift", "Barlow Semi Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d;
    --surface: #1a2129;
    --ink: #e4e9ef;
    --muted: #97a3b1;
    --line: #2f3a46;
    --line-soft: #252e38;
    --accent: #6ea2e6;
    --accent-ink: #0d1520;
    --accent-soft: #1e3150;
    --plate-a: #2a333d;
    --plate-b: #1d242c;
    --plate-edge: #46525f;
    --rivet: #5f6c7a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.wds {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--body); min-height: 100vh; display: flex; flex-direction: column;
}
body.wds a { color: var(--accent); }
body.wds :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; }

/* En-tete */
.top-wrap { background: var(--surface); border-bottom: 1px solid var(--line); }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px); max-width: 1440px; width: 100%; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink) !important; text-decoration: none; min-width: 0; }
.brand-mark { width: 40px; height: 28px; flex: none; }
.brand-mark rect { fill: var(--plate-a); stroke: var(--plate-edge); stroke-width: 1.5; }
.brand-mark circle { fill: var(--rivet); }
.brand-mark path { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-family: var(--din); font-size: 1.3rem; font-weight: 700; letter-spacing: .01em; }
.brand-sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 14px; flex: none; }
.site { font-family: var(--din); font-size: .95rem; color: var(--muted) !important; text-decoration: none; }
.site:hover { color: var(--accent) !important; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex: none; }
.lang a { font-family: var(--din); font-size: .95rem; padding: 5px 11px; text-decoration: none; color: var(--muted) !important; }
.lang a + a { border-left: 1px solid var(--line); }
.lang a:hover { background: var(--accent-soft); color: var(--ink) !important; }
.lang a[aria-current="true"] { background: var(--ink); color: var(--bg) !important; }

/* Contenu */
main.page { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 22px clamp(16px, 4vw, 40px) 56px; }
main.narrow { max-width: 1240px; }
.wds h1, .wds h2 { font-family: var(--din); font-weight: 700; line-height: 1.15; margin: 0; }
.wds h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); letter-spacing: -.005em; }
.wds h2 { font-size: 1.25rem; margin: 34px 0 14px; }
.kicker { font-family: var(--din); font-size: .98rem; color: var(--accent); margin: 0 0 4px; letter-spacing: .02em; }
.lead { color: var(--muted); max-width: 66ch; margin: 10px 0 0; }
.intro { margin-bottom: 22px; }

/* Fil d'Ariane */
.crumbs { margin: 0 0 16px; font-size: .9rem; color: var(--muted); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 0; }
.crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.crumbs li + li::before { content: "›"; padding: 0 7px; color: var(--plate-edge); }
.crumbs a { color: var(--muted) !important; text-decoration: none; border-radius: 4px; padding: 1px 3px; }
.crumbs a:hover { color: var(--accent) !important; background: var(--accent-soft); }
.crumbs li:last-child a { color: var(--ink) !important; font-weight: 600; }

/* Colonnes de navigation */
.cols {
  display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; padding: 2px 2px 14px;
  scroll-snap-type: x proximity; scrollbar-width: thin;
}
.cols ul.list {
  flex: 0 0 240px; list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05); scroll-snap-align: start;
}
.cols ul.list:last-child { flex-basis: 380px; }
.cols ul.list > li { margin: 0; }
.cols ul.list > li > a, .cols ul.list > li > b, .cols ul.list > li > s {
  display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px; border-radius: 6px;
  font-size: .92rem; line-height: 1.32; text-decoration: none; color: var(--ink) !important; font-weight: 400;
}
.cols ul.list > li > a:hover { background: var(--accent-soft); color: var(--accent) !important; }
.cols ul.list > li > b { background: var(--accent); color: var(--accent-ink) !important; font-weight: 600; }
.cols ul.list > li > s { text-decoration: none; color: var(--muted) !important; opacity: .6; }
.cols ul.list > li > a::before, .cols ul.list > li > b::before {
  content: ""; flex: none; width: 15px; height: 15px; margin-top: 2px; background: currentColor; opacity: .55;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.cols ul.list > li > a:not([class*="img"]), .cols ul.list > li > b { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%203.5L10.5%208%206%2012.5%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a:not([class*="img"])::before, .cols ul.list > li > b::before { order: 2; margin-left: auto; }
.cols ul.list > li > b::before { opacity: .9; }
.cols ul.list > li > a.img11 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M1.5%208h3l1.5-3.5%203%207%201.5-3.5h4%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a.img13 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%222%22%20y%3D%223%22%20width%3D%2212%22%20height%3D%2210%22%20rx%3D%221.5%22/%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%222%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a.img15 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%224%22%20width%3D%2210%22%20height%3D%228%22%20rx%3D%221%22/%3E%3Cpath%20d%3D%22M6%204V2M10%204V2M6%209h4%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a.img17 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M8%202v7M5.5%209h5l-1%205h-3z%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a.img19 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%2013l3-8%203%205%202-3%202%206%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a.img21 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226%22/%3E%3Cpath%20d%3D%22M6.3%206.2a1.9%201.9%200%201%201%202.6%201.8c-.6.3-.9.7-.9%201.3v.4M8%2011.6v.1%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a.img23 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%208.5l3%203%207-7%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a.img25 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%201.8h5.5L12.5%205v9.2H4z%22/%3E%3Cpath%20d%3D%22M9.5%201.8V5h3M6%208h4.5M6%2010.5h4.5%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a.img27 { --ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%228%22%20cy%3D%229%22%20r%3D%225%22/%3E%3Cpath%20d%3D%22M8%209l2.5-2.5M8%202v2%22/%3E%3C/svg%3E"); }
.cols ul.list > li > a[class*="img"]::before { opacity: .8; color: var(--accent); }
.cols ul.list > li > a[class*="img"]:hover::before { opacity: 1; }
.filter {
  display: block; width: 100%; margin: 2px 0 6px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--ink); font: .9rem var(--body);
}
.filter:focus { outline: none; border-color: var(--accent); }
.nomatch { padding: 6px 10px; color: var(--muted); font-size: .88rem; }
@media (max-width: 760px) {
  .cols { display: block; overflow: visible; }
  .cols ul.list { display: none; }
  .cols ul.list:last-child { display: block; }
  .top .brand-sub { display: none; }
  .site { display: none; }
}

/* Cartes (langues, modeles) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 15px;
  background: linear-gradient(180deg, var(--plate-a), var(--plate-b)); border: 1px solid var(--plate-edge);
  border-radius: 8px; text-decoration: none; color: var(--ink) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 1px 2px rgba(16, 24, 40, .06);
  transition: transform .12s, border-color .12s;
}
.card::before, .card::after {
  content: ""; position: absolute; top: 8px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--rivet); box-shadow: 0 calc(100% + 0px) 0 0 transparent;
}
.card::before { left: 8px; } .card::after { right: 8px; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .pic { display: flex; align-items: center; justify-content: center; height: 96px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 5px; overflow: hidden; }
.card .pic img { max-width: 100%; height: auto; }
.card .series { font-family: var(--din); font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.card .codes { font-family: var(--din); font-size: 1.05rem; color: var(--accent); }
.card .years { font-size: .86rem; color: var(--muted); }
.card .code-badge {
  align-self: flex-start; font-family: var(--din); font-size: 1.5rem; font-weight: 700; padding: 2px 12px;
  border: 2px solid var(--ink); border-radius: 6px; letter-spacing: .04em;
}
.card .name { font-family: var(--din); font-size: 1.3rem; font-weight: 700; }
.card .desc { font-size: .9rem; color: var(--muted); }

/* Documents techniques */
body.wds.doc main.page { max-width: 980px; }
.doc-body {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: clamp(18px, 3vw, 34px);
  overflow-x: auto;
}
.doc-body, .doc-body p, .doc-body li, .doc-body td, .doc-body th { font-family: var(--body) !important; color: var(--ink) !important; font-size: .98rem; line-height: 1.55; }
.doc-body h1, .doc-body h2, .doc-body h3, .doc-body h4 { font-family: var(--din) !important; color: var(--ink) !important; margin: 1.1em 0 .5em; }
.doc-body h1 { font-size: 1.7rem; margin-top: 0; }
.doc-body table { border-collapse: collapse; margin: 14px 0; max-width: 100%; background: var(--surface); }
.doc-body td, .doc-body th { border: 1px solid var(--line) !important; padding: 7px 10px !important; vertical-align: top; }
.doc-body tr:first-child td, .doc-body th { background: var(--accent-soft); }
.doc-body img { max-width: 100%; height: auto; background: #fff; border-radius: 4px; }
.doc-body a { color: var(--accent); }
/* accueil : versions et avertissement */
.versions { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin: 10px 0 18px; }
.versions section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.versions h3 { font-family: var(--din); font-size: 1.05rem; margin: 0 0 8px; color: var(--ink); }
.versions p { margin: 0 0 8px; color: var(--muted); font-size: .95rem; }
.versions ul { margin: 0; padding-left: 1.1em; }
.versions li { margin: 2px 0; font-size: .95rem; }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); color: var(--ink); padding: 14px 18px; border-radius: 6px; margin: 22px 0; line-height: 1.55; }
/* les fiches BMW imposent un fond blanc et des couleurs fixes a chaque element : on les neutralise (illisible en mode sombre) */
.doc-body *:not(img):not(svg) { background-color: transparent !important; background-image: none !important; }
.doc-body tr:first-child td, .doc-body th { background-color: var(--accent-soft) !important; }
.doc-body img { background-color: #fff !important; }
@media (prefers-color-scheme: dark) {
  .doc-body *:not(a):not(img) { color: var(--ink) !important; }
  .doc-body a, .doc-body a * { color: var(--accent) !important; }
}
.toolbar { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--ink) !important; text-decoration: none;
  font: .92rem var(--din); cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent) !important; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) !important; }

/* Visionneuse de schemas */
body.wds.viewer { height: 100vh; overflow: hidden; }
.v-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px clamp(12px, 3vw, 28px);
  background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.v-title { flex: 1; min-width: 200px; font-family: var(--din); font-size: 1.02rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-hint { color: var(--muted); font-size: .82rem; }
.v-zone { flex: 1; position: relative; background: #fff; }
.v-zone object { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.v-ctl { display: flex; gap: 6px; }
@media (max-width: 760px) { .v-hint { display: none; } .v-title { order: -1; flex-basis: 100%; } }

/* Pages d'information (composant sans fiche, choix, erreur) */
.notice {
  max-width: 620px; margin: 6vh auto 0; padding: 30px 30px 26px; text-align: center;
  background: linear-gradient(180deg, var(--plate-a), var(--plate-b)); border: 1px solid var(--plate-edge); border-radius: 8px;
}
.notice .code { display: inline-block; margin-bottom: 14px; padding: 4px 14px; border: 2px solid var(--ink); border-radius: 6px; font: 700 1.2rem var(--din); letter-spacing: .04em; }
.notice h1 { font-size: 1.5rem !important; margin-bottom: 10px !important; }
.notice p { color: var(--muted); margin: 0 0 8px; }
.notice .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.notice ul { list-style: none; padding: 0; margin: 18px 0 0; text-align: left; }
.notice li a { display: block; padding: 9px 12px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink) !important; }
.notice li a:hover { border-color: var(--accent); color: var(--accent) !important; }

/* Pied de page */
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.foot div { max-width: 1440px; margin: 0 auto; padding: 14px clamp(16px, 4vw, 40px); display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.foot a { color: var(--muted) !important; }
@media print { .top-wrap, .foot, .toolbar, .crumbs { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
