/* SPDX-License-Identifier: GPL-3.0-only */
/*
 * Bryo site styles.
 *
 * Two voices, both fixed-width: Bryo PX5, the firmware's own 5x7 screen face (fonts/, made from
 * bryo/tools/gen_px_font.py by tools/gen_px_webfont.py), for short labels, buttons, numbers and nav; IBM Plex
 * Mono for anything you actually read. Pixel type at body length is hard on the eyes, so it never carries a
 * paragraph.
 *
 * The look is a wireframe: no filled surfaces, no glows. Everything is drawn with 1 px lines on black, the way
 * the screen draws its pictograms (1-dot strokes, dotted guides), with corner ticks on the things you look at.
 *
 * Colour is the firmware's, value for value (firmware/src/ui_px.c): white on black, and colour only ever
 * says where you are or what's alive. Okabe and Ito's colour-blind-safe set: sky blue a page, reddish
 * purple modulation, orange sound, vermillion recording, yellow something to know.
 */

@font-face {
  font-family: "Bryo PX5";
  src: url("../fonts/bryo-px5.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Bryo PX5";
  src: url("../fonts/bryo-px5-bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* the screen's black and white; --ink-faint is the firmware's dim ink (45 % of the way from black) */
  --bg: #000000;
  --bg-sunk: #000000;
  --line: #3a3a3a;      /* a wire */
  --line-soft: #242424; /* a guide: the hero's grid */
  --line-strong: #ffffff;
  --ink: #ffffff;
  --ink-soft: #b8b8b8; /* 10.6:1 on black */
  --ink-faint: #8c8c8c; /* 6.6:1 on black: AA for small text (the firmware's #737373 is 4.5:1, too close) */

  /* px_page, px_mod, px_live, px_rec, px_note */
  --blue: #56b4e9;
  --purple: #cc79a7;
  --orange: #e69f00;
  --red: #d55e00;
  --yellow: #f0e442;

  --font-pixel: "Bryo PX5", ui-monospace, monospace;
  --font-text: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: 16px;
  --measure: 64ch;
  --tick: 12px;
  --max: 1240px;
  --header-h: 72px;
  --bar-h: 64px;
}

@media (min-width: 720px) {
  :root { --gutter: 32px; --header-h: 88px; --bar-h: 72px; }
}
@media (min-width: 1100px) {
  :root { --gutter: 56px; }
}

/* ---------- base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--bar-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 0.9375rem;
  line-height: 1.65;
  overflow-x: hidden;
}

@media (min-width: 720px) {
  body { font-size: 1.0625rem; }
}

img,
svg { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

::selection { background: var(--orange); color: #000; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--yellow);
  color: #000;
  font-family: var(--font-pixel);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The FM-1's screens are 2x2 px dot art: keep them crisp at any size. */
.pixelated { image-rendering: pixelated; }

/* ---------- pixel type ---------- */

.px {
  font-family: var(--font-pixel);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: uppercase;
  line-height: 1.2;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
/* the wordmark is 23 x 7 dots: drawn at a whole number of px a dot so every dot stays square */
.logo__mark { width: 92px; height: 28px; }
@media (min-width: 720px) {
  .logo__mark { width: 115px; height: 35px; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn svg { width: 36px; height: 36px; }
@media (min-width: 720px) {
  .icon-btn { width: 56px; height: 56px; }
  .icon-btn svg { width: 44px; height: 44px; }
}

/* ---------- product bar (the "Syntakt  1149 $  [NOTIFY ME]" strip) ---------- */

.product-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 39;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.product-bar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--bar-h);
}

.product-bar__name {
  font-size: 1.125rem;
  margin: 0;
  font-weight: 500;
}

.product-bar__meta {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 0.95rem;
  white-space: nowrap;
}
@media (max-width: 479px) {
  .product-bar__meta { display: none; }
  .product-bar .btn { margin-left: auto; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-pixel);
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1; /* no leading: the browser can't split it unevenly, so the label sits dead centre */
  cursor: pointer;
  transition: background-color 120ms linear, color 120ms linear;
}
.btn:hover,
.btn:focus-visible {
  border-color: var(--orange);
  color: var(--orange);
  text-decoration: none;
}
/* the main action: still only lines, a doubled border and an arrow say it's the one */
.btn--solid { box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--line-strong); }
.btn--solid::after { content: ">"; }
.btn--solid:hover,
.btn--solid:focus-visible { box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--orange); }

@media (min-width: 720px) {
  .btn { font-size: 1rem; padding: 12px 26px; }
}

/* ---------- full-screen menu (a <dialog>: focus trap and Escape for free) ---------- */

.menu {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--ink);
}
.menu::backdrop { background: var(--bg); }

