@font-face{font-family:"Barlow Condensed";font-style:normal;font-weight:500;font-display:swap;src:url(/static/fonts/barlow-condensed-500.woff2) format("woff2")}
@font-face{font-family:"Barlow Condensed";font-style:normal;font-weight:600;font-display:swap;src:url(/static/fonts/barlow-condensed-600.woff2) format("woff2")}
@font-face{font-family:"Barlow";font-style:normal;font-weight:400;font-display:swap;src:url(/static/fonts/barlow-400.woff2) format("woff2")}
@font-face{font-family:"Barlow";font-style:normal;font-weight:500;font-display:swap;src:url(/static/fonts/barlow-500.woff2) format("woff2")}
@font-face{font-family:"Barlow";font-style:normal;font-weight:600;font-display:swap;src:url(/static/fonts/barlow-600.woff2) format("woff2")}
@font-face{font-family:"EB Garamond";font-style:italic;font-weight:500;font-display:swap;src:url(/static/fonts/eb-garamond-500-italic.woff2) format("woff2")}
/* Layout: one narrow column, like a single instrument faceplate (the home page
   widens on big screens so the whole metronome fits on one screen). The header
   carries the wordmark, whose four Os double as beat lamps; on phones the menu
   drops down under it.

   Depth: one light source, from above. Raised parts (keys, the pyramid, the
   bezels) catch a highlight on their top edge and drop a shadow below;
   recessed parts (the lamp tray, the scale card, slots) are shaded at the top.
   Text and reading pages stay flat. */
:root {
  --face: #e4e7ea;       /* the faceplate: matt enamel */
  --well: #d2d8dd;       /* recesses: lamp tray, slots */
  --key: #f5f7f8;        /* key caps, lit from above… */
  --key-lo: #e2e6e9;     /* …to their lower edge */
  --key-edge: #b2bbc3;
  --key-wall: #9da7b0;   /* the side of a key, seen below its cap */
  --latched: #343a40;    /* a key that's pressed in: chosen settings, Start */
  --latched-lo: #1f2327;
  --latched-ink: #ffffff;
  --ink: #14181c;        /* printed legends */
  --ink-soft: #545f69;
  --rule: #bcc4cb;
  --red: #d1362a;        /* downbeat jewel, the weight's index line */
  --orange: #ee6f1c;     /* accent jewel */
  --grey: #46515c;       /* normal jewel */
  --lamp-off: #aab3bb;
  --focus: #2766d6;
  --shadow: rgb(20 24 28 / 0.22);
  --hl: rgb(255 255 255 / 0.9);                 /* highlight along a top edge */
  --lift: 0 1px 1px rgb(20 24 28 / 0.1), 0 5px 9px -3px rgb(20 24 28 / 0.28);
  --sunk: inset 0 2px 3px rgb(20 24 28 / 0.18), inset 0 -1px 0 rgb(255 255 255 / 0.65);

  /* the pyramid metronome */
  --case-lit: #4f5760;
  --case: #2f353b;
  --case-dark: #1c2024;
  --case-rim: #b3bec8;
  --card: #f8f9f9;
  --card-top: #cfd5da;
  --card-ink: #262b30;
  --floor: rgb(20 24 28 / 0.42);
  --metal-hi: #ffffff;   /* polished steel: bezels, the weight, the pivot */
  --metal: #c3cad0;
  --metal-lo: #7d8891;

  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-score: "EB Garamond", "Iowan Old Style", Georgia, serif;  /* Italian tempo words */

  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --radius-key: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --face: #16191d;
    --well: #0d0f12;
    --key: #2b3137;
    --key-lo: #22272c;
    --key-edge: #3a424a;
    --key-wall: #08090b;
    --latched: #eef1f3;
    --latched-lo: #c4cbd1;
    --latched-ink: #14181c;
    --ink: #e7eaed;
    --ink-soft: #98a4ae;
    --rule: #333c45;
    --red: #ff5946;
    --orange: #ff8a3d;
    --grey: #c6ced6;
    --lamp-off: #39424a;
    --focus: #7ea6ff;
    --shadow: rgb(0 0 0 / 0.5);
    --hl: rgb(255 255 255 / 0.08);
    --lift: 0 1px 1px rgb(0 0 0 / 0.45), 0 6px 12px -3px rgb(0 0 0 / 0.65);
    --sunk: inset 0 2px 4px rgb(0 0 0 / 0.6), inset 0 -1px 0 rgb(255 255 255 / 0.05);
    --case-lit: #59626b;
    --case: #383f46;
    --case-dark: #262b30;
    --case-rim: #c2ccd5;
    --card: #e3e7ea;
    --card-top: #aab2b9;
    --card-ink: #1f2428;
    --floor: rgb(0 0 0 / 0.75);
  --metal-hi: #d9dfe4;
  --metal: #8c959d;
  --metal-lo: #3c444b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --face: #16191d;
  --well: #0d0f12;
  --key: #2b3137;
  --key-lo: #22272c;
  --key-edge: #3a424a;
  --key-wall: #08090b;
  --latched: #eef1f3;
  --latched-lo: #c4cbd1;
  --latched-ink: #14181c;
  --ink: #e7eaed;
  --ink-soft: #98a4ae;
  --rule: #333c45;
  --red: #ff5946;
  --orange: #ff8a3d;
  --grey: #c6ced6;
  --lamp-off: #39424a;
  --focus: #7ea6ff;
  --shadow: rgb(0 0 0 / 0.5);
  --hl: rgb(255 255 255 / 0.08);
  --lift: 0 1px 1px rgb(0 0 0 / 0.45), 0 6px 12px -3px rgb(0 0 0 / 0.65);
  --sunk: inset 0 2px 4px rgb(0 0 0 / 0.6), inset 0 -1px 0 rgb(255 255 255 / 0.05);
  --case-lit: #59626b;
  --case: #383f46;
  --case-dark: #262b30;
  --case-rim: #c2ccd5;
  --card: #e3e7ea;
  --card-top: #aab2b9;
  --card-ink: #1f2428;
  --floor: rgb(0 0 0 / 0.75);
  --metal-hi: #d9dfe4;
  --metal: #8c959d;
  --metal-lo: #3c444b;
  color-scheme: dark;
}

