/* TIS diolum.fr : même charte que WDS et EBA Archiv */
: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 {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--body); min-height: 100vh; display: flex; flex-direction: column;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr, .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-tête */
.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; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); 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: 1.8; 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: 16px; }
.site { font-family: var(--din); font-size: .95rem; color: var(--muted); text-decoration: none; }
.site:hover { color: var(--accent); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--ink); text-decoration: none;
  font: .98rem var(--din); cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.search-btn[aria-current="page"] { border-color: var(--accent); color: var(--accent); }

main.page {
  flex: 1; width: 100%; max-width: 1440px; margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 56px;
}
main:focus { outline: none; }
.loading { color: var(--muted); }
h1, h2, h3 { font-family: var(--din); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); letter-spacing: -.005em; }
h2 { font-size: 1.3rem; }
h2.sec { margin: 30px 0 4px; }
h3.brand-h { font-size: 1.05rem; color: var(--muted); margin: 18px 0 10px; letter-spacing: .04em; }
.kicker { font-family: var(--din); font-size: .98rem; color: var(--accent); margin: 0 0 4px; letter-spacing: .02em; }
.lead { color: var(--muted); max-width: 70ch; 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; align-items: center; }
.crumbs li + li::before { content: "›"; padding: 0 7px; color: var(--plate-edge); }
.crumbs a { color: var(--muted); text-decoration: none; border-radius: 4px; padding: 1px 3px; }
.crumbs a:hover { color: var(--accent); background: var(--accent-soft); }
.crumbs li:last-child span { color: var(--ink); font-weight: 600; }

/* Cartes (séries, modèles) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 15px;
  --rv: radial-gradient(circle at 38% 38%, rgba(255, 255, 255, .75) 0, var(--rivet) 2.3px, var(--rivet) 3px, transparent 3.6px);
  background:
    var(--rv) left 5px top 5px / 8px 8px no-repeat,
    var(--rv) right 5px top 5px / 8px 8px no-repeat,
    var(--rv) left 5px bottom 5px / 8px 8px no-repeat,
    var(--rv) right 5px bottom 5px / 8px 8px no-repeat,
    linear-gradient(180deg, var(--plate-a), var(--plate-b));
  border: 1px solid var(--plate-edge);
  border-radius: 8px; text-decoration: none; color: var(--ink);
  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:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .pic { display: flex; align-items: center; justify-content: center; height: 96px; background: #fff; border: 1px solid var(--line-soft); border-radius: 5px; overflow: hidden; }
.card .pic img { max-width: 100%; height: auto; }
.card .pic img.sil { opacity: .55; }
.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.1rem; color: var(--accent); letter-spacing: .02em; }
.card .years { font-size: .86rem; color: var(--muted); }

/* Recherche */
.search { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; max-width: 760px; }
.search label { width: 100%; font-weight: 600; }
.search input {
  flex: 1 1 280px; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); font-family: var(--din); font-size: 1.25rem; letter-spacing: .02em;
}
.search:not(.quick) input { flex-basis: 100%; }
.search select { flex: 1 1 200px; min-width: 0; padding: 10px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.search input:focus, .search select:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.search .btn { padding: 10px 20px; }
.search.quick { margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .9rem; margin: 8px 0 0; max-width: 70ch; }
.msg { margin-top: 22px; padding: 14px 16px; border-left: 3px solid var(--focus); background: var(--surface); border-radius: 0 6px 6px 0; max-width: 72ch; }

/* Colonnes de navigation (comme WDS) */
.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 270px; list-style: none; margin: 0; padding: 6px; max-height: calc(100vh - 120px); overflow-y: auto;
  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.docs-col { flex-basis: 460px; }
.cols ul.list > li { margin: 0; }
.cols .col-h {
  position: sticky; top: -6px; z-index: 1; margin: -6px -6px 4px !important; padding: 9px 12px 8px;
  font-family: var(--din); font-weight: 700; font-size: .95rem; color: var(--muted); letter-spacing: .02em;
  background: var(--surface); border-bottom: 1px solid var(--line-soft); border-radius: 8px 8px 0 0;
}
.cols ul.list > li > a, .cols ul.list > li > b {
  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); font-weight: 400;
}
.cols ul.list > li > a:hover { background: var(--accent-soft); color: var(--accent); }
.cols ul.list > li > b { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cols ul.list > li > a .l, .cols ul.list > li > b .l { flex: 1; min-width: 0; }
.cols ul.list > li > a small, .cols ul.list > li > b small { flex: none; font-size: .78rem; opacity: .7; font-variant-numeric: tabular-nums; padding-top: 1px; }
.cols ul.list > li > a::before, .cols ul.list > li > b::before {
  content: ""; flex: none; width: 14px; height: 14px; margin-top: 2px; background: currentColor; opacity: .55;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
  --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.docitem::before {
  --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");
  color: var(--accent); opacity: .8;
}
.docitem .ref {
  flex: none; font-family: var(--din); font-size: .84rem; letter-spacing: .03em; font-variant-numeric: tabular-nums;
  padding: 0 6px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--ink); white-space: nowrap; margin-top: 1px;
}
.cols .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);
}
.cols .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; max-height: none; }
  .cols ul.list:last-child { display: block; }
  .top .brand-sub, .site { display: none; }
  .search-btn span { display: none; }
}

