/*
style.css - Styles for the personal site.

One dark scheme for the whole page, with colour kept for meaning: blue is what
was commanded or planned, amber is what the gyro measured, and white is the
gyro after a filter. It covers:
 - the colours, type and section layout every part of the page shares
 - the plots, readouts and controls the live demos use
 - the LED matrix, the project list and the contact links

Author: Rupert

Changes made: [Rupert]
 - rebuilt around one dark scheme for the live demos, replacing the light and
   dark pair that followed the system setting
*/

:root {
  --bg: #0b0a09;
  --ink: #ece7dd;
  --dim: #a39d92;
  --rule: #2a2622;
  --grid: #1c1916;
  --amber: #f0a93a;     /* measured: anything amber came off the gyro */
  --sky: #8fb3c9;       /* commanded or planned */
  --led: #ff5a3c;       /* the LEDs, nothing else */
  --din: "DIN Alternate", Bahnschrift, "D-DIN", "Arial Narrow", sans-serif;
  --body: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pad: clamp(1rem, 4vw, 3rem);
  --gutter: 3.5rem;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font: 400 1.0625rem/1.6 var(--body); }
a { color: inherit; text-decoration-color: var(--amber); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.plot:has(input:focus-visible) { outline: 2px solid var(--amber); outline-offset: 3px; }

/* header and hero */
.bar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.5rem var(--pad); border-bottom: 1px solid var(--rule);
  font: 500 0.9375rem/1 var(--din); letter-spacing: 0.04em;
}
.bar nav { display: flex; gap: 1.5rem; }
.bar a { text-decoration: none; display: inline-block; padding: 0.9rem 0; }
.hero { padding: clamp(2.5rem, 7vw, 5rem) var(--pad) 0; }
h1 { margin: 0; font: 500 clamp(2.75rem, 9.5vw, 8rem)/0.9 var(--din); text-transform: uppercase; letter-spacing: -0.01em; }
.lede { max-width: 36rem; margin: 1.5rem 0 0; font-size: 1.1875rem; }

/* every lab section shares one header layout */
.sect { padding: clamp(4rem, 9vw, 7rem) var(--pad) 0; }
.sect-head { display: grid; grid-template-columns: 15rem minmax(0, 40rem); gap: 1rem 2rem; margin-bottom: 2rem; }
h2 { margin: 0; font: 500 1.75rem/1.1 var(--din); }
.from { margin: 0.6rem 0 0; font-size: 0.9375rem; color: var(--dim); }
.sect-head p { margin: 0 0 0.9rem; }
.sect-head p:last-child { margin-bottom: 0; }
.key-set { color: var(--sky); }
.key-gyro { color: var(--amber); }

/* plots */
.plot { position: relative; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); touch-action: pan-y; }
.plot svg { position: absolute; top: 0; bottom: 0; left: 0; width: calc(100% - var(--gutter)); height: 100%; overflow: visible; }
.plot .g { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ln { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.ln-set { stroke: var(--sky); stroke-width: 2.5; }
.ln-gyro { stroke: var(--amber); stroke-width: 1.1; }
.ln-gyro.faint { opacity: 0.45; }
.ln-out { stroke: var(--ink); stroke-width: 1.8; }
.cursor { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.axis { position: absolute; right: 0.6rem; font: 0.8125rem/1 var(--mono); color: var(--dim); pointer-events: none; }
.xaxis { display: flex; justify-content: space-between; width: calc(100% - var(--gutter)); padding-top: 0.4rem; font: 0.8125rem/1 var(--mono); color: var(--dim); }
.scrub { position: absolute; top: 0; left: 0; width: calc(100% - var(--gutter)); height: 100%; margin: 0; opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none; }
#scope { height: clamp(240px, 36vw, 440px); }
#zoom { height: clamp(180px, 22vw, 260px); }
#spectrum { height: clamp(200px, 26vw, 320px); cursor: ew-resize; }
.band { fill: var(--sky); opacity: 0.12; }
.spec-fill { fill: var(--amber); opacity: 0.22; }
.band-edge { stroke: var(--sky); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.notch { stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.tag { position: absolute; top: 0.6rem; font: 500 0.8125rem/1 var(--din); letter-spacing: 0.04em; pointer-events: none; white-space: nowrap; }
.tag-notch { color: var(--ink); transform: translateX(0.4rem); }
.tag-band { color: var(--sky); top: auto; bottom: 0.6rem; transform: translateX(0.4rem); }

/* readouts */
.readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1.5rem; margin: 0; border-bottom: 1px solid var(--rule); }
.readout div { padding: 0.9rem 0 1rem; }
.readout dt { font: 500 0.8125rem/1.25 var(--din); letter-spacing: 0.05em; text-transform: uppercase; color: var(--dim); }
.readout dd { margin: 0.35rem 0 0; font: 500 clamp(1.25rem, 2.4vw, 1.75rem)/1.1 var(--din); font-variant-numeric: tabular-nums; }
.readout dd small { font-size: 0.6em; color: var(--dim); margin-left: 0.2em; }
.caption { max-width: 46rem; margin: 1rem 0 0; color: var(--dim); font-size: 0.9375rem; }

/* controls */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 1.25rem 0 0; }
.btn {
  font: 500 0.875rem/1 var(--din); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink); background: none; border: 1px solid #4a443d; border-radius: 2px;
  min-height: 44px; padding: 0 1.1rem; cursor: pointer;
}
.btn:hover { border-color: var(--amber); }
.btn[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
.field { display: grid; gap: 0.2rem; min-width: 12rem; flex: 1 1 14rem; }
.field label, .field .lbl { font: 500 0.8125rem/1.2 var(--din); letter-spacing: 0.05em; text-transform: uppercase; color: var(--dim); }
.field output { font: 500 1.125rem/1 var(--din); color: var(--ink); font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; font-size: 0.9375rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--amber); }
select {
  font: 500 1rem var(--din); color: var(--ink); background: var(--bg);
  border: 1px solid #4a443d; border-radius: 2px; min-height: 44px; padding: 0 0.75rem;
}
input[type="range"].slide { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; }
.slide::-webkit-slider-runnable-track { height: 2px; background: #4a443d; }
.slide::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -8px; border-radius: 50%; background: var(--amber); border: 0; }
.slide::-moz-range-track { height: 2px; background: #4a443d; }
.slide::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--amber); border: 0; }
/* the notch slider's track starts at 60 Hz on the spectrum's 0 to 1000 Hz axis */
.under { width: calc(100% - var(--gutter)); }
.under input[type="range"].slide { margin-left: calc(6% - 9px); width: calc(94% + 18px); }

.twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem 3rem; }
pre.cli { margin: 0; padding: 1rem 0 0; border-top: 1px solid var(--rule); font: 0.875rem/1.6 var(--mono); color: var(--ink); overflow-x: auto; }
pre.cli .c { color: var(--dim); }
.warn { color: var(--amber); font-size: 0.9375rem; margin: 0.75rem 0 0; }

