/* The build guide (apps/library/welcome/build/): ten steps down the page, with
   the wiring drawings, parts and pin tables. Loaded after welcome.css, so it
   uses the same brand tokens. */

:root {
  /* the drawings: wires keep their usual colours, on the brand's teal and coral */
  --wire-power: var(--coral-text);
  --wire-ground: var(--ink);
  --wire-signal: var(--teal);
  --wire-data: #9a6200;
  --wire-screen: #3b6db3;
  --wire-switch: #7b4fa3;
  --board: #0b6b66;
  --board-edge: #084f4b;
  --chip: #2a2f2b;
  --pad: #d4b56a;
  --panel-frame: #cfc9b9;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wire-data: #e0a23c;
    --wire-screen: #7fa8e3;
    --wire-switch: #b995dc;
    --board: #14605b;
    --board-edge: #0d4a46;
    --panel-frame: #8c8778;
  }
}

/* ---- the start of the guide ------------------------------------------- */
.guide-head { padding: 56px 0 8px; }
.guide-head .lede { max-width: 38em; }
.before { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 40px 0 0; }
.before h2 { font-size: 20px; line-height: 1.25; font-weight: 600; margin-bottom: 8px; }
.before .badge { margin-bottom: 12px; }
@media (max-width: 760px) { .before { grid-template-columns: 1fr; } }
section.guide { padding-top: 56px; }

/* ---- a timeline you scroll down ----------------------------------------- */
.build { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; align-items: start; }
.rail { position: sticky; top: 100px; }
.rail-track { position: relative; border-left: 3px solid var(--line); padding-left: 18px; }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail .fill { position: absolute; left: -3px; top: 0; width: 3px; background: var(--teal); height: 0; transition: height .25s; }
.rail li { margin: 0 0 6px; }
.rail a { display: block; color: var(--ink-muted); text-decoration: none; font-size: 16px; font-weight: 700; line-height: 1.3; padding: 6px 0; }
.rail a span { display: inline-block; width: 1.6em; font-variant-numeric: tabular-nums; }
.rail a.on { color: var(--ink); }
.rail a.on span { color: var(--teal); }
.rail a.done { color: var(--ink); }
@media (max-width: 980px) { .build { grid-template-columns: minmax(0, 1fr); } .rail { display: none; } }

.step { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 22px; padding-bottom: 72px; position: relative; }
.step::before { content: ""; position: absolute; left: 31px; top: 70px; bottom: 8px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.num { width: 64px; height: 64px; border-radius: 50%; background: var(--teal); color: var(--on-teal);
  display: grid; place-items: center; font: 640 28px/1 var(--display); position: relative; z-index: 1; }
.step-body { min-width: 0; }
.step-body h3 { font-size: 28px; margin-bottom: 12px; }
.step-body code { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .step { grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding-bottom: 56px; }
  .step::before { left: 21px; top: 50px; }
  .num { width: 44px; height: 44px; font-size: 21px; }
  .step-body h3 { font-size: 24px; }
}
.step-body > p { margin: 0 0 16px; max-width: 42em; }
.step-body ol, .step-body ul { margin: 0 0 18px; padding-left: 1.3em; max-width: 42em; }
.step-body li { margin: 0 0 8px; }

/* A wiring drawing is no use shrunk past reading: on a phone it keeps its size and scrolls sideways. */
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; margin: 8px 0 18px; box-shadow: var(--shadow-card); }
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption { font-size: 15px; color: var(--ink-muted); margin-top: 12px; }
.figure.wide { overflow-x: auto; }
@media (max-width: 700px) { .figure.wide svg { min-width: 600px; } }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .pair { grid-template-columns: 1fr; gap: 24px; } }

.note { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius-md); padding: 14px 16px; margin: 0 0 18px; max-width: 42em;
  font-size: 16px; line-height: 1.5; color: var(--ink); }
.note .ico { margin-top: 2px; }
.note b:first-child { display: block; margin-bottom: 2px; }
.note.tip { background: var(--teal-tint); }
.note.tip .ico { color: var(--teal); }
.note.warn { background: var(--marigold-tint); }
.note.warn .ico { color: var(--coral-text); }