/* Résultats de recherche */
.docs { margin-top: 26px; }
.docs-h { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 10px; }
.doclist { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 10px; }
.doc { padding: 10px 18px; }
.doc + .doc { border-top: 1px solid var(--line-soft); }
.doc:hover { background: var(--accent-soft); }
.doc-main { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; text-decoration: none; color: inherit; }
.doc-main:hover .doc-name { color: var(--accent); }
.doc-name { font-weight: 600; }
.doc-alt { display: block; font-weight: 400; font-size: .84rem; color: var(--muted); }
.doc-no { font-family: var(--din); color: var(--ink); font-size: .98rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pn {
  font-family: var(--din); font-size: .85rem; letter-spacing: .04em; padding: 1px 7px; border: 1px solid var(--line);
  border-radius: 3px; color: var(--ink); background: var(--bg); white-space: nowrap; text-decoration: none;
}
.pn:hover { border-color: var(--accent); color: var(--accent); }

/* 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: 8px 24px; justify-content: space-between; flex-wrap: wrap; }
.foot a { color: var(--muted); }
.foot-n { font-weight: 600; }
.nojs { padding: 20px; }

/* Visionneuse (comme EBA Archiv) */
.viewer {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background: #2b3038; color: #e8ecf0;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.viewer[hidden] { display: none; }
.v-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: #1b1f25; border-bottom: 1px solid #000; flex-wrap: wrap; }
.v-title { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.v-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-meta { display: flex; gap: 14px; font-family: var(--din); font-size: .88rem; color: #a7b1bd; overflow: hidden; white-space: nowrap; letter-spacing: .03em; min-width: 0; }
.v-meta span:first-child { color: #dfe5ec; white-space: pre; }
.v-refs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 0; }
.v-ctl { display: flex; align-items: center; gap: 4px; }
.v-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: inherit; }
.v-btn:hover { background: #333a44; }
.v-btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.v-btn:disabled { opacity: .35; cursor: default; background: none; }
.v-page { display: flex; align-items: center; gap: 6px; font-family: var(--din); font-variant-numeric: tabular-nums; }
.v-page input { width: 3.2em; text-align: center; padding: 5px 4px; border: 1px solid #4a5360; border-radius: 4px; background: #262b33; color: inherit; -webkit-user-select: text; user-select: text; }
.v-sep { width: 1px; height: 22px; background: #444c57; margin: 0 6px; }
.v-zoom { min-width: 4.4em; padding: 7px 6px; border: 0; border-radius: 6px; background: transparent; color: inherit; font-family: var(--din); font-variant-numeric: tabular-nums; }
.v-zoom:hover { background: #333a44; }
.v-pages { flex: 1; overflow: auto; padding: 18px 12px 40px; overscroll-behavior: contain; }
.v-pages:focus { outline: none; }
.v-page-box { position: relative; margin: 0 auto 14px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.45); }
.v-page-box canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.v-page-box::after { content: attr(data-n); position: absolute; right: -2px; bottom: -20px; font: .75rem var(--din); color: #8b96a3; }
.v-shield { position: absolute; inset: 0; }
.v-status { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); background: #1b1f25; color: #e8ecf0; padding: 14px 20px; border-radius: 8px; max-width: min(90vw, 460px); text-align: center; }
.v-status:empty { display: none; }
.v-progress { display: block; height: 3px; margin-top: 10px; background: #3a424d; border-radius: 2px; overflow: hidden; }
.v-progress i { display: block; height: 100%; background: #6ea2e6; width: 0; transition: width .2s; }
@media (max-width: 640px) {
  .v-bar { gap: 6px; }
  .v-title { order: 2; flex-basis: 100%; }
  .v-ctl { margin-left: auto; }
  .v-sep { display: none; }
}
/* Écrans tactiles et téléphones : cibles d'au moins 48 px, lignes séparées */
@media (pointer: coarse), (max-width: 760px) {
  .crumbs { font-size: 1rem; line-height: 1.2; margin-bottom: 12px; }
  .crumbs li + li::before { padding: 0 2px; }
  .crumbs a { display: inline-block; padding: 10px 6px; min-height: 40px; }
  .crumbs li:last-child span { display: inline-block; padding: 10px 6px; }
  .btn, .search-btn { min-height: 44px; }
  .search input, .search select, .cols .filter { font-size: 16px; min-height: 48px; }
  .search select { flex: 1 1 140px; min-width: 0; }
  .cols ul.list { padding: 0 0 4px; }
  .cols .col-h { margin: 0 0 0 !important; top: 0; padding: 12px 16px; }
  .cols .filter { width: calc(100% - 16px); margin: 8px; }
  .cols ul.list > li + li { border-top: 1px solid var(--line-soft); }
  .cols ul.list > li > a, .cols ul.list > li > b {
    align-items: center; min-height: 52px; padding: 12px 14px; gap: 10px; border-radius: 0; font-size: 1rem;
  }
  .cols ul.list > li > a:active { background: var(--accent-soft); }
  .cols ul.list > li > a small, .cols ul.list > li > b small { font-size: .85rem; }
  .doc { padding: 0; }
  .doc-main { padding: 14px 16px; min-height: 56px; }
  .doc:active { background: var(--accent-soft); }
  .pns { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; margin: 0; }
  .pn { display: inline-flex; align-items: center; min-height: 38px; min-width: 52px; justify-content: center; padding: 4px 12px; font-size: .95rem; }
  .v-btn { width: 44px; height: 44px; }
  .v-zoom { min-height: 44px; }
  .v-page input { min-height: 40px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Impression désactivée */
.noprint { display: none; }
@media print {
  body > *:not(.noprint) { display: none !important; }
  .noprint { display: block !important; padding: 40px; font: 14pt/1.5 sans-serif; }
  .noprint::after { content: attr(data-msg); }
}
