/* ==========================================================================
   proof.css — component styles for the proof blocks.
   Clinical register: ink on ivory, ruled hairlines, mono metadata.

   Introduces NO new colour values and NO new typefaces. Every custom property
   below resolves against tokens that already exist on the page; the literal
   fallbacks are copies of those same token values, present only because the
   site uses two naming conventions (--hairline/--line, --font-mono/--mono)
   depending on which page the block is embedded in.
   ========================================================================== */

/* --- dark-mode guard -----------------------------------------------------
   Every page carrying a proof block is light-only. Declared here AND inline
   on each host page's :root, because this has silently regressed before. */
:root { color-scheme: only light; }
@media (prefers-color-scheme: dark) {
  :root { color-scheme: only light; }
  html, body { background: #F8F3E8; color: #26190F; }
}

.proof {
  --p-mono:     var(--font-mono, var(--mono, 'IBM Plex Mono', ui-monospace, monospace));
  --p-body:     var(--font-body, var(--body, 'Instrument Sans', Arial, sans-serif));
  --p-serif:    var(--font-serif, var(--serif, 'Young Serif', Georgia, serif));
  --p-ink:      var(--ink, #26190F);
  --p-ink-soft: var(--ink-soft, #4A3B2E);
  --p-ivory:    var(--ivory, #F8F3E8);
  --p-paper:    var(--paper, #FDFAF2);
  --p-hairline: var(--hairline, var(--line, rgba(38, 25, 15, 0.16)));
  --p-marigold: var(--marigold, #E3AB36);
  --p-red:      var(--red, #A8352C);
}

/* A block that has not been populated must occupy no space at all. Blocks
   ship with the `hidden` attribute and proof.js removes it only after a
   successful render, so a JS or fetch failure leaves nothing behind. */
.proof[hidden] { display: none !important; }

.proof {
  border-top: 1px solid var(--p-ink);
  padding: 32px 0 40px;
  color: var(--p-ink);
}
/* Embedded in a host page that supplies its own section rhythm (the homepage
   .sec padding), so the block must not add a second frame of its own. */
.proof--bare { border-top: none; padding: 0; }

.proof-eyebrow {
  font-family: var(--p-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p-red);
  margin-bottom: 14px;
}
.proof-h {
  font-family: var(--p-serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  margin: 0 0 10px;
}
/* the single marigold accent permitted per block */
.proof-accent {
  width: 48px;
  height: 2px;
  background: var(--p-marigold);
  margin: 0 0 16px;
}
.proof-standfirst {
  font-family: var(--p-body);
  font-size: 16px;
  line-height: 1.6;
  max-width: 62ch;
  margin: 0 0 26px;
  color: var(--p-ink-soft);
}
.proof-more {
  display: inline-block;
  margin-top: 22px;
  font-family: var(--p-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p-ink);
  border-bottom: 1px solid var(--p-ink);
  padding-bottom: 2px;
}

/* ==========================================================================
   Block 1 — Work record
   ========================================================================== */
.pw-list { display: grid; gap: 34px; }

.pw-rec {
  border: 1px solid var(--p-hairline);
  background: var(--p-paper);
  padding: 0;
}
/* failure records are identical in size and position; only the outcome
   token and a left rule mark them. */
.pw-rec[data-outcome="fail"],
.pw-rec[data-outcome="partial"] { border-left: 2px solid var(--p-red); }

.pw-id {
  font-family: var(--p-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--p-hairline);
}
/* minmax(0,…) rather than plain 1fr: the pending cell's text has a min-content
   width that would otherwise steal space from the day-0 image, and the two
   halves must stay exactly equal for the comparison to mean anything. */
.pw-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.pw-pair.is-single { grid-template-columns: 1fr; }
.pw-fig { margin: 0; min-width: 0; }
.pw-fig + .pw-fig { border-left: 1px solid var(--p-hairline); }
.pw-fig img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--p-ivory);
  cursor: zoom-in;
}
.pw-cap {
  font-family: var(--p-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  padding: 8px 10px;
  border-top: 1px solid var(--p-hairline);
}
/* the pending half of a pair: a ruled void, never a skeleton or placeholder */
.pw-pending {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  font-family: var(--p-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  border-left: 1px solid var(--p-hairline);
}
.pw-caption {
  font-family: var(--p-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1.6;
  padding: 12px;
  border-top: 1px solid var(--p-ink);
}
.pw-outcome-fail,
.pw-outcome-partial { color: var(--p-red); }
.pw-note {
  font-family: var(--p-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--p-ink-soft);
  padding: 0 12px 14px;
  max-width: 62ch;
}

/* ==========================================================================
   Block 2 — Cycle log
   ========================================================================== */
.pc-lastlogged {
  font-family: var(--p-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  margin-bottom: 12px;
}
.pc-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--p-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
}
.pc-table th {
  text-align: left;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--p-ink-soft);
  padding: 8px 6px;
  border-bottom: 1px solid var(--p-ink);
  white-space: nowrap;
}
.pc-table td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--p-hairline);
  vertical-align: middle;
  white-space: nowrap;
}
.pc-row { cursor: zoom-in; }
.pc-row:hover td { background: var(--p-ivory); }
.pc-row:focus-visible { outline: 2px solid var(--p-red); outline-offset: -2px; }
.pc-spore {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 1px 5px;
  border: 1px solid var(--p-ink);
  margin-left: 6px;
}
.pc-fail { color: var(--p-red); }
.pc-view {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  border-bottom: 1px solid var(--p-hairline);
}

/* ==========================================================================
   Block 3 — Assessment case
   ========================================================================== */
.pa-case { border-left: 1px solid var(--p-ink); padding-left: 20px; }
.pa-stage { position: relative; padding: 0 0 34px; }
.pa-stage::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 7px;
  width: 9px;
  height: 1px;
  background: var(--p-ink);
}
.pa-stamp {
  font-family: var(--p-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  margin-bottom: 10px;
}
.pa-reads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--p-hairline);
  margin-bottom: 16px;
}
.pa-read { padding: 12px; min-width: 0; }
.pa-read + .pa-read { border-left: 1px solid var(--p-hairline); }
.pa-read-label {
  font-family: var(--p-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  margin-bottom: 6px;
}
.pa-read-body { font-family: var(--p-body); font-size: 14px; line-height: 1.6; }
.pa-imgs { display: grid; gap: 14px; margin-bottom: 16px; }
.pa-fig { margin: 0; border: 1px solid var(--p-hairline); }
.pa-fig img { width: 100%; display: block; cursor: zoom-in; background: var(--p-ivory); }
.pa-plan { margin: 4px 0 16px; padding-left: 20px; }
.pa-plan li {
  font-family: var(--p-mono);
  font-size: 12px;
  line-height: 1.75;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.pa-outcome {
  font-family: var(--p-body);
  font-size: 15px;
  line-height: 1.65;
  max-width: 62ch;
}

/* ==========================================================================
   Block 4 — Client record
   ========================================================================== */
.pr-head {
  font-family: var(--p-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--p-ink);
  margin-bottom: 4px;
}
.pr-card { border-bottom: 1px solid var(--p-hairline); padding: 16px 0; }
.pr-meta {
  font-family: var(--p-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--p-ink-soft);
  margin-bottom: 8px;
}
.pr-text {
  font-family: var(--p-body);
  font-size: 15px;
  line-height: 1.65;
  max-width: 62ch;
}

/* ==========================================================================
   Enlarge overlay (self-contained, no library)
   ========================================================================== */
.proof-lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--ink, #26190F);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.proof-lb[hidden] { display: none !important; }
.proof-lb img { max-width: 100%; max-height: 82vh; object-fit: contain; }
.proof-lb-cap {
  font-family: var(--font-mono, var(--mono, 'IBM Plex Mono', ui-monospace, monospace));
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ivory, #F8F3E8);
  margin-top: 14px;
  text-align: center;
}

/* ==========================================================================
   Wider viewports
   ========================================================================== */
@media (min-width: 768px) {
  .proof-h { font-size: 32px; }
  .proof-standfirst { font-size: 17px; }
  .pw-list { gap: 44px; }
  .pc-table { font-size: 12px; }
  .pc-table th { font-size: 10px; }
  .pa-imgs { grid-template-columns: repeat(3, 1fr); }
}

/* The homepage excerpt reads as a strip of three records rather than three
   full-width ones. Stacks back to one column below this. */
@media (min-width: 900px) {
  .proof--excerpt .pw-list { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}

/* 390px and below: the day-0/day-21 pair stays side by side — the comparison
   is the point of the block — so type tightens instead of the grid breaking. */
@media (max-width: 420px) {
  .pw-id { font-size: 9.5px; letter-spacing: 0.06em; }
  .pw-cap { font-size: 9px; letter-spacing: 0.05em; padding: 7px 8px; }
  .pw-caption { font-size: 10px; letter-spacing: 0.05em; padding: 10px; }
  .pc-table { font-size: 10px; letter-spacing: 0.01em; }
  .pc-table th { font-size: 8.5px; letter-spacing: 0.08em; padding: 7px 3px; }
  .pc-table td { padding: 8px 3px; }
  .pc-spore { font-size: 8px; letter-spacing: 0.08em; margin-left: 4px; padding: 1px 3px; }
  .pa-reads { grid-template-columns: 1fr; }
  .pa-read + .pa-read { border-left: none; border-top: 1px solid var(--p-hairline); }
}
