/* Unask. A galley proof on a desk: ink on cream, 1px and 2px rules, hard corners.
   Stamp inks: moss APPROVED, copper REVISE, earth UNASKED; brick for the proof mark. */

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
[hidden] { display: none !important; }

html { background: var(--bg); color: var(--ink); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  -webkit-text-size-adjust: 100%;
}

.page { max-width: 1280px; margin: 0 auto; padding: 32px 40px 72px; }

h1, h2, h3, p, ol, ul { margin: 0; }
h2 { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h3 { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 32px 0 10px; }

.s-approved { --ink-c: var(--c-moss); }
.s-revise   { --ink-c: var(--c-copper); }
.s-unasked  { --ink-c: var(--c-earth); }

/* masthead */
.masthead { display: grid; gap: 10px; justify-items: start; }
.wordmark { display: block; width: 168px; height: auto; }
.masthead h1 { font-size: 34px; line-height: 1; font-weight: 700; letter-spacing: -.01em; margin-top: 14px; }
.lede { font-size: 17px; }
.print-head { display: none; }

/* tray */
.tray { margin: 28px 0 32px; }
.pads { display: flex; flex-wrap: wrap; gap: 16px; }
.pad {
  display: flex; align-items: center; gap: 14px;
  min-width: 13rem; padding: 3px 14px 3px 3px;
  border: 2px solid var(--ink-c);
}
.pad b {
  background: var(--ink-c); color: var(--bg);
  font-size: 12px; letter-spacing: .16em; padding: 8px 10px 8px 12px; min-width: 7.2rem; text-align: center;
}
.pad output { font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.tally { margin-top: 12px; font-size: 15px; }

/* desk */
.desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px 0; align-items: start; }
.box { border: 2px solid var(--ink); background: var(--bg); padding: 0 20px 20px; min-width: 0; }
.box > h2 { border-bottom: 1px solid var(--ink); margin: 0 -20px 16px; padding: 10px 20px 8px; }

.copy textarea {
  display: block; width: 100%; min-height: 320px; resize: vertical;
  font: 400 15px/1.6 var(--font-body); color: var(--ink); background: var(--bg);
  border: 1px solid var(--ink); padding: 10px 12px;
}
.copy.drop textarea { outline: 2px solid var(--ink); outline-offset: 2px; }
.hint { margin-top: 12px; font-size: 13px; color: var(--ink-soft); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
button, .button {
  font: 500 14px/1.2 var(--font-body); color: var(--ink); background: var(--bg);
  border: 1px solid var(--ink); padding: 8px 12px; cursor: pointer; text-align: left;
}
button:hover:not(:disabled), .button:hover { background: var(--ink); color: var(--bg); }
button:disabled { color: var(--ink-soft); border-color: var(--ink-soft); cursor: default; }
:focus-visible, .file:focus-within { outline: 2px solid var(--c-mustard); outline-offset: 2px; }
.file { position: relative; }
.file input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.status { font-size: 13px; color: var(--ink-soft); }

/* proof */
.empty { color: var(--ink-soft); }
.narrow { display: none; }
.rows { list-style: none; padding: 0; }
.row {
  position: relative;
  display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; column-gap: 14px;
  grid-template-areas: "n q s" ". notes notes";
  padding: 16px 0; border-top: 1px solid var(--ink);
}
.row:first-child { border-top: 0; padding-top: 4px; }
.row .n { grid-area: n; font-variant-numeric: tabular-nums; color: var(--ink-soft); padding-top: 3px; }
.row .q { grid-area: q; font-size: 17px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.row > .stamp { grid-area: s; align-self: start; }
.row.u { grid-template-areas: "n q q" ". notes notes"; }
.notes { grid-area: notes; margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.notes ul { list-style: none; padding: 0; margin-top: 4px; }
.notes li { padding-left: 1.6em; text-indent: -1.6em; }
.notes li b { color: var(--ink); font-weight: 700; margin-right: .35em; }
.notes .ev { color: var(--ink); }
.notes .why { display: block; padding-left: 0; text-indent: 0; }
.notes .cap { color: var(--ink); }
.linkish {
  font-size: 13px; padding: 0; border: 0; background: none; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; margin-top: 6px;
}
.linkish:hover:not(:disabled) { background: none; color: var(--ink); text-decoration-thickness: 2px; }

/* the proof mark: an underline in brick, the rule code set beside it by CSS so it is never copied */
.mk { text-decoration: underline 2px var(--c-brick); text-underline-offset: 4px; text-decoration-skip-ink: none; }
.code::after {
  content: attr(data-r);
  font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--c-brick);
  vertical-align: super; line-height: 0; margin: 0 .15em 0 .1em;
}

/* stamps: 2px outer line, 3px gap, 1px inner line; fixed width so every word lines up */
.stamp {
  display: inline-block; width: 7.5rem; padding: 3px;
  border: 2px solid var(--ink-c); background: var(--bg);
  transform: rotate(var(--tilt, 0deg)); transform-origin: 50% 50%;
  user-select: none; -webkit-user-select: none;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.stamp b {
  display: block; border: 1px solid var(--ink-c); background: var(--ink-c); color: var(--bg);
  font-size: 12px; line-height: 1; font-weight: 700; letter-spacing: .12em; text-indent: .12em;
  text-align: center; padding: 7px 0 6px;
}
.stamp.over b { background: transparent; color: var(--ink-c); }

/* the one thing off: UNASKED sits in the margin, outside the ruled box, across its rule line */
.row.u > .stamp { position: absolute; top: 14px; right: calc(100% + 14px); }

.notread { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--ink); font-size: 13px; color: var(--ink-soft); }
.notread:empty { display: none; }
.notread ol { list-style: none; padding: 0; margin-top: 4px; }
.notread li { white-space: pre-wrap; overflow-wrap: anywhere; }
.proof-actions { border-top: 1px solid var(--ink); padding-top: 14px; }

/* rule book */
.rulebook, .literature { margin-top: 56px; border-top: 2px solid var(--ink); padding-top: 12px; }
.intro { margin-top: 8px; max-width: 60em; color: var(--ink-soft); font-size: 14px; }
.tariff { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 14px; table-layout: fixed; }
.tariff th { text-align: left; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; border-bottom: 2px solid var(--ink); padding: 6px 8px; }
.tariff td { border-bottom: 1px solid var(--ink); padding: 8px; vertical-align: top; }
.tariff th:nth-child(1) { width: 3rem; }
.tariff th:nth-child(2) { width: 3rem; }
.tariff th:nth-child(3) { width: 10rem; }
.tariff th:nth-child(4) { width: 7rem; }
.tariff th:nth-child(6) { width: 32%; }
.tariff tr.off td:not(:first-child) { color: var(--ink-soft); }
.tariff .id { font-weight: 700; }
.tariff .st { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--ink-c); }
.tariff .am { display: block; font-weight: 400; letter-spacing: 0; font-size: 12px; color: var(--ink); font-style: italic; }
.tariff input[type="checkbox"] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); }
.pat, .addform input, .exits input, .asks textarea {
  width: 100%; font: 400 13px/1.4 var(--font-body); color: var(--ink); background: var(--bg);
  border: 1px solid var(--ink); padding: 6px 8px;
}
.pat.bad { border-width: 2px; padding: 5px 7px; }
.invalid { margin-top: 4px; font-size: 12px; color: var(--ink); }
.says { display: block; }
.misses { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-soft); }
.tariff .del { margin-top: 6px; font-size: 12px; padding: 4px 8px; }