.menu__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-h);
}

.menu__list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.menu__list li { border-bottom: 1px solid var(--line); }
.menu__list a {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 20px 0;
  text-decoration: none;
  font-family: var(--font-pixel);
  font-size: clamp(1.5rem, 6vw, 3rem);
  text-transform: uppercase;
}
.menu__list a span {
  font-size: 0.875rem;
  color: var(--ink-faint);
  min-width: 3ch;
}
.menu__list a:hover,
.menu__list a:focus-visible { color: var(--orange); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

/* A drafting grid behind the hero: 1 px guides every 48 px, fading out toward the bottom. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}

.hero__inner {
  display: grid;
  gap: 32px;
  padding-block: 48px;
  align-items: center;
}
@media (min-width: 900px) {
  .hero__inner { grid-template-columns: 1.1fr 1fr; padding-block: 88px; gap: 56px; }
}

/* The FM-1's screen, flat and at a whole multiple of its 240 px so the dots stay square: no fake device
 * around it, just the black glass and a hairline, the way the panel frames it. */
.device {
  justify-self: center;
  width: min(100%, 506px); /* 480 px of screen (2x its 240) + the padding and hairline */
}

.device__screen {
  position: relative;
  margin: 0;
  padding: 12px;
  background: #000;
  border: 1px solid var(--line);
}
.device__screen img {
  width: 100%;
  aspect-ratio: 1;
  background: #000;
}

.device__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.device__label {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  min-height: 1.2em;
}

.device__pause {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 0.75rem;
}

.hero__kicker { color: var(--orange); margin: 0 0 16px; font-size: 0.9375rem; }

.hero__title {
  margin: 0;
  font-weight: 600;
  font-size: clamp(2.2rem, 8vw, 4.75rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero__lede {
  margin: 24px 0 32px;
  max-width: 40ch;
  color: var(--ink-soft);
  font-size: 1.0625rem;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- sections ---------- */

.section {
  padding-block: 64px;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 720px) {
  .section { padding-block: 104px; }
}

.section__num {
  display: block;
  margin-bottom: 14px;
  font-size: 1.75rem;
}
.section__num .slash { color: var(--ink-faint); }

.section__title {
  margin: 0 0 28px;
  max-width: 18ch;
  font-weight: 600;
  font-size: clamp(1.75rem, 5.5vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.1em; }
.prose p.lead { font-size: 1.15em; line-height: 1.5; color: var(--ink); }
.prose p,
.prose li { color: var(--ink-soft); }
.prose strong { color: var(--ink); font-weight: 600; }

.split {
  display: grid;
  gap: 40px;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; gap: 72px; align-items: start; }
}

/* A screen shown as a figure. */
.screen {
  position: relative;
  margin: 0;
  background: #000;
  border: 1px solid var(--line);
}
.screen img { width: 100%; }
.screen figcaption {
  padding: 12px 14px;
  border-top: 1px dashed var(--line);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* ---------- the chain (tabs) ---------- */

.chain {
  margin-top: 40px;
}

.chain__tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line-strong);
}

.chain__tab {
  position: relative;
  min-height: 72px;
  padding: 12px 6px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-pixel);
  font-size: clamp(0.6875rem, 2.4vw, 1rem);
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
}
.chain__tab:last-child { border-right: 0; }
.chain__tab small {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-faint);
  font-size: 0.8em;
}
.chain__tab:hover { color: var(--ink); }
/* selected: an inner frame and a blue bar under it (a page's colour), never a fill */
.chain__tab[aria-selected="true"] {
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 -4px 0 var(--blue);
}
.chain__tab[aria-selected="true"] small { color: var(--blue); }
.chain__tab:focus-visible { outline-offset: -5px; outline-color: var(--orange); }

/* the arrows between stages: the signal goes left to right */
.chain__tab:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  z-index: 1;
  width: 10px;
  height: 10px;
  background: var(--bg);
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  transform: translateY(-50%) rotate(45deg);
}

