/* ==========================================================================
   LARS-3D — project page
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --bg:            #ffffff;
  --bg-alt:        #f7f8fa;
  --surface:       #ffffff;
  --surface-2:     #f2f4f7;
  --plate:         #ffffff;
  --line:          #e3e6ec;
  --line-strong:   #cfd4dd;
  --text:          #11151c;
  --text-2:        #4d5663;
  --text-3:        #7a8392;
  --accent:        #d81e3f;
  --accent-soft:   #fdeef1;
  --accent-text:   #b5162f;
  --blue:          #1864d6;
  --blue-soft:     #eaf1fd;
  --shadow-sm:     0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md:     0 4px 12px rgba(16, 24, 40, .07), 0 2px 4px rgba(16, 24, 40, .04);
  --shadow-lg:     0 18px 48px rgba(16, 24, 40, .12);
  --hero-grad:     radial-gradient(1200px 620px at 50% -12%, #eef3fb 0%, rgba(255,255,255,0) 72%);
  --radius:        16px;
  --maxw:          1180px;
  color-scheme:    light;
}

html[data-theme="dark"] {
  --bg:            #0a0c10;
  --bg-alt:        #0e1116;
  --surface:       #13171e;
  --surface-2:     #191e26;
  --plate:         #f4f5f7;
  --line:          #232933;
  --line-strong:   #333b48;
  --text:          #eef1f6;
  --text-2:        #a9b2c0;
  --text-3:        #7b8595;
  --accent:        #ff476b;
  --accent-soft:   #2a1119;
  --accent-text:   #ff7490;
  --blue:          #66a6ff;
  --blue-soft:     #0f1b2c;
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md:     0 6px 18px rgba(0, 0, 0, .45);
  --shadow-lg:     0 24px 60px rgba(0, 0, 0, .55);
  --hero-grad:     radial-gradient(1100px 600px at 50% -14%, #172235 0%, rgba(10,12,16,0) 70%);
  color-scheme:    dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 86px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.022em; font-weight: 700; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

code, .mono, .num {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.narrow { max-width: 820px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 8px;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background-color .2s ease;
}
.site-header.is-stuck { border-bottom-color: var(--line); }

.site-header .wrap {
  display: flex; align-items: center; gap: 20px;
  height: 64px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: -0.03em; font-size: 1.05rem;
  color: var(--text); text-decoration: none; flex: none;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a {
  color: var(--text-2); font-size: .92rem; font-weight: 500;
  padding: 7px 12px; border-radius: 9px; text-decoration: none;
  transition: color .18s ease, background-color .18s ease;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-nav a.active { color: var(--accent-text); background: var(--accent-soft); }

.theme-toggle {
  flex: none; margin-left: 8px;
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all .18s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.theme-toggle svg { width: 18px; height: 18px; }
html[data-theme="dark"] .theme-toggle .i-sun  { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.theme-toggle .i-sun  { display: none; }
.theme-toggle .i-moon { display: block; }

@media (max-width: 860px) { .site-nav { display: none; } }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 78px 0 56px;
  background: var(--hero-grad);
  border-bottom: 1px solid var(--line);
}
#hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: .85; pointer-events: none;
  /* keep the sweep off the text: clear in the middle, lively at the edges */
  -webkit-mask-image: radial-gradient(ellipse 56% 58% at 50% 48%,
                       rgba(0,0,0,0) 30%, rgba(0,0,0,.30) 62%, #000 100%);
          mask-image: radial-gradient(ellipse 56% 58% at 50% 48%,
                       rgba(0,0,0,0) 30%, rgba(0,0,0,.30) 62%, #000 100%);
}
html[data-theme="dark"] #hero-canvas { opacity: .9; }
.hero .wrap { position: relative; z-index: 1; text-align: center; }

.venue {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 15px 6px 7px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: .82rem; font-weight: 600; color: var(--text-2);
  letter-spacing: .01em; margin-bottom: 26px;
}
.venue .pill {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 3px 10px; font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(3.1rem, 9.5vw, 5.6rem);
  letter-spacing: -0.05em; font-weight: 800;
  margin: 0 auto 16px; line-height: 1;
}
.hero h1 .mark {
  background: linear-gradient(100deg, var(--accent) 10%, #ff7a3d 92%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .paper-title {
  font-size: clamp(1.08rem, 2.45vw, 1.6rem);
  font-weight: 650; letter-spacing: -0.028em; line-height: 1.27;
  color: var(--text); max-width: 27ch; margin: 0 auto 16px;
}
.hero .subtitle {
  font-size: clamp(.96rem, 1.7vw, 1.08rem);
  color: var(--text-2); font-weight: 450;
  max-width: 54ch; margin: 0 auto 32px; letter-spacing: -0.008em;
}
.hero .subtitle b { color: var(--text); font-weight: 650; }

.authors {
  font-size: 1.04rem; margin: 0 auto 6px; max-width: 880px;
  color: var(--text); font-weight: 500;
}
.authors a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.authors a:hover { color: var(--accent-text); border-bottom-color: var(--accent); text-decoration: none; }
.authors sup { color: var(--accent-text); font-weight: 700; font-size: .72em; }
.affil { color: var(--text-3); font-size: .93rem; margin: 0 0 4px; }
.affil sup { color: var(--accent-text); font-weight: 700; }
.corresp { color: var(--text-3); font-size: .86rem; margin: 0; }

/* buttons */
.btn-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 11px;
  margin-top: 32px;
}
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 19px; border-radius: 11px;
  font-size: .94rem; font-weight: 600; letter-spacing: -0.005em;
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}
.btn:hover {
  text-decoration: none; transform: translateY(-2px);
  box-shadow: var(--shadow-md); border-color: var(--text-3);
}
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }
.btn[aria-disabled="true"] {
  opacity: .55; cursor: not-allowed; pointer-events: none;
}
.btn .tag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-3);
}

