/*
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 was measured, and white is the result
after a filter. It covers:
 - the colours, type and section layout every part of the page shares
 - the introduction, project blocks and demo tabs
 - the plots, readouts and controls the live demos use
 - the visualiser's stages and LED matrix
 - the achievements and 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
 - added the project blocks, demo tabs, visualiser stages and timeline for the
   page reorganised around me and my projects
 - added the highlights, the hero's LED matrix and the marks lists
 - replaced the timeline, marks and skills with the achievements list
 - removed the highlights strip, which repeated the achievements
 - plainer type: the name in normal case, sentence case buttons with icons
 - added the demo buttons, the local time and the header's GitHub icon
*/

:root {
  --bg: #0b0a09;
  --panel: #121110;
  --ink: #ece7dd;
  --dim: #a39d92;
  --rule: #2a2622;
  --grid: #1c1916;
  --edge: #4a443d;
  --amber: #f0a93a;     /* measured: anything amber came off a sensor */
  --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;
  --measure: 46rem;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@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; }
code { font: 0.92em var(--mono); }
p { margin: 0 0 0.9rem; }
.meta, .from { color: var(--dim); font-size: 0.9375rem; }
.from { margin: 0.6rem 0 0; }
.key-set { color: var(--sky); }
.key-gyro { color: var(--amber); }

/* header: stays at the top so the sections are always one click away */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.35rem var(--pad); border-bottom: 1px solid var(--rule);
  background: var(--bg);
  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-flex; align-items: center; min-height: 44px; }
.brand { gap: 0.6rem; }
.brand img { border-radius: 50%; }

/* introduction */
.hero { padding: clamp(3rem, 8vw, 6rem) var(--pad) 0; }
/* the photo is sized like one line of the name, and held to its first line when the name wraps */
.hero-id { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 1.75rem); }
.avatar {
  flex: none; display: block; width: clamp(4rem, 8vw, 6.5rem); aspect-ratio: 1;
  padding: 0; border: 0; border-radius: 10%; background: none; cursor: pointer;
}
.avatar img { display: block; width: 100%; height: auto; border-radius: 50%; }
/* the hero's LED matrix, drawn like the demo's but sized to the name beside it */
.ledmark {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 3.5%; padding: 9%; aspect-ratio: 1;
  border: 1px solid #222; border-radius: 10%; background: linear-gradient(#131313, #0c0c0c);
}
.ledmark span { border-radius: 50%; aspect-ratio: 1; background: radial-gradient(circle, #1a1a1a 0 78%, #262626); }
.ledmark span.on {
  background: radial-gradient(circle at 42% 38%, #fff1e6, #ffb08f 18%, var(--led) 42%, #c8321a 66%);
  box-shadow: 0 0 0.35rem rgba(255, 90, 60, 0.6);
}
h1 { margin: 0; font: 600 clamp(2.25rem, 5.5vw, 4rem)/1.05 var(--din); letter-spacing: -0.015em; }
.role { margin: 0.5rem 0 0; color: var(--dim); font-size: clamp(1rem, 1.6vw, 1.1875rem); }
.focus { margin: 1.5rem 0 0; font: 500 clamp(1.125rem, 2vw, 1.375rem)/1.3 var(--din); letter-spacing: 0.04em; color: var(--amber); }
.lede { max-width: 38rem; margin: 1.75rem 0 0; font-size: 1.125rem; }
.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 0; padding: 0; list-style: none; }

/* buttons, used for links and controls alike */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0 1.1rem;
  font: 600 0.9375rem/1 var(--body); text-decoration: none;
  color: var(--ink); background: none; border: 1px solid var(--edge); border-radius: 2px; cursor: pointer;
}
.btn:hover { border-color: var(--amber); color: var(--ink); }
.btn[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
.btn-solid { background: var(--amber); border-color: var(--amber); color: #15120d; }
.btn-solid:hover { background: #f5bb5c; color: #15120d; }

/* sections share one header layout: the title on the left, its text on the right */
.sect { padding: clamp(4.5rem, 10vw, 7.5rem) var(--pad) 0; }
.sect-head { display: grid; grid-template-columns: 15rem minmax(0, var(--measure)); gap: 1rem 2rem; margin-bottom: 2.5rem; }
h2 { margin: 0; font: 500 1.75rem/1.1 var(--din); }
h3 { margin: 0; font: 500 1.5rem/1.15 var(--din); }
.sect-head p:last-child { margin-bottom: 0; }

/* one block per project: what it is, its numbers, then its demo */
.project { padding: 2.5rem 0 3rem; border-top: 1px solid var(--rule); }
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem 2rem; flex-wrap: wrap; }
.project-head h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
.project-head .meta { margin: 0.4rem 0 0; }
.code-link { flex: none; display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; font: 600 0.9375rem/1 var(--body); text-decoration: none; }
.code-link:hover { text-decoration: underline; }
.icon { width: 1rem; height: 1rem; flex: none; fill: currentColor; }
.project-body { display: grid; grid-template-columns: minmax(0, var(--measure)) 17rem; justify-content: space-between; gap: 1.5rem 3rem; margin-top: 1.5rem; }
.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); }

/* the demo sits on a slightly lifted panel so it reads as something to use */
.demo { margin-top: 2rem; padding: clamp(1rem, 2.5vw, 1.75rem); background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; }
.demo-intro { max-width: var(--measure); color: var(--ink); }
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: -0.25rem 0 1.25rem; border-bottom: 1px solid var(--rule); }
.tabs [role="tab"] {
  font: 500 0.9375rem/1 var(--din); letter-spacing: 0.03em; color: var(--dim);
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  min-height: 44px; padding: 0 0.1rem; cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--amber); }
.tabs [role="tab"]:hover { color: var(--ink); }