/* ---- page ---------------------------------------------------------------- */

html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--face);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  padding-block: 0;
}

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

/* ---- keys ------------------------------------------------------------------
   Every key is the same object: a cap lit from above, standing on a short
   wall, with a soft shadow under it. Pressing pushes the cap down onto its
   wall; a chosen setting stays pressed in, dark, like a latching switch. */

.btn-key, .menu-btn, .mt-step, .mt-tap, .mt-chips label {
  border: 1px solid var(--key-edge);
  border-radius: var(--radius-key);
  background: linear-gradient(var(--key), var(--key-lo));
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--hl), 0 2px 0 var(--key-wall), var(--lift);
  transition: transform 60ms ease-out, box-shadow 60ms ease-out;
}
.btn-key:active, .menu-btn:active, .mt-step:active, .mt-tap:active, .mt-tap.is-hit {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 var(--hl), 0 0 0 var(--key-wall), 0 1px 1px var(--shadow);
}

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

.site-head {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px 6px;
}

.brand {
  --ls: 0.13em;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  font: 600 21px/1 var(--font-display);
  letter-spacing: var(--ls);
  text-transform: uppercase;
}
.brand-word { display: inline-block; }
.brand .o {
  display: inline-block;
  width: 0.64em;
  height: 0.64em;
  margin-right: var(--ls);
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.105em currentColor;
  vertical-align: -0.005em;
}
.brand .o.is-down { background: var(--red); box-shadow: none; }
/* while the metronome plays, the lit O follows the beat */
.brand.is-live .o.is-down { background: none; box-shadow: inset 0 0 0 0.105em currentColor; }
.brand.is-live .o.is-on { background: var(--ink); box-shadow: 0 0 9px 1px color-mix(in srgb, var(--ink) 35%, transparent); }
.brand.is-live .o.is-on.is-down { background: var(--red); box-shadow: 0 0 10px 2px color-mix(in srgb, var(--red) 55%, transparent); }

