:root {
  --bg: #fdfdfb;
  --ink: #171717;
  --muted: #545454;
  --faint: #737373;
  --line: #dedede;
  --soft: #f5f5f3;
  --accent: #234f7e;
}

@font-face {
  font-family: "Charter";
  src: local("Charter"), local("Charter Roman"),
    url("assets/fonts/charter_regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Charter";
  src: local("Charter Bold"),
    url("assets/fonts/charter_bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.62;
}

main {
  max-width: 1020px;
  margin: 0 auto;
  padding: 54px 24px 76px;
}

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

img {
  display: block;
  max-width: 100%;
  height: auto;
}

code,
pre,
table,
.links,
.venue,
.note {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.project-header {
  max-width: 920px;
  margin: 0 auto 46px;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.venue {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

h1 {
  max-width: 860px;
  margin: 0 auto;
  font-family: "Charter", Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  max-width: 760px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.35;
}

.authors {
  margin: 24px 0 0;
  font-size: 17px;
  font-weight: 600;
}

.affiliation {
  margin: 3px 0 0;
  color: var(--faint);
  font-size: 15px;
}

.builton {
  max-width: 620px;
  margin: 12px auto 0;
  color: var(--faint);
  font-size: 13px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #cfcfcf;
  border-radius: 3px;
  background: #ffffff;
  color: #202020;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.links a:hover {
  border-color: #a8a8a8;
  background: var(--soft);
}

section {
  margin: 42px 0;
}

h2 {
  margin: 0 0 12px;
  font-family: "Charter", Georgia, "Times New Roman", serif;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.005em;
}

p {
  margin: 0 0 14px;
}

.abstract {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

figure {
  margin: 26px 0;
}

figure img {
  border: 1px solid var(--line);
  background: #ffffff;
}

figcaption {
  max-width: 880px;
  margin: 9px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
  margin: 34px 0 48px;
}

.summary-grid div {
  padding: 17px 14px;
  text-align: center;
}

.summary-grid div + div {
  border-left: 1px solid var(--line);
}

.summary-grid span {
  display: block;
  font-family: "Charter", Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
}

.summary-grid p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.findings,
.scope-list,
.artifact-list {
  margin: 0;
  padding-left: 22px;
}

.findings li,
.scope-list li,
.artifact-list li {
  margin: 8px 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  background: var(--soft);
  color: #303030;
  font-weight: 650;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.figure-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

/* ---- Qualitative showcase: interference player ---- */
.showcase {
  border-top: 1px solid var(--line);
  padding-top: 40px;
}

.showcase > p {
  max-width: 820px;
}

.showcase-caption {
  max-width: 820px;
  color: var(--faint);
  font-size: 13px;
}

/* Break the interactive demo wider than the reading column. */
.ic-tabs,
.ic-stage {
  position: relative;
  width: min(1240px, 94vw);
  margin-left: 50%;
  transform: translateX(-50%);
}

.ic-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.ic-tab {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 152px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.ic-tab:hover {
  border-color: #b3b3b3;
}

.ic-tab.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.ic-tab-title {
  font-family: "Charter", Georgia, "Times New Roman", serif;
  font-size: 16px;
  color: var(--ink);
}

.ic-tab-kind {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}

.ic-stage {
  margin-top: 20px;
}

.ic-panel-head {
  max-width: 720px;
  margin-bottom: 20px;
}

.ic-kind {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.ic-blurb {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.ic-strips {
  display: grid;
  gap: 22px;
}

.ic-strip {
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.ic-strip.is-protagonist {
  border-color: #c4d3e2;
  background: #fcfdfe;
}

.ic-strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ic-sys {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
}

.ic-summary {
  font-size: 12px;
  color: var(--muted);
}

.ic-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.ic-track.is-reference {
  grid-template-columns: minmax(0, 232px);
}

.ic-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ic-cell-head {
  line-height: 1.15;
}

.ic-cond {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
}

.ic-sub {
  display: block;
  font-size: 10.5px;
  color: var(--faint);
}

.ic-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 4px;
  background: #111;
  border: 1px solid var(--line);
}

.ic-frame.is-pass {
  border-color: #3a8f57;
  box-shadow: inset 0 0 0 1px #3a8f57;
}

.ic-frame.is-fail {
  border-color: #d2d2d2;
}

.ic-frame.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  color: var(--faint);
}

.ic-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ic-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ic-frame.is-pass .ic-badge {
  background: #e3f2e8;
  color: #22552c;
}

.ic-frame.is-fail .ic-badge {
  background: rgba(255, 255, 255, 0.92);
  color: #5a5a5a;
}

.ic-steps {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.ic-rail {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 9px;
}

.ic-seg {
  height: 4px;
  border-radius: 2px;
}

.ic-seg.is-pass {
  background: #3a8f57;
}

.ic-seg.is-fail {
  background: #d8d8d8;
}

.ic-seg.is-spacer,
.ic-seg.is-empty {
  background: transparent;
}

.ic-ref-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.ic-toggle {
  margin-top: 18px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
}

.ic-toggle:hover {
  border-color: #b3b3b3;
  background: var(--soft);
}

/* Results table: protagonist row highlight + k0->k7 decay sparkline. */
#results table tbody tr.is-best td {
  background: #f2f7fc;
}

#results table tbody tr.is-best td:first-child {
  font-weight: 600;
}

.spark-cell {
  text-align: center;
  color: var(--accent);
}

.spark {
  display: inline-block;
  vertical-align: middle;
}

pre {
  overflow-x: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--soft);
  font-size: 13px;
  line-height: 1.48;
}

/* ---- Sticky section nav ---- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(253, 253, 251, 0.86);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}

.topnav-inner {
  max-width: 1020px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px;
}

.topnav a {
  padding: 5px 12px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.topnav a:hover {
  color: var(--ink);
  background: var(--soft);
}

section[id] {
  scroll-margin-top: 64px;
}

/* ---- Header primary link ---- */
.links a.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.links a.primary:hover {
  border-color: #1d4369;
  background: #1d4369;
}

/* ---- Hero contrast ---- */
.hero {
  margin: 38px 0 10px;
}

.hero-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.hero-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.hero-card.is-pass {
  border-color: #3a8f57;
}

.hero-card.is-fail {
  border-color: #d2d2d2;
}

.hero-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #111;
}

.hero-card-cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
}

.hero-cond {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
}

.hero-cond small {
  color: var(--faint);
  font-weight: 400;
}

.hero-verdict {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 3px;
}

.hero-card.is-pass .hero-verdict {
  background: #e3f2e8;
  color: #22552c;
}

.hero-card.is-fail .hero-verdict {
  background: #eeeeee;
  color: #5a5a5a;
}

.hero-caption {
  max-width: 820px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

/* ---- Contributions ---- */
.contrib {
  margin: 0;
  padding-left: 22px;
}

.contrib li {
  margin: 10px 0;
}

/* ---- Tasks table ---- */
.tasks-table {
  min-width: 640px;
}

.tasks-table th,
.tasks-table td {
  text-align: left;
  white-space: normal;
  vertical-align: top;
}

.tasks-table td:nth-child(2) {
  white-space: nowrap;
  color: var(--muted);
}

/* ---- Systems matrix ---- */
.sys-matrix {
  min-width: 520px;
  text-align: center;
}

.sys-matrix th {
  text-align: center;
}

.sys-matrix th:first-child,
.sys-matrix td:first-child {
  text-align: left;
  white-space: nowrap;
}

.sys-matrix .sys-kind {
  margin-left: 8px;
  color: var(--faint);
  font-size: 11px;
}

.sys-matrix td.yes {
  color: #2f7d49;
  font-weight: 600;
}

.sys-matrix td.no {
  color: var(--faint);
}

/* ---- Results as findings ---- */
.finding {
  margin: 26px 0;
}

.finding h3 {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 6px;
  font-family: "Charter", Georgia, "Times New Roman", serif;
  font-size: 20px;
}

.finding-n {
  flex: none;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.finding p {
  max-width: 820px;
}

.table-title {
  margin-top: 34px;
  font-family: "Charter", Georgia, "Times New Roman", serif;
  font-size: 19px;
}

/* ---- Footer ---- */
.site-footer {
  max-width: 1020px;
  margin: 0 auto;
  padding: 26px 24px 48px;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
  color: var(--faint);
  font-size: 13px;
}

/* Per-family heatmap (system-selectable) */
.heatmap {
  margin: 8px 0 4px;
}

.heatmap-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.heatmap-title {
  margin: 0 0 3px;
  font-family: "Charter", Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
}

.heatmap-sub {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.heatmap-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.heatmap-select select {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.heatmap-scroll {
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: minmax(112px, 1.25fr) repeat(5, 1fr);
  gap: 3px;
  min-width: 540px;
}

.hm-corner {
  background: transparent;
}

.hm-colhead {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.hm-rowhead {
  display: flex;
  align-items: center;
  padding-right: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: #242424;
  white-space: nowrap;
}

.hm-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 3px;
  background: var(--soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--ink);
}

.hm-cell.is-empty {
  color: var(--faint);
  background: #f7f7f5;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

.heatmap-bar {
  width: 150px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: linear-gradient(to right, rgb(237, 242, 248), rgb(31, 78, 126));
}

.heatmap-legend-note {
  margin-left: 6px;
  color: var(--faint);
}

@media (max-width: 760px) {
  main {
    padding: 32px 16px 56px;
  }

  .project-header {
    margin-bottom: 34px;
    padding-bottom: 28px;
  }

  h1 {
    font-size: 36px;
  }

  .summary-grid,
  .figure-pair,
  .hero-pair {
    grid-template-columns: 1fr;
  }

  .topnav-inner {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .ic-tabs,
  .ic-stage {
    width: 100%;
    margin-left: 0;
    transform: none;
  }

  .ic-tab {
    flex: 1 1 auto;
    min-width: 0;
  }

  .ic-track {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 80%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .ic-track.is-reference {
    grid-auto-columns: 100%;
  }

  .ic-track > .ic-cell {
    scroll-snap-align: start;
  }

  .ic-rail {
    display: none;
  }

  .summary-grid div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
