/* ===========================================================
   Event-Guided Dynamic Reconstruction under Extreme Motion Blur
   Paper-toned page. Accents come from event-camera polarity:
   ON (+1) red and OFF (-1) blue, always used as a pair.
   =========================================================== */

:root {
  --paper:   #FFFAFA;
  --paper-2: #F9F0F0;
  --plate:   #FFFFFF;
  --ink:     #1C1B16;
  --ink-2:   #56544A;
  --ink-3:   #8C8A7E;
  --rule:      rgba(28, 27, 22, .16);
  --rule-soft: rgba(28, 27, 22, .085);
  /* Periwinkle, two steps of one hue. The tint is the brand colour and carries
     dark text; at 1.5:1 on paper it cannot be text itself, so the deeper step
     handles links, labels and borders. Event polarity red/blue is not a UI
     colour -- it appears only in the mark and the hero gradient. */
  --accent:      #4D4DD5;
  --accent-tint: #CCCCFF;

  /* Literata is a screen-reading serif: low contrast, sturdy, open. */
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(20px, 5vw, 56px);
  --max:    1080px;
  --measure: 70ch;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.62;
  font-weight: 400;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.prose { max-width: var(--measure); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--ink);
  text-decoration-color: rgba(77, 77, 213, .5);
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
  transition: color .16s ease, text-decoration-color .16s ease;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
strong { font-weight: 600; }

.scene-name { font-style: italic; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff; padding: 10px 18px; z-index: 200; }
.skip:focus { left: 12px; top: 12px; }

/* --- nav --------------------------------------------------- */

.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  padding: 10px var(--gutter);
  background: rgba(255, 250, 250, .88);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--sans);
}
.nav__mark {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13.5px; letter-spacing: -.005em;
  text-decoration: none; white-space: nowrap; flex: none;
}
.nav__mark:hover { color: var(--ink); }
.nav__dots { width: 20px; height: 20px; flex: none; }
.nav__links { margin-left: auto; display: flex; gap: 7px; flex: none; }

