/* Project page: Where Does the Energy Go? */

:root {
  --ink: #16202a;
  --text: #33434f;
  --muted: #667888;
  --rule: #e2e6ea;
  --surface: #ffffff;
  --tint: #f5f6f8;
  --accent: #5f3a8a;
  --accent-strong: #4b2d70;
  --accent-tint: #f4f0f9;

  /* series colors, matched to the paper's figures */
  --gpu: #1f77b4;
  --cpu: #ff7f0e;
  --dram: #d62728;
  --oth: #9467bd;

  --radius: 10px;
  --wrap: 1000px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans",
    "Liberation Sans", sans-serif;
  font-size: 17px;
  line-height: 1.62;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, .seg:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
b { color: var(--ink); font-weight: 650; }
sup { font-size: 0.62em; line-height: 0; }
sub { font-size: 0.68em; line-height: 0; }

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

/* ── Top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 54px;
}
.brand {
  flex: none;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}
.toplinks {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.toplinks::-webkit-scrollbar { display: none; }
.toplinks a {
  flex: none;
  font-size: 14.5px;
  color: var(--muted);
  text-decoration: none;
}
.toplinks a:hover { color: var(--ink); }

/* ── Hero ── */
.hero {
  padding: 72px 0 44px;
  text-align: center;
}
.venue {
  display: inline-block;
  margin: 0 0 22px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 .q {
  display: block;
  color: var(--accent);
  font-size: clamp(38px, 6.2vw, 64px);
  line-height: 1.06;
}
h1 .sub {
  display: block;
  margin-top: 10px;
  font-size: clamp(22px, 3.3vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.012em;
}
.authors {
  margin: 30px 0 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}
.affil { margin: 8px 0 0; font-size: 16px; line-height: 1.45; }
.corr { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.btn:hover { border-color: #b9c2cb; color: var(--ink); background: var(--tint); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2a3744; border-color: #2a3744; color: #fff; }
.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Sections ── */
main > section { padding-top: 44px; padding-bottom: 14px; }
main > section:first-child { padding-top: 6px; }

h2 {
  margin: 0 0 16px;
  padding-top: 18px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.15;
  font-weight: 720;
  letter-spacing: -0.014em;
  background: linear-gradient(var(--accent), var(--accent)) left top / 44px 4px no-repeat;
}
h3 { color: var(--ink); }
p { margin: 0; }
.lede {
  max-width: 50rem;
  margin: 0 auto;
  font-size: 20px;
  line-height: 1.55;
  color: var(--ink);
  text-align: center;
  text-wrap: balance;
}
.note { margin-top: 12px; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.center { text-align: center; }

/* ── Key numbers ── */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 38px;
}
.tile {
  padding: 20px 20px 22px;
  border-radius: var(--radius);
  background: var(--accent-tint);
}
.tile .num {
  color: var(--accent);
  font-size: 44px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: -0.025em;
}
.tile .lab { margin-top: 10px; font-size: 15px; line-height: 1.4; }

/* ── Share chart ── */
.chart {
  margin-top: 18px;
  padding: 26px 28px 22px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 28px;
  flex-wrap: wrap;
}
.chart-title {
  margin: 0;
  padding: 0;
  background: none;
  font-size: 20px;
  letter-spacing: -0.005em;
}
.chart-sub { margin-top: 2px; font-size: 14.5px; color: var(--muted); }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.legend li { display: flex; align-items: center; gap: 7px; }
.key { width: 12px; height: 12px; border-radius: 3px; }
.gpu { background: var(--gpu); }
.cpu { background: var(--cpu); }
.dram { background: var(--dram); }
.oth { background: var(--oth); }

.bars { margin-top: 20px; }
.bar-row, .bar-colhead {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr) 112px;
  column-gap: 20px;
  align-items: start;
}
.bar-colhead {
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.bar-colhead span:last-child { text-align: right; white-space: nowrap; }
.bar-row { padding: 13px 0 9px; }
.bar-row + .bar-row { border-top: 1px solid var(--rule); }
.bar-name { font-size: 15.5px; font-weight: 650; line-height: 1.3; color: var(--ink); }
.bar-name small {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.bar { display: flex; gap: 2px; height: 22px; margin-top: 2px; }
.seg {
  flex: 1 1 0;
  min-width: 3px;
  cursor: default;
  transition: filter 0.12s;
}
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg:hover, .seg:focus-visible { filter: brightness(1.14); }
.bar-labels {
  display: flex;
  gap: 2px;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.bar-labels span { flex: 1 1 0; min-width: 3px; white-space: nowrap; }
.bar-out {
  margin-top: 1px;
  text-align: right;
  font-size: 21px;
  font-weight: 720;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.chart-note { margin-top: 12px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.tableview { margin-top: 12px; font-size: 14px; }
.tableview summary { display: inline-block; cursor: pointer; color: var(--accent); font-weight: 600; }
.tableview[open] summary { margin-bottom: 10px; }

.tip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 6px 20px rgba(22, 32, 42, 0.22);
}
.tip strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.tip span { color: #c5cdd5; }
.tip i {
  display: inline-block;
  width: 12px;
  height: 3px;
  margin-right: 7px;
  border-radius: 2px;
  vertical-align: middle;
}

/* ── Figures ── */
figure { margin: 0; }
.fig {
  padding: 22px 22px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}
.fig img { display: block; width: 100%; margin: 0 auto; }
.fig .zoom { display: block; cursor: zoom-in; }
figcaption {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

/* ── Method ── */
.method {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  margin-top: 22px;
}
.ifaces { display: flex; flex-direction: column; gap: 10px; }
.iface { padding: 13px 18px 14px; border-radius: var(--radius); background: var(--tint); }
.iface h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.iface h3 span { margin-left: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.iface p { font-size: 15.5px; line-height: 1.45; }
.formula { margin-top: 6px; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.formula .eq { display: block; margin-bottom: 2px; font-size: 16px; color: var(--ink); }

.setup { margin: 28px 0 0; border-top: 1px solid var(--rule); }
.setup > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.setup dt {
  padding-top: 3px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.setup dd { margin: 0; font-size: 16px; line-height: 1.55; }
.workloads { margin: 0; padding: 0; list-style: none; }
.workloads li { display: flex; align-items: flex-start; gap: 12px; }
.workloads li + li { margin-top: 6px; }
.workloads .mk { margin-top: 8px; }

/* marker shapes used in the frontier figure */
.mk { display: inline-block; flex: none; width: 11px; height: 11px; }
.mk.agent { background: var(--cpu); transform: rotate(45deg) scale(0.9); }
.mk.reason { background: var(--dram); }
.mk.serve { background: var(--gpu); border-radius: 50%; }

/* ── Findings ── */
.finding { padding: 30px 0 34px; }
.finding + .finding { border-top: 1px solid var(--rule); }
.finding:first-of-type { padding-top: 10px; }
.finding:last-of-type { padding-bottom: 0; }
.finding h3 {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 10px;
  font-size: 23px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.008em;
  text-wrap: balance;
}
.finding h3 .n {
  flex: none;
  width: 30px;
  height: 30px;
  margin-top: -1px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 15.5px;
  line-height: 30px;
  text-align: center;
  letter-spacing: 0;
}
.finding .prose { margin-left: 44px; }
.finding .fig, .finding .split, .finding .table-scroll { margin-top: 22px; }
.finding .fig { max-width: 880px; }
.finding .fig, .finding .table-scroll.narrow { margin-left: auto; margin-right: auto; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}
.split .fig { margin-top: 0; }
.split .table-scroll { margin-top: 0; }

/* ── Tables ── */
.table-scroll { overflow-x: auto; }
.table-scroll.narrow { max-width: 780px; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 15.5px;
  font-variant-numeric: tabular-nums;
}
table.data th {
  padding: 8px 12px;
  border-bottom: 2px solid var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
}
table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: right;
  white-space: nowrap;
  color: var(--ink);
}
table.data .l { text-align: left; }
table.data td.l { color: var(--text); }
table.data tr.grp td { border-top: 1.5px solid #b9c2cb; }
table.data .mk { margin-right: 11px; }

/* ── Implications ── */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 6px;
}
.card { padding: 20px 22px 22px; border-radius: var(--radius); background: var(--tint); }
.card h3 { margin: 0 0 6px; font-size: 18.5px; line-height: 1.3; }
.card p { font-size: 16px; line-height: 1.55; }
.scope { margin-top: 22px; font-size: 15.5px; color: var(--muted); }
.scope b { color: var(--text); }

/* ── Poster ── */
.poster {
  display: block;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  line-height: 0;
}
.poster img { display: block; width: 100%; }

/* ── Citation ── */
.bibtex {
  position: relative;
  border-radius: var(--radius);
  background: var(--tint);
}
.bibtex pre { margin: 0; padding: 22px 24px; overflow-x: auto; }
.bibtex code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}
#copy-bib {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 13px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
#copy-bib:hover { border-color: #b9c2cb; }

/* ── Footer ── */
.foot {
  margin-top: 56px;
  padding: 30px 0 38px;
  border-top: 1px solid var(--rule);
  background: var(--tint);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}

/* ── Narrow screens ── */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .method, .split { grid-template-columns: minmax(0, 1fr); }
  .split .fig { max-width: 440px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 18px; }
  .brand { display: none; }
  .hero { padding: 44px 0 30px; }
  .links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 300px; margin-inline: auto; }
  .btn { justify-content: center; }
  .links .btn:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; min-width: calc(50% - 5px); }
  main > section { padding-top: 38px; }
  .venue { font-size: 11.5px; letter-spacing: 0.06em; }
  .authors { font-size: 18px; }
  .affil { font-size: 15px; }
  .lede { font-size: 18px; text-align: left; }
  h2 { font-size: 25px; }
  .tile .num { font-size: 36px; }
  .tile { padding: 16px 16px 18px; }
  .chart { padding: 20px 16px 18px; }
  .bar-colhead { display: none; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; }
  .bar-name { display: contents; }
  .bar-name span { grid-column: 1; grid-row: 1; align-self: baseline; }
  .bar-name small { grid-column: 1 / -1; grid-row: 2; margin-top: 2px; }
  .bar-out { grid-column: 2; grid-row: 1; align-self: baseline; font-size: 18px; white-space: nowrap; }
  .bar-out::after { content: " outside GPU"; font-size: 12px; font-weight: 500; color: var(--muted); }
  .bar-plot { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; }
  .setup > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .finding h3 { font-size: 20px; gap: 11px; }
  .finding .prose { margin-left: 0; }
  .fig { padding: 14px 12px 12px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .bibtex pre { padding: 46px 16px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
