/* Dokumentacja płytek – uzupełnia legal.css */
:root {
  --purple: #a855f7;
  --pink: #ec4899;
  --amber: #f59e0b;
  --green: #22c55e;
  --inset: #0c121e;
}
code, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.content code { background: var(--card-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--text); }
pre {
  background: var(--inset); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; overflow-x: auto; font-size: 14px; line-height: 1.6; color: #c9d1de;
}
pre code { background: none; border: 0; padding: 0; }
pre .c { color: var(--muted); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px;
  font-size: 13px; font-weight: 600; color: var(--blue);
  padding: 5px 12px; border-radius: 999px; background: var(--blue-soft); border: 1px solid var(--blue-line);
}

/* karty z najważniejszymi parametrami */
.specs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0 8px; }
.spec { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.spec small { display: block; color: var(--muted); font-size: 13px; }
.spec b { display: block; font-size: 22px; letter-spacing: -.01em; margin-top: 2px; }
.spec span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── tor sygnału ── */
.flow-scroll { overflow-x: auto; margin: 16px 0; padding-bottom: 4px; }
.flow { min-width: 760px; display: grid; gap: 10px; }
.flow-top { display: grid; grid-template-columns: 220px 36px 1fr; align-items: stretch; }
.fbox {
  border-radius: 14px; padding: 12px 14px; text-align: center;
  background: var(--card); border: 1px solid var(--line-2);
}
.fbox b { display: block; font-size: 14px; letter-spacing: .02em; }
.fbox span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
.fbox.in, .fbox.mix { border-color: var(--blue-line); background: linear-gradient(180deg, rgba(61, 139, 255, .12), rgba(61, 139, 255, .04)); }
.fbox.mix em { font-style: normal; color: var(--text); font-weight: 600; }
.farrow { display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.fsplit { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; padding: 2px 0; }
.frow {
  display: grid; grid-template-columns: 86px repeat(4, 1fr 24px) 1fr; align-items: stretch; gap: 0;
  background: rgba(255, 255, 255, .02); border: 1px solid var(--line); border-radius: 16px; padding: 10px;
}
.frow .ch { display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--card-2); border-radius: 10px; margin-right: 10px; }
.frow .farrow { font-size: 14px; }
.stage-box { border-radius: 12px; padding: 9px 8px; text-align: center; background: var(--card); border: 1px solid var(--line); border-left-width: 3px; }
.stage-box b { display: block; font-size: 13px; }
.stage-box span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stage-box.f { border-left-color: var(--purple); }
.stage-box.e { border-left-color: var(--pink); }
.stage-box.l { border-left-color: var(--amber); }
.stage-box.d { border-left-color: var(--green); }
.stage-box.d span { color: #86efac; }
.stage-box.none { border-style: dashed; border-left-style: solid; border-left-color: var(--line-2); background: transparent; }
.stage-box.none b, .stage-box.none span { color: var(--muted); font-style: italic; }
.stage-box.o { border-color: rgba(34, 197, 94, .45); border-left-color: var(--green); background: rgba(34, 197, 94, .08); display: grid; place-items: center; }
.stage-box.o b { font-size: 13px; letter-spacing: .04em; }

/* ── schemat blokowy PCB ── */
.pcb { background: var(--inset); border: 1px solid var(--line); border-radius: 20px; padding: 14px; margin: 16px 0 10px; overflow-x: auto; }
.pcb svg { display: block; min-width: 760px; width: 100%; height: auto; }
.pcb text, .board .pic text { font-family: Inter, system-ui, sans-serif; fill: var(--text); }
.pcb .t-b, .board .pic .t-b { font-size: 16px; font-weight: 700; }
.pcb .t-m, .board .pic .t-m { font-size: 13px; fill: var(--muted); }
.pcb .t-p, .board .pic .t-p { font-size: 11px; fill: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 26px; height: 0; border-top: 2.5px solid; }
.legend i.bal { height: 6px; border-top: 2px solid var(--amber); border-bottom: 2px solid var(--amber); }
.legend i.unb { border-color: var(--blue); }
.legend i.ctl { border-top: 2px dashed var(--muted); }

.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.cards2 > div { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.cards2 h3 { margin: 0 0 6px; font-size: 16px; }
.cards2 p { margin: 0; font-size: 15px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; margin-bottom: 8px; }
.tag.b { color: var(--blue); background: var(--blue-soft); }
.tag.a { color: var(--amber); background: rgba(245, 158, 11, .14); }

.note { border-left: 3px solid var(--amber); background: rgba(245, 158, 11, .07); border-radius: 0 14px 14px 0; padding: 12px 16px; margin: 14px 0; }
.note p { margin: 0; }

/* ── lista płytek ── */
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; padding: 8px 0 96px; }
.board {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 22px;
  transition: border-color .15s, transform .15s;
}
a.board:hover { border-color: var(--blue-line); transform: translateY(-2px); }
.board .pic { height: 150px; border-radius: 16px; background: var(--inset); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.board .pic svg { width: 88%; height: auto; }
.board h2 { margin: 6px 0 0; font-size: 22px; }
.board p { margin: 0; color: var(--muted); font-size: 15px; }
.board .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.board .chips span { font-size: 12px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px; }
.board .more { color: var(--blue); font-weight: 600; font-size: 15px; margin-top: auto; }
.board.soon { border-style: dashed; background: transparent; justify-content: center; align-items: center; text-align: center; min-height: 300px; }

@media (max-width: 900px) {
  .specs-grid { grid-template-columns: 1fr 1fr; }
  .cards2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .board { transition: none; } }

/* ── tor sygnału: siatka kanałów ── */
.flow { min-width: 700px; }
.flow-top { grid-template-columns: 240px 40px 1fr; }
.fbox { padding: 14px 18px; }
.fbox b { font-size: 15px; }
.fbox span { font-size: 14px; color: #b4bfd0; }
.fsplit { font-size: 14px; color: #b4bfd0; padding: 6px 0 2px; }
.chain-grid {
  display: grid; grid-template-columns: 104px repeat(5, minmax(0, 1fr));
  --gap: 26px; column-gap: var(--gap); row-gap: 10px; align-items: stretch;
  background: rgba(255, 255, 255, .02); border: 1px solid var(--line); border-radius: 18px; padding: 16px;
}
.c-f { --c: 168 85 247; } .c-e { --c: 236 72 153; } .c-l { --c: 245 158 11; } .c-d { --c: 34 197 94; } .c-o { --c: 61 139 255; }
.hd { font-size: 12.5px; line-height: 1.35; color: var(--muted); padding: 8px 0 6px; border-top: 3px solid rgb(var(--c)); }
.hd b { display: block; font-size: 14.5px; color: var(--text); margin-bottom: 2px; }
.chl { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.chl span {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-size: 14px;
  background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue-line);
}
.cell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 56px; border-radius: 12px; font-weight: 600; font-size: 15px; color: var(--text);
  background: rgb(var(--c) / .13); border: 1px solid rgb(var(--c) / .5);
}
.cell small { font-size: 12px; font-weight: 500; color: rgb(var(--c)); margin-top: 1px; }
.cell.c-o { background: rgb(var(--c) / .2); letter-spacing: .03em; }
.cell.none { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); font-weight: 500; font-style: italic; }
.cell:not(.last)::after {
  content: ""; position: absolute; right: calc(-1 * (var(--gap) / 2 + 2px)); top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); transform: rotate(45deg);
}

/* karta płytki: tytuł z rewizją i lista parametrów */
.board-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.board-title h2 { margin: 0; }
.board-title span { font-size: 12px; font-weight: 600; color: var(--blue); background: var(--blue-soft); border-radius: 8px; padding: 3px 8px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; margin: 4px 0 6px; border-top: 1px solid var(--line); }
.kv div { padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv div:nth-child(odd) { padding-right: 12px; }
.kv div:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--line); }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 1px 0 0; font-size: 14.5px; font-weight: 600; color: var(--text); }

