/* style.css — fiches machines vjlt.be
   Remplacement visuel compatible avec le HTML et le JavaScript existants. */

:root {
  color-scheme: light dark;
  --bg: #eef1f5;
  --bg-glow: rgba(48, 104, 232, 0.09);
  --card: #ffffff;
  --card-soft: #f7f8fa;
  --text: #171a20;
  --muted: #667181;
  --border: #dce1e8;
  --border-strong: #cbd2dc;
  --accent: #3068e8;
  --accent-hover: #2458cc;
  --accent-soft: rgba(48, 104, 232, 0.1);
  --accent-ring: rgba(48, 104, 232, 0.28);
  --warn-bg: #fff7e8;
  --warn-border: #e7ad42;
  --warn-text: #714900;
  --shadow: 0 10px 32px rgba(24, 34, 52, 0.07);
  --radius: 16px;
  --radius-small: 11px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f5;
  --bg-glow: rgba(48, 104, 232, 0.09);
  --card: #ffffff;
  --card-soft: #f7f8fa;
  --text: #171a20;
  --muted: #667181;
  --border: #dce1e8;
  --border-strong: #cbd2dc;
  --accent: #3068e8;
  --accent-hover: #2458cc;
  --accent-soft: rgba(48, 104, 232, 0.1);
  --accent-ring: rgba(48, 104, 232, 0.28);
  --warn-bg: #fff7e8;
  --warn-border: #e7ad42;
  --warn-text: #714900;
  --shadow: 0 10px 32px rgba(24, 34, 52, 0.07);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --bg-glow: rgba(104, 148, 255, 0.1);
  --card: #1a1e24;
  --card-soft: #20252c;
  --text: #f0f2f5;
  --muted: #a4adba;
  --border: #2b313a;
  --border-strong: #3a424e;
  --accent: #729bff;
  --accent-hover: #8aabff;
  --accent-soft: rgba(114, 155, 255, 0.13);
  --accent-ring: rgba(114, 155, 255, 0.3);
  --warn-bg: #34280f;
  --warn-border: #a86f18;
  --warn-text: #ffd99a;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --bg-glow: rgba(104, 148, 255, 0.1);
    --card: #1a1e24;
    --card-soft: #20252c;
    --text: #f0f2f5;
    --muted: #a4adba;
    --border: #2b313a;
    --border-strong: #3a424e;
    --accent: #729bff;
    --accent-hover: #8aabff;
    --accent-soft: rgba(114, 155, 255, 0.13);
    --accent-ring: rgba(114, 155, 255, 0.3);
    --warn-bg: #34280f;
    --warn-border: #a86f18;
    --warn-text: #ffd99a;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 280px;
  background:
    radial-gradient(circle at 50% -220px, var(--bg-glow), transparent 520px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-synthesis: none;
}

button,
input { font: inherit; }

a,
button {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 2px;
}

.page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 30px 20px 56px;
}

.fiche-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin: 0 2px 14px;
}

.fiche-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 11px;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  box-shadow: 0 4px 14px rgba(24, 34, 52, 0.05);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.fiche-tool:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

.fiche-tool-icon {
  width: 1.1em;
  font-family: "Segoe UI Symbol", "Apple Symbols", sans-serif;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
}

header.fiche-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 22px;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

h1 .marque {
  color: var(--muted);
  font-weight: 450;
}

.code-badge {
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-soft);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Les références techniques restent dans le HTML pour la génération,
   mais ne sont pas affichées sur les fiches publiques. */
.fiche-header > .code-badge {
  display: none;
}

/* Le bloc QR est identifiable sans modifier le gabarit ni les scripts. */
.card:has(> img[src$="qr.png"]),
.card:has(> img[alt^="QR code"]) {
  display: none;
}

.card {
  margin-bottom: 16px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.095em;
  line-height: 1.3;
  text-transform: uppercase;
}

.specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
  row-gap: 0;
}

.specs .item {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 54px;
  padding: 8px 0;
}