.chain__panel {
  display: grid;
  gap: 32px;
  padding: 32px 0 0;
}
.chain__panel[hidden] { display: none; }
@media (min-width: 900px) {
  .chain__panel { grid-template-columns: 320px 1fr; gap: 56px; padding-top: 48px; }
}
.chain__panel h3 {
  margin: 0 0 16px;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}
.chain__panel .tag { color: var(--orange); }

/* ---------- specs ---------- */

.specs {
  margin: 40px 0 0;
  border-top: 1px solid var(--line-strong);
}
.specs div {
  display: grid;
  gap: 4px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 720px) {
  .specs div { grid-template-columns: 260px 1fr; gap: 24px; }
}
.specs dt { font-size: 0.875rem; color: var(--ink-faint); padding-top: 0.25em; }
.specs dd { margin: 0; }

/* ---------- steps ---------- */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 32px 0 0;
  padding: 0;
  max-width: var(--measure);
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 28px 64px;
  color: var(--ink-soft);
}
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.05em;
  font-family: var(--font-pixel);
  color: var(--orange);
  font-size: 1.25rem;
}
.steps strong { color: var(--ink); }

/* ---------- code ---------- */

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}
:not(pre) > code {
  padding: 0.05em 0.35em;
  border: 1px dashed var(--line);
  color: var(--ink);
  word-break: break-word;
}

.code {
  position: relative;
  margin: 16px 0 24px;
  border: 1px solid var(--line);
}
.code pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  line-height: 1.6;
  color: var(--ink);
  tab-size: 2;
}
.code__copy {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.6875rem;
  background: var(--bg);
}

/* ---------- thanks ---------- */

.thanks__card {
  position: relative;
  margin-top: 40px;
  padding: 28px;
  border: 1px solid var(--line);
}
.thanks__card h3 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.03em; }
.thanks__card p { margin: 0 0 20px; color: var(--ink-soft); }

