/* 404human: a portfolio and build log drawn like a small control room.
   Light by default. Dark when the system asks for it, unless the toggle picked light,
   or whenever the toggle picked dark. `color-scheme` also drives the code colours. */

:root {
  color-scheme: light;
  --bg: #fdfdfc;
  --text: #1f2328;
  --muted: #656d76;
  --line: #e5e7eb;
  --accent: #b7410e; /* rust */
  --ok: #1a7f37; /* running / release */
  --fail: #cf222e; /* failure */
  --code-bg: #f4f4f2;
  /* Small colourful details: labels, tags, pills, the build log's milestones.
     The backgrounds stay plain. */
  --c-blue: #2563eb;
  --c-violet: #7c3aed;
  --c-teal: #0f766e;
  --c-amber: #b45309;
  --c-pink: #be185d;
  --max: 42rem;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141414;
    --text: #e6e6e6;
    --muted: #9a9a9a;
    --line: #2b2b2b;
    --accent: #f08a5d;
    --ok: #3fb950;
    --fail: #f85149;
    --code-bg: #1d1d1d;
    --c-blue: #60a5fa;
    --c-violet: #a78bfa;
    --c-teal: #2dd4bf;
    --c-amber: #fbbf24;
    --c-pink: #f472b6;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141414;
  --text: #e6e6e6;
  --muted: #9a9a9a;
  --line: #2b2b2b;
  --accent: #f08a5d;
  --ok: #3fb950;
  --fail: #f85149;
  --code-bg: #1d1d1d;
  --c-blue: #60a5fa;
  --c-violet: #a78bfa;
  --c-teal: #2dd4bf;
  --c-amber: #fbbf24;
  --c-pink: #f472b6;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.7;
}

::selection {
  background: color-mix(in srgb, var(--c-violet) 25%, transparent);
}

.site-header,
main,
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1rem;
}

/* A thin rust line across the top. On posts it fills up as you read. */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--rainbow);
  z-index: 10;
}

:root {
  /* A thin line of every accent colour, for the top bar and progress. */
  --rainbow: linear-gradient(90deg, var(--c-blue), var(--c-violet), var(--c-pink), var(--accent), var(--c-amber));
}

.post .top-bar {
  background: var(--line);
}

.post .top-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--rainbow);
  transform-origin: 0 50%;
}

@supports (animation-timeline: scroll()) {
  .post .top-bar::after {
    animation: read-progress linear both;
    animation-timeline: scroll(root);
  }
}

@keyframes read-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* Header: the name and the links share one baseline; the round theme
   button is centred on them. */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.site-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  text-transform: lowercase;
  color: var(--text);
  text-decoration: none;
}

.site-title::before {
  content: "~/";
  color: var(--accent);
}

.site-header nav {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
}

.site-header nav a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}

/* Light/dark toggle: shows the moon in light mode and the sun in dark mode. */
.theme-toggle {
  display: inline-flex;
  align-self: center;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none; /* stays hidden if JavaScript is off */
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

.theme-toggle:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
}

.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* Text */
a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2.1rem;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.45rem;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.5rem;
}

p,
ul,
ol {
  margin: 0 0 1.25rem;
}

li + li {
  margin-top: 0.35rem;
}

strong {
  font-weight: 650;
}

blockquote {
  margin: 0 0 1.25rem;
  padding-left: 1rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

img {
  max-width: 100%;
  height: auto;
}

/* Screenshots in posts: a hairline frame, so a light screenshot doesn't melt
   into a light page. Same 8px radius as code blocks. */
figure.shot {
  margin: 1.75rem 0;
}

figure.shot img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

figure.shot figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.meta,
.subtitle {
  color: var(--muted);
}

.meta {
  font-family: var(--mono);
  font-size: 0.82rem;
  margin: 0;
}

/* Tags: post kinds and project statuses */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  /* Tags are all capitals, so the space a line keeps for descenders (g, p, y) would sit
     empty under the letters. Fallback: a little extra padding on top to even it out. */
  line-height: 1.38;
  padding: 0.19em 0.4rem 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  vertical-align: middle; /* centred on the text beside it */
  white-space: nowrap;
}

