/* Reading Right, Acting Wrong — project site.
   Palette follows the paper's figures: blue = read right & acted right, orange = read right & acted wrong (the
   protagonist), aqua = misread & acted right, violet = misread & acted wrong. */

:root {
  --paper: #f6f4ef;
  --paper-2: #efece5;
  --surface: #fffefb;
  --ink: #17171b;
  --ink-2: #45454c;
  --muted: #8a8882;
  --rule: #e2ded5;
  --rule-2: #d3cec3;
  --blue: #4d6bfe;
  --blue-soft: #dfe5ff;
  --orange: #ed7d31;
  --orange-soft: #fbe3d2;
  --aqua: #1baf7a;
  --aqua-soft: #d6f0e5;
  --violet: #6a4bc4;
  --violet-soft: #e6e0f6;
  --ref: #17171b;
  --shadow: 0 1px 2px rgba(23, 23, 27, .04), 0 8px 24px rgba(23, 23, 27, .06);
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --wrap: 1180px;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121214; --paper-2: #1a1a1d; --surface: #18181b; --ink: #f1efe9; --ink-2: #c6c3bb; --muted: #8d8a83;
    --rule: #2a2a2e; --rule-2: #38383d; --blue: #7d93ff; --blue-soft: #232a4d; --orange: #f39a5b; --orange-soft: #3d2a1d;
    --aqua: #3cc996; --aqua-soft: #173328; --violet: #9b84e6; --violet-soft: #2a2341; --ref: #f1efe9;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --paper: #121214; --paper-2: #1a1a1d; --surface: #18181b; --ink: #f1efe9; --ink-2: #c6c3bb; --muted: #8d8a83;
  --rule: #2a2a2e; --rule-2: #38383d; --blue: #7d93ff; --blue-soft: #232a4d; --orange: #f39a5b; --orange-soft: #3d2a1d;
  --aqua: #3cc996; --aqua-soft: #173328; --violet: #9b84e6; --violet-soft: #2a2341; --ref: #f1efe9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  overflow-x: clip; margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px;
  line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--orange); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); font-weight: 400; }

/* ---------------------------------------------------------------- top bar */
.bar {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.bar.scrolled { border-bottom-color: var(--rule); }
.bar .wrap { display: flex; align-items: center; gap: 28px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; letter-spacing: -.01em; }
.brand svg { flex: none; }
.brand span { font-family: var(--serif); font-size: 21px; }
.tabs { display: flex; gap: 4px; margin-left: auto; position: relative; }
.tabs a {
  text-decoration: none; color: var(--ink-2); font-size: 14px; padding: 8px 12px; border-radius: 99px;
  transition: color .2s, background .2s;
}
.tabs a:hover { color: var(--ink); background: var(--paper-2); }
.tabs a.on { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule); }
.theme {
  border: 0; background: none; color: var(--ink-2); cursor: pointer; padding: 8px; border-radius: 99px; display: grid;
}
.theme:hover { background: var(--paper-2); }

