/* PRISM project page.
   Warm paper background, near-black ink, Geist for text, Geist Mono for small labels.
   Chart and table colours keep the paper's semantics: grey = default proposal,
   blue = learned prior (warm-start), pink = PoG-fused (PRISM). */

:root {
  --paper: #F5F3ED;
  --paper-2: #ECE9E1;
  --plate: #FFFFFF;
  --ink: #141413;
  --ink-2: #4A4843;
  --ink-3: #85827A;
  --rule: rgba(20, 20, 19, .14);
  --rule-2: rgba(20, 20, 19, .07);

  --accent: #C2185B;
  --prior: #4655B8;
  --vanilla: #A9A69D;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --wide: 1080px;
  --text: 740px;
  --gutter: 20px;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.65; font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
h1, h2, h3 { margin: 0; }
b, strong { font-weight: 600; }
sup { font-size: .62em; line-height: 0; }
code { font-family: var(--mono); font-size: .86em; background: var(--rule-2); padding: .06em .35em; border-radius: 4px; }
section[id] { scroll-margin-top: 64px; }

.wrap { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: calc(var(--text) + 2 * var(--gutter)); }
.sec { padding: 72px 0; }
.sec.alt { background: var(--paper-2); }
.sec h2 { font-size: 30px; font-weight: 500; letter-spacing: -.015em; line-height: 1.2; margin-bottom: 18px; }
.sec .intro { color: var(--ink-2); }
.narrow + .wrap, .wrap + .narrow, .wrap + .wrap { margin-top: 36px; }
@media (max-width: 640px) { .sec { padding: 52px 0; } .sec h2 { font-size: 25px; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 243, 237, .88); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule-2);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 52px; }
.wordmark { font-weight: 600; letter-spacing: .12em; font-size: 14px; text-decoration: none; }
.topbar nav { display: flex; gap: 22px; font-size: 14px; }
.topbar nav a { text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.topbar nav a:hover { color: var(--ink); }
@media (max-width: 860px) { .topbar nav .sec-link { display: none; } }

/* ---------- header ---------- */
.header { padding: 64px 0 40px; }
.hd { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px 64px; align-items: end; }
.header h1 { font-size: 96px; font-weight: 500; letter-spacing: -.045em; line-height: .88; margin-left: -4px; }
.header .subtitle { font-size: 23px; font-weight: 400; letter-spacing: -.01em; line-height: 1.3; color: var(--ink-2); margin: 18px 0 0; }
.hd-side { border-left: 1px solid var(--rule); padding-left: 28px; }
.authors { font-size: 17px; line-height: 1.65; margin: 0; }
.authors a { text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--rule); }
.authors a:hover { border-bottom-color: var(--ink); }
.affils { font-size: 14px; color: var(--ink-2); margin: 10px 0 0; line-height: 1.7; }
.affils span { display: inline-block; margin: 0 14px 0 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 15px; border-radius: 999px; background: var(--ink); color: var(--paper); transition: background .15s;
}
.btn:hover { background: #33322f; }
.btn svg { width: 15px; height: 15px; flex: none; }
@media (max-width: 1140px) and (min-width: 861px) {
  .hd { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 28px 40px; }
  .header h1 { font-size: 84px; }
  .header .subtitle { font-size: 20px; text-wrap: balance; }
  .header .subtitle br { display: none; }
}
@media (max-width: 860px) {
  .hd { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .hd-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 22px; }
}
@media (max-width: 640px) { .header { padding: 40px 0 28px; } .header h1 { font-size: 64px; } .header .subtitle { font-size: 19px; } .authors { font-size: 16px; } }

.agent { margin: 44px 0 0; text-align: left; scroll-margin-top: 72px; }
.agent-card { background: var(--plate); border: 1px solid var(--rule-2); border-radius: 12px; padding: 22px 24px 18px; box-shadow: 0 1px 2px rgba(20, 20, 19, .04); }
.agent-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.agent h2 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.agent-top p { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); margin: 4px 0 0; }
.agent-top p a { color: var(--ink); }
.agent-copy { flex: none; display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer; border-radius: 999px; padding: 9px 15px; background: var(--ink); color: var(--paper); font: 500 14px var(--sans); transition: background .15s; }
.agent-copy:hover { background: #33322f; }
.agent-copy svg { width: 15px; height: 15px; }
.agent-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 10px; }
.agent-tabs button { font: 500 13px var(--sans); padding: 5px 12px; border-radius: 999px; cursor: pointer; border: 1px solid var(--rule); background: transparent; color: var(--ink-2); transition: border-color .15s, color .15s, background .15s; }
.agent-tabs button:hover { border-color: var(--ink-3); color: var(--ink); }
.agent-tabs button.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.agent pre { margin: 0; text-align: left; white-space: pre-wrap; word-break: break-word; background: #F8F7F3; border: 1px solid var(--rule-2); border-radius: 8px; padding: 14px 16px; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.agent-meta { font-size: 13px; color: var(--ink-3); margin: 10px 0 0; }
@media (max-width: 640px) {
  .agent-card { padding: 16px 14px 14px; }
  .agent-top { flex-direction: column; gap: 12px; }
  .agent pre { font-size: 12px; padding: 12px; }
}
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 40px 0 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stat { padding: 18px 12px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--rule); }
.stat .v { font-size: 24px; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .k { font-size: 13px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .stat .v { font-size: 20px; }
}

/* ---------- figures ---------- */
figure { margin: 0; }
.plate { background: var(--plate); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 24px; }
.plate img { margin: 0 auto; }
figcaption { max-width: var(--text); margin: 14px auto 0; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
figcaption b { color: var(--ink); }
@media (max-width: 640px) { .plate { padding: 12px; } }

.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- method at a glance ---------- */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.trio > div { background: var(--plate); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 22px 22px 24px; }
.trio .num { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.trio h3 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 10px 0 8px; }
.trio p { font-size: 15.5px; color: var(--ink-2); line-height: 1.6; }
@media (max-width: 860px) { .trio { grid-template-columns: minmax(0, 1fr); } }

.eq { margin: 22px 0; padding: 6px 0; overflow-x: auto; }
.eq mjx-container[display="true"] { margin: .45em 0 !important; }

/* ---------- interactive PoG demo ---------- */
.pog { background: var(--plate); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 22px; }
.pog-panels, .pog-bottom { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 18px; }
.pog-title { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 8px; }
.pog-title .hint { color: var(--ink-3); }
.pog svg { width: 100%; height: auto; display: block; background: #FBFAF6; border: 1px solid var(--rule-2); border-radius: 8px; font-family: var(--sans); }
.pog svg[data-id="svg2"] { touch-action: none; cursor: crosshair; }
.pog .grid { stroke: rgba(20, 20, 19, .06); stroke-width: 1; }
.pog .ax0 { stroke: rgba(20, 20, 19, .2); stroke-width: 1; }
.pog .axis { stroke: rgba(20, 20, 19, .5); stroke-width: 1; }
.pog .tick { font-size: 12.5px; fill: var(--ink-3); }
.pog .axlabel { font-size: 13px; fill: var(--ink-2); }
.pog .a-def { fill: rgba(138, 135, 126, .10); }
.pog .l-def { fill: none; stroke: #8A877E; stroke-width: 2; stroke-dasharray: 7 5; }
.pog .a-pri { fill: rgba(70, 85, 184, .08); }
.pog .l-pri { fill: none; stroke: var(--prior); stroke-width: 2; }
.pog .a-fus { fill: rgba(194, 24, 91, .15); }
.pog .l-fus { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.pog .m-def { fill: #8A877E; } .pog .m-pri { fill: var(--prior); } .pog .m-fus { fill: var(--accent); }
.pog .c-def { fill: none; stroke: #8A877E; stroke-width: 1.5; stroke-dasharray: 5 4; }
.pog .c-pri { fill: rgba(70, 85, 184, .05); stroke: var(--prior); stroke-width: 1.5; }
.pog .c-fus { fill: rgba(194, 24, 91, .07); stroke: var(--accent); stroke-width: 1.5; }
.pog .links line { stroke: rgba(194, 24, 91, .16); stroke-width: .8; }
.pog .s-def { fill: #A9A69D; opacity: .75; }
.pog .s-fus { fill: var(--accent); }
.pog .fmean { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.pog .handle { fill: var(--prior); stroke: #fff; stroke-width: 3; cursor: grab; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.pog.dragging .handle, .pog.dragging svg[data-id="svg2"] { cursor: grabbing; }

.pog-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin: 16px 0 6px; font-size: 13.5px; color: var(--ink-2); }
.pog-legend span { display: inline-flex; align-items: center; gap: 8px; }
.pog-legend .lg { display: inline-block; width: 24px; height: 0; border-top: 2px dashed #8A877E; }
.pog-legend .lg-pri { border-top: 2px solid var(--prior); }
.pog-legend .lg-fus { border-top: 3px solid var(--accent); }
.pog-legend .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.pog-legend .dot-def { background: #A9A69D; } .pog-legend .dot-fus { background: var(--accent); }

.pog-bottom { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--rule-2); align-items: start; }
.pog-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.pog-presets button {
  font: 500 13px var(--sans); padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-2); transition: background .15s, color .15s, border-color .15s;
}
.pog-presets button:hover { border-color: var(--ink-3); color: var(--ink); }
.pog-presets button.active, .pog-presets button.active:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pog-presets .ghost { margin-left: auto; background: transparent; }
.pog-row { display: grid; grid-template-columns: 136px minmax(0, 1fr) 60px; align-items: center; gap: 14px; padding: 5px 0; font-size: 14px; color: var(--ink-2); }
.pog-row output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink); }
.pog input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer; }
.pog input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--prior), var(--prior)) 0 / var(--p, 50%) 100% no-repeat, #E3E0D8; }
.pog input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 2px solid var(--prior); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.pog input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: #E3E0D8; }
.pog input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--prior); }
.pog input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--prior); }
.pog input[type=range]:focus-visible { outline: 2px solid var(--prior); outline-offset: 3px; border-radius: 4px; }
.pog-readout > div { padding: 9px 0; border-bottom: 1px solid var(--rule-2); }
.pog-readout > div:first-child { padding-top: 2px; }
.pog-readout .v { font-size: 22px; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.pog-readout .v.accent { color: var(--accent); }
.pog-readout .k { font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 860px) {
  .pog { padding: 14px; }
  .pog-panels, .pog-bottom { grid-template-columns: minmax(0, 1fr); }
  .pog-row { grid-template-columns: 118px minmax(0, 1fr) 52px; gap: 10px; }
  .pog-presets .ghost { margin-left: 0; }
  .pog-legend { gap: 6px 14px; font-size: 12.5px; }
}

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

/* ---------- tables ---------- */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 15px; }
table.t.fit { width: auto; min-width: min(100%, 640px); }
table.t th, table.t td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule-2); font-weight: 400; }
table.t tr > :first-child { text-align: left; padding-left: 0; }
table.t tr > :last-child { padding-right: 0; }
table.t .l { text-align: left; }
table.t thead tr:first-child th { border-top: 1px solid var(--ink); }
table.t thead tr:last-child th { border-bottom: 1px solid var(--ink); }
table.t thead th { font-size: 13px; font-weight: 500; color: var(--ink-2); }
table.t thead .grp-head th { text-align: center; border-bottom: 1px solid var(--rule); color: var(--ink); }
table.t thead .grp-head th:empty, table.t .gap { border-bottom-color: transparent !important; }
table.t .gap { width: 20px; padding: 0; }
table.t tbody th { font-weight: 500; }
table.t tbody tr:last-child > * { border-bottom: 1px solid var(--ink); }
table.t tbody .grp > * { font-size: 13px; font-style: italic; color: var(--ink-3); padding-top: 16px; }
/* 2px so it wins the collapsed-border conflict with the 1px row rule above it */
table.t tbody .sep > * { border-top: 2px solid var(--rule); }
table.t tr.ours > * { color: var(--accent); font-weight: 600; }
table.t .hi { font-weight: 600; }
.note { font-size: 14px; line-height: 1.6; color: var(--ink-2); margin-top: 14px; }
@media (max-width: 600px) { table.t { font-size: 13.5px; } table.t th, table.t td { padding: 8px 8px; } }