.thanks__links {
  display: grid;
  gap: 0;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.thanks__links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.thanks__links a:hover,
.thanks__links a:focus-visible { color: var(--orange); }
.thanks__links .px { font-size: 0.75rem; color: var(--ink-faint); }

/* ---------- footer ---------- */

.site-footer {
  padding-block: 48px 64px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.site-footer__grid {
  display: grid;
  gap: 32px;
}
@media (min-width: 720px) {
  .site-footer__grid { grid-template-columns: 2fr 1fr 1fr; }
}
.site-footer h2 { margin: 0 0 12px; font-size: 0.8125rem; color: var(--ink); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer p { margin: 0 0 12px; max-width: 52ch; }

/* ---------- docs layout ---------- */

.docs-hero {
  padding-block: 48px 40px;
  border-bottom: 1px solid var(--line);
}
.docs-hero .section__title { max-width: none; margin-bottom: 16px; }

.docs {
  display: grid;
  gap: 32px;
  padding-block: 40px 80px;
}
@media (min-width: 1000px) {
  .docs { grid-template-columns: 260px minmax(0, 1fr); gap: 64px; }
}

.toc {
  align-self: start;
  border: 1px solid var(--line);
}
@media (min-width: 1000px) {
  .toc {
    position: sticky;
    top: calc(var(--header-h) + var(--bar-h) + 24px);
    max-height: calc(100vh - var(--header-h) - var(--bar-h) - 48px);
    overflow-y: auto;
    border: 0;
  }
  .toc summary { pointer-events: none; }
  .toc summary::after { display: none; }
}
.toc summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  cursor: pointer;
  list-style: none;
  font-size: 0.875rem;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "+"; font-family: var(--font-pixel); }
.toc[open] summary::after { content: "-"; }
@media (min-width: 1000px) {
  .toc summary { padding: 0 0 12px; min-height: 0; color: var(--ink-faint); }
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  counter-reset: toc;
}
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  gap: 12px;
  padding: 9px 16px;
  border-left: 3px solid transparent;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1.3;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  color: var(--ink-faint);
  padding-top: 0.2em;
}
.toc a:hover { color: var(--ink); }
.toc a[aria-current="true"] {
  color: var(--ink);
  border-left-color: var(--blue);
}
@media (min-width: 1000px) {
  .toc a { padding-left: 14px; }
}

.doc { min-width: 0; max-width: 820px; }
.doc section { padding-bottom: 56px; margin-bottom: 56px; border-bottom: 1px solid var(--line); }
.doc section:last-child { border-bottom: 0; }
.doc h2 {
  margin: 0 0 20px;
  font-size: clamp(1.5rem, 4vw, 2.125rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.04em;
}
.doc h2 .px { display: block; margin-bottom: 10px; font-size: 0.875rem; color: var(--ink-faint); letter-spacing: 0.04em; }
.doc h3 { margin: 32px 0 10px; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.02em; }
.doc p,
.doc li { color: var(--ink-soft); }
.doc strong { color: var(--ink); font-weight: 600; }
.doc ul,
.doc ol { padding-left: 1.25em; }
.doc li { margin-bottom: 0.4em; }

.doc .more {
  display: inline-flex;
  margin-top: 8px;
  font-family: var(--font-pixel);
  font-size: 0.8125rem;
  text-transform: uppercase;
  color: var(--ink);
}

.callout {
  margin: 24px 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--yellow);
}
.callout p { margin: 0; color: var(--ink); }
.callout .px { display: block; margin-bottom: 6px; font-size: 0.75rem; color: var(--yellow); }
.callout--red { border-left-color: var(--red); }
.callout--red .px { color: var(--red); }

.figure-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.panel-figure {
  position: relative;
  margin: 24px 0;
  padding: 12px;
  border: 1px solid var(--line);
}
.panel-figure figcaption { padding-top: 10px; font-size: 0.875rem; color: var(--ink-soft); }

/* tables scroll inside their own box on phones, never the page */
.table-wrap {
  margin: 20px 0 28px;
  overflow-x: auto;
  border: 1px solid var(--line);
}
.table-wrap:focus-visible { outline-offset: 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  border-bottom-color: var(--line-strong);
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
}
td { color: var(--ink-soft); }
td:first-child { color: var(--ink); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.swatch {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 8px;
  vertical-align: -0.05em;
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* forced colours (Windows High Contrast): keep the selected tab and borders visible */
@media (forced-colors: active) {
  .chain__tab[aria-selected="true"] { outline: 3px solid CanvasText; }
  .btn { border-color: ButtonText; }
}

/* Titles in the bold cut, as the screen draws its page names (PXF_5B: each dot doubled to the right). */
.section__num,
.menu__list a,
.chain__tab,
.hero__kicker { font-weight: 700; }

/* Registration ticks: an L of white at each corner of the things you look at, over their 1 px wire, the way a
 * wireframe marks a frame's extent. Drawn with eight 1 px gradients on a pseudo-element, so no markup. */
.screen::before,
.device__screen::before,
.panel-figure::before,
.thanks__card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) left top / var(--tick) 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) left top / 1px var(--tick) no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) right top / var(--tick) 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) right top / 1px var(--tick) no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) left bottom / var(--tick) 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) left bottom / 1px var(--tick) no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) right bottom / var(--tick) 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) right bottom / 1px var(--tick) no-repeat;
}
@media (forced-colors: active) {
  .screen::before,
  .device__screen::before,
  .panel-figure::before,
  .thanks__card::before { display: none; }
}

/* two screens a row, whatever the column's width (the arpeggiator's four on the landing page) */
.figure-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 32px; }

/* a short definition list inside prose: narrower labels than the spec sheet */
.specs--compact { margin: 24px 0; }
@media (min-width: 720px) {
  .specs--compact div { grid-template-columns: 96px 1fr; gap: 16px; }
}
.specs--compact div { padding: 12px 0; }
.specs--compact dd { color: var(--ink-soft); }

/* On narrow phones five stage names don't fit side by side in the pixel face (CHRONOS is 7 letters), so the
 * strip keeps each tab at a readable width and scrolls sideways inside itself instead of shrinking the type.
 * The page itself never scrolls sideways. */
@media (max-width: 479px) {
  .chain__tabs {
    grid-template-columns: repeat(5, minmax(84px, 1fr));
    overflow-x: auto;
    scrollbar-width: thin;
  }
}

/* Phones: a screen picture on its own would fill the whole view, so it sits at 65 % of the column, centred,
 * with the page around it. Pairs (.figure-row--2) are already two to a row, and the panel drawing keeps the
 * full width because its lettering would get too small to read. */