/* each demo opens from its own button, so the projects read as a list first */
.demo-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.5rem; }
.demo-toggle .teaser { margin: 0; color: var(--dim); font-size: 0.9375rem; }
.btn-demo { border-color: var(--amber); color: var(--amber); }
.btn-demo:hover { background: var(--amber); color: #15120d; }
.btn-demo[aria-expanded="true"] { border-color: var(--edge); color: var(--ink); }
.btn-demo[aria-expanded="true"]:hover { background: none; border-color: var(--amber); }
.where { margin: 0.5rem 0 0; color: var(--dim); font-size: 0.9375rem; }
.where span { margin-left: 0.5rem; font-variant-numeric: tabular-nums; }
.nav-icon { color: var(--dim); }
.nav-icon:hover { color: var(--ink); }
.nav-icon .icon { width: 1.125rem; height: 1.125rem; }

/* 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(220px, 32vw, 400px); }
#zoom { height: clamp(160px, 20vw, 240px); margin-top: 2rem; }
#spectrum { height: clamp(200px, 24vw, 300px); 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-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.readout-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.readout-top { border-top: 1px solid var(--rule); margin-top: 1rem; }
.readout div { padding: 0.8rem 0 0.9rem; }
.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.25em; }
.caption { max-width: var(--measure); 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; }
.controls-first { margin-top: 0; }
.field { display: grid; gap: 0.2rem; min-width: 12rem; flex: 1 1 14rem; }
.field-preset { flex: 0 1 16rem; }
.field-gain { flex: 0 1 18rem; }
.field label { font: 600 0.875rem/1.2 var(--body); 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 var(--edge); 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: var(--edge); }
.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: var(--edge); }
.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; margin-top: 1.25rem; }
pre.cli { margin: 0.5rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--rule); font: 0.875rem/1.6 var(--mono); color: var(--ink); overflow-x: auto; }
.warn { color: var(--amber); font-size: 0.9375rem; margin: 0.75rem 0 0; }
.status { min-height: 1.6em; margin: 1rem 0 0; color: var(--dim); font-size: 0.9375rem; }

/* the visualiser, one stage at a time */
.stages { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.stage { padding: 1.25rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--bg); }
.stage-wide { grid-column: 1 / -1; }
.stage h4 { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 1rem; font: 500 1.125rem/1.2 var(--din); }
.stage .n {
  display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  border: 1px solid var(--amber); color: var(--amber); font-size: 0.875rem;
}
.stage-note { margin: 1rem 0 0; color: var(--dim); font-size: 0.9375rem; max-width: var(--measure); }
.stage-note b { color: var(--ink); font-weight: 500; }
#wave { height: clamp(160px, 18vw, 220px); --gutter: 3rem; }
.ln-wave { stroke: var(--amber); stroke-width: 1.3; }
.minmax { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.window-band { fill: var(--amber); opacity: 0.08; }
.single { fill: var(--ink); stroke: var(--bg); stroke-width: 2; vector-effect: non-scaling-stroke; }

.compare { display: grid; grid-template-columns: 1fr; gap: 0.9rem; }
.compare .lbl { margin: 0 0 0.35rem; font: 500 0.8125rem/1.2 var(--din); letter-spacing: 0.05em; text-transform: uppercase; color: var(--dim); }
.history { display: flex; align-items: flex-end; gap: 2px; height: 64px; border-bottom: 1px solid var(--rule); }
.history span { flex: 1; min-height: 1px; background: var(--amber); opacity: 0.85; }
#h-single span { background: var(--ink); opacity: 0.6; }

.scale { position: relative; height: 44px; }
.scale-bins { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; height: 100%; }
.scale-bins span { background: #1e1b18; border-radius: 2px; }
.scale-bins span.on { background: var(--led); opacity: 0.85; }
.scale-marker { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--ink); left: 0; transition: left 80ms linear; }
.scale-axis { display: flex; justify-content: space-between; margin-top: 0.4rem; font: 0.8125rem/1 var(--mono); color: var(--dim); }
pre.code { margin: 1rem 0 0; font: 0.875rem/1.5 var(--mono); color: var(--ink); white-space: pre-wrap; }

.buffer { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.buffer span {
  display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--rule); border-radius: 3px;
  font: 500 1.125rem/1 var(--din); font-variant-numeric: tabular-nums;
}
.buffer span.new { border-color: var(--amber); color: var(--amber); }

.matrix-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.matrix {
  --led-size: clamp(1.5rem, 4vw, 2.5rem);
  display: grid; grid-template-columns: repeat(8, var(--led-size)); gap: calc(var(--led-size) * 0.32);
  width: max-content; 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;
  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);
}
.scan { display: grid; grid-template-columns: repeat(8, var(--led-size, 2rem)); gap: calc(var(--led-size, 2rem) * 0.32); padding: 0 calc(var(--led-size, 2rem) * 0.55); margin-top: 0.5rem; --led-size: clamp(1.5rem, 4vw, 2.5rem); }
.scan span { height: 3px; border-radius: 2px; background: var(--rule); }
.scan span.on { background: var(--amber); }

/* Cosmic and other work */
.more { padding: 2.5rem 0 0; border-top: 1px solid var(--rule); }
.more-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 3rem; }
.more-list b { display: block; font: 500 1.1875rem/1.25 var(--din); }
.more-list .meta { display: block; margin: 0.25rem 0 0.5rem; }
.more-list p { margin: 0; }
.more-list li { padding-top: 1rem; border-top: 1px solid var(--rule); }