.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  font: 500 17px/1 var(--font-body);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.menu-btn[aria-expanded="true"] {
  border-color: var(--latched-lo);
  background: linear-gradient(var(--latched), var(--latched-lo));
  color: var(--latched-ink);
  transform: translateY(2px);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 1px var(--shadow);
}
.menu-bars {
  width: 14px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}
html:not(.js) .menu-btn { display: none; }

.site-nav a {
  text-decoration: none;
  font: 500 19px/1 var(--font-body);
}
.site-nav a[aria-current="page"]::before {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: var(--red);
  vertical-align: 0.14em;
}

/* phones: a drop-down panel under the header */
html.js .site-nav {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  padding: 6px 0;
  background: var(--key);
  border: 1px solid var(--key-edge);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--hl), 0 14px 30px var(--shadow);
}
html.js .site-nav.is-open { display: block; }
html.js .site-nav a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
}
html.js .site-nav a + a { border-top: 1px solid var(--rule); }
html:not(.js) .site-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }

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

.site-foot {
  display: grid;
  gap: 14px;
  margin-top: 28px;
  padding-block: 20px 32px;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.foot-nav a {
  color: var(--ink);
  text-decoration: none;
  font: 500 15px/2 var(--font-body);
}
.foot-legal { margin: 0; max-width: 62ch; }
.tbc { font-style: italic; text-decoration: underline dotted; text-underline-offset: 3px; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-key);
  font: 600 17px/1.1 var(--font-body);
  text-decoration: none;
  text-align: center;
}
.btn-ink {
  border: 1px solid var(--latched-lo);
  background: linear-gradient(var(--latched), var(--latched-lo));
  color: var(--latched-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.15), 0 2px 0 var(--key-wall), var(--lift);
}

@media (min-width: 40rem) {
  .site-head { padding-block: 16px 10px; }
  .brand { font-size: 23px; }
  .menu-btn { display: none; }
  html.js .site-nav,
  .site-nav {
    position: static;
    display: flex;
    gap: 28px;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }
  html.js .site-nav a,
  html.js .site-nav a + a { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; }
  .site-nav a { font-size: 17px; }
}

/* the home page holds the whole metronome on one screen */
@media (min-width: 64rem) {
  .page-home { max-width: 70rem; }
}

/* The metronome tool. Tokens live in base.css. */

