/* Neither Size: screen and print. Sheet geometry is in millimetres. */

/* 210 is the width of A4, 279.4 the height of Letter. */
@page { size: 210mm 279.4mm; margin: 0; }

* { box-sizing: border-box; }

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

.top { padding: 20px 24px 4px; }
.wordmark { display: block; width: 132px; height: auto; color: var(--ink); }

.desk {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding: 12px 24px 40px;
}

.tool { position: sticky; top: 16px; display: grid; gap: 12px; }
.label { font-size: 13px; color: var(--ink-soft); }

textarea {
  appearance: none;
  display: block;
  width: 100%;
  height: min(56vh, 520px);
  margin: 0;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--ink-soft);
  background: transparent;
  color: var(--ink);
  font: 13px/1.5 var(--font-body);
  tab-size: 12mm;
}
textarea::placeholder { color: var(--ink-soft); }

.note, .status { margin: 0; font-size: 13px; }
.note { color: var(--ink-soft); }
.status { font-variant-numeric: tabular-nums; }

.print {
  appearance: none;
  justify-self: start;
  min-width: 120px;
  min-height: 44px;
  margin: 0;
  padding: 0 24px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font: 500 15px/1 var(--font-body);
  cursor: pointer;
}
.print:hover { background: transparent; color: var(--ink); }
textarea:focus-visible, .print:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.paper { min-width: 0; }
.colophon { margin: 20px 0 0; font-size: 12px; color: var(--ink-soft); }

/* The sheet. Paper does not change with the colour scheme, so the ink on it
   keeps the light value of the house ink. */
.sheet {
  position: relative;
  width: 210mm;
  height: 279.4mm;
  overflow: hidden;
  background: #fff;
  outline: 1px solid var(--ink-soft);
}
.sheet + .sheet { margin-top: 12mm; }
.block, .sheet svg { --ink: #1A1A1A; }

.marks, .edge { position: absolute; top: 0; height: 279.4mm; }
.marks { left: 0; width: 180mm; }
.edge { right: 0; width: 30mm; }
.sheet svg {
  fill: var(--ink);
  font-family: var(--font-body);
  font-size: 2.4694px; /* 7 pt, in millimetre units */
  font-variant-numeric: tabular-nums;
}
.sheet svg path { fill: none; stroke: var(--ink); stroke-width: 0.2px; }

/* The text block and its off-screen measure share one setting. */
.block, .measure {
  font: 10pt/5mm var(--font-body);
  tab-size: 12mm;
  overflow-wrap: anywhere;
}
.block {
  position: absolute;
  left: 30mm;
  top: 22mm;
  width: 150mm;
  height: 235mm;
  color: var(--ink);
  white-space: pre; /* lines arrive already cut by the measure */
}
.measure {
  position: fixed;
  left: 0;
  top: 0;
  width: 150mm;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .top { padding: 16px 16px 0; }
  .desk { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 12px 16px 32px; }
  .tool { position: static; }
  textarea { height: 34vh; }
}

@media print {
  :root:not([data-theme="light"]), :root { color-scheme: light; }
  body { background: none; }
  .top, .tool, .colophon, .measure { display: none !important; }
  .desk { display: block; padding: 0; }
  .sheets { zoom: 1 !important; }
  .sheet { outline: none; margin: 0 !important; break-after: page; }
  .sheet:last-child { break-after: auto; }
}
