/* Sicherman Pair: a component sheet and its proof, on screen and on paper. */

:root {
  --small: 0.7rem;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; border-radius: 0; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.45;
}

main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: 1.15;
  margin: 0;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
p { margin: 0 0 0.5em; }
ol, ul { margin: 0; }

.label, caption, .axis {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 4px;
}

/* the wordmark is the shipped wordmark.svg, painted in the ink of the scheme */
.wordmark {
  display: block;
  width: 36mm;
  aspect-ratio: 420 / 96;
  background: var(--ink);
  -webkit-mask: url(wordmark.svg) left center / contain no-repeat;
  mask: url(wordmark.svg) left center / contain no-repeat;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.wordmark.small { width: 104px; margin-bottom: 20px; }

/* intro */
.intro { margin-bottom: 32px; }
.standfirst { font-size: 1.1rem; max-width: 34em; margin: 8px 0 20px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
a { color: var(--ink); text-underline-offset: 3px; }

button {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.9rem;
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
}
button.primary { background: var(--ink); color: var(--bg); }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* sheets */
.sheet {
  border: 1px solid var(--ink);
  padding: 24px;
  margin: 0 0 32px;
}
.strip {
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--ink);
}
.strip .wordmark { margin-bottom: 10px; }
.title-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; }
.title-row .label { margin: 0; white-space: nowrap; }

.row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 10mm; margin-bottom: 18px; }
.row > * { min-width: 0; }

#contents { padding-left: 1.4em; }
#contents li { margin: 2px 0; }
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  vertical-align: -1px;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.swatch.moss { background: var(--c-moss); outline: 1px solid var(--ink); outline-offset: -1px; }
.swatch.mustard { background: var(--c-mustard); }
.swatch.slip { border: 1px solid var(--ink); }

.keys { display: flex; flex-direction: column; gap: 10px; }
#legend-lines { list-style: none; padding: 0; display: flex; gap: 20px; }
#legend-lines li { display: flex; align-items: center; gap: 8px; }
.sample, #scalebar { color: var(--ink); display: block; }
.scale { margin: 0; }
.scale figcaption { font-size: 0.85rem; margin-top: 4px; }

.nets { display: flex; flex-wrap: wrap; gap: 10mm; margin-bottom: 18px; }
.net { display: block; color: var(--ink); max-width: 100%; height: auto; }

#steps { padding-left: 1.4em; max-width: 88mm; }
#steps li { margin: 0 0 4px; }

#slip {
  border: 1px solid var(--ink);
  width: 85mm;
  max-width: 100%;
  min-height: 48mm;
  padding: 3mm 4mm;
  display: flex;
  flex-direction: column;
}
#slip ol { list-style: none; padding: 0; }
#slip li { margin: 0 0 3px; }
.slip-foot { margin: auto 0 0; }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 8px;
}
.foot p {
  margin: 0;
  font-size: var(--small);
  font-weight: 400;
  font-style: normal;
  color: var(--ink-soft);
}

/* sheet 2 */
table { border-collapse: collapse; font-family: var(--mono); font-variant-numeric: tabular-nums; }
caption { text-align: left; font-family: var(--font-body); }
th, td { border: 1px solid var(--ink); padding: 3px 7px; text-align: right; font-weight: 400; }

.grids { display: flex; flex-wrap: wrap; gap: 20px 10mm; margin-bottom: 20px; }
.grid th { color: var(--ink-soft); }
.grid td, .grid th { width: 2.4em; text-align: center; }

.scroll { overflow-x: auto; margin-bottom: 16px; }
#sums { width: 100%; }
#sums thead th { font-family: var(--font-body); font-size: 0.8rem; vertical-align: bottom; text-align: right; color: var(--ink-soft); }
#sums tr:last-child td { border-top: 2px solid var(--ink); }

#million { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
#million p { margin: 0 0 4px; }
#again { margin-top: 8px; }
#legend-stats { margin: 12px 0; font-size: 0.9rem; }
#legend-stats p { margin: 0 0 2px; }
#derivation { font-family: var(--mono); font-size: 0.9rem; overflow-wrap: anywhere; }
#derivation sup { font-size: 0.7em; }

/* your rolls */
#rolls {
  border-top: 1px solid var(--ink);
  padding-top: 24px;
}
#rolls h2 { margin-bottom: 12px; }
#rolls > p { max-width: 36em; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 20px 0; }
#copy {
  font-family: var(--mono);
  font-size: 1rem;
  min-height: 44px;
  width: 16ch;
  max-width: 100%;
  padding: 0 10px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
}

#next { font-weight: var(--fw-bold); min-height: 1.45em; }

.entry { margin: 8px 0 16px; }
.entry[hidden] { display: none; }
.cells {
  display: grid;
  grid-template-columns: 2rem repeat(6, minmax(44px, 64px));
  gap: 4px;
}
.cells span {
  font-family: var(--mono);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
}
button.cell { padding: 0; min-width: 44px; min-height: 44px; font-size: 1rem; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
#clear[data-armed="true"] { background: var(--ink); color: var(--bg); }
#progress { font-family: var(--mono); font-size: 0.9rem; color: var(--ink-soft); }

#report {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 12px 0 0;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}
#report:not(:empty) { border: 1px solid var(--ink); padding: 16px; }

@media (max-width: 639px) {
  h1 { font-size: 1.7rem; }
  .nets { flex-direction: column; gap: 16px; }
  .grids { flex-direction: column; }
  .sheet { padding: 16px 12px; }
  #sums { font-size: 0.64rem; }
  #sums th, #sums td { padding: 3px 2px; }
  #sums thead th { font-size: 0.6rem; }
}

/* paper: the browser picks the size, the page keeps a 12 mm margin */
@page { margin: 12mm; }

@media print {
  :root, :root:not([data-theme="light"]) {
    --small: 8pt;
    --bg: #FFFFFF;
    --ink: #000000;
    --ink-soft: #000000;
    color-scheme: light;
  }
  html, body { background: #FFFFFF; color: #000000; }
  body { font-size: 9.5pt; line-height: 1.35; }
  main { max-width: none; padding: 0; margin: 0; }
  .intro, #rolls, #again, #print, #pdf, button { display: none !important; }
  .sheet {
    border: 0;
    padding: 0 1mm; /* nothing sits flush against the page clip */
    margin: 0;
    break-after: page;
    break-inside: avoid;
    display: flex;
    flex-direction: column;
    min-height: 254mm; /* the foot sits at the foot on A4 and on US Letter */
  }
  .sheet > .foot { margin-top: auto; }
  #sheet2 { break-after: auto; }
  h2 { font-size: 15pt; }
  .net { max-width: none; width: 85mm; height: 70mm; }
  .net, .swatch { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .nets { flex-direction: row; flex-wrap: nowrap; }
  .grids { flex-direction: row; flex-wrap: nowrap; }
  .scroll { overflow: visible; }
  th, td { padding: 1.2pt 5pt; }
  #sums thead th { font-size: 8pt; }
  #million, #legend-stats, #derivation { font-size: 9pt; }
  .label, caption, .axis { color: #000000; }
}