@media (max-width: 719px) {
  .device { width: 65%; }
  .device__controls { flex-wrap: wrap; }
  .chain__panel > .screen,
  .split > .screen {
    width: 65%;
    margin-inline: auto;
  }
  .figure-row:not(.figure-row--2) {
    grid-template-columns: minmax(0, 65%);
    justify-content: center;
  }
}

/* ---------- the walkthrough: the panel, its screen and one caption ----------
 * Everything you need to follow a step sits in one view: the panel (what the hands do), the screen (what Bryo
 * shows) and a single caption bar (what to do, where you are, and the buttons). Desktop: panel and screen side by
 * side, the caption under both. Phone: panel, caption, screen, so the step's words sit right under its hands. */

.tour { margin-top: 40px; }

.tour__routines {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
/* the routine playing: an inner frame and a blue bar, as the chain's selected tab */
.tour__routine[aria-pressed="true"] {
  border-color: var(--line-strong);
  box-shadow: inset 0 -4px 0 var(--blue);
}

.tour__stage {
  display: grid;
  grid-template-areas: "panel" "caption" "screen";
  gap: 16px;
}
@media (min-width: 720px) {
  .tour__stage {
    grid-template-columns: minmax(0, 1fr) clamp(220px, 26vw, 330px);
    grid-template-areas: "panel screen" "caption caption";
    align-items: center;
    gap: 24px 32px;
  }
}

/* the drawing has its own frame, so no second border here */
.tour__panel { grid-area: panel; }
.tour__panel svg,
.tour__panel img { display: block; width: 100%; height: auto; }

/* inside the drawn panel (it's inline, so these reach its groups) */
.tour__panel .hit { transition: stroke 120ms linear, fill 120ms linear; }
.tour__panel .ptr {
  transform-box: view-box;
  transition: transform 900ms cubic-bezier(0.3, 0.7, 0.3, 1), fill 120ms linear;
}
.tour__panel .no-anim .ptr { transition: none; }
/* pressed: a flash of orange, the screen's colour for something happening now */
.tour__panel .ctl.is-press .hit { stroke: var(--orange); stroke-width: 4; }
/* held: stays lit, with a faint fill so it reads differently from a press */
.tour__panel .ctl.is-hold .hit { stroke: var(--orange); stroke-width: 4; fill: rgba(230, 159, 0, 0.2); }
/* turned: the knob's outline and pointer in orange while it moves */
.tour__panel .ctl.is-turn .hit { stroke: var(--orange); stroke-width: 3; }
.tour__panel .ctl.is-turn .ptr { fill: var(--orange); }
/* a routine's own controls keep their labels; the rest of the panel stays as a faint outline, uncaptioned */
.tour__panel .ctl,
.tour__panel .note { transition: opacity 200ms linear; }
.tour__panel .ctl.is-quiet { opacity: 0.18; }
.tour__panel .ctl.is-quiet .job,
.tour__panel .note.is-quiet { opacity: 0; }

.tour__screen { grid-area: screen; width: 100%; }

.tour__caption {
  grid-area: caption;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line-strong);
}
@media (min-width: 720px) {
  .tour__caption {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "progress progress" "say controls";
    align-items: center;
    gap: 14px 32px;
  }
  .tour__progress { grid-area: progress; }
  .tour__say { grid-area: say; }
  .tour__controls { grid-area: controls; }
}

.tour__progress { display: flex; flex-wrap: wrap; gap: 6px; }
.tour__dot {
  min-width: 36px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: none;
  color: var(--ink-faint);
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}
.tour__dot:hover { color: var(--ink); border-color: var(--ink-soft); }
.tour__dot[aria-current="step"] { color: var(--orange); border-color: var(--orange); }

/* the step's words: fixed to three lines' height so the buttons don't jump as the text changes */
.tour__say {
  margin: 0;
  min-height: calc(3 * 1.55em);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
}

.tour__controls { display: flex; gap: 8px; }
.tour__controls .btn { min-width: 48px; }
.tour__controls [data-tour-play] { min-width: 112px; }