/* Where supported (Chrome, Safari), trim the box to exactly the capitals' height,
   so equal padding gives equal space above and below. */
@supports (text-box: trim-both cap alphabetic) {
  .tag {
    line-height: 1;
    padding: 0.42em 0.4rem;
    text-box: trim-both cap alphabetic;
  }
}

/* Project statuses, each with its colour. */
.status-in-progress {
  color: var(--c-amber);
  border-color: color-mix(in srgb, var(--c-amber) 45%, transparent);
}

.status-write-up {
  color: var(--c-violet);
  border-color: color-mix(in srgb, var(--c-violet) 45%, transparent);
}

.status-live,
.status-shipped {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
}

.kind-experiment {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.kind-failure {
  color: var(--fail);
  border-color: color-mix(in srgb, var(--fail) 45%, transparent);
}

.kind-release {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
}

/* Home page */
.hero h1 {
  font-size: 2.6rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

/* A terminal cursor after the name. */
.hero h1::after {
  content: "";
  display: inline-block;
  width: 0.5ch;
  height: 0.85em;
  margin-left: 0.15em;
  vertical-align: -0.05em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero p {
  font-size: 1.3rem;
  line-height: 1.55;
  max-width: 34rem;
  margin: 0;
}

/* Section labels with a hairline: NOW ────── */
.home h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 3.5rem 0 0.5rem;
}

.home h2::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

/* A small coloured marker in front of each section label. */
.home h2::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  background: var(--marker, var(--accent));
}

.home h2#status { --marker: var(--ok); }
.home h2#build-log { --marker: var(--accent); }
.home h2#projects { --marker: var(--c-violet); }
.home h2#writing { --marker: var(--c-blue); }
.home h2#contact { --marker: var(--c-teal); }

/* Log rows: a narrow mono column (status, year or date), then the entry. */
.log {
  list-style: none;
  padding: 0;
  margin: 0;
}

.log .entry {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  align-items: baseline; /* the left label sits on the same line as the title's first line */
  padding: 0.8rem 0;
  margin: 0;
}

.log .when {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

/* A post's kind sits under its date, so the title starts cleanly and wraps neatly. */
.log .when .tag {
  display: block;
  width: fit-content;
  margin-top: 0.45rem;
}

.log .what p {
  margin: 0;
}

.log .title {
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
}

/* Linked titles turn rust and get an underline on hover; nothing shifts. */
.log a.title {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.log a.title:hover,
.log a.title:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.log .summary {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 0.2rem;
}

/* "running" with a pulsing dot (inline, so "running" keeps its text baseline) */
.log .when.status-running {
  color: var(--ok);
}

.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 0.45rem transparent;
  }
}

/* Post page */
.post-header {
  margin-bottom: 2.5rem;
}

.post-header .meta {
  margin-bottom: 0.75rem;
}

.post-header .subtitle {
  font-size: 1.2rem;
  font-style: italic;
  margin: 0;
}

.back {
  margin-top: 3rem;
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* Build logs: a project written up checkpoint by checkpoint. */

/* Home: the latest entries sit under the log's own row, tighter and lighter. */
.log .log-step {
  padding: 0.3rem 0;
}

.log .log-step .title {
  font-weight: 500;
}

.log .more {
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* "At a glance" under an entry's subtitle: label | value rows, like the home page log. */
.glance {
  margin: 1.5rem 0 0;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.glance div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  align-items: baseline; /* the mono label sits on the value's first line */
  padding: 0.3rem 0;
}

.glance dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* Goal, built, result, code: one colour each. */
.glance div:nth-child(1) dt { color: var(--c-blue); }
.glance div:nth-child(2) dt { color: var(--c-violet); }
.glance div:nth-child(3) dt { color: var(--ok); }
.glance div:nth-child(4) dt { color: var(--c-amber); }

.glance dd {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
}

/* An entry's place in its log, on the line above the date. */
.post-header .series-line {
  margin-bottom: 0.35rem;
}

/* A build log's page: entries grouped under milestones. */
.milestone h2 {
  display: flex;
  align-items: baseline; /* the mono id and the name share one text baseline */
  gap: 0.6rem;
}

.milestone-id {
  font-family: var(--mono);
  font-size: 0.8em;
  font-weight: 600;
  color: var(--mc, var(--accent));
}

.milestone-about {
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.milestone.is-upcoming h2,
.milestone.is-upcoming .milestone-id {
  color: var(--muted);
}

/* The milestone being built: a small green "in progress" beside its name. */
.milestone-now {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ok);
  white-space: nowrap;
}

/* Steps still ahead: faded (muted, not bold), but easy to read. */
.log .entry.is-planned {
  padding: 0.45rem 0;
}

.log .entry.is-planned .title {
  font-weight: 400;
  color: var(--muted);
}

/* Previous / next entry, under a build-log entry. */
.series-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.series-nav a {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.series-dir {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--c-violet);
  margin-bottom: 0.2rem;
}

.series-title {
  font-weight: 650;
  line-height: 1.4;
  transition: color 0.15s ease;
}

.series-nav a:hover .series-title,
.series-nav a:focus-visible .series-title {
  color: var(--accent);
}

/* "Next" stays on the right even when there is no "previous". */
.series-next {
  grid-column: 2;
  text-align: right;
}

.series-nav + .back {
  margin-top: 2rem;
}

/* Code */
code {
  font-family: var(--mono);
  font-size: 0.88em;
}

:not(pre) > code {
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg) !important; /* one background in both modes, whatever the theme sets */
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin: 0 0 1.5rem;
  overflow-x: auto; /* long lines scroll instead of breaking the layout on phones */
  line-height: 1.55;
  font-size: 0.95rem;
}

pre code {
  font-size: inherit;
}

/* Required by Zola's code highlighter (Giallo). */
.giallo-l {
  display: inline-block;
  min-height: 1lh;
  width: 100%;
  vertical-align: top; /* keeps blank lines in code the same height as other lines */
}

.giallo-ln {
  display: inline-block;
  user-select: none;
  margin-right: 0.4em;
  padding: 0.4em;
  min-width: 3ch;
  text-align: right;
  opacity: 0.8;
}

/* Footer */
.site-footer {
  margin-top: 4.5rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.site-footer a {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

/* ---------- The control room: the home page and the build log ----------
   A terminal intro, live status rows, the build log as a status strip,
   milestones and a test-count sparkline. Every number comes from the posts. */

:root {
  --panel: #f6f6f3;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --panel: #1b1b1b;
  }
}

:root[data-theme="dark"] {
  --panel: #1b1b1b;
}

/* Lists that are laid out as rows or bars don't take the text spacing. */
.procs li + li,
.strip li + li,
.track li + li {
  margin-top: 0;
}

/* The intro as a terminal window. */
.term {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.term-lights {
  display: inline-flex;
  gap: 6px;
}

.term-lights i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--fail) 70%, var(--panel));
}

.term-lights i:nth-child(2) {
  background: color-mix(in srgb, #d4a72c 75%, var(--panel));
}

.term-lights i:nth-child(3) {
  background: color-mix(in srgb, var(--ok) 70%, var(--panel));
}

.term-body {
  padding: 1.4rem 1.5rem 1.6rem;
}

.prompt {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.ps1 {
  color: var(--accent);
}

/* The command after the prompt, tinted like a shell's syntax colours. */
.cmd {
  color: var(--c-blue);
}

/* The one coloured word in the headline. */
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--c-violet), var(--c-pink), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* While the name types itself (site.js), untyped letters keep their place
   and the cursor follows the typed letters instead of sitting at the end. */
.hero h1.typing::after {
  display: none;
}

.hero h1.typing .ch {
  visibility: hidden;
}

.hero h1.typing .ch.on {
  visibility: visible;
}

.hero h1.typing .ch.at {
  position: relative;
}

.hero h1.typing .ch.at::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 0.12em;
  width: 0.5ch;
  height: 0.85em;
  margin-left: 0.15em;
  background: var(--accent);
}

/* Under the intro: the newest build-log line, as if tailing a log file. */
.term-tail {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

.tail-line {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.tail-step {
  color: var(--c-teal);
  margin-right: 0.5ch;
}

/* Section labels can carry a value on the right: STATUS ──── 14:05:33 UTC */
.home h2::after {
  order: 1;
}

.clock {
  order: 2;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Live status: one row per running thing, like a process list. */
.procs {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.proc {
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.8rem 1rem;
  margin: 0;
}

.proc + .proc {
  border-top: 1px solid var(--line);
}

.proc-name {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.proc-name a {
  color: var(--text);
  text-decoration: none;
}

.proc-name a:hover,
.proc-name a:focus-visible {
  color: var(--accent);
}

.led {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.6rem;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: 0.05em;
}

.proc-what {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.proc-stat {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.78rem;
  /* On a light page the tint behind the text lowers its contrast, so the text
     is a shade darker there (WCAG 4.5:1 checked for every colour). */
  color: var(--pill-ink, color-mix(in srgb, var(--tone) 75%, #000));
  background: color-mix(in srgb, var(--tone) 12%, transparent);
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .proc-stat {
    --pill-ink: var(--tone);
  }
}

:root[data-theme="dark"] .proc-stat {
  --pill-ink: var(--tone);
}

/* Each running thing has its colour: its stat pill and a soft hover. */
.proc.tone-0 { --tone: var(--c-blue); }
.proc.tone-1 { --tone: var(--c-violet); }
.proc.tone-2 { --tone: var(--c-teal); }
.proc.tone-3 { --tone: var(--c-amber); }
.proc.tone-4 { --tone: var(--c-pink); }

.proc {
  transition: background-color 0.15s ease;
}

.proc:hover {
  background: color-mix(in srgb, var(--tone) 5%, transparent);
}

.proc:first-child {
  border-radius: 11px 11px 0 0;
}

.proc:last-child {
  border-radius: 0 0 11px 11px;
}

/* A panel: the build log at a glance. */
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 1rem 1rem 0.4rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.7rem;
  margin-bottom: 1rem;
}

.panel-title {
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
}

.panel-title:hover,
.panel-title:focus-visible {
  color: var(--accent);
}

.panel-meta {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* The build log as a status strip: one bar per entry, oldest on the left,
   with a wider gap where a new milestone starts. */
.strip {
  list-style: none;
  display: flex;
  gap: 4px;
  height: 2.25rem;
  margin: 0;
  padding: 0;
}

.strip li {
  flex: 1 1 0;
  min-width: 0;
}

.strip li.starts-milestone {
  margin-left: 10px;
}

.bar {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--mc, var(--accent));
  transform-origin: 50% 100%;
  transition: transform 0.15s ease, filter 0.15s ease;
}

/* Each milestone has its colour: bars, the track and the build log's headings.
   A failure or release entry adds a mark along its bar's top. */
.m-m0 { --mc: var(--c-blue); }
.m-m1 { --mc: var(--c-violet); }
.m-m2 { --mc: var(--c-teal); }
.m-m3 { --mc: var(--c-amber); }
.m-m4 { --mc: var(--c-pink); }
.m-m5 { --mc: var(--ok); }

.bar.kind-failure {
  box-shadow: inset 0 3px 0 var(--fail);
}

.bar.kind-release {
  box-shadow: inset 0 3px 0 var(--ok);
}

a.bar:hover,
a.bar:focus-visible {
  transform: scaleY(1.15);
  filter: brightness(1.12);
}

/* What's being built now: an outline still waiting to be filled. */
.bar.is-next {
  background: transparent;
  border: 1.5px dashed color-mix(in srgb, var(--mc, var(--accent)) 80%, transparent);
}

.readout {
  margin: 0.55rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Milestones: done, the current one, and what's next. */
.track {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  margin: 1rem 0 0;
  padding: 0;
}

.track-step {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0.45rem 0 0;
  border-top: 3px solid var(--line);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--muted);
}

.track-step.is-done,
.track-step.is-current {
  border-top-color: var(--mc, var(--accent));
}

.track-step.is-done .track-id,
.track-step.is-current .track-id {
  color: var(--mc, var(--text));
}

.track-id {
  font-weight: 700;
  color: var(--text);
}

.track-step.is-upcoming .track-id {
  color: var(--muted);
}

/* Names wrap to at most two lines, and every step keeps two lines' room, so
   the counts under them line up across the row. */
.track-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-height: calc(2em * 1.35);
}

/* Tests at every checkpoint. */
.spark {
  margin: 1.1rem 0 0.4rem;
}

.spark-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.spark-now {
  text-transform: none;
  letter-spacing: 0;
}

.spark-now strong {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
}

.spark svg {
  display: block;
  width: 100%;
  height: 64px;
  margin-top: 0.35rem;
  overflow: visible;
}

.spark-line {
  fill: none;
  stroke: url(#spark-stroke);
  stroke-width: 2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.spark-area {
  fill: url(#spark-fill);
}

.spark-stop-a { stop-color: var(--c-blue); }
.spark-stop-b { stop-color: var(--c-violet); }
.spark-stop-c { stop-color: var(--accent); }

.spark-axis {
  display: flex;
  justify-content: space-between;
  margin: 0.25rem 0 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

/* The latest entries, under the panel's charts. */
.panel .latest {
  margin-top: 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 0.4rem;
}

/* On the build log's own page, the panel sits between the title and the intro. */
.log-glance {
  margin: 0 0 2.5rem;
  padding-bottom: 0.6rem;
}

/* A little life, only for readers who allow motion. */
@media (prefers-reduced-motion: no-preference) {
  .bar {
    animation: bar-in 0.45s ease-out backwards;
    animation-delay: calc(var(--i) * 35ms);
  }

  .bar.is-next {
    animation: bar-in 0.45s ease-out backwards, waiting 1.6s ease-in-out infinite;
    animation-delay: calc(var(--i) * 35ms), 1s;
  }

  .led {
    animation: pulse 2s ease-out infinite;
  }

  .spark svg {
    animation: draw 1.1s ease-out 0.3s backwards;
  }

  /* Only the current milestone's line pulses, never its text. */
  .track-step.is-current {
    animation: line-waiting 1.6s ease-in-out infinite;
  }
}

@keyframes bar-in {
  from {
    transform: scaleY(0);
  }
}

@keyframes waiting {
  50% {
    opacity: 0.45;
  }
}

@keyframes line-waiting {
  50% {
    border-top-color: color-mix(in srgb, var(--mc, var(--accent)) 30%, var(--line));
  }
}

@keyframes draw {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* Narrower screens: status rows put their description underneath. */
@media (max-width: 640px) {
  .proc {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 1rem;
  }

  .proc-what {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 0.75rem;
  }

  .strip {
    gap: 3px;
  }

  .strip li.starts-milestone {
    margin-left: 7px;
  }

  /* The entry count goes under the title instead of alone on the right. */
  .panel-meta {
    margin-left: 0;
    flex-basis: 100%;
  }
}

/* Phones */
@media (max-width: 480px) {
  body {
    font-size: 1.0625rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .hero p {
    font-size: 1.15rem;
  }

  .site-header {
    padding-top: 1.25rem;
    padding-bottom: 2rem;
  }

  .log .entry {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  /* On phones the label goes above the entry, with date and kind side by side. */
  .log .when {
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .log .when .tag {
    margin-top: 0;
  }

  /* The glance card stacks its labels above the values, like the log rows. */
  .glance div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  /* Previous and next stack, both left-aligned. */
  .series-nav {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .series-next {
    grid-column: auto;
    text-align: left;
  }
}

/* No blinking or pulsing for readers who turn motion off. */
@media (prefers-reduced-motion: reduce) {
  .hero h1::after,
  .dot {
    animation: none;
  }

  .log a.title,
  .series-title {
    transition: none;
  }
}