.mt { display: flex; flex-direction: column; gap: 18px; }
.mt button, .mt label, .mt summary {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.mt :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.mt-label {
  display: block;
  margin: 0 0 9px;
  padding: 0;
  font: 500 15px/1.2 var(--font-body);
  color: var(--ink-soft);
}

.mt-face { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }

/* ---- beat lamps: glass jewels in steel bezels, set in a recessed tray ---- */

.mt-lamps {
  display: grid;
  grid-template-columns: repeat(var(--beats, 4), minmax(0, 1fr));
  gap: 4px;
  padding: 14px 8px 11px;
  background: var(--well);
  border-radius: 14px;
  box-shadow: var(--sunk);
}
.lamp {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  padding: 2px 0;
  display: grid;
  justify-items: center;
  gap: 9px;
  cursor: pointer;
  min-width: 0;
}
.bezel {
  display: grid;
  place-items: center;
  width: min(46px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--metal-hi) 0%, var(--metal) 38%, var(--metal-lo) 78%, var(--metal) 100%);
  box-shadow: 0 1px 1px rgb(20 24 28 / 0.3), 0 4px 7px -2px rgb(20 24 28 / 0.4);
  transition: box-shadow 140ms ease-out;
}
.mt-lamps[data-size="mid"] .bezel { width: min(38px, 100%); }
.mt-lamps[data-size="small"] .bezel { width: min(28px, 100%); }
.jewel {
  /* a glass dome: a small sharp highlight up top, light gathering at the bottom */
  --c: var(--grey);
  --glass: color-mix(in srgb, var(--c) 46%, var(--lamp-off));
  display: block;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 30% 20% at 40% 24%, rgb(255 255 255 / 0.95) 0, rgb(255 255 255 / 0.35) 55%, rgb(255 255 255 / 0) 100%),
    radial-gradient(circle at 50% 88%, color-mix(in srgb, var(--glass) 45%, white) 0, rgb(255 255 255 / 0) 52%),
    radial-gradient(circle at 50% 42%, var(--glass) 0, var(--glass) 40%, color-mix(in srgb, var(--glass) 62%, black) 100%);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.28), inset 0 2px 3px rgb(0 0 0 / 0.35);
}
.lamp[data-level="3"] .jewel { --c: var(--red); }
.lamp[data-level="2"] .jewel { --c: var(--orange); }
.lamp[data-level="1"] .jewel { --c: var(--grey); }
.lamp[data-level="0"] .jewel {
  --glass: color-mix(in srgb, var(--lamp-off) 70%, var(--face));
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.28), inset 0 2px 3px rgb(0 0 0 / 0.35), inset 0 0 0 4px rgb(0 0 0 / 0.08);
}
.lamp.is-on .jewel {
  --glass: var(--c);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.2), 0 0 12px 2px color-mix(in srgb, var(--c) 70%, transparent);
}
.lamp.is-on .bezel {
  box-shadow: 0 1px 1px rgb(20 24 28 / 0.3), 0 4px 7px -2px rgb(20 24 28 / 0.4),
              0 0 26px 6px color-mix(in srgb, var(--c, var(--grey)) 40%, transparent);
}
.lamp.is-on[data-level="1"] .bezel,
.lamp.is-on[data-level="0"] .bezel { box-shadow: 0 1px 1px rgb(20 24 28 / 0.3), 0 4px 7px -2px rgb(20 24 28 / 0.4); }
.lamp.is-on[data-level="0"] .jewel { --glass: var(--lamp-off); box-shadow: inset 0 0 0 2px var(--ink-soft); }
.lamp.is-silent-bar .jewel { --glass: var(--lamp-off); box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.5); }

.pips { display: flex; gap: 3px; height: 4px; }
.pips i {
  display: block;
  width: 7px;
  height: 4px;
  border-radius: 1px;
  background: var(--lamp-off);
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.25);
}
.pips i.is-on { background: var(--ink); box-shadow: none; }

