:root {
  --paper: #eeeae0;
  --paper-2: #f8f5ee;
  --ink: #17262b;
  --muted: #647176;
  --rule: #c6c5bc;
  --night: #14262c;
  --exact: #0b7d6d;
  --operational: #247047;
  --running: #15803d;
  --running-bg: #dcfce7;
  --near: #2688a1;
  --research: #d09418;
  --blocked: #c8513e;
  --unscored: #8a8d87;
  --radius: 4px;
  --shadow: 0 18px 44px rgba(23, 38, 43, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(rgba(23, 38, 43, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 38, 43, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}

button, summary { font: inherit; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  transform: translateY(-200%);
  background: var(--night);
  color: white;
  padding: 0.65rem 0.9rem;
}

.skip-link:focus { transform: translateY(0); }

.masthead {
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--night);
  color: #f5f3ec;
}

.masthead__inner,
main,
footer {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
}

.masthead__inner {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.72rem;
  font-weight: 700;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #67c8b7;
  color: #67c8b7;
  font: 700 1rem/1 Georgia, serif;
  transform: rotate(-4deg);
}

.freshness {
  font: 600 0.72rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #b7c3c4;
  text-align: right;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: clamp(2rem, 7vw, 7rem);
  padding: clamp(4rem, 9vw, 8.5rem) 0 clamp(3rem, 7vw, 6rem);
  align-items: end;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--exact);
  font: 700 0.72rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 780px;
  margin-bottom: 1.25rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 10vw, 8.6rem);
  font-weight: 500;
  line-height: 0.83;
  letter-spacing: -0.065em;
}

.lede {
  max-width: 670px;
  margin-bottom: 1.7rem;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  color: #45555a;
}

.protocol-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.protocol-badges span {
  border: 1px solid var(--rule);
  background: rgba(248, 245, 238, 0.6);
  padding: 0.4rem 0.6rem;
  font: 650 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.protocol-badges .protocol-badge--running,
.indicator-card__activity span,
.output-row__running {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-color: #86b995;
  background: var(--running-bg);
  color: #14532d;
}
.output-row__running[hidden] { display: none; }

.protocol-badge--running i,
.indicator-card__activity i,
.output-row__running i {
  width: 0.5rem;
  height: 0.5rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--running);
}

.score-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--night);
  background: var(--paper-2);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.score-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 42%;
  height: 5px;
  background: var(--exact);
}

.score-card__label,
.score-card__note {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-card__number {
  margin: 0.2rem 0 0.4rem;
  font: 700 clamp(4rem, 8vw, 6.7rem)/0.9 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.09em;
}

.score-card__number small {
  font-size: 0.3em;
  color: var(--muted);
  letter-spacing: -0.04em;
}

.score-card__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.7rem;
  color: var(--muted);
}

