:root {
  --paper: #fbfbf8;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #6c6f75;
  --line: #dcdedc;
  --line-dark: #111111;
  --accent: #ff7a1a;
  --accent-soft: #fff0e5;
  --green: #16a34a;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

a {
  color: inherit;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-dark);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
}

.wordmark {
  font-family: var(--mono);
  font-weight: 900;
  text-decoration: none;
  letter-spacing: 0;
}

.topnav {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: 14px;
}

.topnav a {
  color: var(--muted);
  text-decoration: none;
}

.topnav a.active,
.topnav a:hover {
  color: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}

.directory {
  border-right: 1px solid var(--line-dark);
  background: #f3f3ef;
  position: sticky;
  top: 58px;
  align-self: start;
  height: calc(100vh - 58px);
  overflow-y: auto;
}

.directoryHeader,
.pathbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-dark);
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.tree {
  padding: 14px 12px;
  display: grid;
  gap: 8px;
  font-family: var(--mono);
  font-size: 14px;
}

.tree a {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  color: var(--muted);
  text-decoration: none;
}

.tree a.active,
.tree a:hover {
  background: #ddddda;
  color: var(--ink);
}

.tree .indent {
  margin-left: 20px;
}

.page {
  min-width: 0;
}

.pathbar {
  padding: 0 18px;
  text-transform: none;
  background: var(--panel);
}

.tag {
  margin-left: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line-dark);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.tag.muted {
  border-color: var(--line);
  color: var(--muted);
}

.hero {
  padding: 34px 32px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.hero h1 {
  max-width: 1100px;
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 3.2vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.authors {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.affiliation {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.badges,
.tabs {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badges span,
.tabs button,
.tabButton,
.outlineLink,
button {
  min-height: 38px;
  border: 1px solid var(--line-dark);
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.tabs button.active,
.tabs button:hover,
.tabButton:hover,
.outlineLink:hover,
button:hover {
  background: var(--ink);
  color: #ffffff;
}

.tabButton {
  background: var(--ink);
  color: #ffffff;
}

.tabButton:hover {
  background: #333;
}

.summaryBand {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  background: #f7f7f4;
}

.summaryBand div {
  min-height: 88px;
  padding: 16px 24px;
  border-right: 1px solid var(--line);
}

.summaryBand span {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.summaryBand strong {
  display: block;
  margin-top: 5px;
  font-size: 1.6rem;
  line-height: 1.1;
}

.contentSection {
  padding: 32px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.contentSection:nth-of-type(even) {
  background: var(--paper);
}

.figureSection {
  padding: 28px 32px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f4;
}

.figureSection.twoCol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.figureSection.compact {
  padding-left: 80px;
  padding-right: 80px;
}

.figureSection.compact .subFigure img {
  height: 200px;
  width: 100%;
  object-fit: contain;
  background: #fafaf7;
}

.mainFigure,
.subFigure {
  margin: 0;
}

.mainFigure img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.mainFigure img:hover {
  opacity: 0.9;
}

.subFigure img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.subFigure img:hover {
  opacity: 0.9;
}

figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

figcaption strong {
  color: var(--ink);
}

.sectionHeader {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.sectionLabel {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.sectionHeader h2 {
  margin: 0;
  font-size: 1.7rem;
}

.bodyText {
  max-width: 860px;
  margin: 0 0 16px;
  line-height: 1.7;
  font-size: 15px;
}

.subheading {
  margin: 24px 0 10px;
  font-size: 1.05rem;
  color: var(--ink);
}

.styledList {
  max-width: 860px;
  margin: 0 0 16px 0;
  padding-left: 22px;
  line-height: 1.7;
  font-size: 15px;
}

.styledList li {
  margin-bottom: 8px;
}

.phaseGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0 24px;
}

.phaseCard {
  padding: 18px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.phaseLabel {
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.phaseCard h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.phaseCard p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.tableBlock {
  border: 1px solid var(--line);
  overflow: auto;
  margin-bottom: 20px;
}

.tableBlock h3 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f4;
  font-size: 1rem;
}

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

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

th {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  background: #fafaf7;
}

tr.rank-1 {
  background: #dcfce7;
}

tr.rank-2 {
  background: #f0fdf4;
}

.calloutGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.callout {
  padding: 18px;
  border: 1px solid var(--line);
  background: #ffffff;
  text-align: center;
}

.calloutValue {
  font-size: 2rem;
  font-weight: 900;
  color: var(--green);
  line-height: 1;
  margin-bottom: 8px;
}

.calloutLabel {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  line-height: 1.4;
}

.takeawayGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.takeaway {
  padding: 20px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.takeawayNum {
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
}

.takeaway h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.takeaway p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.pageFooter {
  padding: 24px 32px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  border-top: 1px solid var(--line);
}

.pageFooter a {
  color: var(--ink);
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.lightbox.open {
  display: flex;
}

.lightboxInner {
  position: relative;
  max-width: min(94vw, 1200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lightboxInner img {
  width: 100%;
  max-height: 84vh;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #444;
}

.lightboxInner p {
  margin: 0;
  color: #cccccc;
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  max-width: 800px;
  line-height: 1.5;
}

.lightboxInner button {
  margin-top: 4px;
  min-height: 34px;
  border: 1px solid #888;
  background: transparent;
  color: #ffffff;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}

.lightboxInner button:hover {
  background: #ffffff;
  color: #111111;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .directory {
    display: none;
  }

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

  .figureSection.twoCol {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .hero,
  .contentSection,
  .figureSection,
  .pageFooter {
    padding-left: 16px;
    padding-right: 16px;
  }

  .figureSection.compact {
    padding-left: 16px;
    padding-right: 16px;
  }

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

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

  .sectionHeader {
    flex-direction: column;
    align-items: flex-start;
  }
}