/* ---------- sections ---------- */
.section { padding: 84px 0; }
.section.alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section-head { margin-bottom: 40px; }
.section-head.center { text-align: center; }
.eyebrow {
  display: block; font-size: .76rem; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent-text); margin-bottom: 12px;
}
.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem); letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.section-head p { color: var(--text-2); max-width: 70ch; font-size: 1.02rem; }
.section-head.center p { margin-inline: auto; }

/* ---------- figure plate ---------- */
.plate {
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
html[data-theme="dark"] .plate {
  border-color: #2a3240;
  /* the plate stays light in dark mode, so its text tokens flip back */
  --text: #11151c; --text-2: #434c59; --text-3: #6b7482;
  --surface-2: #e9ecf1; --line: #dfe3ea;
  color: var(--text);
}
.plate img { margin-inline: auto; border-radius: 6px; }
.plate.zoomable img { cursor: zoom-in; }
.caption {
  margin-top: 16px; font-size: .9rem; line-height: 1.6; color: var(--text-2);
  max-width: 92ch;
}
.caption b, .caption strong { color: var(--text); font-weight: 650; }
figure { margin: 0; }
figure > .caption { padding-inline: 2px; }

.scroll-x {
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

/* ---------- abstract + highlights ---------- */
.abstract-grid {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 48px; align-items: start;
}
@media (max-width: 920px) { .abstract-grid { grid-template-columns: 1fr; gap: 36px; } }

.abstract-body p { color: var(--text-2); font-size: 1.04rem; }
.abstract-body strong { color: var(--text); font-weight: 650; }

.tldr {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.tldr h3 { font-size: .78rem; letter-spacing: .13em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 14px; }
.tldr ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.tldr li { position: relative; padding-left: 26px; font-size: .95rem; color: var(--text-2); line-height: 1.55; }
.tldr li::before {
  content: ""; position: absolute; left: 0; top: .52em;
  width: 9px; height: 9px; border-radius: 3px; background: var(--accent);
}
.tldr li b { color: var(--text); font-weight: 650; }

/* key-number strip */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  margin-top: 44px;
}
.kpi { background: var(--surface); padding: 24px 22px; }
.kpi .v {
  font-size: clamp(1.6rem, 3.2vw, 2.1rem); font-weight: 800; letter-spacing: -0.035em;
  line-height: 1.1; display: block; color: var(--text);
}
.kpi .v .u { font-size: .52em; font-weight: 700; color: var(--text-3); margin-left: 3px; letter-spacing: 0; }
.kpi .k { display: block; margin-top: 7px; font-size: .84rem; color: var(--text-3); line-height: 1.4; }
.kpi.hl .v { color: var(--accent-text); }

/* ---------- method ---------- */
.method-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 18px; margin-top: 40px;
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card .step {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 9px; background: var(--accent-soft); color: var(--accent-text);
  font-size: .82rem; font-weight: 800; margin-bottom: 14px;
}
.card h3 { font-size: 1.06rem; margin-bottom: 9px; letter-spacing: -0.02em; }
.card p { font-size: .93rem; color: var(--text-2); line-height: 1.6; }

.split {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px; margin-top: 36px; align-items: start;
}

/* ---------- equation ---------- */
.eq {
  margin-top: 36px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 30px 26px 26px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.eq .note {
  font-size: .9rem; color: var(--text-2); max-width: 70ch; margin-top: 22px;
}
.eq .note em { font-style: normal; font-family: "Liberation Serif", "Times New Roman", Times, serif; }

/* display equation, set the way the paper sets it */
.eq-display {
  font-family: "Liberation Serif", "Times New Roman", Times, serif;
  font-size: clamp(1.35rem, 3.4vw, 1.95rem);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); line-height: 1;
  overflow-x: auto; max-width: 100%; padding: 4px 2px 6px;
}
.eq-display b {                        /* matrices and vectors: upright bold */
  font-weight: 700; font-style: normal;
}
.eq-display .eq-term {                    /* keeps an index tied to its own symbol */
  display: inline-flex; align-items: baseline;
}
.eq-display .eq-term i {                  /* indices: italic, lowered */
  font-style: italic; font-size: .6em;
  transform: translateY(.24em);
  margin-left: .05em; margin-right: .06em;
}
.eq-display .eq-greek { font-style: italic; }
.eq-display .eq-op { margin: 0 .34em; font-style: normal; }
.eq-display .eq-op.tight { margin: 0 .22em; }

.eq-display .eq-frac {
  display: inline-flex; flex-direction: column; align-items: center;
  margin: 0 .1em;
}
.eq-display .eq-frac .eq-num,
.eq-display .eq-frac .eq-den {
  display: flex; align-items: center; justify-content: center;
  padding: 0 .5em; white-space: nowrap;
}
.eq-display .eq-frac .eq-num { padding-bottom: .18em; border-bottom: .055em solid currentColor; }
.eq-display .eq-frac .eq-den { padding-top: .18em; }

.eq-display .eq-sum {
  display: inline-flex; flex-direction: column; align-items: center;
  margin-right: .18em; line-height: .9;
}
.eq-display .eq-sum { font-size: 1.45em; }
.eq-display .eq-sum .eq-lim { font-size: .34em; font-style: italic; margin-top: .18em; padding-left: .12em; }

/* symbol key under the equation */
.eq-key {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px;
  margin: 24px 0 0; padding: 0;
}
.eq-key > div { display: flex; align-items: baseline; gap: 8px; }
.eq-key dt {
  font-family: "Liberation Serif", "Times New Roman", Times, serif;
  font-size: 1.02rem; margin: 0;
}
.eq-key dd { margin: 0; font-size: .86rem; color: var(--text-3); }
.eq-key b { font-weight: 700; }
.eq-key .eq-greek { font-style: italic; }

/* ---------- dataset ---------- */
.gallery {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
@media (max-width: 760px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
.gallery figure {
  border-radius: 13px; overflow: hidden; border: 1px solid var(--line);
  background: var(--plate); box-shadow: var(--shadow-sm); position: relative;
  cursor: zoom-in;
}
.gallery img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; transition: transform .45s cubic-bezier(.2,.7,.3,1); }
.gallery figure:hover img { transform: scale(1.045); }
.gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 13px 10px; font-size: .78rem; font-weight: 600; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0));
  letter-spacing: .01em;
}