/* pasek parametrów pod tytułem dokumentacji */
.facts { display: flex; flex-wrap: wrap; margin: 24px 0 0; row-gap: 12px; }
.facts div { padding: 0 24px; border-left: 1px solid var(--line-2); }
.facts div:first-child { padding-left: 0; border-left: 0; }
.facts dt { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.facts dd { margin: 2px 0 0; font-size: 17px; font-weight: 600; color: var(--text); }
@media (max-width: 620px) {
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 0; }
  .facts div { padding: 0 0 0 14px; }
  .facts div:nth-child(odd) { padding-left: 0; border-left: 0; }
}

/* ── obsługa z ekranu ── */
.content h3.sub { font-size: 18px; margin: 30px 0 8px; }
.oled-row { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: 20px; margin: 18px 0 6px; }
.oled-row figure { margin: 0; }
.oled-frame {
  background: #05070b; border: 1px solid var(--line-2); border-radius: 16px; padding: 14px;
  box-shadow: inset 0 0 0 6px #0d1320, 0 20px 40px -24px rgba(0, 0, 0, .9);
}
.oled { display: block; width: 100%; height: auto; image-rendering: pixelated; border-radius: 3px; }
.oled text { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; white-space: pre; }
.oled-row figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.oled-row figcaption b { display: block; color: var(--text); font-size: 14px; }
.tree, .tree ul { list-style: none; padding-left: 0; }
.tree > li { position: relative; padding: 10px 0 10px 22px; border-bottom: 1px solid var(--line); margin: 0; }
.tree > li::before { content: ""; position: absolute; left: 4px; top: 19px; width: 8px; height: 8px; border-radius: 2px; background: var(--blue); }
.tree b { color: var(--text); }
.tree em { font-style: normal; color: var(--text); background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; font-size: .93em; }
.tree ul { margin: 6px 0 0; border-left: 1px solid var(--line-2); padding-left: 16px; }
.tree ul li { margin: 5px 0; }
@media (max-width: 620px) { .oled-row { grid-template-columns: 1fr; } }