.addform { margin-top: 16px; border: 1px solid var(--ink); padding: 14px; display: grid; gap: 10px; max-width: 40rem; }
.addform label { display: grid; gap: 4px; font-size: 13px; }
.addform .fixed { font-size: 13px; }
.addform .fixed b { color: var(--c-copper); letter-spacing: .1em; margin-left: .4em; }
.addform .actions { margin-top: 0; }

/* the page's own two questions */
.asks:empty { display: none; }
.ask { margin-top: 16px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 12px 0; max-width: 46rem; }
.ask .self { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: start; grid-template-areas: "q s" "notes notes"; }
.ask .q { grid-area: q; font-size: 16px; font-weight: 500; white-space: pre-wrap; }
.ask .stamp { grid-area: s; width: 6rem; padding: 2px; }
.ask .stamp b { font-size: 10px; padding: 5px 0 4px; }
.ask .notes { margin-top: 0; }
.ask textarea { min-height: 120px; margin-top: 10px; }
.ask .actions { margin-top: 10px; }

.exits { display: grid; gap: 14px; max-width: 60rem; }
.exits label { display: grid; gap: 4px; font-size: 13px; }
.exits .am { font-style: italic; margin-left: .4em; }

/* literature */
.lit { padding-left: 1.6em; display: grid; gap: 14px; max-width: 60rem; }
.lit .lq { font-size: 16px; }
.lit .meta { font-size: 13px; color: var(--ink-soft); }
.lit .gives { font-size: 13px; }
.lit .gives b { letter-spacing: .1em; color: var(--ink-c); }
.lit .url { overflow-wrap: anywhere; }

