/* ============================================================
   proof.css - the proofreader's query system. PROOF MODE ONLY.
   Coloured pencil, written ON TOP of the printed page, never part
   of it. Blue in handbill and night; press writes in magenta,
   because press exists to have no blue on it and a blue mark on
   a page with no blue in it is the first thing the eye finds.
   Every rule here takes --proof, so the pencil is a token and
   the direction chooses it (themes.css).
   The hand face is a system stack (zero bytes) and never
   appears on the shipped site: with PROOF_MODE false none of
   these classes are ever injected.
   Every mark is anchored on the paper, not on the photograph;
   annotations belong in the margins of the sheet.
   ============================================================ */

/* Sections become positioning contexts for margin notes. */
body.proof .section,
body.proof .footer {
  position: relative;
}

/* The wavy pencil underline on the words a query is about. */
.q-anchor {
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: var(--proof);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-skip-ink: none;
}

/* A pencil box around block anchors (the photo plates). */
.q-anchor-box {
  outline: 2px dashed var(--proof);
  outline-offset: 6px;
}

/* The superscript query number at the anchor: Q1, Q2 ... */
.q-chip {
  display: inline-block; /* keeps the anchor's wavy line off the chip */
  font-family: var(--font-hand);
  font-size: 0.72em;
  font-weight: 700;
  color: var(--proof);
  vertical-align: super;
  margin-left: 4px;
  white-space: nowrap;
  line-height: 1;
}

/* The marginal note itself. Slight rotation set per note by JS
   so the hand looks placed, not templated. */
.q-note {
  font-family: var(--font-hand);
  color: var(--proof);
  font-size: 16.5px;
  line-height: 1.4;
  text-align: left;
  max-width: 560px;
  margin: 14px 4px 4px 18px;
  transform: rotate(var(--rot, -1.4deg));
}

.q-note__num {
  font-weight: 700;
  margin-right: 6px;
}

/* A TK slot: where an unconfirmed fact will go once Wes confirms
   it. Printer's convention: TK, to come. */
.q-slot {
  display: inline-block;
  font-family: var(--font-hand);
  font-size: 15.5px;
  color: var(--proof);
  background: var(--proof-soft);
  border: 1px dashed var(--proof);
  border-radius: 3px;
  padding: 1px 9px 2px;
  transform: rotate(-0.8deg);
}

/* Wide screens: notes move into the actual right margin of the
   sheet. JS sets each note's top to sit beside its anchor. */
@media (min-width: 1240px) {
  body.proof-margins .q-note {
    position: absolute;
    left: calc(50% + 368px);
    width: 238px;
    margin: 0;
  }
}

/* ---------- The query index at the foot of the proof ---------- */

.query-index {
  margin-top: 84px;
  border-top: 2px dashed var(--proof);
  padding: 38px 20px 80px;
}

.query-index__inner {
  max-width: 680px;
  margin: 0 auto;
}

.query-index .kicker {
  color: var(--proof);
  font-family: var(--font-hand);
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 15px;
}

.query-index h2 {
  font-family: var(--font-hand);
  font-weight: 700;
  color: var(--proof);
  font-size: 26px;
  margin-top: 8px;
}

.query-index__intro {
  font-family: var(--font-hand);
  color: var(--proof);
  font-size: 16.5px;
  margin-top: 12px;
}

.qi-list {
  list-style: none;
  margin-top: 10px;
}

.qi-item {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 4px 8px;
  margin-top: 24px;
}

.qi-num {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 20px;
  color: var(--proof);
}

.qi-text {
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1.45;
  color: var(--proof);
}

/* Ruled lines to write an answer on, screen and paper. */
.qi-answer {
  grid-column: 2;
  margin-top: 6px;
}

.qi-line {
  height: 32px;
  border-bottom: 1px solid color-mix(in srgb, var(--proof) 45%, transparent);
}

.query-index__closer {
  margin-top: 40px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 19px;
  color: var(--proof);
}

/* ---------- Print: he can print it and scribble on it ---------- */

@media print {
  body.proof-margins .q-note {
    position: static;
    width: auto;
    margin: 10px 0 4px 18px;
  }
  .query-index {
    break-before: page;
    border-top: none;
    padding-top: 10px;
  }
  .qi-item {
    break-inside: avoid;
  }
  .qi-line {
    border-bottom-color: var(--proof);
  }
  .hero { min-height: 0; }
}

/* ---------- Hiding the notes ----------
   The notes are apparatus. This lets Wes read the page as a customer
   would and then bring the questions back to answer them.

   display:none rather than opacity or visibility, so the notes leave
   the accessibility tree as well as the screen. Hidden should mean
   hidden for someone using a screen reader too, not just invisible. */
body.notes-off .q-note,
body.notes-off .query-index {
  display: none;
}

/* Everything else the apparatus draws goes too. Hiding only the
   marginal notes left the page covered in blue: the wavy pencil
   underlines, the superscript Q numbers, the dashed boxes round the
   plates. Those are all the same annotation and they hide together. */
body.notes-off .q-chip {
  display: none;
}

body.notes-off .q-anchor {
  text-decoration: none;
}

body.notes-off .q-anchor-box,
body.notes-off [data-q-box] {
  outline: none;
  box-shadow: none;
}

/* The TK slots stay, because they are not annotation: they mark a
   real hole in the copy where a fact will go. But they drop the
   pencil colour and read as a quiet placeholder instead of a note. */
body.notes-off .q-slot {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--bark);
  transform: none;
}

/* The control has two sizes, because it has two jobs.

   With the notes showing it is a real control on a marked-up page and
   it says so at full size. With the notes hidden the page IS the site,
   the way Wes and his customers see it, and a lit pill sitting on the
   photograph is the loudest thing in the first screen. So it shrinks to
   a quiet tab: smaller type, thinner padding, held back to a third
   opacity, no fill of its own. It still says "notes" rather than going
   to an icon, because Wes has to be able to find it without being told
   what a glyph means, and the full label stays on aria-label either
   way. Hover, focus and touch bring it back to full strength. */
.notes-toggle {
  position: fixed;
  left: 12px;
  bottom: calc(64px + 12px);   /* the call bar, and air. See sections.css. */
  z-index: 45;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1;
  padding: 10px 14px;
  color: var(--proof);
  background: var(--paper);
  border: 1px solid var(--proof);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 140ms ease, background-color 140ms ease;
}

.notes-toggle--quiet {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 9px;
  opacity: 0.34;
  background: transparent;
  border-color: currentColor;
}

.notes-toggle--quiet:hover,
.notes-toggle--quiet:focus-visible {
  opacity: 1;
  background: var(--paper);
  border-color: var(--proof);
}

.notes-toggle:hover { opacity: 1; }

.notes-toggle:focus-visible {
  outline: 2px solid var(--proof);
  outline-offset: 2px;
}

.notes-toggle:active { transform: scale(0.98); }

/* On a wide screen the pinned bar is gone, so the control can sit
   lower without anything to clear. */
@media (min-width: 900px) {
  .notes-toggle { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .notes-toggle:active { transform: none; }
  .notes-toggle { transition: none; }
}
