/* Layout concept: an evidence file. The receipt is the document of record; everything else is annotation pinned beside it. */
:root {
  --page: #ECE7DB;        /* evidence-folder manila */
  --ink: #16181D;         /* body text */
  --muted: #5B606B;       /* secondary text, hue-biased cool grey */
  --rule: #CDC5B3;        /* folder rules */
  --receipt: #FFFDF6;     /* thermal paper */
  --receipt-ink: #16181D;
  --receipt-faint: #6F7480;
  --hl: #FFE14A;          /* highlighter */
  --stamp: #D93A2B;       /* rubber-stamp red */
  --profit: #17845C;      /* mint, deepened for light paper */
  --chip: rgba(22, 24, 29, .06);
  --shadow: rgba(22, 24, 29, .18);
  --f-display: 'Anton', 'Impact', 'Arial Narrow', sans-serif;
  --f-body: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --f-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #11141B; --ink: #F1ECE1; --muted: #A3A9B4; --rule: #2B303B;
    --receipt: #F4EFE4; --receipt-ink: #11141B; --receipt-faint: #5E6470;
    --hl: #FFE14A; --stamp: #FF5A4A; --profit: #3FD69B;
    --chip: rgba(244, 239, 228, .07); --shadow: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #11141B; --ink: #F1ECE1; --muted: #A3A9B4; --rule: #2B303B;
  --receipt: #F4EFE4; --receipt-ink: #11141B; --receipt-faint: #5E6470;
  --hl: #FFE14A; --stamp: #FF5A4A; --profit: #3FD69B;
  --chip: rgba(244, 239, 228, .07); --shadow: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--stamp); outline-offset: 3px; }

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* masthead */
.mast { border-bottom: 1px solid var(--rule); }
.mast .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-block: 18px; flex-wrap: wrap; }
.wordmark { font-family: var(--f-display); font-size: 1.6rem; letter-spacing: .02em; text-decoration: none; line-height: 1; }
.mast nav { display: flex; gap: 22px; font-size: .95rem; }
.mast nav a { text-decoration: none; color: var(--muted); }
.mast nav a[aria-current="page"], .mast nav a:hover { color: var(--ink); }

/* type scale */
h1, h2, h3 { text-wrap: balance; margin: 0; }
.display { font-family: var(--f-display); font-weight: 400; line-height: .92; letter-spacing: .005em; }
h2.section { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1; }
.lede { font-family: var(--f-serif); font-style: italic; font-size: clamp(1.35rem, 2.4vw, 1.75rem); line-height: 1.25; color: var(--muted); margin: 0; }
.small { font-size: .9rem; color: var(--muted); }
p { margin: 0; }
.prose { max-width: 65ch; display: grid; gap: 1em; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-weight: 500; font-size: .95rem;
  padding: 11px 18px; border: 2px solid var(--ink); color: var(--ink); text-decoration: none;
  background: transparent;
}
.btn.primary { background: var(--ink); color: var(--page); }
.btn:hover { text-decoration: none; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--stamp); }

/* ---------- receipt ---------- */
.receipt {
  background: var(--receipt); color: var(--receipt-ink);
  font-family: var(--f-mono); font-size: .98rem; line-height: 1.55;
  padding: 26px 26px 40px;
  box-shadow: 10px 12px 0 var(--shadow);
  font-variant-numeric: tabular-nums;
  --zig: 12px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--zig)), 95% 100%, 90% calc(100% - var(--zig)), 85% 100%, 80% calc(100% - var(--zig)), 75% 100%, 70% calc(100% - var(--zig)), 65% 100%, 60% calc(100% - var(--zig)), 55% 100%, 50% calc(100% - var(--zig)), 45% 100%, 40% calc(100% - var(--zig)), 35% 100%, 30% calc(100% - var(--zig)), 25% 100%, 20% calc(100% - var(--zig)), 15% 100%, 10% calc(100% - var(--zig)), 5% 100%, 0 calc(100% - var(--zig)));
}
.receipt .head { text-align: center; font-weight: 700; letter-spacing: .16em; }
.receipt .sub { text-align: center; color: var(--receipt-faint); font-size: .82rem; margin-top: 2px; }
.receipt .cut { border-top: 2px dashed var(--receipt-faint); margin: 12px 0; opacity: .7; }
.receipt .sec { font-size: .74rem; letter-spacing: .16em; color: var(--receipt-faint); margin: 2px 0 2px; }
.receipt .line {
  display: flex; justify-content: space-between; gap: 12px; width: 100%;
  font: inherit; color: inherit; background: none; border: 0; text-align: left;
  padding: 3px 8px; margin: 0 -8px; width: calc(100% + 16px); cursor: pointer;
  text-decoration: none;
}
.receipt .line span:first-child { min-width: 0; overflow-wrap: anywhere; }
.receipt .line:hover, .receipt .line.on { background: var(--hl); }
.receipt .line.strong { font-weight: 700; }
.receipt .line.profit { position: relative; font-weight: 700; }
.receipt .line.total { font-weight: 700; font-size: 1.12rem; cursor: default; }
.receipt .line.total:hover { background: none; }
.receipt .circle { position: absolute; left: -14px; top: -10px; width: calc(100% + 28px); height: calc(100% + 20px); overflow: visible; pointer-events: none; }
.receipt .circle path { fill: none; stroke: var(--stamp); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .receipt .circle path { animation: draw 1.1s .5s cubic-bezier(.3,.7,.3,1) backwards; }
  @keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
}