.mt-legend {
  display: grid;
  gap: 1px;
  margin: -2px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.mt-legend .keys { display: flex; flex-wrap: wrap; gap: 0 14px; }
.key { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.key::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}
.key.k3 { --c: var(--red); }
.key.k2 { --c: var(--orange); }
.key.k1 { --c: var(--grey); }
.key.k0::before { background: none; box-shadow: inset 0 0 0 1.5px var(--ink-soft); }

/* ---- the pyramid metronome ----------------------------------------------------
   A wind-up metronome standing on the faceplate: a graphite case with a scale
   card, an arm that swings in front of it and a steel weight that reads the
   tempo against the scale (higher is slower, like the real thing). Positions
   are stage pixels from PEND in build.py; --k scales the whole stage. */

.mt-pendulum {
  --k: 1;
  position: relative;
  width: calc(320px * var(--k));
  height: calc(304px * var(--k));
  margin: 2px auto 0;
  -webkit-user-select: none;
  user-select: none;
}
.mt-pendulum:has(.mt-slider:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
.pend-case { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pc-card-edge { fill: var(--case-dark); }
.pc-plate { fill: var(--case-dark); stroke: rgb(255 255 255 / 0.07); stroke-width: 1; }

.pend-scale { position: absolute; inset: 0; }
.pt {
  position: absolute;
  left: 50%;
  top: calc((var(--top) + var(--p) * var(--span)) * var(--k) * 1px);
  width: calc(9px * var(--k));
  height: 1px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--card-ink) 34%, var(--card));
}
.pt.major { width: calc(18px * var(--k)); background: var(--card-ink); }
.pt b {
  position: absolute;
  right: calc(100% + 12px * var(--k));
  top: 50%;
  transform: translateY(-50%);
  font: 500 calc(12px * var(--k))/1 var(--font-display);
  letter-spacing: 0.02em;
  color: var(--card-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pm {
  position: absolute;
  left: calc(50% + 18px * var(--k));
  top: calc((var(--top) + var(--p) * var(--span)) * var(--k) * 1px);
  transform: translateY(-55%);
  font: italic 500 calc(12px * var(--k))/1 var(--font-score);
  color: var(--card-ink);
  white-space: nowrap;
}

/* the page's heading, printed on the case's nameplate */
.mt-title {
  position: absolute;
  left: 50%;
  top: calc(var(--plate-mid) * var(--k) * 1px);
  transform: translate(-50%, -50%);
  margin: 0;
  font: 500 calc(11.5px * var(--k))/1 var(--font-body);
  letter-spacing: 0.03em;
  color: #c4ccd3;
  white-space: nowrap;
}

.pend-arm,
.pend-shadow {
  position: absolute;
  left: calc(50% - 2px);
  top: calc(var(--tip) * var(--k) * 1px);
  width: 4px;
  height: calc((var(--pivot) - var(--tip)) * var(--k) * 1px);
  border-radius: 2px;
  transform-origin: 50% 100%;
  will-change: transform;
}
.pend-arm {
  background: linear-gradient(90deg, #1f2327 0%, #7a848c 30%, #d3d9de 48%, #6b757d 70%, #1b1f22 100%);
}
/* the arm's shadow on the card: a blurred copy, offset away from the light */
.pend-shadow {
  transform: translate(4px, 3px);
  background: rgb(8 10 12 / 0.3);
  filter: blur(1.4px);
}
.pend-arm.is-resting,
.pend-shadow.is-resting { transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.3, 1); }
.pend-weight,
.pend-shadow span {
  position: absolute;
  left: 50%;
  top: calc((var(--top) - var(--tip) + var(--w) * var(--span)) * var(--k) * 1px);
  width: calc(32px * var(--k));
  height: calc(22px * var(--k));
  transform: translate(-50%, -50%);
  border-radius: 4px 4px 5px 5px;
}
.pend-shadow span { background: rgb(8 10 12 / 0.34); }
.pend-weight {
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.85) 0, rgb(255 255 255 / 0) 36%, rgb(0 0 0 / 0) 70%, rgb(0 0 0 / 0.16) 100%),
    linear-gradient(90deg, var(--metal-lo) 0%, var(--metal) 20%, var(--metal-hi) 40%, var(--metal) 64%, var(--metal-lo) 100%);
  box-shadow: inset 0 0 0 1px rgb(20 24 28 / 0.32), inset 0 1px 0 rgb(255 255 255 / 0.7);
  transition: transform 120ms ease-out;
}
.pend-weight::after {
  /* the index line you read the tempo against, pointing at the numbers */
  content: "";
  position: absolute;
  left: calc(-5px * var(--k));
  right: 3px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: var(--red);
}
.mt-pendulum.is-dragging .pend-weight { transform: translate(-50%, -50%) scale(1.07); }

.pend-pivot {
  position: absolute;
  left: 50%;
  top: calc(var(--pivot) * var(--k) * 1px);
  width: calc(18px * var(--k));
  height: calc(18px * var(--k));
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--metal-hi) 0, var(--metal) 30%, var(--metal-lo) 72%, #23282c 100%);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(0 0 0 / 0.25);
}
.pend-pivot::after {
  /* the screw slot */
  content: "";
  position: absolute;
  left: 24%;
  right: 24%;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: rgb(20 24 28 / 0.55);
  transform: rotate(-32deg);
}
.pend-grab {
  /* drag anywhere in this column of the card; the rest of the stage still scrolls the page */
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 0;
  width: calc(124px * var(--k));
  height: calc(var(--card-bottom) * var(--k) * 1px);
  transform: translateX(-50%);
  cursor: grab;
  touch-action: none;
}
.pend-grab.is-dragging { cursor: grabbing; }
.mt-pendulum .mt-slider {
  /* the real control, kept for keyboard and screen readers */
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.pend-hint {
  margin: -2px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---- tempo readout ---------------------------------------------------------- */

.mt-tempo {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 8px;
}
.mt-readout { text-align: center; min-width: 0; }
.mt-readout .mt-label { margin-bottom: 0; }
.mt-bpm {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  caret-color: var(--red);
  text-align: center;
  font: 600 clamp(84px, 27vw, 132px)/0.95 var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.mt-bpm:focus { background: var(--well); box-shadow: var(--sunk); outline: none; }
.mt-marking {
  margin: 4px 0 0;
  font: 500 17px/1.2 var(--font-body);
  color: var(--ink-soft);
}
.mk-name {
  margin-right: 0.3em;
  font: italic 500 23px/1 var(--font-score);
  color: var(--ink);
}
.mk-eq { white-space: nowrap; }
.note {
  display: inline-block;
  height: 1.05em;
  width: auto;
  vertical-align: -0.16em;
  fill: currentColor;
}
.mk-eq .note { margin-right: 0.12em; }
.mt-step {
  height: 64px;
  padding: 0;
  font: 400 34px/1 var(--font-body);
  cursor: pointer;
}

/* ---- settings: rows of latching keys ------------------------------------------ */

.mt-settings {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.mt-field { margin: 0; padding: 0; border: 0; min-width: 0; }
.mt-chips { display: flex; flex-wrap: wrap; gap: 9px 7px; padding-bottom: 2px; }
.mt-chips input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.mt-chips label {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  min-height: 42px;
  padding: 0 13px;
  box-sizing: border-box;
  font: 500 17px/1 var(--font-body);
  cursor: pointer;
}
.mt-chips label:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 var(--hl), 0 0 0 var(--key-wall), 0 1px 1px var(--shadow);
}
.mt-chips input:checked + label {
  border-color: var(--latched-lo);
  background: linear-gradient(var(--latched), var(--latched-lo));
  color: var(--latched-ink);
  transform: translateY(2px);
  box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.45), 0 0 0 var(--key-wall), 0 1px 1px var(--shadow);
}
.mt-chips input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 3px; }
.ts {
  display: grid;
  justify-items: center;
  font: 600 17px/0.92 var(--font-display);
  font-variant-numeric: tabular-nums;
}
.mt-chips label:has(.ts) { min-width: 44px; padding: 0 8px; }
.ts span + span { border-top: 1.5px solid currentColor; padding-top: 1px; }

/* volume: a fader cap riding in a slot */
.mt-volume {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 34px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.mt-volume::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: var(--well);
  box-shadow: var(--sunk);
}
.mt-volume::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: var(--well);
  box-shadow: var(--sunk);
}
.mt-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 32px;
  margin-top: -12px;
  border: 1px solid var(--key-edge);
  border-radius: 6px;
  background:
    linear-gradient(var(--ink-soft), var(--ink-soft)) center / 2px 14px no-repeat,
    linear-gradient(var(--key), var(--key-lo));
  box-shadow: inset 0 1px 0 var(--hl), 0 2px 0 var(--key-wall), var(--lift);
}
.mt-volume::-moz-range-thumb {
  width: 20px;
  height: 30px;
  border: 1px solid var(--key-edge);
  border-radius: 6px;
  background:
    linear-gradient(var(--ink-soft), var(--ink-soft)) center / 2px 14px no-repeat,
    linear-gradient(var(--key), var(--key-lo));
  box-shadow: inset 0 1px 0 var(--hl), 0 2px 0 var(--key-wall), var(--lift);
}

