/* Marked Proof: page chrome and the sheet. Square corners everywhere on this page. */

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

html { background: var(--bg); }
body {
  margin: 0;
  padding: 28px 16px 40px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- chrome ---------- */

.masthead, .inputs, .status, .foot { max-width: 1100px; margin-left: auto; margin-right: auto; }

.masthead h1 {
  margin: 0;
  font: var(--fw-medium) 22px/1.2 var(--font-display);
  letter-spacing: -0.01em;
}
.masthead .sub { margin: 4px 0 24px; color: var(--ink-soft); }

.inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 300px;
  gap: 20px;
  align-items: start;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .mode legend, .slider span {
  font: var(--fw-medium) 13px/1.3 var(--font-body);
  color: var(--ink);
}
textarea {
  width: 100%;
  height: 200px;
  contain: strict; /* a long paste is laid out on its own, not again with every sheet */
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font-body);
}
textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; }

button {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: var(--fw-medium) 14px/1.2 var(--font-body);
  cursor: pointer;
}
button:hover, button:focus-visible { background: var(--ink); color: var(--bg); outline: none; }
button:disabled { opacity: 0.45; cursor: default; }
button:disabled:hover { background: transparent; color: var(--ink); }
button.text { align-self: flex-start; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; padding-left: 0; }
button.text:hover, button.text:focus-visible { padding-left: 12px; }