/* compare slider */
.compare {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: var(--plate);
  box-shadow: var(--shadow-sm); touch-action: pan-y;
  --pos: 50%;
}
.compare img { width: 100%; display: block; }
.compare .after {
  position: absolute; inset: 0;
  clip-path: inset(0 0 0 var(--pos));
}
.compare .divider {
  position: absolute; top: 0; bottom: 0; left: var(--pos);
  width: 2px; background: var(--accent); transform: translateX(-1px);
  pointer-events: none; box-shadow: 0 0 0 1px rgba(255,255,255,.55);
}
.compare .knob {
  position: absolute; top: 50%; left: var(--pos);
  width: 42px; height: 42px; margin: -21px 0 0 -21px;
  border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; pointer-events: none;
  box-shadow: 0 3px 14px rgba(0,0,0,.3);
}
.compare .knob svg { width: 20px; height: 20px; }
.compare input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none;
  background: transparent;
}
.compare .lbl {
  position: absolute; top: 12px; padding: 5px 11px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: rgba(10,12,16,.72); color: #fff; backdrop-filter: blur(6px); pointer-events: none;
}
.compare .lbl.l { left: 12px; }
.compare .lbl.r { right: 12px; }

/* class chips */
.classes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 6px 34px; margin-top: 10px;
}
.cls {
  display: grid; grid-template-columns: 15px minmax(84px, auto) 1fr auto;
  align-items: center; gap: 11px;
  padding: 7px 2px; border-bottom: 1px solid var(--line);
  font-size: .87rem;
}
.cls:last-child { border-bottom: 0; }
.cls .sw { width: 13px; height: 13px; border-radius: 4px; border: 1px solid rgba(128,128,128,.4); }
.cls .nm { color: var(--text); font-weight: 550; white-space: nowrap; }
.cls .track { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 40px; }
.cls .fill { display: block; height: 100%; border-radius: 99px; width: 0; transition: width .9s cubic-bezier(.2,.7,.3,1); }
.cls .vl { color: var(--text-3); font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* split table */
.splits {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px;
}
.split-card {
  border: 1px solid var(--line); border-radius: 13px; padding: 18px 20px; background: var(--surface);
}
.split-card .lab { font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.split-card .big { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.03em; margin-top: 6px; }
.split-card .sub { font-size: .85rem; color: var(--text-2); margin-top: 3px; }
.split-card .bar { height: 5px; border-radius: 99px; background: var(--surface-2); margin-top: 13px; overflow: hidden; }
.split-card .bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }


/* ---------- callout ---------- */
.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 12px; background: var(--surface);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.callout h4 {
  font-size: .95rem; letter-spacing: -0.015em; margin-bottom: 8px; color: var(--text);
}
.callout p { font-size: .89rem; color: var(--text-2); line-height: 1.58; margin-bottom: .7em; }
.callout p:last-child { margin-bottom: 0; }
.callout b { color: var(--text); font-weight: 650; }
.callout .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.callout .chips span {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .76rem; padding: 3px 9px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600;
}

/* ---------- tables ---------- */
.tabs {
  display: inline-flex; gap: 3px; padding: 4px;
  background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line);
  margin-bottom: 24px; flex-wrap: wrap;
}
.tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 16px; border-radius: 9px;
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--text-2);
  transition: all .18s ease;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}

