@font-face {
  font-family: 'Barlow';
  src: url(fonts/barlow-400-latin.woff2) format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url(fonts/barlow-500-latin.woff2) format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url(fonts/barlow-600-latin.woff2) format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url(fonts/barlow-semi-condensed-600-latin.woff2) format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url(fonts/plex-mono-400-latin.woff2) format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url(fonts/plex-mono-600-latin.woff2) format('woff2');
  font-weight: 600;
  font-display: swap;
}

/* An instrument case in putty grey, hardware keys, and a paper tape the tools print on. */
:root {
  --case: #cdd1ca;
  --case-low: #c1c6be;
  --cap: #eef0eb;
  --cap-lit: #f8f9f6;
  --cap-edge: #959b92;
  --ink: #15181a;
  --quiet: #474d50;
  --groove: #a9aea6;
  --slot: #222629;
  --paper: #fdfdfb;
  --paper-quiet: #596064;
  --paper-rule: #dfe1dc;
  --paper-wash: #f2f3ef;
  --ok: #1d6b3e;
  --warn: #855600;
  --bad: #a3241c;
  --focus: #0b57d0;
  --accent: #325aa0;
  --sans: 'Barlow', ui-sans-serif, system-ui, sans-serif;
  --narrow: 'Barlow Semi Condensed', 'Barlow', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --gutter: clamp(16px, 3.4vw, 44px);
  color-scheme: light;
  font-family: var(--sans);
  font-synthesis: none;
  /* Barlow's standard ligatures fuse "--" into a dash, which misprints command flags. */
  font-variant-ligatures: no-common-ligatures;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--case);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, a { touch-action: manipulation; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }

:is(button, a, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- top bar ---------- */

.topbar {
  max-width: 1360px;
  margin: auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--narrow);
  font-size: 21px;
  font-weight: 600;
  text-decoration: none;
}
.wordmark svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 3.4; }
.toplinks { display: flex; gap: clamp(14px, 3vw, 26px); align-items: center; font-size: 14px; }
.toplinks span { color: var(--quiet); }
.toplinks a { text-underline-offset: 3px; text-decoration-color: var(--cap-edge); }
.toplinks a:hover { text-decoration-color: currentColor; }

main { max-width: 1360px; margin: auto; padding: 0 var(--gutter); }

/* ---------- the bench: kit on the left, printer on the right ---------- */

.bench {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: clamp(24px, 3.2vw, 44px);
  align-items: start;
  padding: 6px 0 clamp(40px, 6vw, 72px);
}

.kit { position: sticky; top: 16px; min-width: 0; }
.kit h1 {
  font-family: var(--narrow);
  font-size: clamp(25px, 2.3vw, 29px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  max-width: 17em;
  text-wrap: balance;
}
.kit-note { margin-top: 10px; font-size: 15px; line-height: 1.45; color: var(--quiet); max-width: 40ch; }

#tool-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
  padding: 10px;
  background: var(--case-low);
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(21, 24, 26, .18);
}

/* A key: a cap with a hard lower edge that travels down when pressed. */
.tool-button {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr;
  grid-template-rows: auto 1fr;
  gap: 8px 10px;
  min-height: 82px;
  padding: 10px 12px 11px 10px;
  border: 1px solid var(--cap-edge);
  border-radius: 7px;
  background: var(--cap);
  box-shadow: 0 3px 0 var(--cap-edge);
  text-align: left;
  transition: transform .07s ease-out, box-shadow .07s ease-out, background-color .12s ease;
}
.tool-button:hover { background: var(--cap-lit); }
.tool-button:active, .tool-button.active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--cap-edge);
}
.tool-button.active { background: var(--cap-lit); border-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
.tool-button img { width: 26px; height: 26px; border-radius: 6px; }
.tool-button .led {
  justify-self: end;
  align-self: start;
  width: 8px;
  height: 8px;
  margin-top: 2px;
  border-radius: 50%;
  background: #b4b9b1;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .25);
  transition: background-color .12s ease, box-shadow .12s ease;
}
.tool-button.active .led {
  background: var(--led);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--led) 24%, transparent), 0 0 8px var(--led);
}
.tool-button span {
  grid-column: 1 / -1;
  align-self: end;
  font-family: var(--narrow);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.15;
}
.tool-button small {
  display: block;
  margin-top: 2px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--quiet);
}

.local-note { margin-top: 16px; font-size: 13px; line-height: 1.45; color: var(--quiet); max-width: 40ch; }
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: 1px;
}

/* ---------- the printer and its tape ---------- */

