:root {
  --agentic: #f58f29;
  --human: #8789c0;
  --ink: #171717;
  --muted: #666870;
  --line: #dddddf;
  --panel: #ffffff;
  --bg: #ffffff;
  --topbar: #ffffff;
  --subpanel: #fbfbfa;
  --control-bg: #ffffff;
  --control-border: #cfcfd4;
  --nav-ink: #2b2c31;
  --nav-hover: #f0f0ee;
  --nav-active-bg: #242424;
  --nav-active-ink: #ffffff;
  --chart-label: #4c4d52;
  --axis: #d0d0d4;
  --table-border: #ececef;
  --link: #202124;
}

@property --nav-progress {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

body[data-theme="dark"] {
  --ink: #f1f1f2;
  --muted: #b6b7c1;
  --line: #343640;
  --panel: #181a20;
  --bg: #0f1014;
  --topbar: #15171d;
  --subpanel: #15171d;
  --control-bg: #101218;
  --control-border: #444754;
  --nav-ink: #ebebef;
  --nav-hover: #242733;
  --nav-active-bg: #f1f1f2;
  --nav-active-ink: #15171d;
  --chart-label: #c7c8d0;
  --axis: #535765;
  --table-border: #2d3039;
  --link: #f3c27c;
}

@font-face {
  font-family: "Nimbus Roman No9 L";
  src: url("fonts/NimbusRomNo9L-Reg.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nimbus Roman No9 L";
  src: url("fonts/NimbusRomNo9L-RegIta.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Nimbus Roman No9 L";
  src: url("fonts/NimbusRomNo9L-Med.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nimbus Roman No9 L";
  src: url("fonts/NimbusRomNo9L-MedIta.otf") format("opentype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nimbus Roman No9 L", "Times New Roman", Times, serif;
}

.topbar {
  display: flex;
  justify-content: center;
  gap: 24px;
  align-items: center;
  padding: 16px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
}

.eyebrow {
  margin-bottom: 6px;
  color: #6b6c72;
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  font-weight: 760;
  line-height: 1.08;
}

h2 {
  font-size: 16px;
  font-weight: 720;
}

p,
label,
td,
th,
.status {
  font-size: 13px;
}

.agenticText {
  color: var(--agentic) !important;
  font-weight: 780;
}

.humanText {
  color: var(--human) !important;
  font-weight: 780;
}

.topbar p,
.panel p {
  color: var(--muted);
  margin-top: 4px;
}

.status {
  color: var(--muted);
  white-space: nowrap;
}

.headerActions {
  display: grid;
  justify-items: end;
  gap: 8px;
  width: min(100%, 800px);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navTab,
.navLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--nav-ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 680;
}

.navTab {
  cursor: pointer;
  position: relative;
}

.navTab.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-ink);
}

.navTab.navNudge {
  overflow: visible;
}

.navTab.navNudge::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 999px;
  padding: 2px;
  background:
    conic-gradient(
      from 315deg,
      #ff4d4d 0%,
      #f58f29 14%,
      #ffd166 28%,
      #06d6a0 42%,
      #118ab2 58%,
      #7b61ff 74%,
      #ef476f 88%,
      #ff4d4d 100%
    );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 1;
  pointer-events: none;
  animation: navRainbowPulse 3.4s ease-out forwards;
}

@keyframes navRainbowPulse {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }

  12% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.02);
  }
}

.navLink:hover,
.navTab:not(.active):hover {
  background: var(--nav-hover);
}

.themeToggle {
  cursor: pointer;
  border-color: var(--line);
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
}

.themeToggle:hover,
.themeToggle[aria-pressed="true"] {
  background: var(--nav-hover);
}

.iconLink {
  width: 40px;
  padding: 0;
}

.iconLink svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.themeIcon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 21px;
  height: 21px;
  transform: translate(-50%, -50%);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.themeIconSun {
  display: none;
}

body[data-theme="dark"] .themeIconSun {
  display: block;
}

body[data-theme="dark"] .themeIconMoon {
  display: none;
}

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

.page.hidden {
  display: none;
}

.findingsPage {
  min-height: calc(100vh - 78px);
  padding: 42px 28px;
}

.paperHero {
  max-width: 800px;
  margin: 0 auto;
  padding-top: 28px;
}

.paperHero.landingReveal > * {
  animation: landingContentIn 620ms cubic-bezier(0.2, 0.72, 0.22, 1) both;
}

.paperHero.landingReveal > :nth-child(1) {
  animation-delay: 0ms;
}

.paperHero.landingReveal > :nth-child(2) {
  animation-delay: 90ms;
}

.paperHero.landingReveal > :nth-child(3) {
  animation-delay: 170ms;
}

.paperHero.landingReveal > :nth-child(4) {
  animation-delay: 260ms;
}

.paperHero.landingReveal > :nth-child(5) {
  animation-delay: 360ms;
}

.paperHero.landingReveal > :nth-child(6) {
  animation-delay: 480ms;
}

@keyframes landingContentIn {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.paperHero h1 {
  max-width: 860px;
  font-size: 40px;
  line-height: 1.08;
  font-weight: 780;
}

.paperHero h2 {
  max-width: 860px;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 500;
}

.heroLinks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 300px;
  margin-top: 22px;
}

.heroLinkCard {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}

.heroLinkCard:hover {
  background: var(--nav-hover);
}

.heroLinkIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 999px;
  background: var(--nav-hover);
  color: var(--ink);
}

.heroLinkIcon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.heroLinkCard:nth-child(2) .heroLinkIcon svg {
  fill: currentColor;
  stroke: none;
}

.heroLinkCard strong,
.heroLinkCard small {
  display: block;
}

