/* =========================================================
   Design tokens
   Channel colors follow the resistor color code
   (1 brown, 2 red, 3 orange, 4 yellow, 5 green, 6 blue),
   and mark the same kind of work everywhere on the page.
   ========================================================= */
:root {
  /* Brightness: 0 is the light theme, 1 is the dark theme, anything between blends.
     The header fader sets --t; the script derives the other two from it:
     --tb moves backgrounds, hurrying through the middle greys,
     --tf flips text and accents at the middle, and --m pulls secondary text and accents
     toward the ink colour near the middle so they keep their contrast on grey.
     Without JavaScript all three follow the system setting. */
  --t: 0; --tb: 0; --tf: 0; --m: 0;
  color-scheme: light;

  --paper-light: #f5f7fa;
  --paper-raised-light: #ffffff;
  --ink-light: #0f1b2d;
  --muted-light: #56627a;
  --rule-light: #d6dce5;
  --focus-light: #1e5fb4;
  --c-brown-light: #8a5a2b;
  --c-red-light: #c62828;
  --c-orange-light: #cf5f0a;
  --c-yellow-light: #a67c00;
  --c-green-light: #2e7d32;
  --c-blue-light: #1e5fb4;

  --paper-dark: #0f1726;
  --paper-raised-dark: #152033;
  --ink-dark: #e5eaf2;
  --muted-dark: #98a4b8;
  --rule-dark: #28354b;
  --focus-dark: #7cb3ff;
  --c-brown-dark: #c9935f;
  --c-red-dark: #f47171;
  --c-orange-dark: #ff9d45;
  --c-yellow-dark: #f0c94a;
  --c-green-dark: #62cf80;
  --c-blue-dark: #74adff;

  --paper: color-mix(in oklab, var(--paper-light), var(--paper-dark) calc(var(--tb) * 100%));
  --paper-raised: color-mix(in oklab, var(--paper-raised-light), var(--paper-raised-dark) calc(var(--tb) * 100%));
  --ink: color-mix(in oklab, color-mix(in oklab, var(--ink-light), var(--ink-dark) calc(var(--tf) * 100%)),
                           color-mix(in oklab, #000, #fff calc(var(--tf) * 100%)) calc(var(--m) * 100%));
  --muted: color-mix(in oklab, color-mix(in oklab, var(--muted-light), var(--muted-dark) calc(var(--tf) * 100%)), var(--ink) calc(var(--m) * 90%));
  --rule: color-mix(in oklab, var(--rule-light), var(--rule-dark) calc(var(--tb) * 100%));
  --focus: color-mix(in oklab, color-mix(in oklab, var(--focus-light), var(--focus-dark) calc(var(--tf) * 100%)), var(--ink) calc(var(--m) * 60%));
  --c-brown: color-mix(in oklab, color-mix(in oklab, var(--c-brown-light), var(--c-brown-dark) calc(var(--tf) * 100%)), var(--ink) calc(var(--m) * 60%));
  --c-red: color-mix(in oklab, color-mix(in oklab, var(--c-red-light), var(--c-red-dark) calc(var(--tf) * 100%)), var(--ink) calc(var(--m) * 60%));
  --c-orange: color-mix(in oklab, color-mix(in oklab, var(--c-orange-light), var(--c-orange-dark) calc(var(--tf) * 100%)), var(--ink) calc(var(--m) * 60%));
  --c-yellow: color-mix(in oklab, color-mix(in oklab, var(--c-yellow-light), var(--c-yellow-dark) calc(var(--tf) * 100%)), var(--ink) calc(var(--m) * 60%));
  --c-green: color-mix(in oklab, color-mix(in oklab, var(--c-green-light), var(--c-green-dark) calc(var(--tf) * 100%)), var(--ink) calc(var(--m) * 60%));
  --c-blue: color-mix(in oklab, color-mix(in oklab, var(--c-blue-light), var(--c-blue-dark) calc(var(--tf) * 100%)), var(--ink) calc(var(--m) * 60%));

  --sans: 'Archivo', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --max: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}
@media (prefers-color-scheme: dark) {
  :root { --t: 1; --tb: 1; --tf: 1; --m: 0; color-scheme: dark; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
main:focus { outline: none; }

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

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 2rem;
  padding: .9rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-weight: 800; font-variation-settings: 'wdth' 118; letter-spacing: -.01em;
  text-decoration: none;
}

/* Onboard "L" LED, blinking the way a new board runs the Blink sketch: 1 s on, 1 s off */
.onboard { position: relative; margin-right: auto; }
.onboard button {
  display: flex; align-items: center; gap: .3rem; padding: .3rem .35rem; background: none; border: 0; cursor: pointer;
  color: var(--muted); font: 500 .68rem/1 var(--mono);
}
.onboard__led {
  width: .55rem; height: .35rem; border-radius: 1px;
  background: #f5a524; box-shadow: 0 0 6px 1px #f5a524aa;
}
.onboard__sketch {
  position: absolute; top: calc(100% + .5rem); left: 0; z-index: 30; margin: 0;
  padding: .9rem 1.1rem; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--paper-raised); color: var(--ink); box-shadow: 0 10px 24px -12px rgb(0 0 0 / .35);
  font: .75rem/1.55 var(--mono); white-space: pre;
  opacity: 0; visibility: hidden; transform: translateY(-.25rem); transition: opacity .15s, transform .15s, visibility .15s;
}
.onboard__sketch .c { color: var(--muted); }
.onboard__sketch .hi, .onboard__sketch .lo { display: inline-block; border-radius: 2px; }
.onboard:hover .onboard__sketch, .onboard:focus-within .onboard__sketch, .onboard button[aria-expanded="true"] + .onboard__sketch {
  opacity: 1; visibility: visible; transform: none;
}
@media (prefers-reduced-motion: no-preference) {
  .onboard__led { animation: blink 2s step-end infinite; }
  /* The line that just ran lights up in step with the LED */
  .onboard__sketch .hi { animation: run-line 2s step-end infinite; }
  .onboard__sketch .lo { animation: run-line 2s step-end -1s infinite; }
}
@keyframes blink { 50% { background: #5a4a33; box-shadow: none; } }
@keyframes run-line {
  0% { background: color-mix(in srgb, #f5a524 28%, transparent); }
  50% { background: transparent; }
}
.nav-list { display: flex; gap: 1.75rem; }
.nav-list a { text-decoration: none; color: var(--muted); padding-block: .25rem; border-bottom: 2px solid transparent; }
.nav-list a:hover { color: var(--ink); }
.nav-list a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.fader { display: flex; align-items: center; gap: .45rem; color: var(--muted); }
.fader svg { width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fader input {
  -webkit-appearance: none; appearance: none; width: 5.5rem; height: 1.75rem; margin: 0; background: none; cursor: pointer;
}
.fader input:focus-visible { outline-offset: 4px; }
/* The groove, with scale ticks like a mixing desk */
.fader input::-webkit-slider-runnable-track {
  height: 1.75rem;
  background:
    linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 11px) center / 100% .75rem no-repeat;
}
.fader input::-moz-range-track {
  height: 1.75rem;
  background:
    linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 11px) center / 100% .75rem no-repeat;
}
/* The fader cap: a small block with a line across the middle */
.fader input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: .75rem; height: 1.35rem; margin-top: .2rem;
  border-radius: 2px; border: 0;
  background: linear-gradient(var(--paper-raised), var(--paper-raised)) center / 100% 2px no-repeat, var(--ink);
}
.fader input::-moz-range-thumb {
  width: .75rem; height: 1.35rem; border-radius: 2px; border: 0;
  background: linear-gradient(var(--paper-raised), var(--paper-raised)) center / 100% 2px no-repeat, var(--ink);
}
.fader:hover { color: var(--ink); }
@media (pointer: coarse) {   /* a taller grab area for thumbs */
  .fader input, .fader input::-webkit-slider-runnable-track, .fader input::-moz-range-track { height: 2.75rem; }
  .fader input::-webkit-slider-thumb { margin-top: .7rem; }
}

/* ---------- Intro ---------- */
.intro {
  max-width: var(--max); margin: 0 auto; padding: clamp(3rem, 8vw, 6rem) var(--gutter) 2.5rem;
  display: grid; grid-template-columns: 1fr auto; gap: 2rem 4rem; align-items: end;
  position: relative; isolation: isolate;
}
.scope {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 55% 60% at 50% 42%, #000 30%, transparent 100%);
          mask-image: radial-gradient(ellipse 55% 60% at 50% 42%, #000 30%, transparent 100%);
}
.scope__label {
  position: absolute; top: 1.25rem; right: var(--gutter);
  font-family: var(--mono); font-size: .7rem; letter-spacing: .04em; color: var(--muted); opacity: .8;
}
.intro h1 {
  font-size: clamp(2.75rem, 8.5vw, 6.25rem); font-weight: 850; line-height: .95;
  font-variation-settings: 'wdth' 125; letter-spacing: -.02em;
}
.lede { max-width: 38rem; margin-top: 1.5rem; font-size: clamp(1.125rem, 2vw, 1.3rem); line-height: 1.5; color: var(--muted); }
.portrait {
  width: clamp(8rem, 18vw, 13rem); aspect-ratio: 4 / 5; object-fit: cover; border-radius: 6px;
  background: var(--rule);
}

.elsewhere { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: 1.75rem; }
.elsewhere a {
  display: inline-flex; align-items: center; gap: .45rem; font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: .3em; text-decoration-thickness: 2px;
}
.elsewhere a:hover { text-decoration-color: currentColor; }
.elsewhere svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Now strip */
.now {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.25rem;
  max-width: 44rem; margin-top: 1.75rem; padding: .8rem 0; border-block: 1px solid var(--rule); font-size: .92rem;
}
.now__label {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: .75rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--c-green);
}
.now__dot {   /* a lit LED: a dome with a highlight */
  width: .6rem; height: .6rem; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, currentColor 30%, #fff) 0 18%, currentColor 60%);
}
.now dl { display: flex; flex-wrap: wrap; gap: .35rem 1.5rem; margin: 0; }
.now dl div:not([hidden]) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5rem; }
.now dt { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.now dd { margin: 0; font-weight: 600; }
.now a { text-decoration-color: var(--rule); text-decoration-thickness: 2px; text-underline-offset: .25em; }
.now a:hover { text-decoration-color: currentColor; }
@media (prefers-reduced-motion: no-preference) {
  .now__dot { animation: live 2s ease-out infinite; }
}
@keyframes live {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  100% { box-shadow: 0 0 0 .5rem transparent; }
}

/* ---------- Logic analyzer ---------- */
.capture { max-width: var(--max); margin: 0 auto; padding: 1rem var(--gutter) clamp(3rem, 7vw, 5rem); }
.capture__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .5rem 3rem; align-items: baseline; margin-bottom: 1.25rem; }
.capture__head h2 { font-size: 1.15rem; font-weight: 700; }
.capture__head p { color: var(--muted); max-width: 36rem; }

.la { margin: 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper-raised); overflow: hidden; }
.la__body { display: grid; grid-template-columns: 8.5rem 1fr; }
.la__names { padding-top: 2rem; border-right: 1px solid var(--rule); }
.la__names li {
  display: flex; align-items: center; gap: .6rem; height: 3rem; padding-inline: 1rem;
  font-size: .9rem; font-weight: 600;
}
.la__names i { width: .7rem; height: .7rem; border-radius: 2px; background: var(--c); flex: none; }

.la__plot { position: relative; }
.la__axis { position: relative; height: 2rem; border-bottom: 1px solid var(--rule); }
.la__tick { position: absolute; top: 0; bottom: 0; padding: .45rem 0 0 .4rem; font-family: var(--mono); font-size: .75rem; color: var(--muted); border-left: 1px solid var(--rule); }
.la__grid { position: absolute; top: 2rem; bottom: 0; z-index: 0; width: 0; border-left: 1px dashed var(--rule); pointer-events: none; }
.la__rows { position: relative; z-index: 1; }   /* signals always paint above the gridlines */

.la__rows li { position: relative; height: 3rem; }
.la__rows li::before {               /* the low level of the signal */
  content: ''; position: absolute; left: 0; right: 0; bottom: .6rem; height: 2px; background: var(--c);
}
.la__pulse {                         /* the high level: rising edge, high, falling edge */
  position: absolute; top: .6rem; bottom: .6rem; z-index: 1;
  display: flex; align-items: center; min-width: 4px; padding-inline: .5rem;
  border: 2px solid var(--c); border-bottom: 0;
  background: color-mix(in srgb, var(--c) 13%, var(--paper-raised));
  color: var(--ink); text-decoration: none;
  font-family: var(--mono); font-size: .75rem; white-space: nowrap; text-wrap: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color .15s;
}
.la__pulse span { overflow: hidden; text-overflow: ellipsis; }
.la__pulse:hover, .la__pulse:focus-visible, .la__pulse.is-active { background: color-mix(in srgb, var(--c) 30%, var(--paper-raised)); }
.la__pulse:focus-visible { outline-offset: 2px; }
.la__pulse--open { border-right: 0; }
.la__pulse.is-narrow { overflow: visible; }
.la__pulse.is-narrow span {
  position: absolute; left: calc(100% + .4rem); overflow: visible;
  padding: 0 .3rem; border-radius: 3px; background: var(--paper-raised);
}
.la__pulse.label-left span { left: auto; right: calc(100% + .4rem); }
.la__readout .item { white-space: nowrap; text-wrap: nowrap; }

.la__future {
  position: absolute; top: 2rem; right: 0; bottom: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--paper-raised) 70%, transparent) 6px 12px),
              color-mix(in srgb, var(--paper-raised) 45%, transparent);
}
.la__cursor { position: absolute; top: 0; bottom: 0; z-index: 3; width: 0; border-left: 2px solid var(--ink); pointer-events: none; }
.la__cursor span {
  position: absolute; top: .35rem; left: 0; transform: translateX(-50%);
  padding: 0 .4rem; border-radius: 3px; background: var(--ink); color: var(--paper-raised);
  font-family: var(--mono); font-size: .7rem; line-height: 1.35rem;
}

