/* ==========================================================================
   EviDETR — project page
   Light "specimen sheet" treatment. Colour semantics come from the paper's
   own qualitative figure: blue = ground truth, orange = prediction / ours,
   green = saliency. The only dark surfaces are the display bezels and the
   BibTeX block — the figures are footage on a screen, not decoration.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --ground:     #F2F5F9;
  --surface:    #FFFFFF;
  --surface-2:  #F6F8FB;
  --surface-3:  #E9EEF4;

  --line:       #DAE1E9;
  --line-soft:  #E9EDF2;

  --ink:        #0F151C;
  --ink-2:      #4A5769;
  --ink-3:      #6E7B8D;

  --gt:         #1F6FD0;
  --pred:       #BE5511;
  --pred-display: #C85D14;
  --sal:        #2B7848;

  --bezel:      #10161D;

  --radius-sm:  5px;
  --radius-md:  9px;

  --col:        1140px;
  --col-wide:   1360px;
  --measure:    66ch;

  --bar-h:      58px;

  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body:    "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --shadow-sm: 0 1px 2px rgba(15, 21, 28, .05);
  --shadow-md: 0 2px 4px rgba(15, 21, 28, .05), 0 12px 28px -14px rgba(15, 21, 28, .18);

  color-scheme: light;
}

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

html {
  background: var(--ground);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }

a {
  color: var(--gt);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration: underline; }

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

::selection { background: #CFE2F8; color: var(--ink); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600; transition: top .18s ease;
}
.skip-link:focus { top: 0; text-decoration: none; }

.gr { text-transform: none; }

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  height: var(--bar-h);
  max-width: var(--col-wide);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
  display: flex; align-items: center; gap: 20px;
}

.brand {
  display: flex; align-items: center;
  color: var(--ink); text-decoration: none; flex: 0 0 auto;
}
.brand:hover { text-decoration: none; }
.brand:focus-visible { outline-offset: 5px; }

.brand__name {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 84, "wght" 700;
  font-size: 1.34rem;
  letter-spacing: 0.005em;
  line-height: 1;
}

.topbar__nav {
  display: flex; align-items: center; gap: 2px;
  margin-left: auto; flex-wrap: nowrap;
  overflow-x: auto; scrollbar-width: none;
  -ms-overflow-style: none;
}
.topbar__nav::-webkit-scrollbar { display: none; }

.topbar__nav a {
  font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 7px 11px; border-radius: var(--radius-sm);
  white-space: nowrap; transition: color .16s ease, background .16s ease;
}
.topbar__nav a:hover { color: var(--ink); background: var(--surface-3); text-decoration: none; }

/* ==========================================================================
   Page shell
   ========================================================================== */
main { display: block; padding-top: var(--bar-h); }

.wrap { max-width: var(--col); margin: 0 auto; padding: 0 clamp(18px, 4vw, 40px); }
.wrap--wide { max-width: var(--col-wide); }

.section { padding: clamp(26px, 3.4vw, 44px) 0; }
.section--tight { padding-top: 0; }

/* section header: title · hairline */
.sec-head {
  display: flex; align-items: baseline; gap: 18px;
  margin-bottom: 26px;
}
.sec-head__title {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 88, "wght" 640;
  font-size: clamp(1.3rem, 3vw, 1.85rem);
  line-height: 1.1;
  letter-spacing: -0.008em;
  margin: 0;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.sec-head__rule {
  flex: 1 1 auto; height: 1px; background: var(--line);
  position: relative; top: -6px; min-width: 20px;
}

.lede {
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  line-height: 1.6;
  color: var(--ink);
  max-width: var(--measure);
  margin: 0 0 24px;
}

.prose { max-width: var(--measure); color: var(--ink-2); }
.prose p { margin: 0 0 18px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 600; }

.tblnote {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-3);
  margin: 14px 0 0;
  max-width: 84ch;
}

.term--s { color: var(--gt); font-weight: 600; }
.term--m { color: var(--pred); font-weight: 600; }
.term--f { color: var(--sal); font-weight: 600; }

/* ==========================================================================
   Hero — centred
   ========================================================================== */
.hero {
  padding: clamp(46px, 6vw, 78px) 0 clamp(34px, 4vw, 52px);
  text-align: center;
}

/* one title, one size — the paper's own wording, with the model name marked
   by weight and colour only */
.hero__title {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 94, "wght" 600;
  font-size: clamp(1.5rem, 3.5vw, 2.55rem);
  line-height: 1.16;
  letter-spacing: -0.014em;
  max-width: 21em;
  margin: 0 auto 30px;
  text-wrap: balance;
}
.hero__title em {
  font-style: normal;
  color: var(--pred-display);
  font-variation-settings: "wdth" 94, "wght" 780;
}