/* ---- transport: pinned to the bottom edge on phones ------------------------------ */

.mt-transport {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-inline: calc(-1 * var(--gutter-l)) calc(-1 * var(--gutter-r));
  padding: 12px var(--gutter-r) max(12px, env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: var(--face);
  box-shadow: 0 -1px 0 var(--rule), 0 -12px 18px -12px var(--shadow);
}
.mt-keys {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 10px;
}
.mt-tap, .mt-start {
  height: 60px;
  font: 600 19px/1 var(--font-body);
  cursor: pointer;
}
.mt-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid var(--latched-lo);
  border-radius: var(--radius-key);
  background: linear-gradient(var(--latched), var(--latched-lo));
  color: var(--latched-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.16), 0 3px 0 var(--key-wall), var(--lift);
  transition: transform 60ms ease-out, box-shadow 60ms ease-out;
}
.mt-start:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.1), 0 0 0 var(--key-wall), 0 1px 1px var(--shadow);
}
/* while it plays, Start stays pressed in with its light on */
.mt.is-playing .mt-start {
  transform: translateY(2px);
  box-shadow: inset 0 2px 5px rgb(0 0 0 / 0.45), 0 1px 0 var(--key-wall), 0 1px 2px var(--shadow);
}
.pilot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--latched-ink) 30%, var(--latched));
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.55);
}
.mt.is-playing .pilot {
  background: radial-gradient(circle at 40% 35%, #ffd0c8 0, var(--red) 60%);
  box-shadow: 0 0 10px 2px color-mix(in srgb, var(--red) 70%, transparent);
}
.mt-status { margin: 0; font-size: 14px; line-height: 1.4; }
.mt-status:not(:empty) { margin-bottom: 8px; }

/* ---- timing check ------------------------------------------------------------------ */

.mt-diag {
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-soft);
}
.mt-diag summary { cursor: pointer; margin: 0; }
.mt-diag p { margin: 8px 0 10px; max-width: 62ch; }
.mt-diag dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 8px 16px;
  margin: 0;
}
.mt-diag dt { font: 500 13px/1.2 var(--font-body); }
.mt-diag dd {
  margin: 2px 0 0;
  color: var(--ink);
  font: 500 18px/1.2 var(--font-display);
  font-variant-numeric: tabular-nums;
}