/* ---------------------------------------------------------------- views */
.view { display: none; animation: rise .5s cubic-bezier(.2, .7, .2, 1); }
.view.on { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- hero */
.hero { padding: 64px 0 40px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.eyebrow { font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
h1.title {
  font-family: var(--serif); font-weight: 400; font-size: clamp(48px, 7vw, 92px); line-height: .95;
  letter-spacing: -.02em; margin: 18px 0 22px;
}
h1.title em { color: var(--orange); }
.lede { font-size: 18.5px; line-height: 1.6; color: var(--ink-2); max-width: 34em; }
.lede b { color: var(--ink); font-weight: 600; }
.authors { margin-top: 26px; font-size: 14.5px; color: var(--ink-2); }
.authors b { color: var(--ink); font-weight: 500; }
.cta { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px; font-size: 14px;
  text-decoration: none; border: 1px solid var(--rule-2); background: var(--surface); color: var(--ink);
  transition: transform .15s, border-color .2s, background .2s; cursor: pointer; font-family: var(--sans);
}
.btn:hover { transform: translateY(-1px); border-color: var(--ink-2); }
.btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); cursor: default; }
.btn.ghost:hover { transform: none; }

.mosaic-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 22px; padding: 22px 22px 16px;
  box-shadow: var(--shadow);
}
.mosaic-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.mosaic-head .sys { font-family: var(--serif); font-size: 30px; line-height: 1; }
.mosaic-head .cat { font-size: 12.5px; color: var(--muted); text-align: right; }
.mosaic-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 12.5px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink-2); border-radius: 99px;
  padding: 4px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans);
  transition: border-color .2s, background .2s, color .2s;
}
.chip:hover { border-color: var(--rule-2); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip.filt { background: var(--surface); }
.chip.filt:not(.on) { opacity: .45; }
.chip.filt.on { background: var(--surface); color: var(--ink); border-color: var(--ink-2); }
#board-sec .sec-head { grid-template-columns: 1fr; align-items: start; }
.mosaic-note { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; }

/* ---------------------------------------------------------------- numbers strip */
.strip { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.strip .wrap { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 26px 22px 24px; border-left: 1px solid var(--rule); text-decoration: none; transition: background .2s; }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.stat .n { font-family: var(--serif); font-size: 46px; line-height: 1; letter-spacing: -.01em; }
.stat .n small { font-size: 22px; }
.stat .t { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; line-height: 1.45; }
.stat .go { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------------------------------------------------------------- sections */
section.block { padding: 64px 0; }
.sec-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px; margin-bottom: 26px; }
h2.h { font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1.04; margin: 0; letter-spacing: -.01em; }
h2.h em { color: var(--orange); }
.sub { color: var(--ink-2); max-width: 46em; margin: 12px 0 0; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.005em; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.controls .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 99px; padding: 3px; background: var(--surface); }
.seg button {
  border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink-2); padding: 5px 12px; border-radius: 99px;
  cursor: pointer;
}
.seg button.on { background: var(--ink); color: var(--paper); }
select.sel {
  font: inherit; font-size: 13px; padding: 6px 30px 6px 12px; border-radius: 99px; border: 1px solid var(--rule);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8882' fill='none' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink); appearance: none; cursor: pointer;
}

/* ---------------------------------------------------------------- leaderboard */
.board { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.board-scroll { overflow-x: auto; }
table.lb { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 980px; }
.lb th {
  text-align: left; font-weight: 500; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 14px 9px 12px; border-bottom: 1px solid var(--rule); user-select: none; vertical-align: bottom; letter-spacing: .06em; line-height: 1.3;
}
.lb th.sort { cursor: pointer; }
.lb th.sort:hover { color: var(--ink); }
.lb th.on { color: var(--ink); }
.lb th .arr { display: inline-block; width: 10px; color: var(--orange); }
.lb th .hint { display: block; text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.lb td { padding: 10px 9px; border-bottom: 1px solid var(--rule); vertical-align: middle; white-space: nowrap; }
.lb tr.row { cursor: pointer; transition: background .15s; }
.lb tr.row:hover { background: var(--paper); }
.lb tr.row.open { background: var(--paper); }
.lb tr.row.ref td { background: color-mix(in srgb, var(--paper-2) 70%, transparent); }
.lb td.rank { font-family: var(--serif); font-size: 22px; color: var(--muted); width: 44px; text-align: center; }
.lb tr.row:nth-child(-n+6) td.rank { color: var(--ink); }
.sysname { display: flex; align-items: center; gap: 10px; }
.sysname .nm { font-weight: 500; }
.sysname .dev { font-size: 12px; color: var(--muted); display: block; line-height: 1.2; }
.badge { display: inline-block; margin-top: 2px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; border: 1px solid var(--rule-2); border-radius: 99px; padding: 1px 7px; color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.badge.warn { border-color: color-mix(in srgb, var(--orange) 55%, transparent); color: var(--orange); }
.num { font-family: var(--mono); font-feature-settings: "tnum"; font-size: 13.5px; }
.barcell { display: flex; align-items: center; gap: 8px; }
.minibar { width: 58px; height: 6px; border-radius: 3px; background: var(--paper-2); position: relative; overflow: hidden; }
.minibar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.outcome { display: flex; height: 14px; width: 128px; border-radius: 4px; overflow: hidden; }
.outcome i { display: block; height: 100%; }
.detail td { padding: 0; background: var(--paper); }
.detail-in { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; padding: 18px 22px 22px 66px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.board-foot { display: flex; justify-content: space-between; gap: 20px; padding: 14px 18px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--rule); flex-wrap: wrap; }
.key { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
.key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------------------------------------------------------------- findings */
.finding { display: grid; grid-template-columns: 300px 1fr; gap: 48px; padding: 56px 0; border-top: 1px solid var(--rule); }
.finding:first-of-type { border-top: 0; }
.finding .no { font-family: var(--serif); font-size: 64px; line-height: .9; color: var(--rule-2); }
.finding h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.08; margin: 14px 0 14px; letter-spacing: -.005em; }
.finding h2 em { color: var(--orange); }
.finding p { color: var(--ink-2); font-size: 15.5px; }
.finding .take { border-left: 2px solid var(--orange); padding: 2px 0 2px 14px; color: var(--ink); font-size: 15px; margin-top: 18px; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 20px 14px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; }
.cap { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.toc { position: sticky; top: 86px; }
.toc a { display: block; font-size: 13.5px; color: var(--muted); text-decoration: none; padding: 5px 0 5px 14px; border-left: 1px solid var(--rule); }
.toc a:hover, .toc a.on { color: var(--ink); border-left-color: var(--orange); }

/* ---------------------------------------------------------------- svg text */
.axis text { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
.axis path, .axis line { stroke: var(--rule-2); }
.grid line { stroke: var(--rule); stroke-dasharray: 2 3; }
.grid path { display: none; }
.lab { font-family: var(--sans); font-size: 11.5px; fill: var(--ink-2); }
.lab.b { font-weight: 600; fill: var(--ink); }
.axt { font-family: var(--sans); font-size: 12px; fill: var(--ink-2); }

/* ---------------------------------------------------------------- tooltip */
.tip {
  position: fixed; pointer-events: none; z-index: 100; background: var(--ink); color: var(--paper); font-size: 12.5px;
  line-height: 1.45; padding: 9px 11px; border-radius: 9px; max-width: 300px; opacity: 0; transform: translateY(4px);
  transition: opacity .12s, transform .12s; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 600; }
.tip .r { display: flex; justify-content: space-between; gap: 16px; font-family: var(--mono); font-size: 12px; }
.tip .r span:first-child { font-family: var(--sans); opacity: .75; }

/* ---------------------------------------------------------------- studies */
.walk { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps button { font: inherit; font-size: 13.5px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); border-radius: 99px; padding: 7px 14px; cursor: pointer; }
.steps button .k { font-family: var(--mono); color: var(--muted); margin-right: 6px; }
.steps button.on { border-color: var(--ink); color: var(--ink); }
.steps button.done { color: var(--ink); }
.state-card { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.state-card .g { font-family: var(--sans); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.state-card .g:first-child { margin-top: 0; }
.trace-step { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 5px 0; border-top: 1px dashed var(--rule); }
.trace-step:first-child { border-top: 0; }
.trace-step .a { color: var(--ink); }
.trace-step .o { color: var(--muted); }
.reveal { opacity: .14; filter: blur(1.5px); transition: opacity .6s, filter .6s; }
.reveal.shown { opacity: 1; filter: none; }
.q { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.q .qq { font-size: 13.5px; }
.q .qa { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-family: var(--mono); font-size: 12.5px; }
.ok { color: var(--aqua); font-weight: 600; }
.bad { color: var(--orange); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card .tag { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 25px; margin: 6px 0 8px; }
.card p { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; }
.card ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); }
.card .go { font-size: 13px; margin-top: 12px; display: inline-block; }
table.lic { width: 100%; border-collapse: collapse; font-size: 14px; }
.lic th, .lic td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.lic th { font-weight: 500; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lic td:first-child { font-family: var(--mono); white-space: nowrap; }
.formula { font-family: var(--serif); font-size: 30px; text-align: center; padding: 18px 0 8px; }

/* ---------------------------------------------------------------- paper */
.abstract { font-family: var(--serif); font-size: 24px; line-height: 1.45; color: var(--ink); max-width: 34em; }
pre.bib { font-family: var(--mono); font-size: 12.5px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; overflow-x: auto; line-height: 1.6; }

footer { border-top: 1px solid var(--rule); padding: 30px 0 46px; color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 36px; }
  .strip .wrap { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .finding { grid-template-columns: 1fr; gap: 18px; }
  .toc { position: static; }
  .walk, .cards, .detail-in { grid-template-columns: 1fr; }
  .detail-in { padding-left: 22px; }
  .tabs a { padding: 8px 9px; font-size: 13px; }
}
@media (max-width: 680px) {
  .wrap { padding: 0 16px; }
  .bar .wrap { gap: 10px; }
  .theme { display: none; }
  .tabs { overflow-x: auto; scrollbar-width: none; min-width: 0; }
  .tabs::-webkit-scrollbar { display: none; }
  .brand span { display: none; }
  .tabs { gap: 0; }
  .tabs a { padding: 7px 7px; font-size: 12.5px; }
  .strip .wrap { grid-template-columns: 1fr 1fr; }
  .stat { padding: 18px 12px 16px; }
  .stat .n { font-size: 36px; }
  h2.h { font-size: 34px; }
  .sec-head { grid-template-columns: 1fr; }
  .lede { font-size: 16.5px; }
}