.specs .item::before {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: "Segoe UI Symbol", "Apple Symbols", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.specs .item:nth-child(1)::before { content: "⚖"; }
.specs .item:nth-child(2)::before { content: "↔"; }
.specs .item:nth-child(3)::before { content: "ϟ"; }
.specs .item:nth-child(4)::before { content: "⏻"; }
.specs .item:nth-child(5)::before { content: "◉"; }
.specs .item:nth-child(n+6)::before { content: "•"; }

.specs .label {
  display: none;
}

.specs .value {
  grid-column: 2;
  grid-row: 1;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.91rem;
}

.notes {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.docs a {
  display: block;
  margin: 0 -8px;
  padding: 9px 8px;
  border-radius: 8px;
  color: var(--accent);
  overflow-wrap: anywhere;
  text-decoration: none;
}

.docs a:hover {
  background: var(--accent-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Sélecteur du mode DMX */
.dmx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 17px;
}

.dmx-tabs button {
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--card-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.dmx-tabs button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.dmx-tabs button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 14px var(--accent-ring);
}

.dmx-panel { display: none; }
.dmx-panel.active { display: block; }

table.dmx {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.91rem;
  table-layout: fixed;
}

table.dmx th,
table.dmx td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

table.dmx th:first-child,
table.dmx td:first-child {
  width: 84px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

table.dmx th {
  background: var(--card-soft);
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

table.dmx th:first-child { border-radius: 9px 0 0 9px; }
table.dmx th:last-child { border-radius: 0 9px 9px 0; }
table.dmx tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--card-soft) 55%, transparent); }
table.dmx tbody tr:last-child td { border-bottom: 0; }

footer {
  display: none;
}

/* Annuaire */
.search-box {
  width: 100%;
  min-height: 48px;
  margin-bottom: 16px;
  padding: 12px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  box-shadow: var(--shadow);
}

.search-box::placeholder { color: var(--muted); }
.search-box:focus { border-color: var(--accent); }

.machine-list {
  display: grid;
  gap: 9px;
}

.machine-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 5px 18px rgba(24, 34, 52, 0.04);
  transition: border-color 150ms ease, transform 150ms ease;
}

.machine-list a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.machine-list .code {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

/* Etiquettes imprimables */
.labels-grid {
  display: grid;
  grid-template-columns: repeat(4, 50mm);
  justify-content: center;
  gap: 2mm;
}

.label {
  display: flex;
  align-items: center;
  width: 50mm;
  height: 30mm;
  padding: 2mm;
  gap: 2mm;
  border: 0.2mm dashed #999;
  page-break-inside: avoid;
}

.label img { width: 22mm; height: 22mm; }
.label .txt { font-size: 8pt; line-height: 1.25; }
.label .txt .code { font-family: ui-monospace, monospace; font-size: 10pt; font-weight: 700; }

@media (max-width: 540px) {
  .page {
    padding: 22px 14px 42px;
  }

  header.fiche-header {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .fiche-tools {
    justify-content: stretch;
    margin-bottom: 14px;
  }

  .fiche-tool {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 8px;
  }

  h1 { font-size: 1.55rem; }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .specs {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .specs .item {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 0 10px;
    padding: 8px 0;
  }


  .dmx-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dmx-tabs button {
    width: 100%;
    min-height: 46px;
    padding: 8px 10px;
  }

  table.dmx th,
  table.dmx td {
    padding: 9px 8px;
  }

  table.dmx th:first-child,
  table.dmx td:first-child {
    width: 58px;
  }
}

@media (max-width: 340px) {
  header.fiche-header { flex-wrap: wrap; }
  .dmx-tabs { grid-template-columns: minmax(0, 1fr); }
}

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

@media print {
  :root {
    --bg: #fff;
    --card: #fff;
    --card-soft: #fff;
    --text: #000;
    --muted: #444;
    --border: #bbb;
  }

  .no-print,
  .fiche-tools { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}


