/* Оформление в стиле duino.ru (учебник ESP32 DevKit): белый фон, Roboto, синие ссылки, жёлтые кнопки */
:root {
  --bg: #ffffff;
  --band: #f0f6f7;
  --panel: #f7f9fa;
  --panel2: #eeeeee;
  --line: #e2e6e8;
  --text: #000000;
  --muted: #777777;
  --accent: #006bd8;
  --yellow: #fcd630;
  --yellow-dark: #e8bf10;
  --pink: #ee1155;
  --ok: #1a9d55;
  --warn: #e08a00;
  --oled: #7fd8ff;
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 3px; font-size: .92em; }

.top { background: var(--band); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 1080px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 14px; color: var(--text); font-weight: 700; font-size: 17px; }
.logo img { height: 40px; width: auto; display: block; }
.logo-title { color: var(--text); border-left: 1px solid #c9d3d6; padding-left: 14px; }
.logo a:hover { text-decoration: none; }
.logo-title:hover { color: var(--accent); }
.top nav a { margin-left: 26px; color: var(--text); font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .02em; }
.top nav a.active, .top nav a:hover { color: var(--accent); text-decoration: none; }

main { max-width: 1080px; margin: 0 auto; padding: 32px 24px 60px; }
.foot { text-align: center; color: #888; font-size: 13px; padding: 24px; background: #eeeeee; }
.foot a { color: #888; text-decoration: underline; }

h1 { font-size: 36px; margin: 0 0 10px; line-height: 1.2; font-weight: 700; }
h2 { font-size: 22px; margin: 36px 0 12px; font-weight: 700; }
h3 { font-size: 17px; margin: 24px 0 8px; font-weight: 700; }
.lead { color: #444; font-size: 17px; margin: 0 0 24px; }

.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; }
.btn { display: inline-block; background: var(--yellow); color: #000; font-weight: 400; font-size: 15.4px;
  padding: 8px 18px; border-radius: 3px; border: 1px solid var(--yellow-dark); cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.08); margin: 0 8px 8px 0; font-family: inherit; }
.btn:hover { text-decoration: none; background: #ffdf4f; }
.btn.ghost { background: #fff; color: #000; border: 1px solid #c8c8c8; box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 20px 0; }
.fact { background: var(--band); border-radius: 3px; padding: 12px 14px; }
.fact b { display: block; font-size: 18px; }
.fact span { color: var(--muted); font-size: 13px; }

.progress { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin: 8px 0 20px; }
.progress div { height: 100%; background: var(--yellow); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 3px;
  padding: 16px 18px; color: var(--text); transition: border-color .15s; }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card:hover h3 { color: var(--accent); }
.card .num { color: var(--pink); font-weight: 700; font-size: 13px; }
.card h3 { margin: 4px 0 6px; color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card .done { color: var(--ok); font-size: 13px; font-weight: 700; margin-top: 8px; display: block; }
.tags { margin-top: 8px; }
.tag { display: inline-block; font-size: 12px; background: var(--band); color: #555;
  padding: 1px 8px; border-radius: 3px; margin: 2px 4px 0 0; }

.lesson { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; }
.side { position: sticky; top: 84px; align-self: start; }
.box { background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 16px; margin-bottom: 16px; }
.box h4 { margin: 0 0 10px; font-size: 13px; color: var(--text); text-transform: uppercase; letter-spacing: .05em; }
.box ul { margin: 0; padding-left: 18px; }
.crumbs { color: var(--muted); font-size: 14px; margin-bottom: 8px; }

.note, .warn { border-left: 4px solid var(--accent); background: var(--band); padding: 10px 16px;
  border-radius: 0 3px 3px 0; margin: 16px 0; }
.warn { border-color: var(--yellow-dark); background: #fff8d9; }
.note p, .warn p { margin: 4px 0; }

pre { position: relative; background: #f7f9fa; border: 1px solid var(--line); border-radius: 3px;
  padding: 38px 16px 16px; overflow-x: auto; font-size: 14px; line-height: 1.5; margin: 12px 0; }
pre code { background: none; padding: 0; font-family: "JetBrains Mono", "Fira Code", Consolas, monospace; }
.copy { position: absolute; top: 8px; right: 8px; background: var(--yellow); color: #000;
  border: 1px solid var(--yellow-dark); border-radius: 3px; padding: 2px 10px; font-size: 12px; cursor: pointer; }
.copy:hover { background: #ffdf4f; }
.c-com { color: #6a737d; font-style: italic; }
.c-str { color: #0a7a3e; }
.c-kw { color: #c2185b; }
.c-num { color: #6f42c1; }
.c-pre { color: #b35900; }

table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text); font-weight: 700; background: var(--band); }

.oled-wrap { background: #18272f; border-radius: 3px; padding: 14px; text-align: center; }
.oled-wrap canvas { image-rendering: pixelated; width: 100%; max-width: 288px; background: #000; border-radius: 3px; }
.oled-wrap small { display: block; color: #aab7bd; margin-top: 6px; font-size: 12px; }

.wiring { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; font-size: 14px; }
.wiring b { color: var(--accent); }

.navlinks { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; flex-wrap: wrap; }
.board svg { width: 100%; height: auto; }

@media (max-width: 860px) {
  .hero, .lesson { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  table { display: block; overflow-x: auto; }
  .top nav a { margin: 0 16px 0 0; }
  .logo-title { display: none; }
}

/* Элементы, которые есть только в учебнике DevKit */
.lesson { grid-template-columns: minmax(0, 1fr) 330px; }
.box small { display: block; color: var(--muted); font-size: 12px; text-align: center; margin-top: 4px; }
.box.board svg { display: block; }
.legend { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.wiring span { white-space: nowrap; }
pre.tall { max-height: 640px; overflow-y: auto; }
tr.sect td { background: var(--panel2); font-weight: 700; }

@media (max-width: 860px) {
  .lesson { grid-template-columns: minmax(0, 1fr); }
}