/* ---- sizes ---------------------------------------------------------------------- */

@media (max-width: 351px) {
  .mt-pendulum { --k: 0.9; }
}
@media (min-width: 40rem) {
  .mt-transport { position: static; margin-inline: 0; padding-inline: 0; background: none; box-shadow: none; }
}
/* big screens: the metronome on the left, its controls on the right, all on one screen */
@media (min-width: 64rem) {
  .mt {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-areas:
      "face tempo"
      "face settings"
      "face transport"
      "diag diag";
    grid-template-rows: auto auto 1fr auto;
    column-gap: 64px;
    row-gap: 18px;
    align-items: start;
  }
  .mt-face { grid-area: face; }
  .mt-tempo { grid-area: tempo; padding-top: 6px; }
  .mt-settings { grid-area: settings; }
  .mt-transport { grid-area: transport; align-self: end; padding-top: 6px; }
  .mt-diag { grid-area: diag; }
  .mt-pendulum { --k: 1.5; margin-top: 14px; }
  .mt-lamps { padding: 18px 12px 14px; }
  .bezel { width: min(58px, 100%); }
  .mt-lamps[data-size="mid"] .bezel { width: min(46px, 100%); }
  .mt-legend { font-size: 14px; }
}

/* Reading pages: home sections, blog, lessons, legal. Flat and quiet: the
   depth is saved for the metronome. */