/* the LED matrix */
.matrix-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2.5rem; align-items: center; }
.matrix {
  display: grid; grid-template-columns: repeat(8, var(--led-size)); gap: calc(var(--led-size) * 0.32);
  --led-size: clamp(1.5rem, 4.4vw, 2.6rem);
  width: max-content; justify-self: start;
  padding: calc(var(--led-size) * 0.55); border: 1px solid #222; border-radius: 6px;
  background: linear-gradient(#131313, #0c0c0c);
}
.matrix span { width: var(--led-size); height: var(--led-size); border-radius: 50%; border: 1px solid #262626; background: radial-gradient(ellipse 26% 16% at 33% 26%, rgba(255, 255, 255, 0.08), transparent), radial-gradient(circle, #1a1a1a 0 80%, #232323); }
.matrix span.on { border-color: transparent; }
.matrix span.on { background: radial-gradient(circle at 42% 38%, #fff1e6, #ffb08f 18%, var(--led) 40%, #c8321a 62%); box-shadow: 0 0 calc(var(--led-size) * 0.45) rgba(255, 90, 60, 0.55); }
.matrix-side .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.status { min-height: 1.6em; margin: 0.75rem 0 0; color: var(--dim); font-size: 0.9375rem; }

/* projects and contact */
.channel { display: grid; grid-template-columns: 15rem minmax(0, 1fr) 17rem; gap: 2rem; padding: 2rem 0; border-top: 1px solid var(--rule); }
.channel h3 { margin: 0; font: 500 1.5rem/1.15 var(--din); }
.channel h3 a { text-decoration: none; }
.channel h3 a:hover { text-decoration: underline; }
.meta { margin: 0.5rem 0 0; color: var(--dim); font-size: 0.9375rem; }
.channel p { margin: 0 0 0.75rem; }
.gauges { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1.5rem; align-content: start; }
.gauges div { display: flex; flex-direction: column; }
.gauges dd { margin: 0; font: 500 2.25rem/1 var(--din); font-variant-numeric: tabular-nums; }
.gauges dt { order: 2; margin-top: 0.35rem; font-size: 0.875rem; line-height: 1.3; color: var(--dim); }
.links { list-style: none; margin: 0; padding: 0; font: 500 clamp(1.375rem, 3vw, 2.25rem)/1.25 var(--din); }
.links a { display: inline-block; padding: 0.3rem 0; text-decoration-thickness: 2px; }
footer { margin-top: 5rem; padding: 1.5rem var(--pad) 2.5rem; border-top: 1px solid var(--rule); color: var(--dim); font-size: 0.875rem; }

@media (max-width: 1100px) {
  .channel { grid-template-columns: 13rem minmax(0, 1fr); }
  .gauges { grid-column: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .hero-id { flex-direction: column; align-items: flex-start; }
  .avatar { width: 4.5rem; margin-top: 0; }
  :root { --gutter: 0rem; }
  .axis { display: none; }
  .sect-head, .channel, .twocol, .matrix-row { grid-template-columns: minmax(0, 1fr); }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gauges { grid-column: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar nav { gap: 1rem; }
}

/* the R on the LED matrix, the same picture as my GitHub profile */
/* sized like one line of the name, and held to its first line when the name wraps */
.hero-id { display: flex; align-items: flex-start; gap: clamp(0.75rem, 2vw, 1.75rem); }
.avatar { flex: none; display: block; width: clamp(2.75rem, 9.5vw, 8rem); height: auto; margin-top: -0.04em; border-radius: 50%; }
.cli-actions { margin-top: 0.75rem; }