/* ---------- main results ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .charts { grid-template-columns: minmax(0, 1fr); } }
.chart { background: var(--plate); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 20px 22px 22px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; }
.chart-head h3 { font-size: 18px; font-weight: 600; }
.chart-head .unit { font-size: 13px; color: var(--ink-3); }
.k-group { margin-top: 14px; }
.k-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.bar-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 84px; align-items: center; gap: 10px; margin: 4px 0; }
.bar-name { font-size: 12.5px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.bar-track { height: 12px; background: #EFEDE7; border-radius: 3px; overflow: hidden; }
.bar { height: 100%; width: var(--w); border-radius: 3px; }
.bar.b-vanilla { background: var(--vanilla); }
.bar.b-warm { background: var(--prior); }
.bar.b-prism { background: var(--accent); }
.bar-val { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row.ours .bar-name, .bar-row.ours .bar-val { color: var(--accent); font-weight: 600; }
.legend-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; margin-top: 18px; font-size: 13.5px; color: var(--ink-2); }
.legend-row span { display: inline-flex; align-items: center; gap: 8px; }
.sw { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.b-vanilla { background: var(--vanilla); } .sw.b-warm { background: var(--prior); } .sw.b-prism { background: var(--accent); }
.findings { margin: 0; padding-left: 1.2em; }
.findings li { margin-bottom: 8px; }

/* ---------- analysis cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cards .wide { grid-column: 1 / -1; }
@media (max-width: 860px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--plate); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 22px; min-width: 0; }
.card h3 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 14px; }
.card h3 .tag { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--ink-3); margin-right: 8px; }
.card img { margin: 0 auto; }
@media (max-width: 600px) { .card { padding: 16px 14px; } }

/* ---------- galleries ---------- */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .gallery { grid-template-columns: minmax(0, 1fr); } }
.col-head { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.tile { background: var(--plate); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 8px; margin-bottom: 14px; }
.tile:last-child { margin-bottom: 0; }
.tile img, .tile video { width: 100%; border-radius: 6px; background: #000; }
.tile .t-cap { font-size: 13px; color: var(--ink-3); padding: 8px 4px 2px; text-align: center; }

/* ---------- real robot ---------- */
.vs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; margin: 0 auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.vs { padding: 16px 12px; text-align: center; }
.vs + .vs { border-left: 1px solid var(--rule); }
.vs .v { font-size: 26px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.vs .v .a { color: var(--accent); }
.vs .v .b { color: var(--ink-3); }
.vs .v .x { font-size: .6em; color: var(--ink-3); margin: 0 .35em; }
.vs .k { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.setups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .setups { grid-template-columns: minmax(0, 1fr); } }
.setups .tile img { aspect-ratio: 1824 / 1066; object-fit: cover; }
.setups p { font-size: 14px; color: var(--ink-2); line-height: 1.6; padding: 10px 6px 4px; margin: 0; }
.setups p b { color: var(--ink); }
.sub-h { font-size: 18px; font-weight: 600; margin-bottom: 12px; }

/* ---------- citation + footer ---------- */
.bib { position: relative; background: var(--plate); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 48px 22px 20px; }
.bib pre { margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.copy { position: absolute; top: 12px; right: 12px; font-family: var(--sans); font-size: 12.5px; color: var(--ink-2); background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.copy:hover { color: var(--ink); border-color: var(--ink-3); }
.footer { border-top: 1px solid var(--rule-2); padding: 28px 0 40px; font-size: 13px; color: var(--ink-3); text-align: center; }
.footer a { color: var(--ink-2); }
