/* Second Reading: the galley proof. Tokens come from tokens.css. */

:root {
  --plum: var(--c-earth);
  --rule: var(--ink-soft);
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --pfs: 20px; /* passage size, fitted by app.js */
}
[data-theme="dark"] { --plum: color-mix(in srgb, var(--c-earth) 30%, var(--ink)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --plum: color-mix(in srgb, var(--c-earth) 30%, var(--ink)); }
}

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

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

.column { max-width: 44rem; margin: 0 auto; padding: 0 16px; }
main.column { padding-top: 2rem; }
[hidden] { display: none !important; }

/* ---- the slip ---- */
.slip {
  border-top: 3px double var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: .55rem 0 .6rem;
  color: var(--plum);
}
.slip p { margin: 0; }
.slip-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.slip-state { font-weight: var(--fw-bold); letter-spacing: .14em; }
.slip-code { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.slip-copy, .slip-note { font-size: .9rem; margin-top: .2rem !important; }
.slip-copy { color: var(--ink); }

/* ---- the galley ---- */
.galley { overflow-x: auto; margin: 1.6rem 0 0; }
.proof {
  list-style: none;
  margin: 0;
  padding: 0;
  width: max-content;
  min-width: 100%;
  font-family: var(--serif);
  font-size: var(--pfs);
  line-height: 1.9;
}
.ln {
  display: grid;
  grid-template-columns: 2.25rem 1fr 2.5rem;
  align-items: baseline;
  min-height: 1.9em;
}
.no {
  font-family: var(--font-body);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  text-align: right;
  padding-right: .8rem;
  user-select: none;
}
.tx { white-space: pre; }
.mg { white-space: nowrap; padding-left: 2px; line-height: 1; }
.mg i { display: inline-block; width: 1px; height: 1em; margin-right: 1px; background: var(--error); vertical-align: -0.15em; }

.w {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  line-height: inherit;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.w:focus { outline: none; }
.w:focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 1px; }
.w[aria-pressed="true"] {
  text-decoration: underline 1.5px var(--error);
  text-underline-offset: .2em;
}
/* the caret: a proofreader's mark under the word, outside the flow */
.w[aria-pressed="true"]::after, .gap::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: .36em;
  height: .36em;
  margin-top: -.16em;
  border-left: 1.5px solid var(--error);
  border-top: 1.5px solid var(--error);
  transform: translateX(-50%) rotate(45deg);
  pointer-events: none;
}
.proof[data-locked] .w { cursor: default; }

/* ---- controls ---- */
.act {
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  padding: .45rem .9rem;
  cursor: pointer;
}
.act:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.act:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.act.quiet { border-color: transparent; padding-left: 0; padding-right: 0; text-decoration: underline 1px var(--rule); text-underline-offset: .25em; }
.act.quiet:hover { background: none; color: var(--plum); }
.hand { margin: 1.4rem 0 0; }
.desk {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1.6rem;
  margin-top: 3rem;
  padding-top: .5rem;
  border-top: 1px solid var(--rule);
}
.panel { display: grid; gap: .35rem; margin-top: 1rem; }
.panel label { font-size: .85rem; color: var(--ink-soft); }
.panel .row { display: flex; gap: .5rem; flex-wrap: wrap; }
.panel input, .panel textarea {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  padding: .4rem .5rem;
  min-width: 0;
}
.panel input { font-variant-numeric: tabular-nums; flex: 1 1 12rem; max-width: 16rem; }
.panel textarea { width: 100%; font-family: var(--serif); line-height: 1.5; resize: vertical; }
.small { font-size: .82rem; color: var(--ink-soft); margin: 0; }
.msg { min-height: 1.5em; font-size: .9rem; color: var(--error); margin: .8rem 0 0; }

/* ---- the returned sheet ---- */
.sheet { margin-top: 1.4rem; }
.sheet h2 {
  font-size: .78rem;
  font-weight: var(--fw-medium);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--plum);
  margin: 2rem 0 .4rem;
}
.sheet table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.sheet th, .sheet td { text-align: left; font-weight: 400; padding: .2rem 0; vertical-align: baseline; }
.totals { table-layout: fixed; }
.totals th { overflow: hidden; white-space: nowrap; }
.totals th::after { content: " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ."; color: var(--ink-soft); }
.totals td { white-space: nowrap; padding-left: .6rem; text-align: right; width: 7.5rem; }
@media (max-width: 30rem) {
  .totals th { white-space: normal; }
  .totals th::after { content: none; }
}
.kinds { font-size: .9rem; }
.kinds thead th { color: var(--ink-soft); font-size: .78rem; border-bottom: 1px solid var(--rule); }
.kinds td, .kinds thead th + th { text-align: right; padding-left: .6rem; white-space: nowrap; }
.kinds tbody tr + tr td, .kinds tbody tr + tr th { border-top: 1px solid color-mix(in srgb, var(--rule) 30%, transparent); }
.kinds .none { color: var(--ink-soft); }
.note { font-size: .88rem; margin: .6rem 0 0; }
.sheet .act { margin-top: .8rem; }
.ruled { font-size: .9rem; margin: 2rem 0 .4rem; }
.rules { font-size: .9rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: .4rem 0; }
.rules summary { cursor: pointer; color: var(--plum); }
.rules ol { padding-left: 1.4rem; }
.rules li { margin: .3rem 0; }

/* the caption: the same words, size and place on every sheet */
.caption {
  font-size: .95rem;
  font-weight: var(--fw-thin);
  letter-spacing: .02em;
  color: var(--plum);
  border-top: 1px solid var(--rule);
  padding-top: .35rem;
  margin: 2.2rem 0 .3rem;
}
.left, .nothing { list-style: none; margin: 0; padding: 0; }
.left li, .nothing li { padding: .45rem 0; display: grid; gap: .1rem; }
.where { font-size: .82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.q { display: block; font-family: var(--serif); font-size: var(--pfs); line-height: 1.9; white-space: pre; overflow-x: auto; }
.err { text-decoration: underline 1.5px var(--error); text-underline-offset: .2em; }
.gap { display: inline-block; position: relative; width: .9em; height: 1em; vertical-align: baseline; }
.gap::after { top: 1.15em; }
.kind { font-size: .78rem; color: var(--ink-soft); }
.nothing-head { font-size: .95rem; font-weight: 400; color: var(--ink-soft); margin: 1.6rem 0 .2rem; }

.imprint { font-size: .85rem; color: var(--ink-soft); margin: 2.4rem 0 0; }

/* ---- footer ---- */
.foot { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.foot img { display: block; max-width: 100%; height: auto; }
.foot .small { margin-top: .6rem; }
.kinds td + th { padding-left: 1.2rem; }
