/* ---------- EvoHarness-RL project page ---------- */

:root {
  --ink:        #0f1e33;
  --ink-soft:   #44546a;
  --ink-faint:  #7d8ca3;
  --rule:       #dfe7f3;
  --rule-soft:  #eef3fa;
  --bg:         #ffffff;
  --tint:       #f5f9ff;
  --tint-2:     #eaf2ff;

  --blue:       #0064e0;
  --blue-hi:    #0081fb;
  --blue-deep:  #0a2a5c;
  --blue-mid:   #3b7be8;
  --blue-soft:  #a9c8f7;

  --orange:      #ff5f05;
  --orange-ink:  #c4470a;
  --orange-tint: #fff3ec;
  --orange-rule: #ffd6bf;

  --belief-bg:  #e7f0ff;  --belief-ink:  #0064e0;
  --progress-bg:#ecebff;  --progress-ink:#4338ca;
  --exp-bg:     #e2f5fb;  --exp-ink:     #007a9e;

  --maxw: 1100px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --display: "Source Serif 4", Charter, Georgia, serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  --shadow-sm: 0 1px 2px rgba(10,42,92,.05), 0 1px 3px rgba(10,42,92,.04);
  --shadow-md: 0 6px 18px rgba(10,42,92,.08), 0 1px 3px rgba(10,42,92,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.68;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
a { color: var(--blue); text-decoration: none; border-bottom: 1px solid rgba(0,100,224,.25); }
a:hover { color: var(--blue-hi); border-bottom-color: var(--blue-hi); }
code, .mono { font-family: var(--mono); font-size: .88em; }
.sc { font-variant: small-caps; letter-spacing: .02em; }
b, strong { color: var(--ink); }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s;
}
.nav.scrolled { border-bottom-color: var(--rule); box-shadow: var(--shadow-sm); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.nav .mark { font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--blue-deep); letter-spacing: -.01em; }
.nav .mark span { color: var(--orange); }
.nav .links a { border: 0; margin-left: 20px; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.nav .links a:hover, .nav .links a.active { color: var(--blue); }

/* ---------- header ---------- */
header { padding: 64px 0 28px; text-align: center;
  background: radial-gradient(1200px 420px at 50% -60px, var(--tint-2), transparent 70%); }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--blue-deep);
  background: #fff; border: 1px solid var(--rule); border-radius: 999px; padding: 5px 14px;
  box-shadow: var(--shadow-sm);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255,95,5,.15); }
.title {
  font-family: var(--display); font-weight: 700; font-size: clamp(34px, 5vw, 54px);
  line-height: 1.12; letter-spacing: -.02em; margin: 26px auto 22px; max-width: 920px; color: var(--blue-deep);
}
.title .accent {
  background: linear-gradient(90deg, var(--blue), var(--blue-hi));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title .sub { display: block; font-size: .56em; font-weight: 600; color: var(--ink); margin-top: 10px; letter-spacing: -.01em; }
.authors { font-size: 16.5px; margin: 0 auto 6px; max-width: 900px; line-height: 1.9; }
.authors .au, .affil .au { white-space: nowrap; margin: 0 5px; }
.authors a { color: var(--ink); border-bottom: 1px solid var(--rule); }
.authors a:hover { color: var(--blue); border-bottom-color: var(--blue); }
.authors sup, .affil sup { color: var(--blue); font-weight: 600; }
.affil { font-size: 15.5px; color: var(--ink-soft); margin: 4px 0; }
.logos { display: flex; justify-content: center; align-items: center; gap: 44px; margin: 22px 0 4px; }
.logos img { height: 44px; width: auto; display: block; }
.logos img[src*="meta"] { height: 30px; }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 28px 0 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0;
  padding: 10px 20px; border-radius: 999px; font-size: 15px; font-weight: 600;
  background: var(--blue); color: #fff; box-shadow: var(--shadow-md);
  transition: transform .15s, background .15s;
}
.btn:hover { background: var(--blue-hi); color: #fff; transform: translateY(-1px); }
.btn.ghost { background: #fff; color: var(--blue-deep); border: 1px solid var(--rule); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn.soon { opacity: .55; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }

/* ---------- figures ---------- */
.teaser { margin: 36px auto 0; }
.figure {
  background: #fff; border: 1px solid var(--rule); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow-sm);
}
.figure img { display: block; width: 100%; height: auto; }
.caption { font-size: 14.5px; color: var(--ink-soft); margin: 12px 4px 0; line-height: 1.6; }
.caption .fignum { font-weight: 700; color: var(--blue); margin-right: 6px; }

/* ---------- stats ---------- */
.statband { background: var(--tint); border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft);
  padding: 30px 0; margin-top: 48px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px 14px; box-shadow: var(--shadow-sm); }
.stat .lbl { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.stat .k { font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--orange); line-height: 1.2; margin: 4px 0 2px; }
.stat .t { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }

/* ---------- sections ---------- */
section { padding: 68px 0 8px; }
section.alt { background: var(--tint); border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); padding-bottom: 56px; margin-top: 56px; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; }
.sec-head .no { font-family: var(--mono); font-size: 14px; color: var(--blue); font-weight: 700; }
.sec-head h2 { font-family: var(--display); font-size: 32px; margin: 0; letter-spacing: -.015em; color: var(--blue-deep); }
h3 { font-family: var(--display); font-size: 22px; margin: 36px 0 10px; color: var(--blue-deep); }
.lead { font-size: 18.5px; color: var(--ink); max-width: 860px; }
p { margin: 0 0 14px; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }

.question {
  margin: 22px 0 8px; padding: 16px 22px; border-left: 4px solid var(--orange);
  background: linear-gradient(90deg, var(--orange-tint), #fff); border-radius: 0 12px 12px 0;
  font-family: var(--display); font-size: 20px; font-style: italic; color: var(--blue-deep);
}

/* ---------- key insights ---------- */
.insights { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 28px 0 6px; }
.insight {
  display: block; border: 1px solid var(--rule); border-radius: 14px; padding: 18px 20px 16px;
  background: #fff; box-shadow: var(--shadow-sm); color: var(--ink); transition: border-color .15s, transform .15s;
}
.insight:hover { border-color: var(--blue); transform: translateY(-2px); color: var(--ink); }
.insight .num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--blue); color: #fff; font: 700 13px var(--mono); margin-right: 10px; }
.insight .hd { display: flex; align-items: center; font-weight: 700; font-size: 16.5px; color: var(--blue-deep); }
.insight p { font-size: 15px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.55; }
.insight .metric { display: inline-block; margin-top: 10px; font: 600 12.5px var(--mono); color: var(--orange-ink);
  background: var(--orange-tint); border-radius: 6px; padding: 2px 8px; }

/* ---------- BPE workflow ---------- */
.flow { display: flex; align-items: stretch; gap: 0; margin: 24px 0 10px; }
.flow .node { flex: 1; background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; text-align: center; box-shadow: var(--shadow-sm); }
.flow .node .t { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }
.flow .node .v { font-size: 15px; font-weight: 600; color: var(--blue-deep); margin-top: 2px; line-height: 1.4; }
.flow .node.hl { background: var(--blue); border-color: var(--blue); }
.flow .node.hl .t { color: rgba(255,255,255,.75); } .flow .node.hl .v { color: #fff; }
.flow .arr { flex: 0 0 52px; padding: 0 8px; display: flex; align-items: center; justify-content: center; color: var(--blue-soft); font-size: 20px; }

.grid-bpe { display: grid; grid-template-columns: 150px repeat(3, 1fr); border: 1px solid var(--rule); border-radius: 14px;
  overflow: hidden; margin: 18px 0 8px; background: #fff; box-shadow: var(--shadow-sm); font-size: 14.5px; }
.grid-bpe > div { padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); border-right: 1px solid var(--rule-soft); line-height: 1.45; color: var(--ink-soft); }
.grid-bpe > div:nth-child(4n) { border-right: 0; }
.grid-bpe .span { grid-column: span 3; border-right: 0; }
.grid-bpe .r.e, .grid-bpe .span { border-bottom: 0; }
.grid-bpe .h { background: var(--tint); font-weight: 700; color: var(--blue-deep); font-size: 13.5px; }
.grid-bpe .r { font-weight: 700; display: flex; flex-direction: column; justify-content: center; }
.grid-bpe .r small { font-weight: 500; font-size: 12px; color: var(--ink-faint); }
.grid-bpe .r.b { color: var(--belief-ink); background: var(--belief-bg); }
.grid-bpe .r.p { color: var(--progress-ink); background: var(--progress-bg); }
.grid-bpe .r.e { color: var(--exp-ink); background: var(--exp-bg); }

.callout { display: flex; gap: 16px; align-items: center; margin: 20px 0; padding: 14px 18px; border-radius: 12px;
  background: var(--orange-tint); border: 1px solid var(--orange-rule); }
.callout .big { font-family: var(--display); font-weight: 700; font-size: 28px; color: var(--orange); white-space: nowrap; }
.callout p { margin: 0; font-size: 15.5px; color: var(--ink-soft); }

/* ---------- action protocol ---------- */
.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.rule { border-top: 3px solid var(--blue); background: #fff; border-radius: 0 0 12px 12px; padding: 12px 16px 14px;
  box-shadow: var(--shadow-sm); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.rule .s { font: 700 12px var(--mono); color: var(--blue); }
.rule h4 { margin: 2px 0 4px; font-size: 15.5px; color: var(--blue-deep); }
.rule p { margin: 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.5; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 8px; }
.act { border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; background: #fff; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.act .top { display: flex; align-items: center; justify-content: space-between; }
.act .op { font-family: var(--mono); font-weight: 700; font-size: 15px; padding: 1px 8px; border-radius: 6px; }
.act .rw { font: 700 10.5px var(--mono); letter-spacing: .05em; color: var(--ink-faint); }
.act .op.b { background: var(--belief-bg); color: var(--belief-ink); }
.act .op.p { background: var(--progress-bg); color: var(--progress-ink); }
.act .op.e { background: var(--exp-bg); color: var(--exp-ink); }
.act p { font-size: 13.5px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.5; }

.trace { background: #f6f8fb; color: var(--ink); border: 1px solid var(--rule); border-radius: 14px; padding: 16px 18px;
  font: 13px/1.75 var(--mono); overflow-x: auto; margin: 12px 0 6px; }
.trace .ln { display: grid; grid-template-columns: 34px 62px 1fr; gap: 8px; white-space: pre-wrap; }
.trace .t { color: var(--ink-faint); }
.trace .k { font-weight: 700; }
.trace .k.env { color: var(--ink-faint); }
.trace .k.bpe { color: var(--blue); }
.trace .ret { color: #0f6e63; }
.trace .ret::before { content: "↳ "; color: var(--ink-faint); }

.recipe { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.panel { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 16px 20px; box-shadow: var(--shadow-sm); }
.panel .tag { display: inline-block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--blue); background: var(--tint-2); border-radius: 999px; padding: 2px 10px; margin-bottom: 6px; }
.panel h4 { font-family: var(--display); font-size: 19px; margin: 2px 0 6px; color: var(--blue-deep); }
.panel p { font-size: 15px; color: var(--ink-soft); margin: 0; }

.eqbox { margin: 14px 0; padding: 12px 18px; background: #fff; border: 1px solid var(--rule);
  border-radius: 12px; overflow-x: auto; text-align: center; font-size: 17px; }

/* ---------- findings ---------- */
.finding { display: grid; grid-template-columns: 1fr 1.1fr; gap: 32px; align-items: center; margin: 22px 0; }
.finding.flip .text { order: 2; }
.finding.stack { grid-template-columns: 1fr; gap: 14px; }
.finding .kicker { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: #fff; background: var(--orange); border-radius: 6px; padding: 2px 9px; }
.finding h3 { margin: 8px 0 8px; font-size: 23px; }
.finding .claim, .claim { font-size: 16.5px; color: var(--ink); margin-bottom: 10px; max-width: 900px; }
.finding .figure { padding: 12px; }
.figcol { display: flex; flex-direction: column; align-items: center; }
.figcol .figure { width: 100%; }
.figcol.narrow .figure { max-width: 500px; }
.figcol.wide { margin: 14px 0 6px; }
.figcol .caption { width: 100%; max-width: 100%; margin-top: 10px; }
.figcol.narrow .caption { max-width: 500px; }

ul.pts { list-style: none; padding: 0; margin: 6px 0 10px; }
ul.pts li { position: relative; padding-left: 20px; margin: 7px 0; font-size: 15.5px; color: var(--ink-soft); line-height: 1.55; }
ul.pts li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--blue); }
ul.pts li b { color: var(--blue-deep); }

.num-hl { font-family: var(--mono); font-weight: 700; color: var(--orange-ink); }

details.why { margin: 12px 0 0; border: 1px solid var(--rule); border-radius: 10px; background: var(--tint); font-size: 14.5px; }
details.why summary { cursor: pointer; padding: 9px 14px; font-weight: 600; color: var(--blue-deep); list-style: none; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary::before { content: "▸"; color: var(--blue); margin-right: 8px; display: inline-block; transition: transform .15s; }
details.why[open] summary::before { transform: rotate(90deg); }
details.why .body { padding: 0 16px 12px; color: var(--ink-soft); }
details.why .body p { margin: 6px 0; }
details.why .katex-display { margin: .5em 0; font-size: 1em; }

/* stage strip */
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 20px 0 14px; border: 1px solid var(--rule);
  border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.stage { padding: 14px 18px; border-right: 1px solid var(--rule-soft); position: relative; }
.stage:last-child { border-right: 0; background: var(--tint-2); }
.stage .s { font: 700 11.5px var(--mono); letter-spacing: .06em; color: var(--ink-faint); text-transform: uppercase; }
.stage h4 { margin: 2px 0 4px; font-size: 16px; color: var(--blue-deep); }
.stage p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.stage .n { font-family: var(--mono); font-size: 13px; color: var(--blue); font-weight: 700; margin-top: 6px; display: block; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-sm); margin: 10px 0 8px; background: #fff; }
table.res { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.res th, table.res td { padding: 5px 6px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule-soft); }
table.res th:first-child, table.res td:first-child { text-align: left; padding-left: 12px; }
table.res thead th { background: var(--tint); font-weight: 700; color: var(--blue-deep); font-size: 12.5px; }
table.res thead tr.g th { font-size: 13px; text-align: center; border-bottom: 1px solid var(--rule); }
table.res .gs { border-left: 1px solid var(--rule); }
table.res .grp td { background: #fafcff; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); text-align: left; padding-top: 8px; }
table.res .avg { font-weight: 600; background: rgba(10,42,92,.025); }
table.res td.best { color: var(--blue); font-weight: 700; }
table.res td.best > span:not(.pm) { background: rgba(0,100,224,.1); border-radius: 4px; padding: 1px 3px; }
table.res .delta { font-weight: 600; color: var(--ink-soft); }
table.res .ours td { background: #eef5ff; }
table.res .ours td.avg { background: #e3eefe; }
table.res .ours td:first-child { font-weight: 700; color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
table.res .ours td.delta { color: var(--orange-ink); font-weight: 700; }
table.res .sub td:first-child { padding-left: 24px; }
table.res .ico { font-size: 12px; margin-left: 3px; }
table.res .pm { display: block; font-size: 10px; line-height: 1; color: var(--ink-faint); font-weight: 500; }
.tcap .pm { display: inline; font-size: 12px; }
table.res.compact { font-size: 14.5px; }
table.res.compact td, table.res.compact th { padding: 6px 14px; }
.frozen { color: var(--blue); font-weight: 700; }
.tcap { font-size: 13.5px; color: var(--ink-soft); margin: 0 2px 14px; }
.tcap b { color: var(--blue-deep); }
.rtitle { font-family: var(--display); font-size: 20px; color: var(--blue-deep); margin: 34px 0 2px; }

.wins { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 20px 0 22px; }
.win { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.win .l { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.win .v { font-family: var(--display); font-size: 28px; font-weight: 700; color: var(--orange); line-height: 1.2; }
.win .c { font-size: 13px; color: var(--ink-soft); }
.win .c b { color: var(--orange-ink); }

/* ---------- analysis sub-sections ---------- */
.ana-head { margin-bottom: 10px; }
.ana-head .kick { display: inline-flex; align-items: center; gap: 8px; font: 700 12.5px var(--mono); color: var(--blue); letter-spacing: .04em; }
.ana-head .kick .pill { background: var(--blue); color: #fff; border-radius: 6px; padding: 2px 9px; font-family: var(--sans); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.ana-head h2 { font-family: var(--display); font-size: 29px; margin: 8px 0 0; letter-spacing: -.015em; color: var(--blue-deep); }
section.ana { padding-top: 56px; }
.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.phases.v { grid-template-columns: 1fr; margin-top: 0; }
.phases.v .phase { display: flex; gap: 12px; align-items: flex-start; }
.phase .mk { flex: 0 0 12px; height: 12px; margin-top: 5px; }
.phase .mk.m1 { background: #d4a017; border-radius: 2px; }
.phase .mk.m2 { border: 2.5px solid #e3b341; border-radius: 50%; }
.phase .mk.m3 { width: 0; height: 0; flex-basis: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid #ecd28c; }
.phase { border-radius: 10px; padding: 10px 12px; border: 1px solid var(--rule); background: #fff; }
.phase .s { font: 700 11.5px var(--mono); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.phase h4 { margin: 2px 0 3px; font-size: 15px; color: var(--blue-deep); }
.phase p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }

/* ---------- layout ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; }

.chart { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 12px 16px 10px; box-shadow: var(--shadow-sm); margin: 10px 0 8px; }
.chart .cg { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 8px 0 2px; }
.chart .cg:first-child { margin-top: 0; }
.bar-row { display: grid; grid-template-columns: 128px 1fr 86px; align-items: center; gap: 10px; margin: 4px 0; font-size: 13.5px; }
.bar-row .name { color: var(--ink-soft); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { position: relative; display: block; height: 14px; background: var(--rule-soft); border-radius: 4px; }
.bar-row .fill { display: block; height: 100%; width: 0; background: var(--blue-soft); border-radius: 4px; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.bar-row .ref { position: absolute; top: -4px; bottom: -4px; border-left: 2px dashed var(--blue-deep); opacity: .45; }
.bar-row .val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row .dn { font-size: 12px; font-weight: 700; color: var(--orange-ink); margin-left: 6px; }
.bar-row.is-ours .fill { background: linear-gradient(90deg, var(--blue), var(--blue-hi)); }
.bar-row.is-ours .name, .bar-row.is-ours .val { color: var(--blue); font-weight: 700; }
.axis { display: grid; grid-template-columns: 128px 1fr 86px; gap: 10px; font-size: 11px; color: var(--ink-faint); margin-top: 4px; }
.axis span:nth-child(2) { display: flex; justify-content: space-between; }

/* ---------- bibtex ---------- */
.bib { position: relative; background: #f6f8fb; color: var(--ink); border: 1px solid var(--rule); border-radius: 14px; padding: 22px 24px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.65; overflow-x: auto; }
.bib pre { margin: 0; white-space: pre; }
.copy { position: absolute; top: 12px; right: 12px; border: 1px solid var(--rule); background: #fff;
  color: var(--blue-deep); font: 600 12.5px var(--sans); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.copy:hover { background: var(--blue); border-color: var(--blue); color: #fff; }

footer { margin-top: 80px; padding: 30px 0 46px; border-top: 1px solid var(--rule); color: var(--ink-faint); font-size: 14px; text-align: center; }

/* reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .stats, .insights { grid-template-columns: repeat(2, 1fr); }
  .wins { grid-template-columns: repeat(2, 1fr); }
  .two-col, .finding, .recipe, .rules, .stages, .phases { grid-template-columns: 1fr; }
  .finding.flip .text { order: 0; }
  .actions { grid-template-columns: repeat(2, 1fr); }
  .grid-bpe { grid-template-columns: 110px repeat(3, 1fr); font-size: 13px; }
  .flow { flex-direction: column; } .flow .arr { transform: rotate(90deg); flex-basis: 26px; }
  .stage { border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .nav .links { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .stats, .actions, .insights { grid-template-columns: 1fr; }
  .grid-bpe { display: block; } .grid-bpe .h { display: none; }
  .trace .ln { grid-template-columns: 26px 54px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .bar-row .fill { transition: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
.axis i { font-style: normal; }

/* ================= motion ================= */
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: linear-gradient(90deg, var(--blue), var(--blue-hi)); }
.nav { position: sticky; }

header { position: relative; overflow: hidden; }
header::before, header::after { content: ""; position: absolute; z-index: 0; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; }
header::before { width: 520px; height: 520px; left: -140px; top: -180px; background: radial-gradient(circle, #cfe2ff, transparent 70%); animation: drift1 18s ease-in-out infinite alternate; }
header::after { width: 460px; height: 460px; right: -120px; top: 40px; background: radial-gradient(circle, #d9e7ff, transparent 70%); animation: drift2 22s ease-in-out infinite alternate; }
header > .wrap { position: relative; z-index: 1; }
@keyframes drift1 { to { transform: translate(180px, 120px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-200px, 80px) scale(.9); } }

.title .accent { background-size: 200% auto; background-image: linear-gradient(90deg, var(--blue), var(--blue-hi), #5aa9ff, var(--blue)); animation: sheen 6s linear infinite; }
@keyframes sheen { to { background-position: 200% center; } }
.badge .dot { animation: ping 2s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255,95,5,.35); } 100% { box-shadow: 0 0 0 9px rgba(255,95,5,0); } }

.stagger > * { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i, 0) * 90ms); }
.stagger.in > *, .in .stagger > * { opacity: 1; transform: none; }

.stat, .win, .act, .rule, .panel, .phase, .stage { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.stat:hover, .win:hover, .act:hover, .rule:hover, .panel:hover, .phase:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #c8daf6; }

.flow .arr span { position: relative; display: block; width: 100%; height: 2px; background: var(--blue-soft); overflow: visible; }
.flow .arr span::after { content: ""; position: absolute; right: -2px; top: -4px; border-left: 7px solid var(--blue-soft); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.flow .arr span::before { content: ""; position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 8px rgba(0,100,224,.6); animation: flowdot 1.8s linear infinite; }
.flow .arr:nth-child(4) span::before { animation-delay: .6s; } .flow .arr:nth-child(6) span::before { animation-delay: 1.2s; }
@keyframes flowdot { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
.flow .node.hl { animation: glow 3s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(0,100,224,.12), var(--shadow-md); } }

.trace { position: relative; }
.trace-bar { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 8px; font: 600 11.5px var(--sans); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }
.trace-bar .live { display: inline-flex; align-items: center; gap: 7px; }
.trace-bar .live i { width: 7px; height: 7px; border-radius: 50%; background: #9aa9bd; }
.trace.playing .trace-bar .live i { background: #16a34a; animation: ping-g 1.4s ease-out infinite; }
@keyframes ping-g { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.4); } 100% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } }
.replay { border: 1px solid var(--rule); background: #fff; color: var(--blue-deep); font: 600 12px var(--sans); padding: 3px 10px; border-radius: 7px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.replay:hover { border-color: var(--blue); color: var(--blue); }
.trace.js .ln { opacity: 0; transform: translateX(-6px); transition: opacity .35s ease, transform .35s ease; }
.trace.js .ln.on { opacity: 1; transform: none; }
.trace .ln.cur > span:last-child::after { content: "\258D"; color: var(--blue); margin-left: 2px; animation: blink 1s steps(1) infinite; }
.trace .ln.on.bpe-hit { background: linear-gradient(90deg, rgba(0,100,224,.07), transparent 70%); border-radius: 5px; }
@keyframes blink { 50% { opacity: 0; } }

.figure img { cursor: zoom-in; transition: transform .35s ease; }
.figure { transition: box-shadow .25s ease, transform .25s ease; }
.figure:hover { box-shadow: var(--shadow-md); }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10,26,51,.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 4vh 4vw; opacity: 0; pointer-events: none; transition: opacity .25s ease; cursor: zoom-out; }
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 100%; max-height: 92vh; background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); transform: scale(.96); transition: transform .25s ease; }
.lightbox.open img { transform: none; }

@media (prefers-reduced-motion: reduce) {
  header::before, header::after, .title .accent, .badge .dot, .flow .arr span::before, .flow .node.hl, .trace.playing .trace-bar .live i { animation: none; }
  .stagger > * { opacity: 1; transform: none; transition: none; }
  .trace.js .ln { opacity: 1; transform: none; transition: none; }
}
@media (max-width: 900px) { .flow .arr { transform: none; flex-basis: 22px; } .flow .arr span { width: 2px; height: 100%; } .flow .arr span::after, .flow .arr span::before { display: none; } }

/* ================= analysis motion ================= */
section.ana { position: relative; overflow: hidden; }
.ana-head { position: relative; }
.ana-head::before { content: attr(data-n); position: absolute; right: 0; top: -54px; z-index: 0; pointer-events: none;
  font: 700 150px/1 var(--display); color: rgba(0,100,224,.055); letter-spacing: -.04em; transform: translateY(var(--py, 0px)); }
.ana-head > * { position: relative; z-index: 1; }

.kpis { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 6px; }
.kpi { display: flex; align-items: baseline; gap: 8px; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--orange-rule); box-shadow: var(--shadow-sm); }
.kpi b { font: 700 19px var(--display); color: var(--orange); }
.kpi span { font-size: 13px; color: var(--ink-soft); }

/* text slides in, figure wipes in like a plot being drawn */
.ana .finding.reveal .text, #findings .finding.reveal .text { opacity: 0; transform: translateX(-26px); transition: opacity .7s ease .1s, transform .7s cubic-bezier(.2,.8,.2,1) .1s; }
.ana .finding.reveal.in .text, #findings .finding.reveal.in .text { opacity: 1; transform: none; }
.ana .reveal .figure img, #findings .reveal .figure img { clip-path: inset(0 100% 0 0); transition: clip-path 1.3s cubic-bezier(.6,.05,.3,1) .25s, transform .35s ease; }
.ana .reveal.in .figure img, #findings .reveal.in .figure img { clip-path: inset(0 0 0 0); }
.ana .reveal .figcol .caption, #findings .reveal .figcol .caption { opacity: 0; transform: translateY(6px); transition: opacity .5s ease 1.3s, transform .5s ease 1.3s; }
.ana .reveal.in .figcol .caption, #findings .reveal.in .figcol .caption { opacity: 1; transform: none; }
.ana .figure:hover img, #findings .figure:hover img { transform: scale(1.015); }

/* linked text <-> figure regions */
.ovl { position: relative; }
.ovl .band { position: absolute; border-radius: 6px; pointer-events: auto; cursor: pointer; opacity: 0; transition: background .35s ease, box-shadow .35s ease, opacity .5s ease 1.4s; }
.reveal.in .ovl .band { opacity: 1; }
.linked.has-active .ovl .band { background: rgba(255,255,255,.5); }
.linked .ovl .band.active { background: rgba(0,100,224,.07); box-shadow: inset 0 0 0 2px rgba(0,100,224,.55); }
.linked [data-k] { transition: background .3s ease, border-color .3s ease, box-shadow .3s ease, transform .2s ease; cursor: pointer; }
.linked .phase.active { border-color: var(--blue); background: var(--tint-2); box-shadow: inset 3px 0 0 var(--blue), var(--shadow-sm); }
.linked li[data-k] { border-radius: 8px; padding: 4px 8px 4px 22px; margin-left: -8px; }
.linked li[data-k]::before { left: 9px; }
.linked li.active { background: var(--tint-2); box-shadow: inset 3px 0 0 var(--blue); }
.linked .hint { font-size: 12px; color: var(--ink-faint); margin: 4px 0 0; }

/* Analysis 2 mini bars */
.mini { margin-top: 8px; display: grid; gap: 5px; }
.mb { display: grid; grid-template-columns: 54px 1fr 44px; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-faint); }
.mb i { display: block; height: 8px; border-radius: 4px; background: var(--rule-soft); overflow: hidden; }
.mb em { display: block; height: 100%; width: 0; border-radius: 4px; background: #9fb6d6; transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.mb.sr em { background: linear-gradient(90deg, var(--blue), var(--blue-hi)); }
.mb b { font: 700 12px var(--mono); color: var(--blue-deep); text-align: right; }
.stages.in .mb em { width: var(--w); }
.stages.in .stage:nth-child(2) .mb em { transition-delay: .35s; }
.stages.in .stage:nth-child(3) .mb em { transition-delay: .7s; }

/* Analysis 4 legend chips */
.lg { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--c); vertical-align: middle; margin: 0 6px 2px 0; border-radius: 2px; }
.lg.dash { border-top-style: dashed; }

@media (prefers-reduced-motion: reduce) {
  .ana .finding.reveal .text, #findings .finding.reveal .text, .ana .reveal .figcol .caption, #findings .reveal .figcol .caption { opacity: 1; transform: none; transition: none; }
  .ana .reveal .figure img, #findings .reveal .figure img { clip-path: none; transition: none; }
  .ovl .band { opacity: 1; transition: none; }
  .mb em { width: var(--w); transition: none; }
}
@media (max-width: 900px) { .ana-head::before { font-size: 96px; top: -30px; } }
