/* When Text Lies, Patches Don't — project page
   Palette taken from the paper figures:
   blue  = J-List / visual evidence, orange = decoding state h_m, red = hallucinated. */

:root {
  --paper: #f8f6f1;
  --card: #fffdf9;
  --ink: #23211e;
  --ink-soft: #57524a;
  --ink-faint: #8c8579;
  --rule: #d9d3c7;
  --blue: #0b4f7c;
  --blue-soft: #1f78b4;
  --orange: #8a4a00;
  --orange-soft: #e08214;
  --red: #8b0f1f;
  --red-soft: #c8102e;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Courier Prime", "Courier New", ui-monospace, monospace;

  --measure: 880px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--blue-soft); }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 24px; }
.wrap.wide { max-width: 1120px; }

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

.hero { padding: 72px 0 40px; text-align: center; }

.case-tag {
  display: inline-flex; align-items: center; gap: 10px;
  font: 400 13px/1 var(--mono);
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 26px;
}
.case-tag svg { width: 16px; height: 16px; color: var(--blue); }

h1 {
  font: 600 clamp(30px, 4.4vw, 46px)/1.15 var(--serif);
  letter-spacing: -.01em;
  margin: 0 auto 6px;
  max-width: 940px;
  text-wrap: balance;
}
h1 .sub {
  display: block;
  font-weight: 400;
  font-size: .62em;
  line-height: 1.3;
  color: var(--ink-soft);
  margin-top: 12px;
}
/* the two halves of the title, marked like the paper's figures */
.lies { text-decoration: underline wavy var(--red-soft); text-decoration-thickness: 1.5px; text-underline-offset: 7px; text-decoration-skip-ink: none; }
.patches { text-decoration: underline solid var(--blue-soft); text-decoration-thickness: 2px; text-underline-offset: 7px; }

.authors { margin: 32px auto 8px; font-size: 18px; max-width: 980px; }
.authors span { white-space: nowrap; margin: 0 10px; display: inline-block; }
.authors sup, .affils sup { font-size: .65em; color: var(--ink-faint); margin-left: 1px; }

.affils { font-size: 14.5px; color: var(--ink-soft); line-height: 1.7; }
.affils span { margin: 0 8px; display: inline-block; }

.venue { margin-top: 14px; font: 14px var(--mono); color: var(--ink-faint); letter-spacing: .04em; }

.buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font: 500 15px/1 var(--sans); text-decoration: none;
  transition: background .15s, transform .15s;
}
.btn:hover { background: var(--blue); color: #fff; transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; }
.btn.soon { position: relative; }
.btn.soon::after {
  content: "soon"; font: 11px var(--mono); letter-spacing: .06em;
  padding: 2px 6px; border-radius: 4px; margin-left: 2px;
  background: rgba(255,255,255,.16);
}

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

section { padding: 44px 0; }
section + section { border-top: 1px dashed var(--rule); }

.eyebrow {
  font: 400 13px/1 var(--mono);
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 10px;
}
h2 {
  font: 600 28px/1.25 var(--serif);
  margin: 0 0 18px;
}
h3 { font: 600 19px/1.3 var(--serif); margin: 28px 0 8px; }

p { margin: 0 0 14px; }
.lead { font-size: 18.5px; color: var(--ink); }
.muted { color: var(--ink-soft); }

b.jlist, .jlist { color: var(--blue); font-weight: 600; }
b.james, .james { color: var(--ink); font-weight: 700; letter-spacing: .02em; }
.hm { color: var(--orange); font-style: italic; }

/* ---------- figures ---------- */

figure { margin: 8px 0 0; }

/* exhibit plate: white card with an evidence tag, a strip of tape and an offset shadow */
.plate {
  position: relative;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px;
  box-shadow: 4px 5px 0 rgba(35, 33, 30, .055);
}
.plate img { display: block; width: 100%; height: auto; cursor: zoom-in; }
figure.tight .plate { padding: 8px; }

.plate[data-tag]::before {
  content: attr(data-tag);
  position: absolute; top: -11px; left: 14px; z-index: 2;
  padding: 3px 9px 2px;
  font: 400 11px/1.3 var(--mono);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.plate::after {   /* tape */
  content: "";
  position: absolute; top: -10px; right: 22px; z-index: 2;
  width: 74px; height: 20px;
  background: rgba(222, 210, 176, .5);
  border-left: 1px dashed rgba(160, 145, 110, .25);
  border-right: 1px dashed rgba(160, 145, 110, .25);
  transform: rotate(4deg);
  pointer-events: none;
}
.table-plate { padding: 0; }
.table-plate { margin-top: 0; border-top-left-radius: 0; }
.table-plate::after { display: none; }

/* folder tabs on top of the table plate */
.tabs { display: flex; gap: 4px; margin-top: 18px; position: relative; z-index: 1; }
.tab {
  font: 400 12.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint);
  background: #efebe2;
  border: 1px solid var(--rule); border-bottom: 0;
  border-radius: 6px 6px 0 0;
  padding: 10px 16px 9px;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink-soft); }
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); padding-bottom: 10px; }
.tab:focus-visible { outline: 2px solid var(--blue-soft); outline-offset: 2px; }
.table-plate .table-scroll { border: 0; border-radius: 4px; margin-top: 0; }