.printer { position: relative; min-width: 0; padding-top: 2px; }
.slot {
  position: relative;
  z-index: 2;
  height: 12px;
  border-radius: 6px;
  background: var(--slot);
  box-shadow: inset 0 -2px 0 #3a4044, 0 1px 0 rgba(255, 255, 255, .5);
}
.tape {
  position: relative;
  margin: -6px 14px 0;
  padding: 24px clamp(16px, 2.6vw, 30px) 26px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(21, 24, 26, .08), 0 18px 30px -22px rgba(21, 24, 26, .45);
}
/* The torn lower edge of the roll. */
.tape::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 8px;
  background: var(--paper);
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%;
}
.tape.feeding { animation: feed .22s cubic-bezier(.2, .8, .3, 1); }
@keyframes feed {
  from { transform: translateY(-10px); clip-path: inset(0 0 calc(100% - 40px) 0); }
  to { transform: none; clip-path: inset(0 0 -20px 0); }
}

.tape-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}
.tape-head img { width: 34px; height: 34px; border-radius: 8px; }
.tape-head h2 { font-family: var(--narrow); font-size: clamp(23px, 2.4vw, 28px); line-height: 1.05; letter-spacing: -0.01em; }
.tape-kind {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--paper-quiet);
}
.sandbox-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--ink);
}
.sandbox-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.run-button {
  min-width: 108px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 3px 0 #000;
  transition: transform .07s ease-out, box-shadow .07s ease-out, background-color .12s ease;
}
.run-button:hover:not(:disabled) { background: #2b3034; }
.run-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.run-button:disabled { transform: translateY(2px); box-shadow: 0 1px 0 #000; background: #3a4044; color: #c9cdcf; }

.runner-headline {
  margin-top: 16px;
  font-size: clamp(16px, 1.6vw, 18px);
  font-weight: 500;
  line-height: 1.35;
  max-width: 58ch;
}
.run-status {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--paper-quiet);
}
.run-status.is-running::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink .9s steps(2, jump-none) infinite;
}
.run-status.is-failed { color: var(--bad); }
@keyframes blink { 50% { opacity: .2; } }

#console { transition: opacity .15s ease; }
#console.is-stale { opacity: .38; }
#console.printing .step { animation: print .42s cubic-bezier(.3, .7, .2, 1) both; }
#console.printing .step + .step { animation-delay: .12s; }
@keyframes print {
  from { clip-path: inset(0 0 100% 0); transform: translateY(-6px); }
  to { clip-path: inset(0 0 -2px 0); transform: none; }
}

.step { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--groove); }
.step-title { font-size: 14px; font-weight: 600; }
.step-command {
  display: block;
  margin-top: 8px;
  padding: 9px 12px;
  background: var(--paper-wash);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.step-command::before { content: '$ '; color: var(--accent); font-weight: 600; }
.step-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--paper-quiet);
}
.pill {
  padding: 1px 8px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-weight: 600;
  color: var(--ok);
}
.is-needs-attention .pill { color: var(--warn); }
.is-error .pill { color: var(--bad); }
.step-summary { margin-top: 10px; font-size: 15px; line-height: 1.45; max-width: 76ch; overflow-wrap: anywhere; }
.step-stderr {
  margin: 12px 0 0;
  padding: 12px;
  background: var(--paper-wash);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--bad);
}