/* colophon */
.colophon { margin-top: 56px; border-top: 1px solid var(--ink); padding-top: 12px; font-size: 13px; color: var(--ink-soft); display: grid; gap: 4px; }
.ledger { margin: 8px 0; }
.ledger p { color: var(--ink); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; }
.ledger ol { list-style: none; padding: 0; font-variant-numeric: tabular-nums; }

/* medium: Copy above, a margin of three columns beside the Proof for UNASKED */
@media (min-width: 700px) {
  .desk { grid-template-columns: 128px minmax(0, 1fr); }
  .copy { grid-column: 1 / -1; }
  .proof { grid-column: 2; }
}
/* wide: 32 column grid, one column of page margin each side: Copy 10, margin 3, Proof 17 */
@media (min-width: 1100px) {
  .desk { grid-template-columns: minmax(0, 10fr) minmax(132px, 3fr) minmax(0, 17fr); }
  .copy { grid-column: 1; }
  .proof { grid-column: 3; }
  .wide { display: inline; }
  .narrow { display: none; }
}
@media (max-width: 1099px) {
  .wide { display: none; }
  .narrow { display: inline; }
}

/* narrow: everything stacks; the margin collapses and UNASKED sits above its question, inside the box */
@media (max-width: 699px) {
  .page { padding: 20px 16px 48px; }
  .masthead h1 { font-size: 28px; }
  .lede { font-size: 16px; }
  .pads { gap: 8px; flex-wrap: nowrap; }
  .pad { min-width: 0; flex: 1 1 0; flex-direction: column; align-items: stretch; gap: 4px; padding: 3px 3px 6px; }
  .pad b { min-width: 0; padding: 6px 0; letter-spacing: .1em; font-size: 11px; text-indent: .1em; }
  .pad output { font-size: 22px; text-align: center; }
  .box { padding: 0 14px 16px; }
  .box > h2 { margin: 0 -14px 14px; padding: 10px 14px 8px; }
  .copy textarea { min-height: 200px; }
  .row { grid-template-columns: 1.6em minmax(0, 1fr); column-gap: 10px; grid-template-areas: "n q" ". s" ". notes"; }
  .row > .stamp { justify-self: end; margin-top: 10px; }
  .row.u { grid-template-areas: ". s" "n q" ". notes"; }
  .row.u > .stamp { position: static; justify-self: start; margin: 2px 0 10px; }
  .tariff, .tariff tbody, .tariff tr, .tariff td { display: block; width: 100%; }
  .tariff thead { display: none; }
  .tariff tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; border-bottom: 1px solid var(--ink); padding: 10px 0; }
  .tariff td { border: 0; padding: 0; }
  .tariff td:nth-child(5), .tariff td:nth-child(6) { grid-column: 1 / -1; }
  .tariff td:nth-child(4) { text-align: right; }
  .ask .self { grid-template-columns: minmax(0, 1fr); grid-template-areas: "q" "s" "notes"; }
}

/* print: the header line, the tray, the Proof and the colophon; no text area, no rule inputs */
@media print {
  @page { margin: 14mm; }
  :root { --bg: #fff; }
  html, body { background: var(--bg); }
  .page { max-width: none; padding: 0; }
  .wordmark, .masthead h1, .lede, .copy, .rulebook, .literature, .actions, .linkish, .empty { display: none !important; }
  .print-head { display: grid; gap: 2px; font-size: 13px; }
  .print-head p:first-child { font-size: 16px; font-weight: 700; letter-spacing: .08em; }
  .tray { margin: 14px 0 18px; }
  .desk { grid-template-columns: 34mm minmax(0, 1fr); }
  .proof { grid-column: 2; }
  .row { break-inside: avoid; grid-template-columns: 2em minmax(0, 1fr) auto; grid-template-areas: "n q s" ". notes notes"; }
  .row.u { grid-template-areas: "n q q" ". notes notes"; }
  .row.u > .stamp { position: absolute; top: 14px; right: calc(100% + 14px); margin: 0; }
  .row > .stamp { justify-self: auto; margin-top: 0; }
  .pad b, .stamp, .stamp b { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .colophon { margin-top: 24px; }
}
