/* ============================================================
   Your Receipt — styles
   A receipt is a thing you read once. Make it legible.

   Type sizes here are deliberately larger than a typical UI: the
   whole point of the page is that somebody reads every line of it.
   ============================================================ */

:root {
  --bg:        #0b0d10;
  --bg-soft:   #12151a;
  --paper:     #f7f4ec;
  --paper-2:   #efeade;
  --ink:       #1c1a16;
  --ink-soft:  #55503f;
  --ink-faint: #6b6558;
  --rule:      #d5cdb9;
  --accent:    #b4552d;
  --hi:        #a12d20;
  --mid:       #8a5d15;
  --lo:        #35603c;
  --info:      #35597a;

  /* the dark surround around the receipt */
  --chrome:        #d3dae2;
  --chrome-strong: #f4f7fa;
  --chrome-soft:   #b7c3d1;
  --chrome-faint:  #8b98a8;
  --chrome-line:   #33404f;
  --chrome-btn:    #1b222c;
  --chrome-btn-hi: #232c38;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
}

/* True inversion. The whole receipt flips, and so does the surround.

   The camouflaged text on this page is painted in a FIXED colour — the
   colour of the surface it hides on — so when that surface flips, the
   text becomes visible. That is the whole trick, and the button proves
   it rather than describing it. */
body.inverted {
  --bg:        #f1eee4;
  --bg-soft:   #e5e1d3;
  --paper:     #14181d;
  --paper-2:   #1e242b;
  --ink:       #e9eef4;
  --ink-soft:  #aab5c3;
  --ink-faint: #8b98a8;
  --rule:      #39424d;
  --accent:    #e08a5f;

  --hi:        #e8705f;
  --mid:       #d9a441;
  --lo:        #6fae7c;
  --info:      #6fa8d6;

  --chrome:        #1d242c;
  --chrome-strong: #0d1116;
  --chrome-soft:   #414c58;
  --chrome-faint:  #5c6874;
  --chrome-line:   #c2c9d0;
  --chrome-btn:    #e2e6ea;
  --chrome-btn-hi: #f2f4f6;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 20px 96px;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-soft) 0%, transparent 60%),
    var(--bg);
  color: var(--chrome);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 900px; margin: 0 auto; }

/* ---------- hero ---------- */

.hero { padding: 76px 0 44px; text-align: center; }

.kicker {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--chrome-faint);
}

.hero h1 {
  margin: 0 0 22px;
  font-size: clamp(40px, 8vw, 66px);
  line-height: 1.04;
  letter-spacing: -.03em;
  font-weight: 700;
  color: var(--chrome-strong);
}

.lede {
  max-width: 62ch;
  margin: 0 auto 16px;
  font-size: 19px;
  color: var(--chrome-soft);
}

.lede em { color: var(--chrome-strong); font-style: italic; }
.lede strong { color: var(--chrome-strong); font-weight: 600; }
.lede.sub { font-size: 17px; color: var(--chrome-faint); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 30px;
}

/* ---------- camouflaged text ----------
   Painted in the exact colour of the surface underneath it. Invisible to
   a human eye, entirely present in the document — so every screen reader,
   scraper and agent that reads this page has already read it. */