.home-block {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}
.block-title {
  margin: 0 0 4px;
  font: 600 27px/1.1 var(--font-display);
  color: var(--ink);
}
.crumb { margin: 0 0 6px; font-size: 15px; }
.crumb a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}
.home-lessons p { max-width: 36rem; font-size: 17px; margin: 0 0 14px; }
.more-link { margin: 12px 0 0; }
.more-link a {
  font: 600 16px/1.2 var(--font-body);
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* big screens: notes and lessons side by side under the metronome */
@media (min-width: 64rem) {
  .page-home main {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    column-gap: 64px;
  }
  .page-home .mt { grid-column: 1 / -1; }
}

/* post lists */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li + li { border-top: 1px solid var(--rule); }
.post-list a {
  display: grid;
  gap: 5px;
  padding-block: 14px;
  color: inherit;
  text-decoration: none;
}
.post-title {
  font: 600 23px/1.12 var(--font-display);
  text-wrap: balance;
}
.post-list a:hover .post-title,
.post-list a:focus-visible .post-title {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.post-desc { color: var(--ink-soft); font-size: 16px; line-height: 1.45; max-width: 36rem; }
.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 500 14px/1.3 var(--font-body);
  color: var(--ink-soft);
}
.page-intro .post-meta { margin-top: 14px; }
.post-list-full { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: 18px; }
.draft {
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--well);
  color: var(--ink);
  font-size: 13px;
}

/* page intro */
.page-intro { padding-block: 14px 4px; }
.page-intro h1 {
  margin: 4px 0 12px;
  font: 600 clamp(34px, 9.5vw, 52px)/1.02 var(--font-display);
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.standfirst {
  max-width: 36rem;
  margin: 0;
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* long-form text */
.prose {
  max-width: 36rem;
  font-size: 18px;
  line-height: 1.65;
}
.prose > :first-child { margin-top: 26px; }
.prose h2 {
  margin: 1.7em 0 0.45em;
  font: 600 27px/1.12 var(--font-display);
  text-wrap: balance;
}
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; padding-left: 0.2em; }
.prose li::marker { color: var(--ink-soft); }
.prose strong { font-weight: 600; }
.prose a {
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* "Try it" boxes: open the metronome with the settings the post describes */
.try {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin: 1.5em 0 1.7em;
  padding: 16px 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--key);
}
.try-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font: 600 15px/1.2 var(--font-body);
  color: var(--ink);
}
.try-label::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
}
.try-text p { margin: 0; font-size: 17px; line-height: 1.5; }
.try-go { min-height: 44px; font-size: 16px; }
.try-go b { font-weight: 600; font-variant-numeric: tabular-nums; }
.try-spec {
  margin: -2px 0 0;
  font: 500 14px/1.3 var(--font-body);
  color: var(--ink-soft);
}

/* author note */
.author {
  max-width: 36rem;
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 16px;
  color: var(--ink-soft);
}
.author p { margin: 0 0 6px; }
.author-name { font: 600 20px/1.2 var(--font-display); color: var(--ink); }
.author a {
  color: var(--ink);
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* key facts (lessons, legal) */
.facts {
  max-width: 36rem;
  margin: 22px 0 0;
  border-top: 1px solid var(--rule);
}
.facts > div {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 14px;
  padding-block: 12px;
  border-bottom: 1px solid var(--rule);
}
.facts dt {
  padding-top: 2px;
  font: 500 15px/1.3 var(--font-body);
  color: var(--ink-soft);
}
.facts dd { margin: 0; font-size: 17px; line-height: 1.45; }
.fact-line { display: block; }
.fact-line + .fact-line { margin-top: 6px; }

.cta {
  display: grid;
  gap: 12px;
  justify-items: start;
  max-width: 36rem;
  margin-top: 30px;
  padding: 18px;
  border-radius: 10px;
  background: var(--well);
}
.cta p { margin: 0; font-size: 17px; }

@media (max-width: 30rem) {
  .facts > div { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}