/* ---- the parts, the pins, the keys -------------------------------------- */
table.parts, table.wires, .keys-table { width: 100%; border-collapse: collapse; font-size: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); overflow: hidden; margin: 0 0 18px; }
table.parts th, table.parts td, table.wires th, table.wires td, .keys-table th, .keys-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.parts thead th, table.wires thead th, .keys-table thead th { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); background: var(--teal-tint); }
table.parts tr:last-child td, table.wires tr:last-child td, .keys-table tr:last-child th, .keys-table tr:last-child td { border-bottom: 0; }
table.parts td:first-child { font-weight: 700; white-space: nowrap; }
table.wires { width: auto; }
table.wires td:first-child, table.wires td.mono { font-family: var(--mono); font-weight: 700; }
.keys-table { font-size: 15px; }
.keys-table tbody th { font-weight: 700; white-space: nowrap; }
.table-scroll { overflow-x: auto; margin: 0 0 18px; border-radius: var(--radius-md); }
.table-scroll .keys-table { margin: 0; min-width: 520px; }
@media (max-width: 640px) {
  table.parts, table.parts tbody, table.parts tr, table.parts td { display: block; width: 100%; }
  table.parts thead { display: none; }
  table.parts tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  table.parts td { border: 0; padding: 2px 0; }
  table.parts td:first-child { white-space: normal; }
  .keys-table { font-size: 14px; }
  .keys-table th, .keys-table td { padding: 8px; }
}

/* ---- the wiring drawings ---------------------------------------------- */
.dg { font-family: var(--body); }
.dg text { fill: var(--ink); font-size: 19px; }
.dg .small { font-size: 16px; fill: var(--ink-muted); }
.dg .title { font-weight: 700; }
.dg .on-board { fill: #fff; }
.dg .pin { font-family: var(--mono); font-size: 19px; font-weight: 700; }
.dg .board { fill: var(--board); stroke: var(--board-edge); stroke-width: 2; }
.dg .chip { fill: var(--chip); }
.dg .pad { fill: var(--pad); }
.dg .line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.dg .screen-w { stroke: var(--wire-screen); } .dg .screen-t { fill: var(--wire-screen); }
.dg .mem-w { stroke: var(--wire-data); } .dg .mem-t { fill: var(--wire-data); }
.dg .btn-w { stroke: var(--wire-signal); } .dg .btn-t { fill: var(--wire-signal); }
.dg .sw-w { stroke: var(--wire-switch); } .dg .sw-t { fill: var(--wire-switch); }
.dg .pwr-w { stroke: var(--wire-power); } .dg .pwr-t { fill: var(--wire-power); }
.dg .gnd-w { stroke: var(--wire-ground); } .dg .gnd-t { fill: var(--ink-muted); }
.dg .part { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.dg .ink { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.dg .dot { fill: var(--ink); }

.step-body .chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; max-width: 48em; }
.chain li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 9px 13px; margin: 0; font-size: 15px; line-height: 1.3; }
.chain li b { display: block; font-size: 16px; }
.chain li.to { background: none; border: 0; padding: 0; color: var(--teal); font-weight: 700; font-size: 20px; }

.term { background: #14201f; color: #e7efe9; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px 18px; font: 14px/1.65 var(--mono);
  overflow-x: auto; margin: 0 0 18px; max-width: 48em; white-space: pre; }
.term .dim { color: #9fb3ad; }
.term .ok { color: #7fd6c8; }

/* A photo of a step goes here once there is one (an <img> inside); empty, it takes no room. */
figure.photo:empty { display: none; }
figure.photo { margin: 8px 0 18px; }
figure.photo img { width: 100%; height: auto; border-radius: var(--radius-lg); border: 1px solid var(--line); display: block; }
figure.render { margin: 8px 0 18px; max-width: 760px; }
figure.render img { width: 100%; height: auto; display: block; }
figure.render figcaption { font-size: 15px; color: var(--ink-muted); margin-top: 6px; }

/* ---- what next --------------------------------------------------------- */
.next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 860px; }
@media (max-width: 760px) { .next { grid-template-columns: 1fr; } }
.next .card { display: flex; flex-direction: column; align-items: flex-start; }
.next .btn { margin-top: auto; }
.next p { margin-bottom: 20px; }

/* ---- the privacy page: plain text, easy to read ------------------------ */
.prose { max-width: 46rem; }
.prose h2 { font-size: 26px; margin: 40px 0 12px; }
.prose p, .prose li { max-width: 42em; }
.prose ul { margin: 0 0 16px; padding-left: 1.3em; }
.prose li { margin: 0 0 8px; }
.prose .small { font-size: 15px; color: var(--ink-muted); }
