/* First Crack, one page, no build step, no JavaScript.

   The page is set as a parts catalogue: numbered rows banded by hairline rules, mono for
   labels and numbers, and one technical figure. Monochrome throughout, so there are 3 roles
   (ink, muted, rule) on a grey ground and no accent anywhere.

   Vertical space is viewport-relative so the whole sheet fits a laptop screen without
   scrolling, and opens up again on a taller display. */

:root {
  --ground: #e8e8e6;
  --ink:    #17181a;
  --muted:  #5c5e62;
  --rule:   #c5c5c1;

  /* One family for the whole page: the lead, the body, the labels, and the numbers. */
  --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --col-num:   2.75rem;
  --col-label: 7.5rem;
  --gutter:    1.5rem;
  --sheet-max: 54rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1a1b1d;
    --ink:    #e8e8e6;
    --muted:  #93969b;
    --rule:   #313336;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  /* minmax(0, 1fr) rather than the implicit auto track: an auto track sizes to
     max-content, which lets the sheet grow wider than a phone screen. */
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.55;
  text-wrap: pretty;
}

a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--muted); }
a:hover { border-bottom-color: var(--ink); }
::selection { background: var(--ink); color: var(--ground); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.sheet {
  width: 100%;
  max-width: var(--sheet-max);
  margin: 0 auto;
  padding: clamp(1.5rem, 3.4vh, 3rem) 2.5rem;
}

.strip { padding-bottom: clamp(0.5rem, 1.2vh, 0.875rem); }

.mark { display: block; }
.mark rect:first-child { stroke: var(--ink); }
.mark rect + rect { fill: var(--ink); }

.row {
  display: grid;
  grid-template-columns: var(--col-num) var(--col-label) 1fr;
  gap: 0 var(--gutter);
  align-items: start;
  border-top: 1px solid var(--rule);
  padding: clamp(0.875rem, 1.9vh, 1.375rem) 0;
}

.row:last-of-type { border-bottom: 1px solid var(--rule); }

.row--wide .cell { grid-column: 2 / -1; }

/* The nudge on .num lines the 11px label up with 15px body text. Row 01 opens on
   the ident, which is 11px too, so there the number needs no correction. */
.row--wide .num { padding-top: 0; }

.num, .label {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.25rem;
}

.num { font-variant-numeric: tabular-nums; }
.label { color: var(--ink); }

.cell > * { margin: 0; }
.cell p { max-width: 58ch; color: var(--muted); }
.cell b { font-weight: 500; color: var(--ink); }

.ident {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.cell .lead {
  font-size: clamp(1.375rem, 2.8vw, 1.875rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  max-width: 24ch;
  color: var(--ink);
  text-wrap: balance;
}

/* The drawing is the tallest block on the page, so it is capped against the
   viewport height as well as its own width. */
.fig svg {
  display: block;
  width: 100%;
  max-width: 20rem;
  max-height: 24vh;
  height: auto;
  color: var(--muted);
}
/* An index mark on the drum face, the one view where rotation is actually visible.
   view-box keeps the origin in the drawing's own coordinates. */
.spoke {
  transform-box: view-box;
  transform-origin: 270px 84px;
  animation: drum 6s linear infinite;
}

@keyframes drum { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spoke { animation: none; }
}

.fig figcaption {
  margin-top: 0.625rem;
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding-top: clamp(1.625rem, 4vh, 3rem);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* On a tall screen, a tablet in portrait especially, the sheet has height to spare.
   Open the rows up rather than leaving the space above and below the block. */
@media (min-height: 60rem) {
  .sheet { padding: clamp(3rem, 5vh, 4.5rem) 2.5rem; }
  .strip { padding-bottom: clamp(0.875rem, 2vh, 1.5rem); }
  .row { padding: clamp(1.375rem, 3vh, 2.5rem) 0; }
  .foot { padding-top: clamp(1.875rem, 4.5vh, 3.25rem); }
}

/* Monospace runs wide, so a phone needs the number column and the page padding
   trimmed to leave a usable measure for the text. */
@media (max-width: 46rem) {
  body { font-size: 0.875rem; }
  .sheet { padding: 2rem 1.125rem; }
  .row {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0 0.875rem;
    row-gap: 0.5rem;
  }
  .row .label { grid-column: 2; }
  .row .cell, .row--wide .cell { grid-column: 2; min-width: 0; }
  .cell p { max-width: none; }
  .fig svg { max-height: none; }
  /* Three items will not sit on one phone line, and letting them wrap strands the
     last one. Stack them instead so the break reads as intended. */
  .foot { flex-direction: column; gap: 0.3125rem; }
}