.camouflage {
  color: #0b0d10;
  margin: 22px auto 0;
  max-width: 62ch;
  font-size: 16px;
  line-height: 1.6;
  text-align: left;
}
.camouflage.paper { color: #f7f4ec; }
body.inverted .camouflage {
  padding: 14px 16px;
  border: 1px dashed currentColor;
  border-radius: 5px;
  margin-top: 26px;
}
body.inverted .camouflage.paper { background: var(--paper-2); }

/* ---------- buttons ---------- */

.btn {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: .03em;
  padding: 11px 17px;
  border-radius: 6px;
  border: 1px solid var(--chrome-line);
  background: var(--chrome-btn);
  color: var(--chrome-strong);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { background: var(--chrome-btn-hi); border-color: var(--chrome-faint); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid #6aa9ff; outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--chrome-soft); }
.btn.ghost:hover { background: var(--chrome-btn); color: var(--chrome-strong); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[aria-pressed="true"] { background: var(--chrome-btn); color: var(--chrome-strong); border-color: var(--chrome-strong); }

/* Buttons inside the receipt sit on the paper, not on the dark surround,
   so they have to use the paper palette. The surround colours — a pale
   blue-grey on cream — are unreadable here. */
.receipt .btn {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.receipt .btn:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.receipt .btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.receipt .btn.ghost:hover { background: var(--paper-2); border-color: var(--ink); }
.receipt .btn:focus-visible { outline: 2px solid var(--accent); }

/* ---------- receipt card ---------- */

.receipt {
  background: var(--paper);
  color: var(--ink);
  border-radius: 4px;
  padding: 44px 48px 34px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.35) inset,
    0 30px 70px -20px rgba(0,0,0,.75),
    0 4px 14px rgba(0,0,0,.4);
  position: relative;
  overflow: hidden;
}
/* torn/perforated top edge */
.receipt::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--paper) 0 9px, transparent 9px 18px);
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.08));
}

.r-head {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: .05em;
  color: var(--ink-soft);
  margin-bottom: 28px;
}
.r-head-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--rule);
}
.r-head-row.total {
  border-bottom: 0;
  margin-top: 8px;
  padding-top: 11px;
  border-top: 2px solid var(--ink);
  color: var(--ink);
  font-weight: 700;
}
.r-head-row span:last-child { text-align: right; word-break: break-all; }

/* ---------- verdict ---------- */

.verdict {
  font-family: var(--mono);
  font-size: 15px;
  background: var(--paper-2);
  border-left: 4px solid var(--accent);
  padding: 18px 20px;
  margin: 0 0 30px;
}
.verdict-main { margin: 0; font-weight: 700; letter-spacing: .005em; line-height: 1.5; }
.verdict-sub { margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.verdict-sub b { color: var(--ink); }

/* ---------- sections ---------- */

.sect { border-top: 1px solid var(--rule); }
.sect:last-of-type { border-bottom: 1px solid var(--rule); }

.sect > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 20px 0;
  font-family: var(--mono);
  font-size: 16.5px;
  user-select: none;
}
.sect > summary::-webkit-details-marker { display: none; }
.sect > summary:hover .sect-t { color: var(--accent); }
.sect > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sect-n { color: var(--ink-faint); font-size: 13.5px; }
.sect-t { flex: 1; font-weight: 700; letter-spacing: .005em; }
.sect-t em { font-style: italic; }

