/* Bellows: an instrument maker's leaflet. Radius 0 everywhere; the knobs are the only curves. */

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

html { background: var(--bg); color: var(--ink); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.45;
}

.leaflet {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 16px;
}

main.leaflet { padding-top: 28px; }

h1 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--c-earth);
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
}

.sub { margin: 4px 0 0; }

figure { margin: 22px 0 0; }

figcaption,
.label,
.engraved {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

figcaption { margin-top: 8px; text-align: left; color: var(--ink-soft); }

/* Fig. 1: label panel, copper rail, knobs hanging from it */
.rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1.5px solid var(--ink);
  padding-bottom: 30px;
}

.rail::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 34px;
  height: 8px;
  background: var(--c-copper);
}

.stop {
  appearance: none;
  background: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}


.stop:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }

.label {
  display: block;
  align-self: stretch;
  height: 34px;
  line-height: 34px;
  padding: 0 2px;
  white-space: nowrap;
  text-align: center;
}

.stop + .stop .label { border-left: 1.5px solid var(--ink); }

.knob {
  position: relative;
  z-index: 1;
  display: block;
  width: 44px;
  height: 44px;
  margin-top: 8px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--c-cream);
  transition: transform 150ms ease-out;
}

.knob::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 2px;
  height: 0;
  margin-left: -1px;
  margin-bottom: 2px;
  background: var(--ink);
}

.stop[aria-pressed="true"] .knob { transform: translateY(22px); background: var(--c-mustard); }
.stop[aria-pressed="true"] .knob::before { height: 22px; }

.nostop { margin: 8px 0 0; }

/* Fig. 2: the manual */
.manual {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  border: 1.5px solid var(--ink);
  border-right: 0;
  height: 128px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.key {
  border-right: 1.5px solid var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  min-width: 0;
}

.key .note { font-size: 11px; color: var(--ink-soft); }
.key.down { background: var(--c-peach); }

/* Meter, status, controls */
.controls { margin-top: 22px; }

.meter {
  height: 18px;
  border: 1.5px solid var(--ink);
  background: var(--bg);
  position: relative;
}

.meter-fill { height: 100%; width: 0; background: var(--c-brick); }

.ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.status { margin: 10px 0 0; min-height: 1.45em; }

.notice {
  margin: 6px 0 0;
  padding-left: 10px;
  border-left: 3px solid var(--c-brick);
}

.listen {
  margin-top: 12px;
  appearance: none;
  background: var(--bg);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 8px 22px;
  cursor: pointer;
}

.listen:active { background: var(--c-peach); }
.listen:focus-visible,
.file input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.small { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; }

.file { display: block; font-size: 13px; margin-top: 14px; }
.file input { display: block; margin-top: 4px; max-width: 100%; font: inherit; }
.file input::file-selector-button {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--ink);
  padding: 4px 10px;
  margin-right: 10px;
  cursor: pointer;
}

/* Readings */
.readings { margin-top: 26px; border-top: 1.5px solid var(--ink); padding-top: 12px; }

.readings dl {
  display: grid;
  grid-template-columns: 10rem 1fr;
  margin: 0;
  row-gap: 2px;
}

.readings dt { color: var(--ink-soft); }
.readings dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.engraved { margin: 18px 0 4px; color: var(--ink-soft); }

.breaths {
  margin: 0;
  padding: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
  white-space: pre;
}

/* The colophon: wordmark and the specification plate */
.plate { padding-top: 40px; padding-bottom: 48px; }
.plate img { display: block; width: 140px; height: auto; }

.spec {
  margin-top: 12px;
  border-top: 1.5px solid var(--ink-soft);
  padding-top: 10px;
}

.spec p {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}

@media (max-width: 480px) {
  /* the engraving tightens on a phone so "Expression" stays one word */
  figcaption,
  .label,
  .engraved { font-size: 11px; letter-spacing: 0.04em; }
  .readings dl { grid-template-columns: 8.5rem 1fr; }
  .key { font-size: 12px; }
  .key .note { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .knob { transition: none; }
}