.controls { display: flex; flex-direction: column; gap: 16px; }
.slider { display: flex; flex-direction: column; gap: 6px; }
.slider input { width: 100%; min-height: 32px; accent-color: var(--ink); margin: 0; }
.mode { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.mode legend { padding: 0; margin-bottom: 6px; }
.mode label { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
.mode input { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.copied { margin: 0; min-height: 1.5em; font-size: 13px; color: var(--ink-soft); }

.status { margin-top: 28px; min-height: 2.6em; }
.status p { margin: 0; }
#summary { font-weight: var(--fw-medium); }
.spacing { font-size: 13px; color: var(--ink-soft); }

.foot {
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 13px;
}
.foot p { margin: 0; }
.wordmark { width: 92px; height: auto; color: var(--ink); font-family: var(--font-display); }
.wordmark text { fill: currentColor; }
.wordmark rect { fill: var(--c-brick); }

@media (max-width: 1000px) {
  .inputs { grid-template-columns: 1fr 1fr; }
  .controls { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .inputs { grid-template-columns: 1fr; }
  textarea { height: 150px; }
}

/* ---------- the sheet: paper in every colour scheme ---------- */

.sheet-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding: 6mm;
  margin-top: 8px;
}

#sheet {
  --paper: #FCF0DD;
  --type: #1A1A1A;
  --pencil: #5B5B5B;
  position: relative;
  width: 170mm;
  min-height: 60mm;
  margin: 0 auto;
  padding: 9mm 0 10mm 8mm;
  background: var(--paper);
  color: var(--type);
  border: 1px solid var(--pencil);
  font: 11pt/19.8pt ui-serif, Georgia, "Times New Roman", serif;
  color-scheme: light;
}
#sheet.blank { display: flex; align-items: center; justify-content: center; min-height: 90mm; padding: 0; }
#sheet .state { margin: 0; font-style: italic; color: var(--pencil); }

.crop { position: absolute; width: 4mm; height: 4mm; border: 0 solid var(--pencil); }
.crop.tl { left: -6mm; top: -6mm; border-right-width: 1px; border-bottom-width: 1px; }
.crop.tr { right: -6mm; top: -6mm; border-left-width: 1px; border-bottom-width: 1px; }
.crop.bl { left: -6mm; bottom: -6mm; border-right-width: 1px; border-top-width: 1px; }
.crop.br { right: -6mm; bottom: -6mm; border-left-width: 1px; border-top-width: 1px; }

.slug {
  margin: 0 0 19.8pt;
  font: 8pt/19.8pt ui-serif, Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--pencil);
  margin-right: 8mm;
}
.sheet-line { margin: 0 0 19.8pt; font-style: italic; }

.row {
  display: grid;
  grid-template-columns: 112mm 6mm 1fr;
  margin-bottom: 19.8pt;
  break-inside: avoid;
}
.tc { grid-column: 1; position: relative; align-self: start; min-height: 19.8pt; overflow-wrap: break-word; }
.mc { grid-column: 3; position: relative; }

del {
  text-decoration: line-through 1px var(--pencil);
  text-decoration-skip-ink: none;
  color: var(--type);
}

.caret { display: inline-block; position: relative; width: 0; height: 0; vertical-align: baseline; }
.caret .g-caret { position: absolute; left: -6px; top: -7px; }
.caret.gap .g-caret { left: -4px; }
.caret .num {
  position: absolute; left: 5px; top: 1px;
  font: italic 7pt/1 var(--font-body);
  color: var(--pencil);
}

.bracket {
  position: absolute; left: -4mm; top: 3px; bottom: 3px; width: 1.6mm;
  border: 1px solid var(--pencil); border-right: 0;
}

.g {
  fill: none;
  stroke: var(--pencil);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  height: 20px;
  vertical-align: -5px;
  overflow: visible;
}
.g-delete { width: 16px; }
.g-caret { width: 12px; }
.g-slash { width: 10px; }

.mblock {
  position: absolute; left: 0; right: 4mm;
  font: italic 10pt/19.8pt var(--font-body);
  color: var(--pencil);
}
.mblock .piece { white-space: normal; }
.ring { display: inline-block; min-width: 1.4em; padding: 0 0.3em; text-align: center; border: 1px solid var(--pencil); border-radius: 50%; line-height: 1.3; }

.mblock.slip {
  border: 1px solid var(--pencil);
  background: color-mix(in srgb, var(--pencil) 10%, var(--paper));
  padding: 0 2mm 1mm;
  color: var(--type);
}
.slip-l { font: italic 7.5pt/16pt var(--font-body); color: var(--pencil); }
.slip-t { font: 10pt/19.8pt var(--font-body); }

.legend {
  margin: 0 8mm 0 0;
  padding: 3mm 4mm;
  border: 1px solid var(--pencil);
  font: 9pt/1.5 var(--font-body);
  break-inside: avoid;
}
.legend h2 { margin: 0 0 2mm; font: italic 9pt/1.4 var(--font-body); }
.legend ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1mm 6mm; }
.legend li { display: flex; align-items: center; gap: 3mm; min-height: 22px; }
.lg-mark { flex: 0 0 13mm; display: inline-flex; justify-content: center; align-items: center; }
.legend .g { vertical-align: middle; }
.legend p { margin: 2mm 0 0; }
.legend .small { font-size: 7.5pt; color: var(--pencil); }
.specimen { font: 10pt/1 ui-serif, Georgia, serif; }
.specimen-bracket { display: inline-block; width: 1.6mm; height: 18px; border: 1px solid var(--pencil); border-right: 0; }
.specimen-slip { display: inline-block; padding: 0 1.5mm; border: 1px solid var(--pencil); background: color-mix(in srgb, var(--pencil) 10%, var(--paper)); font: italic 7.5pt/16px var(--font-body); color: var(--pencil); }
.colophon { margin: 3mm 8mm 0 0; font: italic 7.5pt/1.4 var(--font-body); color: var(--pencil); }

[data-stray] { user-select: none; pointer-events: none; }
.mblock.stray { user-select: none; pointer-events: none; }

@media screen {
  .piece:focus, .slip-t:focus { outline: none; }
  del.hl { text-decoration-line: line-through underline; text-underline-offset: 3px; }
  .piece.hl, .slip-t.hl { text-decoration: underline 1px var(--pencil); text-underline-offset: 3px; }
  .caret.hl::after { content: ""; position: absolute; left: -7px; width: 14px; top: 15px; border-top: 1px solid var(--pencil); }
}

/* ---------- print: the sheet alone, pencil and type on white ---------- */

@page { margin: 12mm; }

@media print {
  html, body { background: none !important; padding: 0; margin: 0; }
  body > :not(.sheet-wrap):not(.sprite) { display: none !important; }
  .sheet-wrap { padding: 6mm; margin: 0; overflow: visible; }
  #sheet, #sheet * { background: none !important; }
  #sheet { border: 0; margin: 0; }
  #sheet .mblock.slip { border: 1px solid var(--pencil); }
}