.table-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden;
}
.table-wrap .scroll-x { max-width: 100%; }
table.data {
  width: 100%; border-collapse: collapse; font-size: .89rem;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  padding: 11px 14px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2);
  font-size: .76rem; font-weight: 700; letter-spacing: .055em; text-transform: uppercase;
}
table.data th:first-child, table.data td:first-child {
  text-align: left; position: sticky; left: 0; z-index: 1;
  background: var(--surface); font-weight: 600; color: var(--text);
}
table.data thead th:first-child { z-index: 3; background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td,
table.data tbody tr:hover th { background: var(--surface-2); }
table.data td.best { font-weight: 750; color: var(--text); }
table.data td.key { font-weight: 700; }
table.data tr.ours td, table.data tr.ours td:first-child {
  background: var(--accent-soft); color: var(--text);
}
table.data tr.ours:hover td { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface-2)); }
table.data tr.ours td:first-child { color: var(--accent-text); font-weight: 750; }
table.data tr.ours td.best { color: var(--accent-text); }
table.data tr.ours td.yes { color: #16a34a; }
html[data-theme="dark"] table.data tr.ours td.yes { color: #4ade80; }
table.data tbody tr.group td {
  background: var(--bg-alt); color: var(--text-3);
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  text-align: left; padding-block: 8px;
}
table.data .sd { color: var(--text-3); font-size: .82em; font-weight: 400; }
table.data th.sep, table.data td.sep { border-left: 1px solid var(--line-strong); }
table.data .mk {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  vertical-align: -1px; margin-right: 2px;
}
.table-note {
  padding: 13px 16px; font-size: .83rem; color: var(--text-3);
  border-top: 1px solid var(--line); background: var(--bg-alt);
}
.yes { color: #16a34a; font-weight: 700; }
.no  { color: var(--text-3); }
html[data-theme="dark"] .yes { color: #4ade80; }

/* efficiency chart */
.chart-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 24px; box-shadow: var(--shadow-sm);
}
.chart-card h3 { font-size: 1.02rem; margin-bottom: 4px; }
.chart-card .sub { font-size: .87rem; color: var(--text-3); margin-bottom: 14px; }
#eff-chart { width: 100%; height: auto; display: block; overflow: visible; }
#eff-chart .grid { stroke: var(--line); stroke-width: 1; }
#eff-chart .axis { stroke: var(--line-strong); stroke-width: 1; }
#eff-chart .tick { fill: var(--text-3); font-size: 11px; font-family: inherit; }
#eff-chart .alab { fill: var(--text-2); font-size: 11.5px; font-weight: 600; }
#eff-chart .pt { fill: var(--text-3); fill-opacity: .2; stroke: var(--text-3); stroke-width: 1.5; transition: fill-opacity .2s ease; }
#eff-chart .pt-core { fill: var(--text-2); }
#eff-chart .plab { fill: var(--text-2); font-size: 11.5px; font-weight: 600; }
#eff-chart g.ours .pt { fill: var(--accent); fill-opacity: .22; stroke: var(--accent); stroke-width: 2; }
#eff-chart g.ours .pt-core { fill: var(--accent); }
#eff-chart g.ours .plab { fill: var(--accent-text); font-weight: 750; }
#eff-chart g.m:hover .pt { fill-opacity: .45; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: .82rem; color: var(--text-3); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.legend i.a { background: var(--accent); }

/* ---------- bibtex ---------- */
.bib {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm);
}
.bib-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px 11px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.bib-head span { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
  border-radius: 9px; padding: 6px 13px; font: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: all .18s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-3); }
.copy-btn.done { color: #16a34a; border-color: #16a34a; }
.copy-btn svg { width: 14px; height: 14px; }
.bib pre {
  margin: 0; padding: 20px; overflow-x: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .82rem; line-height: 1.7; color: var(--text-2);
  tab-size: 2;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); background: var(--bg-alt);
  padding: 46px 0 56px; font-size: .9rem; color: var(--text-3);
}
.footer-grid { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; align-items: flex-start; }
.site-footer a { color: var(--text-2); }
.site-footer .ack { max-width: 56ch; line-height: 1.6; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 8px 18px; }


/* ---------- inline vector figures ---------- */
.fig-svg {
  display: block; width: 100%; height: auto;
  /* the diagram is drawn on white, so it keeps its own ground in both themes */
  background: #fff;
}
.fig-hold .fig-svg { min-width: 760px; }
.fig-svg text { cursor: text; }          /* the labels are real, selectable text */

/* draw.io puts its labels in foreignObject with content-box geometry, which the
   page-wide border-box reset would collapse */
.fig-svg foreignObject, .fig-svg foreignObject * { box-sizing: content-box; }
.teaser-fig .fig-svg { min-width: 0; }

/* ---------- zoom affordance ---------- */
[data-zoom], [data-zoom-svg] { position: relative; }
[data-zoom]::after, [data-zoom-svg]::after {
  content: ""; position: absolute; right: 13px; top: 13px;
  width: 30px; height: 30px; border-radius: 9px; pointer-events: none;
  background: rgba(14, 18, 25, .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 15px no-repeat;
  backdrop-filter: blur(3px);
  opacity: 0; transform: scale(.9);
  transition: opacity .2s ease, transform .2s ease;
}
[data-zoom]:hover::after, [data-zoom]:focus-within::after,
[data-zoom-svg]:hover::after, [data-zoom-svg]:focus-within::after { opacity: 1; transform: none; }
@media (hover: none) { [data-zoom]::after, [data-zoom-svg]::after { opacity: .8; transform: none; } }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 10, 14, .9);
  display: none; align-items: center; justify-content: center;
  padding: 36px 20px; backdrop-filter: blur(6px);
}
.lightbox[open], .lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%; max-height: 100%; border-radius: 10px;
  background: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.6);
  object-fit: contain;
}
.lightbox .close {
  position: absolute; top: 18px; right: 20px;
  width: 42px; height: 42px; border-radius: 11px; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2);
  display: grid; place-items: center;
}
.lightbox .close:hover { background: rgba(255,255,255,.2); }
.lightbox .hint { position: absolute; bottom: 20px; color: rgba(255,255,255,.6); font-size: .82rem; }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.3,1); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .section { padding: 62px 0; }
  .hero { padding: 54px 0 44px; }
  .wrap { padding-inline: 18px; }
  .btn { padding: 10px 15px; font-size: .88rem; }
  .plate { padding: 12px; }
}

@media print {
  .site-header, .btn-row, .theme-toggle, #hero-canvas, .lightbox { display: none !important; }
  .section { padding: 24px 0; page-break-inside: avoid; }
  body { font-size: 11pt; }
}