/* exhibit letter tags pair a receipt line with its evidence */
.tag {
  display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; flex: none;
  font-family: var(--f-mono); font-size: .78rem; font-weight: 700;
  border: 1.5px solid currentColor; border-radius: 50%;
}

/* ---------- home ---------- */
.hero { padding-block: clamp(40px, 7vw, 88px) clamp(28px, 4vw, 48px); }
.hero .display { font-size: clamp(3.2rem, 9vw, 7.5rem); max-width: 14ch; line-height: 1; }
.hero .lede { margin-top: 18px; }
.hero p.intro { max-width: 58ch; margin-top: 22px; }

.cases { display: grid; gap: 18px; padding-block: 8px 56px; }
.case-stub {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto; gap: 20px; align-items: center;
  border-top: 1px solid var(--rule); padding-block: 22px;
  text-decoration: none;
}
.case-stub .no { font-family: var(--f-mono); color: var(--muted); font-size: .9rem; }
.case-stub h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1; }
.case-stub .find { color: var(--muted); margin-top: 6px; }
.case-stub .state { font-family: var(--f-mono); font-size: .85rem; white-space: nowrap; }
a.case-stub:hover h3 { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.case-stub.lab h3 { color: var(--muted); }
@media (max-width: 640px) {
  .case-stub { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

.band { border-top: 1px solid var(--rule); padding-block: 44px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
@media (max-width: 800px) { .two { grid-template-columns: minmax(0, 1fr); } }

/* ---------- case page ---------- */
.case-head { padding-block: clamp(32px, 5vw, 64px) 28px; display: grid; gap: 16px; }
.case-head .no { font-family: var(--f-mono); color: var(--muted); }
.case-head .display { font-size: clamp(3.2rem, 10vw, 8rem); }
.case-head .meta { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; margin-top: 6px; }

.file { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; padding-block: 12px 56px; }
.file .pin { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 20px); display: grid; gap: 14px; }
.file .pin .small { padding-left: 4px; }
@media (max-width: 860px) {
  .file { grid-template-columns: minmax(0, 1fr); }
  .file .pin { position: static; max-width: 440px; }
}

.evidence { display: grid; gap: 0; }
.ex { border-top: 1px solid var(--rule); padding-block: 26px; display: grid; gap: 12px; scroll-margin-top: 24px; }
.ex:first-child { border-top: 0; padding-top: 4px; }
.ex header { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.ex h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.85rem; line-height: 1; }
.ex .amt { font-family: var(--f-mono); font-weight: 700; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.ex.on h3 { background: linear-gradient(transparent 55%, var(--hl) 55%); color: var(--ink); }
.ex .math { font-family: var(--f-mono); font-size: .93rem; background: var(--chip); padding: 12px 14px; overflow-x: auto; }
.src { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.src li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; font-size: .97rem; }
.src .when { color: var(--muted); font-size: .88rem; grid-column: 1; }
.grade { font-family: var(--f-mono); font-size: .78rem; padding: 2px 8px; border: 1.5px solid currentColor; align-self: start; grid-row: 1 / span 2; grid-column: 2; white-space: nowrap; }
.grade.strong { color: var(--profit); }
.grade.medium { color: var(--muted); }
.grade.weak, .grade.derived { color: var(--stamp); }

.findings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.findings .ex { border-top: 1px solid var(--rule); }
@media (max-width: 800px) { .findings { grid-template-columns: minmax(0, 1fr); } }

.mini { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .93rem; display: grid; gap: 2px; max-width: 30rem; }
.mini div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dotted var(--rule); padding-block: 3px; }
.mini div:last-child { border-bottom: 0; font-weight: 700; }

.copyrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.copyrow code { font-family: var(--f-mono); background: var(--chip); padding: 6px 10px; user-select: all; }
.copyrow button { font: inherit; font-family: var(--f-mono); font-size: .85rem; padding: 6px 12px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }

.foot { border-top: 1px solid var(--rule); }
.foot .wrap { padding-block: 28px 40px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .9rem; }
.case-stub.lab:hover h3 { text-decoration: none; }