figcaption {
  font-size: 15px; line-height: 1.6; color: var(--ink-soft);
  margin-top: 12px;
}
figcaption b { color: var(--ink); }

.teaser-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 40px; align-items: center;
}
.teaser-grid .plate { padding: 10px; }

/* ---------- contributions ---------- */

.points { list-style: none; padding: 0; margin: 18px 0 0; counter-reset: pt; }
.points li {
  position: relative; padding-left: 46px; margin-bottom: 16px;
  counter-increment: pt;
}
.points li::before {
  content: counter(pt, upper-alpha);
  position: absolute; left: 0; top: 1px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  display: grid; place-items: center;
  font: 600 13px/1 var(--mono); color: var(--ink-soft);
}

/* ---------- results table ---------- */

.table-scroll { overflow-x: auto; margin-top: 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); }
table.results { border-collapse: collapse; width: 100%; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.results th, .results td { padding: 7px 12px; text-align: right; white-space: nowrap; }
.results th:first-child, .results td:first-child { text-align: left; }
.results td.venue { text-align: left; color: var(--ink-faint); font: 12.5px var(--mono); }
.results thead th { font-weight: 600; border-bottom: 1px solid var(--ink-faint); vertical-align: bottom; font-size: 13.5px; }
.results tr.super th { text-align: center; font: 400 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); border-bottom: 1px solid var(--rule); padding-top: 12px; }
.results.ood th, .results.ood td { padding-left: 9px; padding-right: 9px; }
.results.ood tr.fam th { text-align: center; font-size: 13px; padding-bottom: 5px; }
.results.ood tr.sizes th { font: 400 12px var(--mono); color: var(--ink-soft); }
.results.ood tr.sizes th:first-child { font: 600 13.5px var(--sans); color: var(--ink); }
.results.ood tr.super th, .results.ood tr.fam th { border-bottom: 1px solid var(--rule); }
.results.ood th.sep, .results.ood td:nth-child(8) { border-left: 1px dashed var(--rule); }
.results.ood tr.group td { border-left: 0; }
.results tr.ours td.nb { font-weight: 500; }
.results thead th small { display: block; font-weight: 400; color: var(--ink-faint); font-size: 12px; }
.results tr.group td {
  text-align: left; font: italic 13.5px var(--sans); color: var(--ink-faint);
  padding-top: 14px; border-bottom: 1px dashed var(--rule);
}
.results tr.ours td { background: rgba(31,120,180,.08); font-weight: 700; color: var(--blue); }
.results tr.ours td:first-child { color: var(--ink); }
.results .u { text-decoration: underline; text-underline-offset: 3px; }
.results tr.extra { display: none; }
.results.show-all tr.extra { display: table-row; }

.table-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: var(--ink-soft); }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 14px var(--mono); color: var(--blue);
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- bibtex ---------- */