.score-card__meta strong {
  display: block;
  color: var(--ink);
  font: 700 1rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.signal-board,
.indicators {
  padding: clamp(3rem, 6vw, 5.5rem) 0;
  border-top: 1px solid var(--rule);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
  margin-bottom: 2rem;
}

.section-heading h2,
.method-strip h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 4vw, 3.6rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.section-heading > p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.plot-rail {
  display: grid;
  grid-template-columns: repeat(27, 1fr);
  gap: 4px;
  padding: 1rem;
  background: var(--night);
  border: 1px solid var(--night);
}

.rail-cell {
  aspect-ratio: 0.72;
  min-height: 20px;
  border: 0;
  border-radius: 1px;
  cursor: pointer;
  transition: transform 120ms ease, outline-color 120ms ease;
}

.rail-cell:hover { transform: translateY(-2px); }
.rail-cell:focus-visible { outline: 3px solid white; outline-offset: 2px; }

[data-tone="exact"] { --tone: var(--exact); }
[data-tone="operational"] { --tone: var(--operational); }
[data-tone="near"] { --tone: var(--near); }
[data-tone="research"] { --tone: var(--research); }
[data-tone="blocked"] { --tone: var(--blocked); }
[data-tone="unscored"] { --tone: var(--unscored); }
.rail-cell { background: var(--tone); }
.rail-cell.is-running { box-shadow: inset 0 0 0 3px #b7f7c9; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
  margin-top: 1rem;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #45555a;
  font-size: 0.72rem;
}

.legend__swatch {
  width: 10px;
  height: 10px;
  background: var(--tone);
}

.method-strip {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(2rem, 8vw, 8rem);
  margin: 1rem calc(50% - 50vw);
  padding: clamp(3rem, 6vw, 5rem) max(20px, calc((100vw - 1240px) / 2));
  background: var(--night);
  color: #f5f3ec;
}

.method-strip .eyebrow { color: #67c8b7; }

.method-strip ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #526066;
}

.method-strip li {
  display: grid;
  grid-template-columns: 3rem 1fr;
  padding: 1rem 0;
  border-bottom: 1px solid #526066;
}

.method-strip li span {
  color: #67c8b7;
  font: 700 0.7rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.indicator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.indicator-card {
  scroll-margin-top: 1.5rem;
  border: 1px solid var(--rule);
  background: rgba(248, 245, 238, 0.86);
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
}

.indicator-card.is-running {
  border-color: #86b995;
  box-shadow: inset 4px 0 0 var(--running);
}

.indicator-card:target { outline: 3px solid var(--exact); outline-offset: 4px; }

.indicator-card__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.indicator-card__index {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font: 700 0.67rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.indicator-card h3 {
  margin-bottom: 0;
  font: 600 clamp(1.3rem, 2.5vw, 1.9rem)/1.05 Georgia, "Times New Roman", serif;
}

.indicator-card__score {
  white-space: nowrap;
  font: 700 1.25rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.indicator-card__score small { color: var(--muted); font-size: 0.65em; }

.indicator-card__activity {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.indicator-card__activity:empty { display: none; }

.indicator-card__activity span {
  border: 1px solid #86b995;
  padding: 0.35rem 0.5rem;
  font: 700 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.indicator-card__bar {
  height: 5px;
  margin: 1.15rem 0 0.9rem;
  background: #d8d7cf;
}

.indicator-card__bar span { display: block; height: 100%; background: var(--exact); }

.indicator-card__counts { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.status-chip {
  border-left: 3px solid var(--tone);
  background: #e5e2d9;
  padding: 0.35rem 0.5rem;
  font-size: 0.68rem;
  color: #46555a;
}

.indicator-card details { margin-top: 1rem; border-top: 1px solid var(--rule); }

.indicator-card summary {
  display: flex;
  justify-content: space-between;
  padding: 0.9rem 0 0;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.indicator-card summary:focus-visible { outline: 3px solid var(--near); outline-offset: 4px; }

.output-list { margin-top: 0.75rem; border-top: 1px solid var(--rule); }

.output-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(130px, 0.7fr);
  gap: 1rem;
  padding: 0.72rem 0;
  border-bottom: 1px solid var(--rule);
}

.output-row.is-running {
  margin: 0 -0.5rem;
  padding-right: 0.5rem;
  padding-left: 0.5rem;
  background: rgba(220, 252, 231, 0.45);
  box-shadow: inset 3px 0 0 var(--running);
}

.output-row__name { font-size: 0.82rem; font-weight: 650; }
.output-row__feature { color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; }
.output-row__status { text-align: right; font-size: 0.72rem; color: var(--tone); font-weight: 700; }
.output-row__running {
  width: max-content;
  margin: 0 0 0.25rem auto;
  padding: 0.2rem 0.35rem;
  font: 700 0.62rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.output-row__metric { display: block; margin-top: 0.15rem; color: var(--muted); font: 500 0.65rem/1.25 ui-monospace, SFMono-Regular, Menlo, monospace; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.72rem;
}

footer p { margin: 0; }

.error-panel {
  margin: 4rem auto;
  max-width: 680px;
  border: 1px solid var(--blocked);
  background: var(--paper-2);
  padding: 2rem;
}

@media (max-width: 820px) {
  .hero, .method-strip { grid-template-columns: 1fr; }
  .hero { gap: 2rem; }
  .plot-rail { grid-template-columns: repeat(18, 1fr); }
  .indicator-grid { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 0.8rem; }
}

@media (max-width: 540px) {
  .masthead__inner, main, footer { width: min(100% - 24px, 1240px); }
  .masthead__inner { align-items: start; padding: 0.8rem 0; }
  .freshness { max-width: 150px; }
  h1 { font-size: clamp(3.5rem, 19vw, 5rem); }
  .plot-rail { grid-template-columns: repeat(12, 1fr); gap: 3px; padding: 0.7rem; }
  .score-card__meta { grid-template-columns: 1fr 1fr; }
  .output-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .output-row__status { text-align: left; }
  footer { display: block; }
  footer p + p { margin-top: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rail-cell { transition: none; }
}