.la__readout {
  min-height: 4.25rem; padding: .9rem 1rem; border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: 7.5rem 1fr; gap: .25rem 1rem; align-items: baseline;
  font-size: .95rem;
}
.la__readout .when { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.la__readout strong { font-weight: 650; }
.la__readout .swatch { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; background: var(--c); margin-right: .45rem; vertical-align: .05em; }

/* The one orchestrated moment: the capture sweeps in on load */
@media (prefers-reduced-motion: no-preference) {
  .la.is-capturing .la__rows { animation: capture 1.6s cubic-bezier(.3, .7, .2, 1) both; }
  .la.is-capturing .la__cursor, .la.is-capturing .la__future { animation: appear .4s 1.4s both; }
}
@keyframes capture { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes appear { from { opacity: 0; } }

/* ---------- Sections ---------- */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(3.5rem, 8vw, 6rem) var(--gutter); border-top: 1px solid var(--rule); }
.section > h2 {
  font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 800; font-variation-settings: 'wdth' 115; letter-spacing: -.015em;
}
/* Reference designators, like the silkscreen next to a part on a board */
.refdes {
  display: inline-block; margin-right: .6em; padding: .1em .45em; vertical-align: .55em;
  border: 1.5px solid var(--muted); border-radius: 3px;
  font-family: var(--mono); font-size: .3em; font-weight: 500; letter-spacing: .06em; color: var(--muted);
  font-variation-settings: normal;
}
.section__intro { max-width: 40rem; margin-top: 1rem; font-size: 1.15rem; color: var(--muted); }
.subhead { margin: 3.5rem 0 1.25rem; font-size: 1.25rem; font-weight: 700; }

.entries { display: grid; gap: 0; }
.entry {
  display: grid; grid-template-columns: 11rem minmax(0, 44rem); gap: .5rem 2rem;
  padding: 1.5rem 0 1.5rem 1.25rem; border-left: 3px solid var(--c, var(--rule));
}
.entry + .entry { margin-top: .5rem; }
.entry__when { font-family: var(--mono); font-size: .85rem; color: var(--muted); padding-top: .15rem; }
.entry h4 { font-size: 1.15rem; font-weight: 700; }
.entry__where { color: var(--muted); font-size: .95rem; margin: .15rem 0 .6rem; }
.entry p + p { margin-top: .6rem; }
.entry__tech { font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.text-link { font-weight: 600; text-decoration-thickness: 2px; text-underline-offset: .25em; text-decoration-color: var(--c, var(--rule)); }
.text-link:hover { text-decoration-color: currentColor; }


/* Every coloured rule is a PCB trace; a via pad marks where it starts */
.entry, .feature, .personal article, .hikes { position: relative; }
.entry::before, .feature::before, .personal article::before, .hikes::before {
  content: ''; position: absolute; top: -6px; left: -8px; width: 13px; height: 13px; border-radius: 50%;
  border: 3px solid var(--c, var(--rule)); background: var(--paper);
}

/* Pinout: a DIP chip with a button per pin */
.chip { margin: 0; max-width: 44rem; }
.chip__caption { color: var(--muted); max-width: 36rem; margin-bottom: 1.5rem; }
.chip__board { display: grid; grid-template-columns: minmax(0, 1fr) 7rem minmax(0, 1fr); align-items: stretch; }
.chip__pins { display: grid; grid-template-rows: repeat(8, 2.4rem); padding-block: .9rem; }
.chip__pin {
  display: flex; align-items: center; justify-content: flex-end; gap: .55rem; width: 100%; height: 100%;
  padding: 0; background: none; border: 0; color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer; text-align: right;
}
.chip__pins--right .chip__pin { flex-direction: row-reverse; text-align: left; }
.chip__name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip__sig { font-family: var(--mono); font-size: .78rem; font-weight: 500; min-width: 2.2rem; }
.chip__pins--left .chip__sig { text-align: right; }
.chip__num { font-family: var(--mono); font-size: .7rem; color: var(--muted); min-width: 1.1rem; text-align: center; }
.chip__pin i {   /* the metal leg */
  flex: none; width: 1.1rem; height: .75rem; border-radius: 1px;
  background: linear-gradient(#e4e7eb, #a3aab4); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12);
  transition: background .15s;
}
.chip__pin:hover .chip__name, .chip__pin.is-active .chip__name { color: var(--ink); }
.chip__pin:hover i, .chip__pin.is-active i { background: linear-gradient(#f3d27a, #c9a227); }
.chip__pin[aria-pressed="true"] .chip__sig { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .25em; }

.chip__body {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  border-radius: 4px; background: linear-gradient(90deg, #1c1f24, #2b3038 50%, #1c1f24);
  box-shadow: 0 1px 0 rgb(255 255 255 / .06) inset, 0 6px 14px -6px rgb(0 0 0 / .45);
}
.chip__body::before {   /* the notch at the pin 1 end */
  content: ''; position: absolute; top: -1px; left: 50%; width: 1.5rem; height: .75rem; transform: translateX(-50%);
  border-radius: 0 0 .75rem .75rem; background: var(--paper);
}
.chip__body::after {    /* the pin 1 dot */
  content: ''; position: absolute; top: .7rem; left: .6rem; width: .45rem; height: .45rem; border-radius: 50%; background: #111317;
  box-shadow: inset 0 1px 1px rgb(0 0 0 / .6);
}
.chip__mark { font-family: var(--mono); font-size: .85rem; font-weight: 500; letter-spacing: .06em; color: #c9ced6; writing-mode: vertical-rl; }
.chip__mark--small { font-size: .65rem; color: #8a929e; }

.chip__readout {
  min-height: 3.5rem; margin-top: 1.25rem; padding: .8rem 1rem; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--paper-raised); font-size: .95rem;
  opacity: 0; transform: translateY(-.35rem); transition: opacity .15s, transform .15s;
}
.chip__readout.is-shown { opacity: 1; transform: none; }
.chip__at { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin-right: .35rem; }

.feature {
  margin-top: 2.5rem; max-width: 50rem; padding: 1.75rem 0 .25rem 1.25rem; border-left: 3px solid var(--c);
}
.feature__status { font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.feature h3 { font-size: clamp(1.4rem, 3vw, 1.85rem); font-weight: 750; font-variation-settings: 'wdth' 108; margin: .6rem 0 .9rem; }
.feature p + p { margin-top: .9rem; }

.personal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 3.5rem; margin-top: 2.5rem; max-width: 60rem; }
.personal article { padding-left: 1.25rem; border-left: 3px solid var(--c, var(--rule)); }
.personal h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: .4rem; }
.personal p { color: var(--muted); }

/* Hiking map */
.hikes { margin: 3.5rem 0 0; max-width: 60rem; padding-left: 1.25rem; border-left: 3px solid var(--c); }
.hikes__head h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: .4rem; }
.hikes__head p { color: var(--muted); max-width: 40rem; }
.hikes__body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.5rem 2.5rem; align-items: center; margin-top: 1.5rem; }
.hikes__map {
  position: relative; aspect-ratio: 744 / 620;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--paper-raised); overflow: hidden;
}
.hikes__map > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hikes__contours path { fill: none; stroke: var(--rule); stroke-width: 1; stroke-linecap: round; }
.hikes__contours path.is-index { stroke: color-mix(in srgb, var(--muted) 55%, var(--rule)); stroke-width: 1.4; }
.hikes__trail { fill: none; stroke: var(--c); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.hikes__trail.is-walking { stroke-dashoffset: 0; transition: stroke-dashoffset .9s cubic-bezier(.3, .7, .2, 1); }

.hikes__home, .hikes__peak { position: absolute; display: flex; align-items: center; gap: .35rem; font-size: .8rem; }
.hikes__home { transform: translate(-.3rem, -50%); font-family: var(--mono); font-size: .72rem; color: var(--muted); pointer-events: none; }
.hikes__home i { width: .6rem; height: .6rem; border: 2px solid var(--ink); background: var(--paper-raised); flex: none; }

.hikes__peak {
  transform: translate(-.45rem, -50%); padding: .25rem .4rem .25rem 0;
  background: none; border: 0; color: var(--ink); font: inherit; font-size: .8rem; cursor: pointer; text-align: left;
}
.hikes__peak.is-left { flex-direction: row-reverse; transform: translate(calc(-100% + .45rem), -50%); padding: .25rem 0 .25rem .4rem; text-align: right; }
.hikes__peak svg { width: .9rem; height: .75rem; flex: none; fill: var(--paper-raised); stroke: var(--c); stroke-width: 1.6; stroke-linejoin: round; overflow: visible; transition: fill .15s; }
.hikes__peak span { display: grid; line-height: 1.2; font-weight: 650; padding: .1rem .3rem; border-radius: 3px; background: color-mix(in srgb, var(--paper-raised) 80%, transparent); }
.hikes__peak small { font-family: var(--mono); font-size: .68rem; font-weight: 400; color: var(--muted); }
.hikes__peak:hover svg, .hikes__peak[aria-pressed="true"] svg { fill: var(--c); }
.hikes__peak[aria-pressed="true"] span { background: color-mix(in srgb, var(--c) 18%, var(--paper-raised)); }

.hikes__card { min-height: 9rem; }
.hikes__eyebrow { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.hikes__card h4 { font-size: clamp(1.4rem, 3vw, 1.85rem); font-weight: 750; font-variation-settings: 'wdth' 108; margin: .35rem 0 .5rem; }
.hikes__card p:not(.hikes__eyebrow) { color: var(--muted); }
.hikes__elev { font-weight: 600; color: var(--ink) !important; margin-bottom: .4rem; }

@media (prefers-reduced-motion: no-preference) {
  .hikes__contours { clip-path: circle(0% at 41% 43%); transition: clip-path 1.8s cubic-bezier(.3, .7, .2, 1); }
  .hikes.is-drawn .hikes__contours { clip-path: circle(80% at 41% 43%); }
}

.contact p { margin-top: 1rem; font-size: 1.15rem; color: var(--muted); max-width: 36rem; }
.contact p a { color: var(--ink); font-weight: 600; text-decoration-color: var(--rule); text-decoration-thickness: 2px; text-underline-offset: .25em; }
.contact p a:hover { text-decoration-color: currentColor; }
/* Serial Monitor: the contact links print out like a board saying hello over USB */
.serial { margin: 2rem 0 0; max-width: 40rem; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--paper-raised); }
.serial__bar {
  display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 1rem;
  background: #00878f; color: #fff; font: 500 .75rem/1.4 var(--mono); letter-spacing: .03em;
}
.serial__out { padding: 1rem 1rem 1.1rem; font-family: var(--mono); font-size: clamp(.85rem, 2.2vw, 1rem); line-height: 1.9; }
.serial__out li { display: flex; flex-wrap: wrap; column-gap: 1ch; }
.serial__out li::before { content: '>'; color: var(--muted); }
.serial__key { min-width: 9ch; color: var(--muted); }
.serial__out a {
  font-weight: 500; overflow-wrap: anywhere;
  text-decoration-color: var(--rule); text-decoration-thickness: 2px; text-underline-offset: .25em;
}
.serial__out a:hover { text-decoration-color: currentColor; }
.serial__sys { color: var(--muted); }
.serial__cursor::after { content: '_'; }
@media (prefers-reduced-motion: no-preference) {
  .serial__cursor::after { animation: blink-cursor 1s step-end infinite; }
  /* script.js arms the monitor so the lines can type in when it scrolls into view */
  .serial.is-armed li { clip-path: inset(0 100% 0 0); }
  .serial.is-armed.is-on li { animation: type-line .45s steps(28) both; animation-delay: calc(var(--i) * .35s); }
}
@keyframes blink-cursor { 50% { opacity: 0; } }
@keyframes type-line { to { clip-path: inset(0 0 0 0); } }

/* The way into play.html: a spark sitting on a short trace */
.play-link {
  display: inline-flex; align-items: center; gap: .7rem; margin-top: 1.5rem; padding: .55rem 1rem .55rem .8rem;
  border: 1.5px solid var(--ink); border-radius: 6px; font-weight: 650; text-decoration: none;
}
.play-link span { width: .7rem; height: .7rem; border-radius: 50%; background: #f5a524; box-shadow: 0 0 8px 2px #f5a52488; }
.play-link:hover { background: var(--ink); color: var(--paper); }

.site-footer {
  max-width: var(--max); margin: 0 auto; padding: 2rem var(--gutter) 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .9rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem;
}
.resistor { position: relative; display: flex; align-items: center; gap: .75rem; }
.resistor button { padding: .25rem; background: none; border: 0; color: var(--muted); cursor: pointer; line-height: 0; }
.resistor svg { width: 4.5rem; height: 1.25rem; overflow: visible; }
.resistor .lead { stroke: currentColor; stroke-width: 1.5; }
.resistor .body { fill: #e3d3b0; }
.resistor button:hover .body, .resistor button[aria-expanded="true"] .body { fill: #efe2c4; }
.resistor__decode { font-family: var(--mono); font-size: .78rem; opacity: 0; transform: translateX(-.25rem); transition: opacity .2s, transform .2s; pointer-events: none; }
.resistor button:hover + .resistor__decode,
.resistor button:focus-visible + .resistor__decode,
.resistor button[aria-expanded="true"] + .resistor__decode { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .capture__head { grid-template-columns: 1fr; }
  .entry { grid-template-columns: 1fr; gap: .35rem; }
  .personal { grid-template-columns: 1fr; }
  .hikes__body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* The nav drops to its own row under the name and fader */
  html { scroll-padding-top: 7rem; }
  .site-header { flex-wrap: wrap; gap: .35rem 1rem; padding-bottom: .4rem; }
  .site-header nav { order: 3; width: 100%; }
  /* Name, LED and fader share the first row: a narrower name and a shorter fader without its icons */
  .site-header { column-gap: .75rem; }
  .wordmark { font-variation-settings: 'wdth' 100; }
  .fader svg { display: none; }
  .fader input { width: 4rem; }
  /* The Blink popup hangs from the header and stays inside the screen; long lines scroll inside it */
  .onboard { position: static; }
  .onboard__sketch { left: var(--gutter); right: var(--gutter); overflow-x: auto; }
  .nav-list { gap: .5rem; justify-content: space-between; }
  .nav-list a { display: inline-block; padding-block: .5rem; }
  .intro { grid-template-columns: 1fr; }
  .portrait { order: -1; width: 7.5rem; }
  .la__body { grid-template-columns: 6.25rem 1fr; }
  .la__names li { padding-inline: .6rem; font-size: .8rem; gap: .45rem; }
  .la__pulse span { display: none; }
  .la__tick { font-size: .65rem; padding-left: .2rem; }
  .la__tick:nth-child(even) { color: transparent; }
  .la__readout { grid-template-columns: 1fr; }
  .hikes { padding-left: 0; border-left: 0; }
  .hikes::before { display: none; }
  .chip__board { grid-template-columns: minmax(0, 1fr) 5.5rem minmax(0, 1fr); }
  .chip__name { display: none; }
  .hikes__peak small { display: none; }
}

/* ---------- Terminal ---------- */
.term-open {
  display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .6rem;
  border: 1px solid var(--rule); border-radius: 5px; background: none; color: var(--muted);
  font: 500 .78rem/1.2 var(--mono); cursor: pointer;
}
.term-open:hover { color: var(--ink); border-color: var(--muted); }
.term-open kbd { padding: 0 .3rem; border: 1px solid var(--rule); border-radius: 3px; font: inherit; }

.term {
  width: min(46rem, calc(100vw - 2rem)); height: min(30rem, calc(100dvh - 4rem));
  padding: 0; border: 1px solid #2a3140; border-radius: 10px;
  background: #0d1117; color: #d7dde8; font: .9rem/1.6 var(--mono);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / .6);
}
.term[open] { display: flex; flex-direction: column; }
.term::backdrop { background: rgb(8 12 20 / .45); backdrop-filter: blur(2px); }
.term__bar {
  display: flex; justify-content: space-between; align-items: center; padding: .4rem .5rem .4rem 1rem;
  border-bottom: 1px solid #2a3140; background: #161b24; color: #8b95a7; font-size: .75rem;
}
.term__close { padding: .15rem .5rem; border: 0; border-radius: 4px; background: none; color: inherit; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.term__close:hover { background: #2a3140; color: #fff; }
.term__log { flex: 1; overflow-y: auto; padding: .9rem 1rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.term__log > div { min-height: 1.6em; }
.term__log a { color: #7cc4ff; text-underline-offset: .2em; }
.term__form { display: flex; gap: 1ch; padding: .15rem 1rem 1rem; }
.term__prompt, .term .ps { color: #62cf80; }
.term__input { flex: 1; min-width: 0; padding: 0; border: 0; outline: none; background: none; color: inherit; font: inherit; caret-color: #62cf80; }
.term .dim { color: #8b95a7; }
.term .err { color: #f47171; }
.term .hl { color: #f0c94a; }
@media (pointer: coarse) { .term__input { font-size: 16px; } }   /* stops iOS zooming in on focus */
@media (max-width: 640px) { .term__prompt { display: none; } .term__form::before { content: '$'; color: #62cf80; } }
