/* Specimen Signature Card. Light scheme only, every radius 0. */

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

html, body { background: var(--c-cream); }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.num {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}
.lab {
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  color: var(--c-moss);
}

/* The card, with its security tint on the margin only. */
.card {
  width: min(1000px, calc(100% - 32px));
  margin: 24px auto 40px;
  padding: 12px;
  border: 1px solid var(--c-moss);
  background-color: var(--c-cream);
  background-image:
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--c-teal) 40%, transparent) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c-teal) 40%, transparent) 0 1px, transparent 1px 7px);
}
.sheet {
  background: var(--c-cream);
  border: 1px solid var(--c-moss);
  padding: 20px 24px 16px;
}

/* Header. */
.head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "l1 stamp" "l2 stamp" "l3 l3" "l4 l4";
  column-gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-moss);
}
.l1 { grid-area: l1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; }
.l2 { grid-area: l2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 6px 0 8px; }
.l3 { grid-area: l3; }
.l4 { grid-area: l4; }
.title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-moss);
}
.date { font-size: 14px; }
#name {
  flex: 1 1 200px;
  max-width: 340px;
  min-width: 0;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-soft);
  padding: 1px 2px;
}
#name:focus { outline: none; border-bottom-color: var(--c-moss); background: color-mix(in srgb, var(--c-sky) 45%, transparent); }
.name-print { display: none; }
.imp { margin: 0; min-height: 1.45em; }
.imp .sit { margin-left: 1.4em; }
.imp .lab { display: inline-block; min-width: 9.5em; }

.stamp-zone { grid-area: stamp; display: flex; align-items: flex-start; justify-content: flex-end; padding: 6px 4px 0 0; }
.stamp {
  pointer-events: none;
  user-select: none;
  transform: rotate(-3deg);
  transform-origin: 50% 50%;
  border: 2px solid var(--c-brick);
  padding: 1px 6px 1px 10px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px var(--c-brick);
  /* the photocopy offset, the only shadow on the page */
  text-shadow: 1px 1px 0 color-mix(in srgb, var(--c-brick) 30%, transparent);
  box-shadow: 1px 1px 0 color-mix(in srgb, var(--c-brick) 30%, transparent);
}

/* Body: field and plate on the left, harmonic table on the right. */
.body {
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
  column-gap: 28px;
  padding: 16px 0 12px;
}
.field {
  position: relative;
  aspect-ratio: 8 / 3;
  background: var(--c-sky);
  border: 1px solid var(--c-moss);
}
.field canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.field.closed canvas { cursor: default; }
.field-label { position: absolute; left: 10px; top: 5px; right: 10px; font-size: 13px; pointer-events: none; }
.x {
  position: absolute;
  left: 3.6%;
  bottom: calc(25% + 3px);
  font-size: 22px;
  line-height: 1;
  color: var(--c-moss);
  pointer-events: none;
}
.base { position: absolute; left: 3%; right: 4%; bottom: 25%; border-top: 1px solid var(--c-moss); pointer-events: none; }
.msg { min-height: 1.45em; margin: 6px 0 8px; color: var(--error); font-size: 13.5px; }

.plates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: 12px; }
.plate {
  position: relative;
  margin: 0;
  aspect-ratio: 8 / 3;
  background: var(--c-sky);
  border: 3px double var(--c-moss);
}
.plate canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.plate figcaption { position: absolute; left: 5px; top: 1px; font-size: 11.5px; line-height: 1.2; pointer-events: none; }
.trace { position: relative; border: 1px solid var(--c-moss); }
.trace svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.trace polyline, .trace line { fill: none; vector-effect: non-scaling-stroke; }
.trace .zero { stroke: var(--c-moss); stroke-width: 1; stroke-dasharray: 2 4; opacity: .55; }
.trace .spec { stroke: var(--ink); stroke-width: 1.1; }
.trace .counter { stroke: var(--ink-soft); stroke-width: 1.1; }

.lines { margin-top: 10px; }
.lines p { margin: 0; font-size: 13.5px; }
.lines .lab { display: inline-block; min-width: 13em; }