.hero__authors {
  font-size: 1.02rem;
  color: var(--ink);
  margin: 0 auto 10px;
  max-width: 62ch;
}
.hero__authors sup { color: var(--pred); font-size: 0.62em; margin-left: 1px; }

.hero__affil {
  font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 400;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 auto 6px;
}
.hero__note {
  font-size: 0.85rem; color: var(--ink-3);
  margin: 0 auto 34px;
}

/* buttons */
.btnrow {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  margin-bottom: 40px;
}

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 12px 19px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.btn:hover {
  text-decoration: none;
  border-color: #C3CDD9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* TL;DR */
.tldr {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pred);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 20px 24px;
  margin: 0 auto 34px;
  max-width: 900px;
  box-shadow: var(--shadow-sm);
}
.tldr__label {
  font-family: var(--font-mono);
  font-size: 0.58rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--pred);
  padding-top: 4px;
  white-space: nowrap;
}
.tldr__text { font-size: 1rem; line-height: 1.6; color: var(--ink); margin: 0; }
.tldr__text b { font-weight: 600; }

/* readout */
.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  text-align: left;
  box-shadow: var(--shadow-sm);
}
.readout__cell { background: var(--surface); padding: 18px 20px 16px; }
.readout__k {
  font-family: var(--font-mono);
  font-size: 0.55rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3);
  display: block; margin-bottom: 10px;
  white-space: nowrap;
}
.readout__v {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 84, "wght" 680;
  font-size: clamp(1.65rem, 3.2vw, 2.2rem);
  line-height: 1;
  letter-spacing: -0.02em;
  display: block;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.readout__v small { font-size: 0.42em; font-weight: 500; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.readout__meter {
  margin-top: 12px; height: 3px; width: 100%;
  background: var(--surface-3); border-radius: 2px; overflow: hidden;
}
.readout__meter i {
  display: block; height: 100%; width: 0;
  background: var(--pred);
  border-radius: 2px;
  transition: width 1.1s cubic-bezier(.22,.8,.28,1);
}
.readout__cell:nth-child(1) .readout__meter i { background: var(--gt); }
.readout__cell:nth-child(2) .readout__meter i { background: var(--gt); }
.readout__cell:nth-child(3) .readout__meter i { background: var(--gt); }
.readout__cell:nth-child(4) .readout__meter i { background: var(--sal); }
.readout__cell:nth-child(5) .readout__meter i { background: var(--sal); }

.readout__best {
  font-family: var(--font-mono);
  font-size: 0.5rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); display: block; margin-top: 9px;
}

/* ==========================================================================
   Plate — a figure on a display
   ========================================================================== */
.plate { margin: 0; }

.plate__screen {
  display: block;
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow-md);
}
.plate__screen img { width: 100%; display: block; }
.plate__screen::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,21,28,0) 82%, rgba(15,21,28,.05));
  opacity: 0; transition: opacity .2s ease;
}
.plate__screen:hover::after { opacity: 1; }
.plate__screen:focus-visible { outline: 2px solid var(--gt); outline-offset: 3px; }
.plate__screen--pad { padding: clamp(14px, 2.5vw, 30px); }

/* captions: the BOX is centred on the figure, the text inside stays ranged
   left. Centring the box keeps its centre line on the image's, whatever the
   column width. */
.plate__note {
  font-size: 0.9rem;
  line-height: 1.68;
  color: var(--ink-3);
  padding: 15px 0 0;
  margin: 0 auto;
  max-width: 92ch;
  text-align: left;
  text-wrap: pretty;
}
.plate__note b { color: var(--ink-2); font-weight: 600; }

/* the architecture plate sits in the wide column, so its caption gets a
   broader measure — near the abstract column, a little narrower */
.plate--wide .plate__note { max-width: 76%; }

/* ==========================================================================
   Spec panel
   ========================================================================== */
.abstract-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(28px, 5vw, 60px);
  align-items: start;
}

.spec {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.spec__head {
  font-family: var(--font-mono);
  font-size: 0.55rem; font-weight: 600;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  margin: 0;
}
.spec dl { margin: 0; padding: 5px 0; }
.spec__row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.spec__row:last-child { border-bottom: 0; }
.spec dt {
  font-family: var(--font-mono);
  font-size: 0.5rem; font-weight: 500;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 3px;
}
.spec dd { margin: 0; font-size: 0.84rem; line-height: 1.5; color: var(--ink-2); }
.spec dd b { color: var(--ink); font-weight: 600; }

/* ==========================================================================
   Visualization — reading guide
   ========================================================================== */
.viz { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 26px; align-items: start; }

.viz__query {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gt);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.viz__query span {
  font-family: var(--font-mono);
  font-size: 0.5rem; font-weight: 600;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-3);
  display: block; margin-bottom: 7px;
}
.viz__query p { margin: 0; font-size: 1.02rem; color: var(--ink); font-weight: 500; }