/* ── wersja do druku / PDF: jasna, schematy zostają ciemne ── */
.print-brand { display: none; }
@media print {
  @page { size: A4; }
  :root {
    --bg: #fff; --bg-deep: #fff; --card: #f5f7fb; --card-2: #eef2f8; --inset: #f5f7fb;
    --line: #dfe5ee; --line-2: #cbd4e1; --text: #0b1220; --muted: #5b6678;
    --blue: #2563eb; --blue-soft: #e6efff; --blue-line: #9dbcf5;
  }
  html, body { background: #fff !important; color: var(--text); font-size: 13px; line-height: 1.55; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .content p, .content li, td { color: #1f2937 !important; }
  .fbox span, .fsplit { color: var(--muted); }
  .wrap.doc { display: block; padding: 0; max-width: none; }
  .print-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
  .print-brand img { width: 28px; height: 28px; border-radius: 7px; }
  .print-brand b { color: var(--text); letter-spacing: 0; text-transform: none; font-size: 15px; margin-right: 4px; }
  .doc-head h1 { font-size: 34px; margin: 8px 0 10px; }
  .doc-head .label a { pointer-events: none; }
  .pdf-link { display: none !important; }
  .toc { display: block !important; position: static; margin: 22px 0 8px; background: var(--card); break-inside: avoid; }
  .toc ol { columns: 2; column-gap: 24px; }
  .content h2 { font-size: 19px; margin-top: 26px; break-after: avoid; }
  .content h3.sub { break-after: avoid; }
  .flow { min-width: 0; }
  .chain-grid { --gap: 20px; padding: 12px; }
  .cell { min-height: 46px; font-size: 13px; }
  .hd b { font-size: 13px; }
  .pcb, .oled-frame { --text: #f3f5f9; --muted: #8a97ad; --inset: #0c121e; --line: #1f2a40; --line-2: #2c3752; background: #0c121e; }
  .pcb .legend { color: #8a97ad; }
  .pcb svg { min-width: 0; }
  .flow-scroll, .pcb, .oled-row, .cards2 > div, .note, .specs-grid, tr, pre, .tree > li, figure { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  .specs-grid { grid-template-columns: repeat(4, 1fr); }
  .spec b { font-size: 18px; }
  a { color: var(--blue); text-decoration: none; }
  .oled-frame, .pcb, .specs-grid .spec, .toc { box-shadow: none !important; }
  .keep { break-inside: avoid; page-break-inside: avoid; }
  .content p, .content li, .tree ul li, .summary { break-inside: avoid; }
  #wejscia, #out34, #start { break-inside: avoid; }
  .content h2, .content h3.sub { break-inside: avoid; }
}
.pdf-link {
  font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; margin-top: 22px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 9px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card);
}
.pdf-link::before { content: "↓"; color: var(--blue); }
.pdf-link:hover { border-color: var(--blue-line); }

/* ── zdjęcie wyprowadzeń ── */
.pinout { margin: 16px 0 10px; }
.pinout a { display: block; border-radius: 20px; overflow: hidden; background: #fff; border: 1px solid var(--line-2); box-shadow: 0 30px 60px -36px rgba(0, 0, 0, .9); transition: border-color .15s, transform .15s; }
.pinout a:hover { border-color: var(--blue-line); transform: translateY(-2px); }
.pinout img { display: block; width: 100%; height: auto; }
.pinout figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); text-align: center; }
.pin-key { display: inline-flex; align-items: center; gap: 6px; margin: 2px 10px 2px 0; font-size: 14px; color: var(--text); white-space: nowrap; }
.pin-key::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--k); }
.pin-key.amber { --k: #f59e0b; } .pin-key.blue { --k: #3d8bff; } .pin-key.purple { --k: #a855f7; } .pin-key.red { --k: #ef4444; }
@media print { .pinout a { box-shadow: none; transform: none; } .pinout figcaption { display: none; } }
@media (prefers-reduced-motion: reduce) { .pinout a { transition: none; } }
.pin-sep { display: none; }

/* zdjęcie wyprowadzeń: ramka (przewijana na telefonie) */
.pinout a { border: 0; border-radius: 0; box-shadow: none; transform: none !important; }
.pinout-frame { border-radius: 20px; overflow: hidden; background: #fff; border: 1px solid var(--line-2); box-shadow: 0 30px 60px -36px rgba(0, 0, 0, .9); transition: border-color .15s; }
.pinout-frame:hover { border-color: var(--blue-line); }
.hint-mob { display: none; }
@media (max-width: 760px) {
  .pinout-frame { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; border-radius: 16px; }
  .pinout-frame a { width: 760px; max-width: none; }
  .hint-desk { display: none; }
  .hint-mob { display: inline; }
  /* tabele złączy jako karty */
  .table-wrap:has(table.stack) { background: none; border: 0; border-radius: 0; overflow: visible; }
  table.stack, table.stack tbody { display: block; }
  table.stack thead { display: none; }
  table.stack tr { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; }
  table.stack td { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 4px 0; border: 0; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; padding-top: 1px; }
  table.stack td:first-child { display: block; font-size: 16px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  table.stack td:first-child::before { content: none; }
}
@media print { .pinout-frame { box-shadow: none; } }