.heroLinkCard strong {
  font-size: 16px;
  line-height: 1.05;
}

.heroLinkCard small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
}

.scaleStats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 1px;
}

.scaleStat {
  min-height: 112px;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.scaleStat strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  font-weight: 780;
}

.scaleStat span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.2;
}

.paperHero > p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 20px;
}

.findingsPlaceholder {
  margin-top: 10px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.findingsPlaceholder h2 {
  max-width: 860px;
  font-size: 30px;
  line-height: 1.08;
  font-weight: 500;
  color: var(--ink);
}

.findingsPlaceholder h3 {
  max-width: 860px;
  font-size: 26px;
  line-height: 1.08;
  font-weight: 500;
  color: var(--ink);
}

.findingsPlaceholder h4 {
  max-width: 860px;
  font-size: 20px;
  line-height: 1.08;
  font-weight: 500;
  color: var(--ink);
}

.findingCards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.findingCard {
  position: relative;
  min-height: 142px;
  padding: 16px 16px 15px 18px;
  border: 0;
  border-left: 4px solid color-mix(in srgb, var(--agentic) 38%, var(--line));
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  overflow: hidden;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.findingCard:hover {
  border-left-color: var(--agentic);
  background: var(--nav-hover);
  transform: translateX(2px);
}

.findingCard strong {
  display: block;
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
  font-weight: 780;
}

.findingCard strong.findingMetricLarge {
  font-size: 50px;
}

.findingCard p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.22;
}

.citationBox {
  position: relative;
  margin-top: 16px;
}

.citationBox pre {
  min-height: 92px;
  margin: 0;
  padding: 14px 88px 14px 16px;
  overflow: auto;
  border-left: 4px solid var(--agentic);
  border-radius: 8px;
  background: var(--subpanel);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre;
}

.citationCopyButton {
  position: absolute;
  top: 14px;
  right: 10px;
  width: auto;
  min-width: 62px;
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
}

.citationCopyButton.copied {
  background: var(--agentic);
  border-color: var(--agentic);
  color: #171717;
}

.visualizationPage {
  padding: 26px 28px 42px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 800px;
  min-height: calc(100vh - 135px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.layout.vizReveal > .filters,
.layout.vizReveal > .content > * {
  animation: landingContentIn 560ms cubic-bezier(0.2, 0.72, 0.22, 1) both;
}

.layout.vizReveal > .filters {
  animation-delay: 0ms;
}

.layout.vizReveal > .content > :nth-child(1) {
  animation-delay: 90ms;
}

.layout.vizReveal > .content > :nth-child(2) {
  animation-delay: 160ms;
}

.layout.vizReveal > .content > :nth-child(3) {
  animation-delay: 230ms;
}

.layout.vizReveal > .content > :nth-child(4) {
  animation-delay: 300ms;
}

.layout.vizReveal > .content > :nth-child(5) {
  animation-delay: 370ms;
}

.layout.vizReveal > .content > :nth-child(6) {
  animation-delay: 440ms;
}

.layout.vizReveal > .content > :nth-child(7) {
  animation-delay: 510ms;
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--subpanel);
}

.filters button {
  grid-column: span 2;
}

.filters label {
  display: grid;
  gap: 7px;
  margin-bottom: 0;
  color: var(--ink);
  font-weight: 620;
}

.filters label span {
  white-space: nowrap;
}

input,
select,
button {
  width: 100%;
  height: 36px;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background: var(--control-bg);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

button {
  cursor: pointer;
  background: var(--nav-active-bg);
  color: var(--nav-active-ink);
  border-color: var(--nav-active-bg);
  font-weight: 650;
}

.content {
  padding: 18px;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card {
  padding: 14px;
}

.card .label {
  color: var(--muted);
  font-size: 12px;
}

.card .value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 760;
}

.panel {
  padding: 14px;
  min-width: 0;
}

.panelHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}

.chart {
  width: 100%;
  height: 360px;
  display: block;
  margin-top: 12px;
}

.chart.compact {
  height: 315px;
}

.chart.sankeyChart {
  height: 430px;
}

.axis text,
.legend text,
.chartLabel {
  fill: var(--chart-label);
  font-size: 14px;
  font-weight: 650;
  pointer-events: none;
}

.chartTooltip {
  position: fixed;
  z-index: 1000;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 30px rgba(23, 23, 23, 0.16);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.32;
  opacity: 0;
  pointer-events: none;
  white-space: pre-line;
}

.chartTooltip.visible {
  opacity: 1;
}

body[data-theme="dark"] .chartTooltip {
  background: rgba(24, 26, 32, 0.98);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
}

.axis path,
.axis line {
  stroke: var(--axis);
}

.tableWrap {
  overflow: auto;
  max-height: 460px;
  margin-top: 12px;
}

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

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

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
  color: var(--ink);
}

td a {
  color: var(--link);
  text-decoration: none;
  font-weight: 650;
}

td a:hover {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .topbar {
    align-items: center;
  }

  .headerActions {
    width: 100%;
    justify-items: end;
  }

  .topnav {
    flex-wrap: wrap;
  }

  .paperHero h1 {
    font-size: 30px;
  }

  .paperHero h2 {
    font-size: 25px;
  }

  .scaleStats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards,
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .findingsPage,
  .visualizationPage {
    padding: 30px 18px;
  }

  .heroLinks {
    grid-template-columns: 1fr;
  }

  .scaleStats {
    grid-template-columns: 1fr;
  }

  .findingCards {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filters button {
    grid-column: auto;
  }

  .citationCopyButton {
    height: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .paperHero.landingReveal > *,
  .layout.vizReveal > .filters,
  .layout.vizReveal > .content > * {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