/* achievements: the result on the left, the story in the middle, the year on the right */
.achievements { list-style: none; margin: 0; padding: 0; }
.achievements li { display: grid; grid-template-columns: 15rem minmax(0, var(--measure)) auto; gap: 0.5rem 2rem; padding: 1.75rem 0; border-top: 1px solid var(--rule); }
.achievements .stat { margin: 0; font: 500 clamp(2rem, 4vw, 2.75rem)/1 var(--din); font-variant-numeric: tabular-nums; }
.achievements h3 { font-size: 1.375rem; margin-bottom: 0.5rem; }
.achievements p { margin: 0; }
.achievements .when { margin: 0.35rem 0 0; font: 500 0.9375rem/1.3 var(--din); letter-spacing: 0.04em; color: var(--dim); white-space: nowrap; }

/* contact */
.links { list-style: none; margin: 1.25rem 0 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 { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 2rem; 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) {
  .project-body { grid-template-columns: minmax(0, 1fr); }
  .gauges { grid-template-columns: repeat(3, minmax(0, 12rem)); }
  .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage:nth-child(4) { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  :root { --gutter: 0rem; }
  .axis { display: none; }
  .bar .brand span { display: none; }
  .bar nav { gap: 0.9rem; }
  #wave { --gutter: 0rem; }
  .hero-id { align-items: flex-start; }
  .avatar { width: 4rem; }
  .sect-head, .twocol, .matrix-row, .more-list, .achievements li { grid-template-columns: minmax(0, 1fr); }
  .achievements .when { grid-row: auto; }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stages { grid-template-columns: minmax(0, 1fr); }
}