.harm { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13.5px; }
.harm th, .harm td {
  padding: 3px 8px 3px 0;
  text-align: left;
  font-weight: 400;
  border-bottom: 1px solid color-mix(in srgb, var(--c-moss) 30%, transparent);
  white-space: nowrap;
}
.harm thead th { border-bottom-color: var(--c-moss); font-variant-caps: all-small-caps; letter-spacing: .08em; color: var(--c-moss); }
.harm th:first-child { width: 3.2em; }
.harm td .num { display: inline-block; width: 3.4em; }
.track { display: inline-block; vertical-align: middle; width: calc(100% - 3.9em); height: 7px; }
.bar { display: block; width: 0; height: 100%; background: var(--ink); }
.harm td + td .bar { background: var(--ink-soft); }
.caption, .vline, .rule { margin: 8px 0 0; font-size: 13px; }
.caption { color: var(--ink-soft); }
.vline + .vline, .vline + .rule { margin-top: 2px; }

/* Controls. */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--c-moss);
}
.edge { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 auto 0 0; padding: 0; border: 0; min-width: 0; }
.edge legend { float: left; padding: 0; margin-right: 2px; }
.edge label { cursor: pointer; white-space: nowrap; }
.edge input {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin: 0 6px 0 0;
  padding: 2px;
  vertical-align: -2px;
  border: 1px solid var(--c-moss);
  background: transparent;
  background-clip: content-box;
  cursor: pointer;
}
.edge input:checked { background-color: var(--ink); }
.controls button {
  font: inherit;
  font-size: 13.5px;
  letter-spacing: .03em;
  padding: 7px 14px;
  color: var(--c-moss);
  background: var(--c-cream);
  border: 1px solid var(--c-moss);
  cursor: pointer;
}
.controls button:hover:not(:disabled) { background: var(--c-sky); }
.controls button:disabled { color: var(--ink-soft); border-color: var(--ink-soft); opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--c-moss); outline-offset: 2px; }

/* Keyboard, 25 keys. */
.keys { padding: 4px 0 16px; }
.keyboard {
  position: relative;
  height: 128px;
  border-left: 1px solid var(--c-moss);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.k { position: absolute; top: 0; margin: 0; padding: 0; font: inherit; cursor: pointer; border: 1px solid var(--c-moss); }
.k.white {
  width: calc(100% / 15);
  height: 100%;
  border-left-width: 0;
  background: var(--c-sky);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
}
.k.white span { font-size: 11px; color: var(--c-moss); }
.k.black { z-index: 1; width: calc(100% / 15 * .62); height: 60%; background: var(--c-moss); }
.k.white.down { background: var(--c-teal); }
.k.black.down { background: var(--ink); }
.keyboard.locked .k { cursor: not-allowed; }
.keyboard.locked .k.white { background: color-mix(in srgb, var(--c-sky) 45%, var(--c-cream)); }
.keyboard.locked .k.black { background: color-mix(in srgb, var(--c-moss) 55%, var(--c-cream)); }
.keyboard.locked .k.white span { color: var(--ink-soft); }
.keys-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }

/* Foot: four column footnotes and the imprint. */
.foot { border-top: 1px solid var(--c-moss); padding-top: 10px; }
.notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: auto 1fr;
  column-gap: 22px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}
.n1 { grid-column: 1; grid-row: 1 / 3; }
.n2 { grid-column: 2; grid-row: 1 / 3; }
.n3 { grid-column: 3; grid-row: 1 / 3; }
.n4 { grid-column: 4; grid-row: 1; }
.n5 { grid-column: 4; grid-row: 2; }
.nn { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; margin-right: .35em; }
.imprint { display: flex; align-items: center; gap: 14px; margin: 16px 0 0; }
.imprint img { display: block; height: 22px; width: auto; }
.imprint .lab { font-size: 12px; }

@media screen and (max-width: 720px) {
  .card { padding: 6px; margin-top: 16px; }
  .sheet { padding: 14px 12px 12px; }
  .title { font-size: 13px; letter-spacing: .1em; }
  .stamp { font-size: 17px; letter-spacing: .12em; padding: 0 4px 0 7px; }
  .body { grid-template-columns: minmax(0, 1fr); row-gap: 14px; }
  .field-label { font-size: 12px; left: 7px; }
  .lines .lab { min-width: 0; margin-right: .4em; }
  .imp .lab { display: block; min-width: 0; }
  .imp .sit { display: block; margin-left: 0; }
  .plate figcaption { font-size: 10px; left: 4px; }
  .keyboard { height: 108px; }
  .k.white { padding-bottom: 4px; }
  .k.white span { font-size: 9.5px; }
  .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; column-gap: 16px; row-gap: 6px; }
  .n1, .n2, .n3, .n4, .n5 { grid-column: auto; grid-row: auto; }
}

