/* One Cycle: a specification page printed on cream card. Every corner is square. */

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 32px 16px;
  background: var(--bg);
  font-family: var(--font-body);
}

/* The sheet keeps light ink in both schemes, like paper on a desk; only the ground goes dark. */
.sheet {
  --ink: #1A1A1A;
  --ink-soft: #5B5B5B;
  color-scheme: light;
  width: max(640px, calc(100vw * 16 / 32));
  max-width: 100%;
  margin: 0 auto;
  padding: 28px 32px 32px;
  background: var(--c-cream);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

p, h1, h2, dl, dd, figure, ol { margin: 0; }

.label, dt, h2 {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 400;
}

h1 { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; }

#status { margin-top: 8px; min-height: 22px; }
#status.error { border-left: 2px solid var(--c-brick); padding-left: 8px; }

button {
  font: inherit;
  color: var(--ink);
  background: var(--c-cream);
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  min-height: 40px;
  padding: 7px 14px;
  cursor: pointer;
}
button:disabled,
button[aria-disabled="true"] { color: var(--ink-soft); background: var(--c-cream); cursor: default; }

:focus-visible { outline: 2px solid #1A1A1A; outline-offset: 2px; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* Scrub: the strip, the slider whose thumb centre travels the strip's full width, the readout. */
#scrub { margin-top: 20px; }
#scrub .row { margin-top: 6px; }
canvas { display: block; border: 1px solid var(--ink); border-radius: 0; background: var(--c-cream); }
#strip { width: 100%; height: 64px; }

#position {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: calc(100% + 8px);
  height: 24px;
  margin: 6px -4px 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
}
#position::-webkit-slider-runnable-track { height: 1px; background: var(--ink); border: 0; border-radius: 0; }
#position::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 24px;
  margin-top: -11.5px;
  background: var(--ink);
  border: 0;
  border-radius: 0;
}
#position::-moz-range-track { height: 1px; background: var(--ink); border: 0; border-radius: 0; }
#position::-moz-range-thumb { width: 8px; height: 24px; background: var(--ink); border: 0; border-radius: 0; }

/* Keyboard: ten white keys share the width; black keys sit on the lines between them. */
.keyboard { margin-top: 20px; }
.keys {
  position: relative;
  display: flex;
  height: 132px;
  margin-top: 6px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.key {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 1px;
  min-height: 0;
  padding: 0 0 8px;
  font-size: 12px;
  line-height: 1.15;
  border-radius: 0;
}
.key .n { font-weight: 600; }
.key.white { flex: 0 0 10%; background: var(--c-cream); color: var(--ink); }
.key.white:not(:first-child) { border-left-width: 0; }
.key.black {
  position: absolute;
  top: 0;
  z-index: 1;
  width: max(28px, 6%);
  height: 60%;
  left: calc(var(--at) * 10% - max(14px, 3%));
  padding-bottom: 6px;
  font-size: 11px;
  background: var(--ink);
  color: var(--c-cream);
}
.key.white[aria-disabled="true"] { color: var(--ink-soft); background: var(--c-cream); }
.key.black[aria-disabled="true"] { color: var(--c-cream); background: var(--ink); }
.key.down, .key.black.down { background: var(--c-mustard); color: var(--ink); }

/* Legend */
#legend { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--ink); }
#seam-line { font-size: 26px; line-height: 1.2; font-weight: 600; }
.note { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
#legend dl {
  display: grid;
  grid-template-columns: 8.5em 1fr;
  margin-top: 14px;
  border-top: 1px solid var(--ink);
}
#legend dt, #legend dd { padding: 5px 0 4px; border-bottom: 1px solid var(--ink-soft); }
#legend dd { color: var(--ink); overflow-wrap: anywhere; text-wrap: pretty; }

/* Figures */
figure { margin-top: 24px; }
#figure { width: 100%; height: 160px; }
#detail { width: 386px; max-width: 100%; height: auto; }
figcaption { font-size: 13px; margin-top: 6px; text-wrap: pretty; }

.save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 24px; }
#filename { overflow-wrap: anywhere; }

.colophon { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--ink); }
.colophon img { display: block; height: 32px; width: auto; }
.colophon p { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.list { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--ink); }
.list h2 { font-size: 15px; }
#figures { list-style: none; padding: 0; margin-top: 6px; font-size: 14px; }
#figures li { padding: 3px 0; overflow-wrap: anywhere; }

@media (max-width: 671px) {
  body { padding: 16px; }
  .sheet { padding: 16px; }
  h1 { font-size: 26px; }
  .keys { height: 124px; }
  .key { font-size: 11px; }
  .key.black { font-size: 10px; }
  #legend dl { grid-template-columns: 7.2em 1fr; }
}