.sect-badge {
  font-size: 12px;
  letter-spacing: .08em;
  padding: 4px 9px;
  border-radius: 3px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.sect-body { padding: 0 0 28px; }

.sect-note {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 18px;
  max-width: 70ch;
}
.sect-note strong { color: var(--ink); }

.mini-h {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 30px 0 12px;
  font-weight: 700;
}

/* ---------- findings ---------- */

.findings { font-family: var(--mono); font-size: 14.5px; }

.finding {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 2fr auto;
  gap: 6px 18px;
  padding: 11px 0;
  border-bottom: 1px dotted var(--rule);
  align-items: baseline;
}
.finding:last-child { border-bottom: 0; }

.f-label { color: var(--ink-faint); font-size: 13px; letter-spacing: .015em; }
.f-value { color: var(--ink); word-break: break-word; line-height: 1.55; }
.f-value.muted { color: var(--ink-faint); font-style: italic; }
.f-value .u { color: var(--ink-faint); font-size: 12.5px; }

.risk {
  font-size: 11px;
  letter-spacing: .09em;
  padding: 3px 7px;
  border-radius: 3px;
  white-space: nowrap;
  font-weight: 700;
}
.risk-high { background: var(--hi); color: #fff; }
.risk-mid  { background: var(--mid); color: #fff; }
.risk-low  { background: var(--lo); color: #fff; }
.risk-info { background: var(--info); color: #fff; }
body.inverted .risk { color: #10141a; }

/* ---------- panels ---------- */

.panel {
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 20px;
  margin: 0 0 20px;
  background: var(--paper-2);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.panel-head h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 14.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.panel-note {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 68ch;
}
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.panel .findings { margin-top: 16px; }

/* ---------- defences ---------- */

.defences { display: grid; gap: 12px; }

.defence {
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 16px 18px;
  background: var(--paper-2);
}
.defence h4 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 14.5px;
  letter-spacing: .03em;
}
.defence p { margin: 0 0 8px; font-size: 15px; line-height: 1.6; color: var(--ink-soft); max-width: 70ch; }
.defence a {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.defence a:hover { color: var(--hi); }

/* ---------- verify list ---------- */

.verify {
  font-size: 15px;
  color: var(--ink-soft);
  padding-left: 22px;
  line-height: 1.75;
}
.verify code, .mini-h + code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--paper-2);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--rule);
}
.verify b { color: var(--ink); }

/* ---------- footers ---------- */

.r-foot {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: center;
}
.r-foot p { margin: 0; }

.site-foot {
  margin-top: 44px;
  text-align: center;
  font-size: 15px;
  line-height: 1.65;
  color: var(--chrome-faint);
}
.site-foot a { color: var(--chrome-soft); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #e8edf3;
  color: #12171d;
  font-family: var(--mono);
  font-size: 14px;
  padding: 11px 19px;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ---------- reveal (clipboard, kept text) ---------- */

.reveal-value {
  background: var(--hi);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  word-break: break-all;
}
.reveal-countdown {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--hi);
}

/* ---------- the sticky field ---------- */

.sticky-field {
  width: 100%;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px 16px;
  resize: vertical;
  min-height: 120px;
}
.sticky-field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.kept-box {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  border: 1px dashed var(--hi);
  border-radius: 4px;
  padding: 12px 14px;
  margin-top: 12px;
  word-break: break-word;
  white-space: pre-wrap;
}
.kept-reveal {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hi);
  border-radius: 4px;
  padding: 12px 14px;
  margin-top: 12px;
  word-break: break-word;
  white-space: pre-wrap;
}
.wire-preview {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px 16px;
  margin-top: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}
.warn {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--hi);
  margin: 12px 0 0;
}

/* ---------- responsive ---------- */

@media (max-width: 620px) {
  body { padding: 0 12px 64px; }
  .receipt { padding: 30px 20px 24px; }
  .finding { grid-template-columns: 1fr auto; }
  .f-label { grid-column: 1 / -1; }
  .f-value { grid-column: 1; }
  .risk { grid-column: 2; grid-row: 2; }
}

/* ---------- print ---------- */

@media print {
  body {
    background: #fff; padding: 0; color: #000;
    /* always print the light-paper palette, whichever theme is on screen */
    --paper: #fff; --paper-2: #fff; --ink: #000; --ink-soft: #333;
    --ink-faint: #444; --rule: #bbb; --accent: #b4552d;
    --hi: #a12d20; --mid: #8a5d15; --lo: #355c3c; --info: #35597a;
  }
  .hero { padding: 0 0 18px; }
  .hero h1 { color: #000; font-size: 30px; }
  .lede, .lede.sub { color: #333; font-size: 12px; }
  .hero-actions, .site-foot, .toast { display: none !important; }
  .camouflage { display: none; }
  .receipt {
    box-shadow: none; border-radius: 0; padding: 0;
    background: #fff; color: #000; width: 100%; max-width: none;
  }
  .receipt::before { display: none; }
  .sect > summary { font-size: 12px; }
  .sect-body { display: block !important; }
  .finding, .panel, .defence { break-inside: avoid; }
  .panel, .defence { background: #fff; }
  /* Badges are white-on-colour, which vanishes on paper unless the printer
     is set to print backgrounds. Give them their colour as text instead. */
  .risk { background: none !important; border: 1px solid currentColor; padding: 1px 4px; }
  .risk-high { color: #a12d20 !important; }
  .risk-mid  { color: #8a5d15 !important; }
  .risk-low  { color: #355c3c !important; }
  .risk-info { color: #35597a !important; }
  .reveal-value { background: none !important; color: #000 !important; }
  .btn { display: none !important; }
  a { color: #000; }
}