@media (max-width: 719px) {
  .tour__screen { width: 65%; margin-inline: auto; }
  .tour__controls [data-tour-play] { flex: 1; }
  .tour__say { min-height: calc(4 * 1.55em); font-size: 0.9375rem; }
  /* five routines in one row that scrolls sideways, rather than a ragged 3 + 2 */
  .tour__routines { overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
  .tour__routine { flex: 0 0 auto; padding: 10px 14px; font-size: 0.75rem; }
}


/* ---------- bands: Elektron-style alternating rows ----------
 * One big screen and its words a band, the screen swapping sides from band to band, with room to breathe. The
 * screen is never wider than 480 px, exactly twice the firmware's 240, so its dots stay square. Phones: the
 * screen first (at 65 %, as everywhere), then the words. */

.band { padding-block: clamp(72px, 10vw, 160px); border-bottom: 1px solid var(--line); }
.band-group { padding-bottom: 0; }
.band-group > .wrap { padding-bottom: clamp(24px, 4vw, 48px); }
.band-group__lede { margin: 0; max-width: 52ch; color: var(--ink-soft); font-size: 1.0625rem; }
.band-group .band:last-child { border-bottom: 0; }
.band-group .band { padding-block: clamp(56px, 8vw, 120px); border-bottom: 1px dashed var(--line); }

.band__grid {
  display: grid;
  gap: 32px;
  align-items: center;
}
@media (min-width: 900px) {
  .band__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(56px, 7vw, 120px);
  }
  /* the screen on the right for every other band */
  .band--flip .band__grid > .band__media,
  .band--flip.band__grid > .band__media { order: 2; }
}

.band__media {
  width: 100%;
  max-width: 480px;
  justify-self: center;
}
.band__media > .screen { width: 100%; }

/* small screens under a band's big one */
.band__thumbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.band__thumbs figcaption { padding: 8px 10px; font-size: 0.6875rem; }

.band__text { max-width: 56ch; }
.band__text .section__title { max-width: 16ch; }
.band__text p { color: var(--ink-soft); margin: 0 0 1.1em; }
.band__text p.lead { color: var(--ink); font-size: 1.2em; line-height: 1.5; }
.band__text strong { color: var(--ink); font-weight: 600; }

/* a source's name, big in the firmware's bold pixel face, as the screen titles its pages */
.band__title {
  margin: 0 0 20px;
  font-weight: 700;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1;
  color: var(--blue);
}

.more-link {
  display: inline-flex;
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--ink);
}
.more-link:hover { color: var(--orange); }

@media (max-width: 899px) {
  .band__grid > .band__media,
  .band__grid > div.band__media { order: 0; }
}
@media (max-width: 719px) {
  .band__media { width: 65%; margin-inline: auto; }
  /* a band with thumbnails keeps them readable: the big screen 65 %, the row full width */
  .band__media:has(.band__thumbs) { width: 100%; }
  .band__media:has(.band__thumbs) > .screen { width: 65%; margin-inline: auto; }
}

/* the chain's stages laid out as a band too: the stage's screen big on the left, its words on the right */
@media (min-width: 900px) {
  .chain__panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(56px, 7vw, 120px);
    align-items: center;
  }
  .chain__panel > .screen { max-width: 480px; width: 100%; justify-self: center; }
}
.chain__panel h3 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
@media (min-width: 900px) {
  .band__text { font-size: 1.125rem; }
}

/* ---------- step-by-step guides: the panel with the hands lit, and the screen it gives ---------- */

.walk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 24px 0 8px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  font-size: 0.875rem;
  color: var(--ink-soft);
}
.walk-legend__item { display: inline-flex; align-items: center; gap: 10px; }
.walk-legend__swatch {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  border: 3px solid var(--orange);
}
.walk-legend__swatch--hold { background: rgba(230, 159, 0, 0.35); }
.walk-legend__swatch--turn i {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  background: var(--orange);
  transform: rotate(35deg);
  transform-origin: 50% 100%;
}