/* The card can be kept: one A6 landscape page, fixed in millimetres. */
@media print {
  /* A6 landscape. The explicit size is for engines that do not know the A6 keyword. */
  @page { size: 148mm 105mm; size: A6 landscape; margin: 6mm; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  html, body { background: none; }
  body { font-size: 7pt; line-height: 3mm; }
  .controls, .controls *, .keys, .keys *, .msg, #name, .l2 label { display: none !important; }

  .card {
    width: 136mm;
    height: 93mm;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--c-cream);
    break-inside: avoid;
  }
  .sheet { border: 0; padding: 0; background: none; }
  .band { width: 136mm; margin: 0; }
  .lab { letter-spacing: .05em; }

  .head {
    height: 12mm;
    padding: 0;
    border: 0;
    grid-template-columns: 104mm 4mm 28mm;
    grid-template-rows: repeat(4, 3mm);
    grid-template-areas: "l1 . stamp" "l2 . stamp" "l3 . stamp" "l4 . stamp";
    column-gap: 0;
  }
  .head .l1, .head .l2, .head .imp { display: block; margin: 0; min-height: 0; height: 3mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .title { display: inline; font-size: 7pt; letter-spacing: .1em; }
  .date { font-size: 7pt; margin-left: 3mm; }
  .name-print { display: inline; }
  .imp .lab { display: inline-block; min-width: 23mm; }
  .imp .sit { margin-left: 2.5mm; }
  .stamp-zone { padding: 0; height: 12mm; align-items: center; justify-content: center; }
  .stamp {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24mm;
    height: 7mm;
    padding: 0 0 0 .14em;
    border-width: .45mm;
    font-size: 10pt;
    line-height: 1;
    letter-spacing: .14em;
    -webkit-text-stroke-width: .25pt;
    text-shadow: .3mm .3mm 0 color-mix(in srgb, var(--c-brick) 30%, transparent);
    box-shadow: .3mm .3mm 0 color-mix(in srgb, var(--c-brick) 30%, transparent);
  }

  .body {
    height: 64mm;
    padding: 1.2mm 0 0;
    border-top: .2mm solid var(--c-moss);
    grid-template-columns: 62mm 70mm;
    column-gap: 4mm;
    align-content: start;
  }
  .field { width: 62mm; height: 23mm; aspect-ratio: auto; }
  .field-label { left: 1mm; top: .4mm; right: 1mm; font-size: 7pt; line-height: 3mm; }
  .x { font-size: 9pt; left: 2mm; }
  .plates { margin-top: 1.5mm; grid-template-columns: 30mm 30mm; column-gap: 2mm; }
  .plate { width: 30mm; height: 11mm; aspect-ratio: auto; border-width: .7mm; }
  .plate figcaption { font-size: 7pt; line-height: 3mm; left: .6mm; top: 0; }
  .trace { width: 30mm; height: 11mm; border-width: .2mm; }
  .lines { margin-top: 1.5mm; }
  .lines p { font-size: 7pt; line-height: 3mm; height: 3mm; white-space: nowrap; }
  .lines .lab { min-width: 0; margin-right: 1.2mm; }

  .harm { width: 70mm; font-size: 7pt; line-height: 3mm; }
  .harm th, .harm td { padding: 0; height: 3mm; line-height: 3mm; border: 0; }
  .harm thead th { border: 0; }
  .harm th:first-child { width: 8mm; }
  .harm tr { height: 3mm; }
  .harm td .num { width: 8.5mm; }
  .track { width: calc(100% - 10mm); height: 1.5mm; vertical-align: -.1mm; }
  .caption, .vline, .rule { margin: 0; font-size: 7pt; line-height: 3mm; }
  .caption { margin-top: .6mm; }

  .foot { height: 17mm; padding: .6mm 0 0; border-top: .2mm solid var(--c-moss); }
  .notes {
    height: 12mm;
    grid-template-columns: 30mm 31mm 38mm 34mm;
    grid-template-rows: auto 1fr;
    column-gap: 1mm;
    font-size: 7pt;
    line-height: 3mm;
  }
  .notes li { break-inside: avoid; }
  .imprint { height: 4mm; margin: 0; gap: 2mm; }
  .imprint img { height: 3.2mm; }
  .imprint .lab { font-size: 7pt; line-height: 4mm; }
}