.pill {
  display: inline-flex; align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none; color: var(--ink);
  background: transparent; cursor: pointer; white-space: nowrap;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.pill:hover { border-color: var(--accent); background: rgba(77, 77, 213, .08); color: var(--accent); }
.pill--muted { color: var(--ink-3); border-style: dashed; }
.pill--muted:hover { color: var(--ink-2); background: transparent; border-color: var(--rule); }
.pill--primary { background: var(--accent-tint); border-color: var(--accent-tint); color: var(--ink); font-weight: 600; }
.pill--primary:hover { background: #AAAAFA; border-color: #AAAAFA; color: var(--ink); }

@media (max-width: 680px) { .nav__mark span { display: none; } }

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

.hero { padding: clamp(34px, 5vw, 58px) 0 0; }

.hero__venue {
  font-family: var(--sans);
  font-size: 13.5px; color: var(--ink-2);
  margin: 0 0 clamp(22px, 3.2vw, 30px);
}

.hero__title {
  font-weight: 400;
  font-size: clamp(32px, 5.4vw, 57px);
  line-height: 1.1;
  letter-spacing: -.023em;
  margin: 0 0 clamp(10px, 1.4vw, 14px);
  max-width: 20ch;
  text-wrap: balance;
}
.hero__title .l2 { display: block; font-style: italic; color: #3B3930; }

/* Polarity gradient across the italic line: ON red through to OFF blue, held
   back so it sits under the roman line rather than competing with it. The stops
   are #C62B38 / #8B3A86 / #1A5FC4 pre-blended 80% onto --paper, rather than an
   opacity -- the load animation ends on opacity:1 and would cancel that. Re-blend
   them if --paper changes. Guarded, because without background-clip the text
   would paint transparent. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero__title .l2 {
    background: linear-gradient(104deg, #D1545F 4%, #A2609D 46%, #487ECF 92%);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

/* One orchestrated moment: the title resolves out of blur, which is
   what the method itself does. */
@media (prefers-reduced-motion: no-preference) {
  .hero__title .l1, .hero__title .l2 {
    display: block;
    animation: resolve 1050ms cubic-bezier(.17, .67, .3, 1) both;
    will-change: filter, opacity;
  }
  .hero__title .l2 { animation-delay: 150ms; }
  @keyframes resolve {
    0%   { filter: blur(13px); opacity: 0; transform: translateX(-8px); }
    55%  { filter: blur(3px);  opacity: 1; transform: translateX(2px); }
    100% { filter: blur(0);    opacity: 1; transform: translateX(0); }
  }
}

.hero__lead {
  font-size: clamp(17.5px, 1.9vw, 19.5px);
  line-height: 1.55;
  color: #35332B;
  max-width: 58ch;
  margin: 0 0 clamp(22px, 3.2vw, 30px);
}

.authors {
  font-family: var(--sans);
  max-width: 76ch; margin: 0 0 8px;
  font-size: 15px; line-height: 1.7;
}
.authors sup, .affils sup { color: var(--accent); font-size: .72em; }
/* First author carries their own link, set bold by the usual convention. */
.authors a { font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: .18em; }

.affils {
  font-family: var(--sans);
  max-width: 76ch; margin: 0 0 clamp(20px, 3vw, 28px);
  font-size: 13.5px; color: var(--ink-2); line-height: 1.65;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(30px, 4.4vw, 46px); }
.actions .pill { padding: 10px 18px; font-size: 14.5px; }

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

figure { margin: 0; }
.plate {
  background: var(--plate);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: clamp(8px, 1.1vw, 13px);
}
.plate img { display: block; width: 100%; height: auto; }

figcaption, .caption {
  font-family: var(--sans);
  margin-top: 11px;
  font-size: 13.5px; line-height: 1.5;
  color: var(--ink-2);
  max-width: 92ch;
}
figcaption b { color: var(--ink); font-weight: 600; }

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

.section { padding: clamp(34px, 4.6vw, 62px) 0; border-top: 1px solid var(--rule-soft); }
[id] { scroll-margin-top: 66px; }

.section__eyebrow {
  font-family: var(--sans);
  font-size: 13px; font-weight: 600; color: var(--accent);
  margin: 0 0 10px;
}
.section__title {
  font-weight: 400;
  font-size: clamp(25px, 3.3vw, 36px);
  line-height: 1.17;
  letter-spacing: -.018em;
  margin: 0 0 clamp(14px, 1.8vw, 20px);
  max-width: 24ch;
  text-wrap: balance;
}

/* --- method ------------------------------------------------- */

.method__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(22px, 3.4vw, 42px);
  align-items: start;
  margin-bottom: clamp(26px, 3.6vw, 40px);
}
@media (max-width: 760px) { .method__grid { grid-template-columns: 1fr; } }

/* The pipeline diagram is tall; cap it so it stays one glance rather than one screen. */
.pipeline { max-width: 640px; }

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

.deltas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: clamp(16px, 2.6vw, 34px);
  margin: 0 0 clamp(26px, 3.6vw, 38px);
}
.delta__label { font-family: var(--sans); font-size: 13px; color: var(--ink-2); margin: 0 0 7px; }
.delta__row { display: flex; align-items: baseline; gap: 8px; font-size: 23px; letter-spacing: -.015em; margin: 0; }
.delta__from { color: var(--ink-3); }
.delta__arrow { width: 13px; height: 1px; background: var(--ink-3); align-self: center; flex: none; }
.delta__to { font-weight: 600; }
.delta__gain { font-family: var(--sans); margin: 6px 0 0; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.delta__base { font-family: var(--sans); margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

.tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.tab {
  font-family: var(--serif); font-style: italic;
  font-size: 13.5px; padding: 8px 13px;
  border: 1px solid var(--rule); background: transparent; color: var(--ink-2);
  border-radius: 3px; cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.tab:hover { color: var(--ink); border-color: var(--ink-3); }
.tab[aria-selected="true"] { color: var(--accent); border-color: var(--accent); background: rgba(204, 204, 255, .40); }

.videoframe {
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  overflow: hidden;
  background: var(--plate);
}
.videoframe video {
  display: block; width: 100%; height: auto;
  /* Reserve the box so swapping sources cannot collapse the layout. */
  aspect-ratio: var(--ar, 16 / 9);
  background: var(--plate);
}

/* --- tables -------------------------------------------------- */

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  -webkit-overflow-scrolling: touch;
  margin-top: clamp(26px, 3.6vw, 40px);
}
/* Fade the trailing edge while columns are still off-screen. */
.tablewrap.can-scroll {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 52px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 52px), transparent);
}

table.data {
  width: 100%; border-collapse: collapse;
  font-family: var(--sans);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  min-width: 700px;
}
table.data th, table.data td {
  padding: 9px 13px; text-align: right;
  border-bottom: 1px solid var(--rule-soft);
  white-space: nowrap;
}
table.data thead th {
  background: var(--paper-2);
  font-weight: 600; color: var(--ink-2); font-size: 12.5px;
}
table.data thead tr:first-child th { border-bottom: 1px solid var(--rule); }
table.data th.grp { text-align: center; color: var(--ink); }
table.data .m { text-align: left; font-weight: 500; color: var(--ink); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.rule-above td,
table.data tbody tr.rule-above th { border-top: 1px solid var(--rule); }

td.r1 { background: rgba(28, 27, 22, .115); font-weight: 700; }
td.r2 { background: rgba(28, 27, 22, .058); }
td.r3 { background: rgba(28, 27, 22, .026); }

tr.ours td, tr.ours .m { background-color: rgba(204, 204, 255, .42); }
tr.ours td.r1 { background: rgba(204, 204, 255, 1); }
tr.ours td.r2 { background: rgba(204, 204, 255, .72); }
tr.ours .m { font-weight: 700; box-shadow: inset 2px 0 0 var(--accent); }

.legend {
  font-family: var(--sans);
  display: flex; flex-wrap: wrap; gap: 7px 18px;
  margin-top: 11px; font-size: 12.5px; color: var(--ink-3);
  align-items: center;
}
.legend i {
  display: inline-block; width: 20px; height: 10px;
  border-radius: 2px; margin-right: 6px; vertical-align: -1px;
  border: 1px solid var(--rule-soft);
}
.legend .k1 { background: rgba(28, 27, 22, .115); }
.legend .k2 { background: rgba(28, 27, 22, .058); }
.legend .k3 { background: rgba(28, 27, 22, .026); }

/* --- paper / citation ---------------------------------------- */

.cite { position: relative; margin-top: clamp(22px, 3vw, 30px); }
.cite pre {
  margin: 0;
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px; line-height: 1.7;
  color: #403E35;
}
.cite__copy { position: absolute; top: 10px; right: 10px; background: var(--paper); }

@media (max-width: 680px) {
  body { font-size: 16.5px; }
  .delta__row { font-size: 21px; }
}