.walk { list-style: none; margin: 16px 0 32px; padding: 0; counter-reset: walk; }
.walk__step {
  counter-increment: walk;
  padding: 20px 0 28px;
  border-top: 1px solid var(--line);
}
.walk__text { position: relative; padding-left: 48px; }
.walk__text::before {
  content: counter(walk, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.15em;
  font-family: var(--font-pixel);
  color: var(--orange);
  font-size: 1.125rem;
}
.walk__text p { margin: 0 0 14px; }

/* the panel and the screen side by side: the screen is the panel's height, so they line up */
.walk__fig {
  display: grid;
  grid-template-columns: minmax(0, 960fr) minmax(0, 340fr);
  gap: 12px;
  align-items: start;
  margin: 0;
}
.walk__panel { width: 100%; height: auto; border: 1px solid var(--line); }
.walk__screen { position: relative; margin: 0; }
.walk__screen img { width: 100%; display: block; }
.walk__screen span {
  display: block;
  padding: 6px 8px;
  border-top: 1px dashed var(--line);
  font-size: 0.6875rem;
  color: var(--ink-soft);
}
@media (max-width: 599px) {
  /* phones: the panel across the column, the screen under it at 65 %, as everywhere on the site */
  .walk__fig { grid-template-columns: minmax(0, 1fr); }
  .walk__screen { width: 65%; margin-inline: auto; }
  .walk__text { padding-left: 40px; }
}

/* the numbered screen and its key */
.screen--marks { max-width: 360px; margin: 8px 0 16px; background: #fff; }
.screen--marks img { width: 100%; }
.screen--marks::before { display: none; }
.doc .screen-key { margin: 0 0 20px; padding-left: 2.25em; }
.screen-key li { margin-bottom: 0.35em; }
/* a guide's steps run the full column: no list indent (the step number sits in the text's own gutter) */
.doc ol.walk { padding-left: 0; }

/* ---------- the home page, pared down ----------
 * Teenage Engineering's restraint (small mono labels, short lines, room around everything) on Elektron's black
 * bands. Three pieces: the quick start's three steps, the "what's inside" index, and the specs folded away. */

.quick {
  list-style: none;
  display: grid;
  margin: 40px 0 0;
  padding: 0;
  border-top: 1px solid var(--line-strong);
}
@media (min-width: 900px) {
  .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.quick__step {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 900px) {
  .quick__step { padding: 28px 32px 32px; border-bottom: 0; border-right: 1px solid var(--line); }
  .quick__step:first-child { padding-left: 0; }
  .quick__step:last-child { border-right: 0; }
}
.quick__num { font-size: 2rem; color: var(--orange); }
.quick__title { margin: 16px 0 8px; font-size: 1.375rem; font-weight: 600; letter-spacing: -0.03em; }
.quick__title a { color: var(--ink); text-decoration: none; }
/* the whole step is the link's target; the heading's link stays the one thing a reader tabs to */
.quick__title a::after { content: ""; position: absolute; inset: 0; }
.quick__title a:focus-visible { outline: none; }
.quick__step:has(a:focus-visible) { outline: 2px solid var(--orange); outline-offset: -2px; }
.quick__step p { margin: 0 0 20px; max-width: 34ch; color: var(--ink-soft); }
.quick__go { margin-top: auto; font-size: 0.8125rem; color: var(--ink-faint); }
.quick__step:hover .quick__go,
.quick__step:hover .quick__title a { color: var(--orange); }
.quick__more { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 24px 0 0; }

.inside {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 16px;
  margin: 48px 0 0;
  padding: 0;
}
@media (min-width: 900px) {
  .inside { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 56px 32px; }
}
.inside__item { position: relative; }
.inside__item img { width: 100%; border: 1px solid var(--line); }
.inside__name { margin: 14px 0 6px; font-size: 1rem; font-weight: 700; }
.inside__name a { color: var(--blue); text-decoration: none; }
.inside__name a::after { content: ""; position: absolute; inset: 0; }
.inside__name a:focus-visible { outline: none; }
.inside__item:has(a:focus-visible) { outline: 2px solid var(--orange); outline-offset: 6px; }
.inside__item:hover img { border-color: var(--orange); }
.inside__item:hover .inside__name a { color: var(--orange); }
.inside__item p { margin: 0; font-size: 0.875rem; line-height: 1.5; color: var(--ink-soft); }

.fold { margin-top: 64px; border-top: 1px solid var(--line-strong); }
.fold summary {
  display: flex;
  justify-content: space-between;
  padding: 20px 0;
  font-size: 0.875rem;
  cursor: pointer;
  list-style: none;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; color: var(--ink-faint); }
.fold[open] summary::after { content: "-"; }
.fold summary:hover { color: var(--orange); }
.fold .specs { margin-top: 0; border-top: 1px solid var(--line); }

/* the S-4 nod: its name, big in the pixel face */
.nod__mark {
  margin: 8px 0 0;
  font-weight: 700;
  font-size: clamp(4rem, 14vw, 9rem);
  line-height: 1;
  color: var(--orange);
}
@media (max-width: 899px) {
  .nod__mark { display: none; }
}
