/* Numbered Edition: a print-shop job ticket on screen, plain ink sheets on paper. */

:root {
  --head: var(--c-earth);
  --rule: var(--ink);
  --serif: Georgia, "Times New Roman", serif;
}
[data-theme="dark"] {
  --head: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --head: var(--ink);
  }
}

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

html { -webkit-text-size-adjust: 100%; }

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

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

h1, h2 { color: var(--head); margin: 0; font-weight: var(--fw-bold); }
h1 { font-size: 22px; letter-spacing: -0.01em; }

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 10px;
}
.sub, .label, .caption, th {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: var(--fw-medium);
}
.sub { margin: 0; }

.notice {
  margin: 16px 0 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--warn);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  margin-top: 20px;
}
@media (min-width: 801px) {
  .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
}

/* ---------- ticket ---------- */

.ticket { min-width: 0; }

.field { margin: 0 0 18px; min-width: 0; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label { display: block; margin: 0 0 6px; }
h2.label { color: var(--ink-soft); font-weight: var(--fw-medium); }

.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }

.tabs { display: flex; gap: 0; }
.tab {
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 2px 0 2px 14px;
  cursor: pointer;
}
.tab[aria-pressed="true"] { color: var(--head); border-bottom-color: var(--head); font-weight: var(--fw-medium); }

.drop {
  display: block;
  position: relative;
  border: 1px dashed var(--ink-soft);
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-soft);
  cursor: pointer;
}
.drop.has { border-style: solid; border-color: var(--rule); color: var(--ink); }
.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.drop:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }

input[type="text"], input[type="number"], select, textarea {
  display: block;
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 6px 0;
  outline: none;
}
textarea {
  border: 1px solid var(--rule);
  padding: 8px;
  resize: vertical;
  font-family: var(--serif);
  font-size: 16px;
}
input:focus-visible, select:focus-visible { border-bottom: 2px solid var(--head); padding-bottom: 5px; }
textarea:focus-visible { outline: 1px solid var(--head); outline-offset: 2px; }
select { appearance: none; cursor: pointer; }
select option { color: #1A1A1A; background: #FFFFFF; }
input[type="number"] { font-variant-numeric: tabular-nums; }

.fixed { margin: 0; padding: 6px 0; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.line { margin: 8px 0 0; }
.soft { color: var(--ink-soft); }
#locked-line { margin: -6px 0 18px; font-size: 13px; }
#work-notice { color: var(--ink); }

/* ---------- action ---------- */

.action { border-top: 1px solid var(--rule); padding-top: 18px; margin-top: 4px; }
#message { margin: 0 0 14px; }
#message.error { color: var(--error); }
.k { max-width: 220px; }

button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
.primary {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  padding: 11px 22px;
  font-weight: var(--fw-medium);
  min-width: 180px;
}
.primary:disabled { background: transparent; color: var(--ink-soft); border-color: var(--ink-soft); }
.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 8px 14px;
}
.secondary:disabled { color: var(--ink-soft); border-color: var(--ink-soft); }
.small { padding: 4px 10px; font-size: 13px; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.question {
  border-left: 3px solid var(--c-mustard);
  padding: 2px 0 2px 16px;
}
.question .line { margin: 0 0 12px; }
.q-head { font-size: 17px; margin: 0 0 4px; }
.question input[type="text"] { font-family: var(--serif); font-size: 18px; margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.question input[type="number"] { max-width: 120px; }

.refusal p { margin: 0; font-size: 17px; }
.brick-rule { height: 1px; background: var(--c-brick); margin-top: 14px; }
/* the brick rule closes the action area on its own: no ink rule directly beneath it */
.action:has(.refusal:not([hidden])) + .record { border-top-color: transparent; margin-top: 8px; }

/* ---------- record ---------- */

.record { border-top: 1px solid var(--rule); margin-top: 22px; padding-top: 14px; }
.record-line {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

/* ---------- preview ---------- */

.preview-col { min-width: 0; display: flex; flex-direction: column; align-items: center; }
.frame { position: relative; overflow: hidden; outline: 1px solid var(--ink-soft); }
#preview { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#preview .sheet { background: #FFFFFF; }
.caption { margin: 10px 0 0; align-self: center; }

/* ---------- ledger and shelf ---------- */

.ledger, .shelf { margin-top: 36px; border-top: 1px solid var(--rule); padding-top: 14px; }
.ledger h2, .shelf h2 { font-size: 17px; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: var(--fw-medium); }
td.num, .nowrap { white-space: nowrap; }
td.soft { color: var(--ink-soft); }
.shelf ol { list-style: none; margin: 0; padding: 0; }
.shelf li { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.shelf li .record-line { min-width: 0; }

.foot {
  margin-top: 44px;
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
}
.foot p { margin: 0; }
.foot img { display: block; height: 28px; width: auto; }
/* the wordmark is plum on cream; on the dark ground it is set in light ink so it stays legible */
[data-theme="dark"] .foot img { filter: brightness(0) invert(0.92); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .foot img { filter: brightness(0) invert(0.92); }
}

/* ---------- sheets (preview and print share these) ---------- */

#sheets { display: none; }

.sheet {
  width: var(--w);
  height: calc(var(--h) - 1mm);
  padding: var(--m);
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--band);
  color: #1A1A1A;
  font-family: var(--serif);
  break-after: page;
  page-break-after: always;
  position: relative;
}
.sheet:last-child { break-after: auto; page-break-after: auto; }
.sheet .work {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet .work img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sheet .text {
  font-size: var(--text-size);
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: center;
  max-width: 100%;
}
.sheet .band {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 4mm;
  font-size: 10pt;
  line-height: 1.1;
}
.sheet .no { color: #5B5B5B; font-variant-numeric: tabular-nums; justify-self: start; }
.sheet .ttl { font-style: italic; text-align: center; }
.sheet .sig { justify-self: end; width: 28mm; border-bottom: 0.3pt solid #1A1A1A; height: 1em; }

.sheet.colophon { grid-template-rows: minmax(0, 1fr); }
.sheet .colo {
  font-size: var(--colo-size);
  line-height: 1.4;
  width: 100%;
  max-width: 120mm;
  text-align: left;
}
.colo p { margin: 0 0 0.9em; }
.colo-head { font-size: 1.5em; }
.colo-title { font-style: italic; }
.colo dl { display: grid; grid-template-columns: auto 1fr; gap: 0.15em 1.2em; margin: 0 0 1.1em; }
.colo dt { color: #5B5B5B; }
.colo dd { margin: 0; font-variant-numeric: tabular-nums; }
.colo-record { overflow-wrap: anywhere; }
.colo-imprint { color: #5B5B5B; font-style: italic; margin: 0; }

[hidden] { display: none !important; }

@media print {
  html, body { background: #FFFFFF !important; color: #1A1A1A !important; margin: 0; padding: 0; }
  body > *:not(#sheets) { display: none !important; }
  #sheets { display: block; }
  .sheet { background: none; }
}