.keycap {
  display: grid; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.keycap__item { background: var(--surface); padding: 15px 16px; }
.keycap__item i { display: block; width: 22px; height: 4px; border-radius: 2px; margin-bottom: 10px; }

/* Chips decode THIS figure's legend, so they track its colours rather than the
   page palette. The figure's fills are very pale; these are the same hues
   deepened to stay legible in a 4px swatch. */
.keycap {
  --fig-gt:   #1C5790;
  --fig-pred: #7E598D;
  --fig-base: #659146;
  --fig-sal:  #99802E;
}
.keycap__item--gt i { background: var(--fig-gt); }
.keycap__item--pred i { background: var(--fig-pred); }
.keycap__item--base i { background: var(--fig-base); }
.keycap__item--sal i { background: var(--fig-sal); }
.keycap__item b {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.55rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 6px;
}
.keycap__item p { margin: 0; font-size: 0.84rem; line-height: 1.55; color: var(--ink-2); }

/* ==========================================================================
   BibTeX
   ========================================================================== */
.bib {
  background: var(--bezel);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.bib__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 15px;
  border-bottom: 1px solid #232D38;
}
.bib__bar span {
  font-family: var(--font-mono);
  font-size: 0.55rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #7E8C9C;
}
.bib__copy {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.55rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: #232D38;
  border: 1px solid #313D4A;
  border-radius: var(--radius-sm);
  padding: 6px 13px;
  cursor: pointer;
  color: #C7D2DE;
  transition: all .16s ease;
}
.bib__copy:hover { background: #2C3844; color: #fff; }
.bib__copy.is-done { background: #2B7848; border-color: #2B7848; color: #EAF7EF; }

.bib pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.85;
  color: #B9C6D4;
  font-variant-numeric: tabular-nums;
}
.bib pre .k { color: #6FB2F5; }
.bib pre .f { color: #FFA45C; }
.bib pre .s { color: #7FD79E; }

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(10, 15, 22, .88); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox__img {
  max-width: min(96vw, 1800px);
  max-height: 88vh;
  width: auto; height: auto;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}
.lightbox__close {
  position: fixed; top: 20px; right: 22px;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  color: #fff; font-size: 1.3rem; line-height: 1;
  cursor: pointer;
  transition: background .16s ease;
}
.lightbox__close:hover { background: rgba(255, 255, 255, .24); }
.lightbox__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.foot {
  background: var(--surface);
  padding: 34px 0 46px;
  margin-top: clamp(18px, 2.5vw, 32px);
}

/* centred box, ranged-left text, a little narrower than the BibTeX block */
.foot__note {
  max-width: 88%;
  margin: 0 auto;
  text-align: left;
}

/* ==========================================================================
   Reveal on scroll — scoped to .js so the page still reads with JS disabled
   ========================================================================== */
.js .rv { opacity: 0; transform: translateY(14px); }
.js .rv.is-in {
  opacity: 1; transform: none;
  transition: opacity .6s ease, transform .6s cubic-bezier(.22,.8,.28,1);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .viz { grid-template-columns: minmax(0, 1fr); }
  .keycap { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .abstract-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  /* at this width the proportional measures would be too cramped to read */
  .plate--wide .plate__note,
  .foot__note { max-width: 100%; }
}

@media (max-width: 860px) {
  .hero__meta { display: block; }
  .sec-head { flex-wrap: wrap; gap: 10px 14px; }
  .sec-head__rule { display: none; }
}

@media (max-width: 620px) {
  :root { --bar-h: 54px; }
  body { font-size: 15px; }
  .topbar__nav {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  }
  .topbar__nav a { padding: 7px 7px; }
  /* the wordmark is larger now, so give some of it back to the nav */
  .brand__name { font-size: 1.12rem; }
  .tldr { grid-template-columns: 1fr; gap: 8px; }
  .readout__cell { padding: 15px 16px 13px; }
  .btn { padding: 11px 16px; }
}

/* ==========================================================================
   Reduced motion / print
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .rv { opacity: 1; transform: none; }
}

@media print {
  .topbar, .skip-link, .lightbox { display: none; }
  main { padding-top: 0; }
  body { background: #fff; }
  .js .rv { opacity: 1; transform: none; }
  .bib { box-shadow: none; }
}