.bib {
  position: relative;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
}
.bib pre {
  margin: 0; padding: 20px 22px; overflow-x: auto;
  font: 14px/1.6 var(--mono); color: var(--ink);
}
.bib pre code { font: inherit; }
.copy {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 4px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-soft);
  font: 13px var(--mono); cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy:hover { color: var(--blue); border-color: var(--blue-soft); }
.copy.done { color: var(--blue); border-color: var(--blue-soft); }
.copy svg { width: 14px; height: 14px; }

/* ---------- footer ---------- */

footer {
  border-top: 1px dashed var(--rule);
  padding: 30px 0 48px; margin-top: 20px;
  font-size: 13.5px; color: var(--ink-faint); text-align: center;
}
footer .mono { font-family: var(--mono); letter-spacing: .08em; }

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(35,33,30,.82);
  display: none; place-items: center; padding: 3vw;
  cursor: zoom-out;
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 100%; max-height: 94vh; background: #fff; border-radius: 4px; padding: 12px; }

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

@media (max-width: 820px) {
  .teaser-grid { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .hero { padding-top: 48px; }
  .case-tag { letter-spacing: .1em; font-size: 12px; }
  .plate:not(.table-plate) { padding: 6px; }
  .tab .long, .results .stamp.sm { display: none; }
  .plate::after { width: 54px; right: 14px; }
  .results:not(.ood) th:nth-child(2), .results td.venue { display: none; }
  .bib pre { padding-top: 52px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}

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

.stamp {
  --ink-c: var(--red-soft);
  display: inline-block;
  padding: .28em .7em .22em;
  border: 2px solid var(--ink-c);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), inset 0 0 0 2.5px var(--ink-c);
  color: var(--ink-c);
  font: 700 clamp(9.5px, 1.25vw, 15px)/1 var(--mono);
  letter-spacing: .14em; text-transform: uppercase;
  transform: rotate(-5deg);
  opacity: .88;
  mix-blend-mode: multiply;
  /* uneven ink */
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.4 2.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.4 2.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stamp.red  { --ink-c: var(--red-soft); }
.stamp.blue { --ink-c: var(--blue); transform: rotate(4deg); }
.stamp.sm {
  font-size: 10px; letter-spacing: .1em; border-width: 1.5px;
  box-shadow: none; padding: .35em .6em .25em; margin-left: 8px;
  transform: rotate(-4deg); vertical-align: 1px;
  -webkit-mask-image: none; mask-image: none; opacity: .8;
}

.verdicts {
  display: grid; grid-template-columns: repeat(3, 1fr);
  text-align: center; padding: 14px 0 4px;
}

/* stamps land when they scroll into view */
.js .stamp:not(.sm) { opacity: 0; transform: scale(1.7) rotate(-12deg); transition: opacity .18s ease-in, transform .22s cubic-bezier(.3,1.6,.5,1); }
.js .stamp.blue:not(.sm) { transform: scale(1.7) rotate(10deg); }
.js .stamp.landed { opacity: .88; transform: rotate(-5deg); }
.js .stamp.blue.landed { transform: rotate(4deg); }

/* ---------- magnifier ---------- */

.loupe {
  position: absolute; z-index: 5; pointer-events: none;
  width: 190px; height: 190px; border-radius: 50%;
  border: 4px solid var(--blue);
  background-color: #fff; background-repeat: no-repeat;
  box-shadow: 0 6px 22px rgba(35,33,30,.28), inset 0 0 0 1px rgba(0,0,0,.08);
  opacity: 0; transform: scale(.85);
  transition: opacity .12s, transform .12s;
}
.loupe::after {   /* handle */
  content: ""; position: absolute;
  width: 16px; height: 62px; border-radius: 8px;
  background: #3c3a36;
  left: 50%; top: 100%;
  transform-origin: 50% -95px;
  transform: translate(-50%, -2px) rotate(-45deg);
}
.loupe.on { opacity: 1; transform: none; }
.plate.inspecting img { cursor: none; }

@media (prefers-reduced-motion: reduce) {
  .js .stamp:not(.sm) { transition: none; }
  .loupe { transition: none; }
}