/* Measured values read like a printed spec sheet: label, leader dots, value. */
.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 32px;
  margin: 12px 0 0;
}
.readout div { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; min-width: 0; }
.readout dt { flex: none; font-size: 14px; color: var(--paper-quiet); }
.readout div::after {
  content: '';
  order: 1;
  flex: 1;
  min-width: 12px;
  border-bottom: 1px dotted var(--groove);
  transform: translateY(-4px);
}
.readout dd { order: 2; margin: 0; font-family: var(--mono); font-size: 13.5px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.table-scroll { margin-top: 14px; overflow-x: auto; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.evidence { border-collapse: collapse; width: 100%; font-size: 13px; }
.evidence th, .evidence td { text-align: left; padding: 7px 14px 7px 0; white-space: nowrap; }
.evidence th { font-size: 13px; font-weight: 600; color: var(--paper-quiet); }
.evidence td { font-family: var(--mono); border-top: 1px solid var(--paper-rule); }
.evidence td:first-child { font-family: var(--sans); font-weight: 500; font-size: 14px; white-space: normal; min-width: 14ch; overflow-wrap: anywhere; }

.step-figure { margin: 16px 0 0; }
.step-figure img {
  display: block;
  width: 100%;
  max-width: 460px;
  padding: 12px;
  border: 1px solid var(--paper-rule);
}
.step-figure figcaption { margin-top: 6px; font-size: 13px; color: var(--paper-quiet); }

.file-row { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 14px; }
.file-link { font-size: 14px; font-weight: 500; text-underline-offset: 3px; text-decoration-color: var(--groove); }
.file-link:hover { text-decoration-color: currentColor; }

.raw { margin-top: 12px; }
.raw summary { font-size: 13.5px; color: var(--paper-quiet); cursor: pointer; width: fit-content; }
.raw summary:hover { color: var(--ink); }
.raw pre {
  margin: 10px 0 0;
  padding: 14px;
  max-height: 320px;
  overflow: auto;
  background: var(--paper-wash);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #3d4346;
}

.tape-foot { margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--groove); display: grid; gap: 10px; }
.input-credit, .sandbox-note { font-size: 13.5px; line-height: 1.55; color: var(--paper-quiet); max-width: 82ch; }
.tape-foot strong { margin-right: 6px; font-weight: 600; color: var(--ink); }
.input-credit a { color: var(--ink); text-underline-offset: 3px; }

/* ---------- below the bench ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(24px, 4vw, 56px);
  padding: clamp(32px, 4.5vw, 52px) 0;
  border-top: 1px solid var(--groove);
}
.about h2 { font-family: var(--narrow); font-size: 24px; }
.about-text p { margin-top: 10px; color: var(--quiet); max-width: 62ch; }
.about-text .file-link { display: inline-block; margin-top: 14px; }
.about-runtime { font-size: 14px; }
.install h3 { font-size: 17px; }
.command {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 8px 8px 14px;
  background: var(--slot);
  color: #e6e9e6;
  border-radius: 6px;
}
.command code { flex: 1; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.command button {
  border: 1px solid #50575b;
  border-radius: 5px;
  background: #2e3337;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
}
.command button:hover { background: #3a4044; }
.command button:focus-visible { outline-color: #8ab4ff; }
.install-note { margin-top: 12px; font-size: 14px; color: var(--quiet); max-width: 64ch; }
.prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--cap);
  border: 1px solid var(--cap-edge);
  border-radius: 7px;
}
.prompt-row p { font-size: 15px; max-width: 54ch; }
.prompt-row strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--quiet); margin-bottom: 2px; }
.prompt-row button {
  padding: 7px 14px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--cap-lit);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 0 var(--ink);
  transition: transform .07s ease-out, box-shadow .07s ease-out;
}
.prompt-row button:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }

.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px clamp(22px, 3vw, 44px);
  padding: clamp(28px, 4vw, 44px) 0 clamp(36px, 5vw, 56px);
  border-top: 1px solid var(--groove);
}
.principles h2 { font-family: var(--narrow); font-size: 19px; margin-bottom: 6px; }
.principles p { font-size: 15px; color: var(--quiet); max-width: 44ch; }

body > footer {
  max-width: 1360px;
  margin: auto;
  padding: 22px var(--gutter) 36px;
  border-top: 1px solid var(--groove);
  display: flex;
  justify-content: space-between;
  gap: 14px 28px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--quiet);
}
body > footer div { display: flex; gap: 22px; flex-wrap: wrap; }
body > footer a { text-underline-offset: 3px; text-decoration-color: var(--groove); }
body > footer a:hover { color: var(--ink); text-decoration-color: currentColor; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 14px);
  padding: 9px 18px;
  border-radius: 6px;
  background: var(--slot);
  color: #eef0eb;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- support, privacy and terms pages ---------- */

.document {
  max-width: 760px;
  margin: 12px auto 56px;
  padding: clamp(28px, 5vw, 56px) clamp(18px, 5vw, 56px);
  background: var(--paper);
  box-shadow: 0 18px 30px -22px rgba(21, 24, 26, .45);
}
.document h1 { font-family: var(--narrow); font-size: clamp(30px, 5vw, 40px); line-height: 1.08; margin-bottom: 18px; }
.document .doc-date { margin-bottom: 12px; font-size: 14px; }
.document h2 { font-family: var(--narrow); font-size: 20px; margin: 28px 0 8px; }
.document p, .document li { color: var(--paper-quiet); font-size: 15.5px; margin-bottom: 10px; }
.document code { font-family: var(--mono); font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.document ul { padding-left: 20px; }
.document a { color: var(--ink); text-underline-offset: 3px; }

/* ---------- narrow screens: the keys become a strip above the tape ---------- */

@media (max-width: 1000px) {
  .bench { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .kit { position: static; }
  .kit h1 { max-width: 24em; }
  .kit-note { max-width: 62ch; }
  #tool-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    margin-inline: calc(var(--gutter) * -1);
    padding: 10px var(--gutter) 12px;
    border-radius: 0;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gutter);
  }
  #tool-list::-webkit-scrollbar { display: none; }
  .tool-button {
    flex: 0 0 auto;
    width: 168px;
    min-height: 74px;
    scroll-snap-align: start;
  }
  .local-note { display: none; }
  .about { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .topbar { padding-block: 12px; }
  .toplinks span { display: none; }
  .kit h1 { font-size: 23px; }
  .kit-note { font-size: 14.5px; }
  .tool-button { width: 150px; }
  .tool-button small { display: none; }
  .tool-button { min-height: 0; grid-template-rows: auto auto; }
  .tape { margin-inline: 8px; }
  .tape-head { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; }
  .tape-head img { width: 30px; height: 30px; }
  .run-button { min-width: 0; padding: 8px 12px; font-size: 14px; }
  .readout { grid-template-columns: minmax(0, 1fr); }
  .readout dt { flex: 0 1 auto; }
  .step-meta { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
