@import url("./tokens.css");

/* TremOR Operation Research Group — core site stylesheet.
   Printed-page layout: figures and tables sit directly on the paper canvas
   and are ruled like a journal table. Serif headings, sans body, mono numerals. */

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink-primary);
  line-height: 1.2;
}

h1,
h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.012em;
}

h1 {
  font-size: clamp(1.75rem, 1.15rem + 2.4vw, var(--text-3xl));
  line-height: 1.14;
  max-width: 24ch;
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.005em;
}

p {
  margin: 0 0 1em;
  max-width: var(--measure-width);
}

p:last-child {
  margin-bottom: 0;
}

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

a:hover {
  color: var(--accent-primary-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-variant-numeric: tabular-nums;
}

code {
  background: var(--bg-code);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 0.05em 0.32em;
  overflow-wrap: anywhere;
}

sub,
sup {
  font-size: 0.72em;
  line-height: 0;
}

var {
  font-family: var(--font-serif);
  font-style: italic;
}

.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--accent-primary);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 0.75rem;
  color: #fff;
}

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

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--ink-primary);
  background: var(--bg-canvas);
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0 1.75rem;
  padding-top: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding-bottom: 0.9rem;
  color: var(--ink-primary);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink-primary);
}

.brand__mark {
  flex: none;
  width: 2.35rem;
  height: 2.35rem;
}

.brand__text {
  display: block;
  min-width: 0;
}

.brand__name {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.15;
}

.brand__sub {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  line-height: 1.25;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 0.55rem 0 0.9rem;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-secondary);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--accent-primary);
  border-bottom-color: var(--border-strong);
}

.site-nav a[aria-current="page"] {
  color: var(--ink-primary);
  border-bottom-color: var(--accent-primary);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: none;
  min-width: 44px;
  min-height: 44px;
  margin-bottom: 0.75rem;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: 500 var(--text-sm) / 1 var(--font-sans);
  color: var(--ink-primary);
  cursor: pointer;
}

.nav-toggle__bars {
  display: block;
  width: 1rem;
  height: 0.7rem;
  border-block: 2px solid currentColor;
  position: relative;
}

.nav-toggle__bars::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  border-top: 2px solid currentColor;
  transform: translateY(-50%);
}

/* ---------- Page head ---------- */

.page-head {
  padding-block: clamp(2rem, 5vw, 3.25rem) clamp(1.75rem, 4vw, 2.5rem);
}

.lede {
  margin-top: 1.1rem;
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--ink-secondary);
  max-width: 62ch;
}

/* Home: headline and lead beside the opening plate, roughly 40:60. */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 3.5vw, 2.75rem);
  align-items: start;
}

.hero h1 {
  font-size: clamp(1.85rem, 1.2rem + 1.6vw, 2.3rem);
  line-height: 1.1;
  max-width: none;
}

.hero .lede {
  max-width: 38ch;
}

.hero__links {
  margin-top: 1.4rem;
  font-size: var(--text-sm);
}

.hero-plate {
  margin: 0;
  min-width: 0;
}

.hero-plate__canvas {
  position: relative;
}

.hero-plate__img,
.hero-plate__canvas > svg {
  display: block;
  width: 100%;
  height: auto;
}

.hero-plate__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.2rem 1.25rem;
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-hairline);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink-secondary);
}

.hero-plate__controls {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  white-space: nowrap;
  color: var(--ink-muted);
}

.hero-plate__controls[hidden] {
  display: none;
}

.plate-btn {
  appearance: none;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  font: inherit;
  color: var(--accent-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.plate-btn:hover {
  color: var(--accent-primary-hover);
  text-decoration-thickness: 2px;
}

/* On-page jump links under a page head */

.jump {
  margin-top: 1.5rem;
  font-size: var(--text-sm);
}

.jump ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.5rem;
  margin: 0;
  padding: 0.7rem 0 0;
  list-style: none;
  border-top: 1px solid var(--border-hairline);
}

.jump li:first-child {
  color: var(--ink-muted);
}

/* A request or release note set apart from the running text */

.callout {
  max-width: var(--measure-width);
  padding: 0.9rem 1.1rem 1rem;
  background: var(--bg-subtle);
  border-block: 1px solid var(--border-hairline);
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--ink-secondary);
}

.callout p {
  margin-bottom: 0.45em;
}

/* ---------- Sections ---------- */

.section {
  border-top: 1px solid var(--border-hairline);
  padding-block: clamp(1.75rem, 4vw, 2.5rem) clamp(2rem, 5vw, 3.25rem);
}

.section--tool {
  border-top: 0;
  padding-top: 0;
}

.section > h2 {
  margin-bottom: 1.1rem;
}

/* Long reference pages keep the heading and local links in a left margin. */

.section__grid {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  gap: 1.5rem 2.75rem;
}

.rail-links {
  margin: 0.9rem 0 0;
  padding: 0.65rem 0 0;
  list-style: none;
  border-top: 1px solid var(--border-hairline);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.rail-links li {
  padding: 0.16rem 0;
}

.rail-links a {
  color: var(--ink-secondary);
  text-decoration-color: var(--border-strong);
}

.rail-links a:hover {
  color: var(--accent-primary);
}

@media (min-width: 861px) {
  .section__label {
    position: sticky;
    top: 1.25rem;
    align-self: start;
  }
}

.section__body > :not(:first-child) {
  margin-top: 1.4rem;
}

.section__body > h3:not(:first-child) {
  margin-top: 1.9rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--border-hairline);
}

.section__body > h3 + :not(:first-child) {
  margin-top: 0.6rem;
}

.section__body > h3 + p + p {
  margin-top: 0.75rem;
}

.section__body > h3,
.section[id],
.table-wrap[id] {
  scroll-margin-top: 1rem;
}

/* Frequency band set beside a regime heading */

.band {
  margin-left: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--accent-secondary);
  white-space: nowrap;
}

.thesis {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: 1.5;
  max-width: 60ch;
}

.note {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  line-height: 1.55;
}

/* Marks a protocol whose targets could be mistaken for results. Use sparingly. */

.tag {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12em 0.5em 0.14em;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  vertical-align: 0.12em;
  white-space: nowrap;
}

.tag--prereg {
  background: var(--status-prereg-tint);
  color: var(--status-prereg);
}

/* ---------- Study entries (home) ---------- */

.entries {
  border-top: 1px solid var(--border-hairline);
}

.entry {
  padding: 1.05rem 0 1.15rem;
  border-bottom: 1px solid var(--border-hairline);
}

.entry h3 {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: 1.3;
}

.entry h3 a {
  color: var(--ink-primary);
  text-decoration-color: var(--border-strong);
}

.entry h3 a:hover {
  color: var(--accent-primary);
}

.entry p {
  margin-top: 0.35rem;
  color: var(--ink-secondary);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 2.5rem;
  max-width: 50rem;
}

/* Definition rows */

.spec {
  margin: 0;
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  max-width: 50rem;
  border-bottom: 1px solid var(--border-hairline);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.spec dt,
.spec dd {
  margin: 0;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border-hairline);
}

.spec dt {
  padding-right: 1.25rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.spec dd {
  color: var(--ink-secondary);
}

.spec--wide {
  grid-template-columns: 14rem minmax(0, 1fr);
}

/* ---------- Tables ---------- */

/* Journal-style rules: heavy top and bottom, a thin rule under the header,
   hairlines between rows, no outer frame. */

.table-wrap {
  max-width: 50rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap--wide,
.grid-2 .table-wrap {
  max-width: none;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  border-top: 1.5px solid var(--ink-primary);
  border-bottom: 1.5px solid var(--ink-primary);
  font-size: var(--text-sm);
  line-height: 1.45;
}

table.data caption {
  caption-side: top;
  padding: 0 0 0.55rem;
  text-align: left;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink-secondary);
}

table.data caption b,
.fig figcaption b {
  font-weight: 600;
  color: var(--ink-primary);
  margin-right: 0.35em;
}

table.data th,
table.data td {
  padding: 0.5rem 1.25rem 0.5rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border-hairline);
}

table.data th:last-child,
table.data td:last-child {
  padding-right: 0;
}

table.data thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-secondary);
  border-bottom: 1px solid var(--ink-primary);
  white-space: nowrap;
  vertical-align: bottom;
}

table.data thead th.num {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
}

table.data thead th .sub {
  margin-top: 0.1rem;
}

table.data tbody th {
  font-weight: 500;
  color: var(--ink-primary);
}

table.data tbody tr:last-child > * {
  border-bottom: 0;
}

table.data tfoot th,
table.data tfoot td {
  border-top: 1px solid var(--ink-primary);
  border-bottom: 0;
  font-weight: 600;
}

table.data .num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.data .em {
  color: var(--accent-secondary);
  font-weight: 500;
}

table.data th.mono,
table.data th > .mono {
  white-space: nowrap;
}

table.data td.wrap-text {
  min-width: 15rem;
}

table.data .num.num--wrap {
  white-space: normal;
}

table.data .sub {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--ink-muted);
}

table.data .sub code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 1em;
}

/* ---------- Figures ---------- */

.fig {
  margin: 0;
}

.fig__scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Multiply lets a figure drawn on white take the paper tone of the page. */
.fig__scroll img,
.fig__scroll svg {
  display: block;
  width: 100%;
  min-width: 620px;
  mix-blend-mode: multiply;
}

.fig figcaption {
  max-width: var(--measure-width);
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-hairline);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink-secondary);
}

/* ---------- Equations ---------- */

.eq {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  max-width: 50rem;
  margin: 0;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border-hairline);
}

.eq:last-of-type {
  border-bottom: 1px solid var(--border-hairline);
}

.eq__expr {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-style: italic;
  overflow-wrap: anywhere;
}

.eq__expr .rm {
  font-style: normal;
}

.eq__no {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.eq__desc {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

/* ---------- Reference lists ---------- */

.refs {
  max-width: 50rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: ref;
  border-top: 1px solid var(--border-hairline);
}

.refs > li {
  counter-increment: ref;
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0 0.9rem;
  padding: 0.95rem 0 1rem;
  border-bottom: 1px solid var(--border-hairline);
}

/* Directly under a section rule the list needs no rule of its own. */
.section__body > .refs:first-child {
  border-top: 0;
}

.section__body > .refs:first-child > li:first-child {
  padding-top: 0;
}

.refs > li::before {
  content: "[" counter(ref) "]";
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  padding-top: 0.25em;
}

.refs p {
  margin-bottom: 0.35em;
}

.refs .ref__title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.35;
}

.refs .ref__meta {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.cite summary {
  display: inline-block;
  padding: 0.3rem 0;
  font-size: var(--text-sm);
  color: var(--accent-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.cite-block {
  max-width: 50rem;
  margin: 0.5rem 0 0;
  padding: 0.9rem 1rem;
  background: var(--bg-code);
  border-block: 1px solid var(--border-hairline);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink-secondary);
}

/* ---------- People ---------- */

/* A plain directory: name and role in the left column, notes beside them. */

.directory {
  max-width: 58rem;
  border-top: 1px solid var(--border-hairline);
}

.person {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  gap: 0.6rem 2.5rem;
  padding: 1.25rem 0 1.4rem;
  border-bottom: 1px solid var(--border-hairline);
}

.person:last-child {
  border-bottom: 0;
  padding-bottom: 0.4rem;
}

.person__name {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.012em;
}

.person__role {
  margin: 0.35rem 0 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--ink-secondary);
}

.person__role + .person__role {
  margin-top: 0.15rem;
}

.person__bio p {
  max-width: 58ch;
  margin-bottom: 0.6em;
}

/* ---------- Physics explorer ---------- */

/* An open panel between two rules: inputs on a toned column, results on paper. */

.explorer {
  border-top: 1.5px solid var(--ink-primary);
}

.explorer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.5rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-hairline);
}

.explorer__preset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.explorer select,
.explorer input[type="number"] {
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.45rem;
}

.explorer select {
  font-family: var(--font-sans);
  max-width: 100%;
  min-width: 0;
}

.explorer__preset {
  min-width: 0;
  max-width: 100%;
}

.btn {
  padding: 0.32rem 0.7rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: 500 var(--text-sm) / 1.4 var(--font-sans);
  color: var(--ink-primary);
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.explorer__body {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
}

.explorer__controls {
  padding: 1.1rem 1.25rem 1.3rem;
  border-right: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
}

.explorer__results {
  padding: 1.1rem 0 1.3rem 1.5rem;
  min-width: 0;
}

.explorer__results > :not(:first-child) {
  margin-top: 1.25rem;
}

.ctl {
  margin: 0;
  padding: 0.7rem 0 0.8rem;
  border: 0;
  border-top: 1px solid var(--border-hairline);
  min-width: 0;
}

.ctl:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.ctl__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.ctl label,
.ctl legend {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-primary);
  padding: 0;
}

.ctl legend {
  float: left;
  width: 100%;
}

.ctl legend + * {
  clear: both;
}

.ctl__field {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}

.ctl__field input[type="number"] {
  width: 5.1rem;
  text-align: right;
}

.ctl__unit {
  min-width: 2.1rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.ctl input[type="range"] {
  display: block;
  width: 100%;
  margin: 0.55rem 0 0;
  accent-color: var(--accent-primary);
}

.ctl__range {
  display: flex;
  justify-content: space-between;
  margin-top: 0.1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-muted);
}

.ctl__hint {
  margin: 0.4rem 0 0;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--ink-muted);
}

.ctl__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin-top: 0.45rem;
  font-size: var(--text-sm);
}

.ctl__choices label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  cursor: pointer;
}

.ctl__choices input {
  accent-color: var(--accent-primary);
  margin: 0;
}

.ctl[disabled] {
  opacity: 0.45;
}

.explorer .table-wrap {
  max-width: none;
}

table.data.readout thead th {
  white-space: normal;
  line-height: 1.3;
}

/* Fixed columns so the three checks stay aligned while values change */
.readout {
  table-layout: fixed;
  min-width: 37rem;
}

.readout thead th:nth-child(1) { width: 31%; }
.readout thead th:nth-child(2) { width: 19%; }
.readout thead th:nth-child(3) { width: 17%; }
.readout thead th:nth-child(4) { width: 15%; }
.readout thead th:nth-child(5) { width: 18%; }

.readout td.val .sub {
  white-space: normal;
}

/* Symbol kerning after a semi-bold sans label */
.readout tbody th var {
  margin-left: 0.22em;
}

.readout td.regime {
  color: var(--ink-secondary);
}

.readout td.note-cell {
  color: var(--ink-secondary);
}

.readout .sub.flag {
  margin-top: 0.2rem;
  color: var(--accent-secondary);
  white-space: normal;
}

.readout td .sub {
  font-family: var(--font-sans);
}

.readout .val {
  font-size: 0.95em;
  font-weight: 500;
  color: var(--ink-primary);
}

/* One short reading of the table for the selected slab. */

.verdict {
  margin: 0;
  max-width: 64ch;
  font-family: var(--font-serif);
  font-size: 1.04rem;
  line-height: 1.55;
  color: var(--ink-primary);
}

.explorer__caveat {
  max-width: 72ch;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--ink-secondary);
}

.explorer__results > .verdict + .explorer__caveat {
  margin-top: 0.75rem;
}

.explorer__plot {
  border-top: 1px solid var(--border-hairline);
}

.explorer__plot-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.explorer__plot svg {
  display: block;
  width: 100%;
  min-width: 560px;
}

/* Live summary beside the inputs when the readout sits below them */

.px-strip {
  display: none;
}

.explorer__plot-title {
  margin: 0;
  padding: 0.5rem 0 0.35rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-secondary);
  max-width: none;
}

.explorer__foot {
  margin: 0;
  max-width: none;
  padding: 0.8rem 0 0.9rem;
  border-top: 1px solid var(--border-hairline);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink-secondary);
}

/* Explorer SVG primitives (inline SVG, so page fonts and tokens apply) */

.px text {
  font-family: var(--font-sans);
  font-size: 11.5px;
  fill: var(--ink-secondary);
}

.px .px-mono {
  font-family: var(--font-mono);
  font-size: 11px;
}

.px .px-strong {
  font-weight: 600;
  fill: var(--ink-primary);
}

.px .px-muted {
  fill: var(--ink-muted);
}

.px .px-halo {
  paint-order: stroke;
  stroke: var(--bg-canvas);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.px .px-halo-slab {
  paint-order: stroke;
  stroke: var(--bg-subtle);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.px .px-halo-band {
  paint-order: stroke;
  stroke: var(--accent-primary-tint);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.px .px-axis {
  stroke: var(--border-strong);
  stroke-width: 1;
  fill: none;
}

.px .px-grid {
  stroke: var(--border-hairline);
  stroke-width: 1;
}

.px .px-band {
  fill: var(--accent-primary-tint);
  stroke: var(--accent-primary);
  stroke-width: 1;
}

.px .px-band-open {
  fill: var(--accent-primary-tint);
  stroke: none;
}

.px .px-excite {
  fill: var(--bg-subtle);
  stroke: var(--border-strong);
  stroke-width: 1;
}

.px .px-nyq {
  stroke: var(--ink-primary);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.px .px-fp {
  stroke: var(--accent-primary);
  stroke-width: 2;
  fill: none;
}

.px .px-fd {
  stroke: var(--accent-secondary);
  stroke-width: 2;
  fill: none;
}

.px .px-fflex {
  stroke: var(--accent-secondary);
  stroke-width: 2;
  stroke-dasharray: 5 3;
  fill: none;
}

.px .px-dot-fp {
  fill: var(--accent-primary);
}

.px .px-dot-fd {
  fill: var(--accent-secondary);
}

.px .px-dot-fflex {
  fill: var(--bg-canvas);
  stroke: var(--accent-secondary);
  stroke-width: 2;
}

.px .px-slab {
  fill: var(--bg-subtle);
  stroke: var(--border-strong);
  stroke-width: 1;
}

.px .px-delam {
  fill: none;
  stroke: var(--accent-secondary);
  stroke-width: 2;
  stroke-linecap: round;
}

.px .px-ball {
  fill: var(--ink-secondary);
}

.px .px-rx {
  fill: var(--accent-primary);
}

.px .px-dim {
  stroke: var(--ink-muted);
  stroke-width: 1;
  fill: none;
}

.px .px-fade {
  opacity: 0.35;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: clamp(2rem, 5vw, 4rem);
  border-top: 1px solid var(--ink-primary);
  background: var(--bg-subtle);
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 1.5rem 3rem;
  padding-block: 1.75rem 1.5rem;
}

.footer-name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink-primary);
}

.footer-scope {
  margin: 0.45rem 0 0;
  max-width: 46ch;
  line-height: 1.5;
}

.site-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-pages ul {
  columns: 2;
  column-gap: 1.5rem;
}

.site-footer li {
  padding: 0.14rem 0;
  break-inside: avoid;
}

.site-footer a {
  color: var(--ink-secondary);
  text-decoration-color: var(--border-strong);
}

.site-footer a:hover {
  color: var(--accent-primary);
}

.footer-base {
  padding-block: 0.8rem 1.1rem;
  border-top: 1px solid var(--border-hairline);
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.footer-base p {
  max-width: none;
  margin: 0;
}

/* ---------- Responsive ---------- */

/* Below full width the navigation takes its own row under the wordmark. */
@media (max-width: 1160px) {
  .masthead {
    padding-top: 0.85rem;
  }

  .brand {
    padding-bottom: 0.7rem;
  }

  .site-nav {
    flex: 1 1 100%;
    border-top: 1px solid var(--border-hairline);
  }

  .site-nav a {
    padding-top: 0.6rem;
    padding-bottom: 0.7rem;
  }
}

@media (max-width: 1020px) {
  .explorer__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .explorer__controls {
    border-right: 0;
    border-bottom: 1px solid var(--border-hairline);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.75rem;
  }

  .explorer__results {
    padding-left: 0;
  }

  .ctl:nth-of-type(2) {
    border-top: 0;
    padding-top: 0;
  }

  .px-strip {
    position: sticky;
    top: 0;
    z-index: 2;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: -1.1rem -1.25rem 1rem;
    background: var(--bg-canvas);
    border-bottom: 1px solid var(--border-strong);
  }

  .px-strip__cell {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0.45rem 0.6rem 0.5rem;
    border-left: 1px solid var(--border-hairline);
    line-height: 1.25;
  }

  .px-strip__cell:first-child {
    border-left: 0;
    padding-left: 1.25rem;
  }

  .px-strip__k {
    font-size: var(--text-xs);
    color: var(--ink-muted);
  }

  .px-strip__v {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--ink-primary);
    white-space: nowrap;
  }

  .px-strip__s {
    font-size: 0.7rem;
    color: var(--ink-muted);
    white-space: nowrap;
  }

  .px-strip__cell.is-above .px-strip__v,
  .px-strip__cell.is-above .px-strip__s {
    color: var(--accent-secondary);
  }
}

@media (max-width: 860px) {
  .section__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.1rem;
  }

  .rail-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.4rem;
  }

  .rail-links li {
    padding: 0.3rem 0;
  }

  /* Home: headline and lead first, then the plate at full width. */
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero h1 {
    max-width: 20ch;
  }

  .hero .lede {
    max-width: 62ch;
  }

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

  .footer-inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .footer-inner > :first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .masthead {
    align-items: center;
    gap: 0 0.75rem;
  }

  .brand {
    flex: 1 1 0;
  }

  /* Without JavaScript the navigation stays visible as a wrapped list. */
  .site-nav {
    padding: 0.35rem 0 0.6rem;
  }

  .site-nav ul {
    gap: 0 1.25rem;
  }

  .site-nav a {
    padding: 0.45rem 0;
    margin-bottom: 0;
    border-bottom-width: 2px;
  }

  .js .nav-toggle {
    display: inline-flex;
  }

  .js .site-nav {
    display: none;
    padding: 0;
  }

  .js .site-nav.is-open {
    display: block;
  }

  .js .site-nav ul {
    display: block;
  }

  .js .site-nav li + li {
    border-top: 1px solid var(--border-hairline);
  }

  .js .site-nav a {
    padding: 0.7rem 0 0.7rem 0.7rem;
    border-bottom: 0;
    border-left: 2px solid transparent;
    font-size: var(--text-base);
  }

  .js .site-nav a[aria-current="page"] {
    border-left-color: var(--accent-primary);
  }
}

@media (max-width: 620px) {
  /* Masthead: wordmark and menu button share one row; the open menu takes row two. */
  .masthead {
    padding-top: 0.65rem;
  }

  .brand {
    gap: 0.55rem;
    padding-bottom: 0.65rem;
  }

  .brand__mark {
    width: 2rem;
    height: 2rem;
  }

  .brand__name {
    font-size: 1.04rem;
  }

  .brand__sub {
    font-size: 0.72rem;
  }

  .nav-toggle {
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.75rem;
  }

  .hero-plate__caption {
    display: block;
  }

  .hero-plate__controls {
    display: flex;
    margin-top: 0.15rem;
  }

  .plate-btn {
    min-height: 44px;
  }

  .site-footer li a,
  .rail-links a,
  .jump a {
    display: inline-block;
    padding-block: 0.68rem;
  }

  .rail-links li {
    padding: 0;
  }

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

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

  .ctl:nth-of-type(2) {
    border-top: 1px solid var(--border-hairline);
    padding-top: 0.7rem;
  }

  .explorer select,
  .explorer input[type="number"],
  .explorer .btn {
    min-height: 2.75rem;
  }

  .explorer__preset select {
    flex: 1 1 100%;
    width: 100%;
  }

  .ctl input[type="range"] {
    min-height: 2rem;
  }

  .ctl__choices label {
    min-height: 2.75rem;
  }

  .px-strip {
    padding-inline: 0.75rem;
  }

  .px-strip__cell,
  .px-strip__cell:first-child {
    padding-inline: 0.4rem;
  }

  .px-strip__v {
    font-size: 0.8rem;
  }

  .px-strip__s {
    font-size: 0.64rem;
  }

  .spec,
  .spec--wide {
    grid-template-columns: minmax(0, 1fr);
  }

  .spec dt {
    padding-bottom: 0;
  }

  .spec dd {
    border-top: 0;
    padding-top: 0.15rem;
  }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  table.data th,
  table.data td {
    padding-right: 0.8rem;
  }

  /* Compact tables fit the column: let their headers wrap instead of forcing a scroll. */
  table.data thead th,
  table.data thead th.num {
    white-space: normal;
  }

  table.data td.wrap-text {
    min-width: 0;
  }

  /* Wide tables and figures keep their width and scroll in place, with a short cue. */
  table.data--wide {
    min-width: 34rem;
  }

  table.data.data--wide thead th,
  table.data.data--wide thead th.num {
    white-space: nowrap;
  }

  table.data--wide caption::after,
  .fig figcaption::after,
  .explorer__plot-title::after {
    content: "Scroll \2192";
    margin-left: 0.5em;
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--ink-muted);
    white-space: nowrap;
  }

  /* Edge shadows appear only on the side that still has content to scroll to. */
  .table-wrap--scroll,
  .fig__scroll,
  .explorer__plot-scroll {
    background:
      linear-gradient(to right, var(--bg-canvas) 35%, rgba(250, 249, 246, 0)) left center / 2.25rem 100% no-repeat local,
      linear-gradient(to left, var(--bg-canvas) 35%, rgba(250, 249, 246, 0)) right center / 2.25rem 100% no-repeat local,
      linear-gradient(to right, rgba(22, 24, 29, 0.16), rgba(22, 24, 29, 0)) left center / 0.85rem 100% no-repeat scroll,
      linear-gradient(to left, rgba(22, 24, 29, 0.16), rgba(22, 24, 29, 0)) right center / 0.85rem 100% no-repeat scroll,
      var(--bg-canvas);
  }

  /* Wide enough that 14-unit figure labels stay near 11px while panning. */
  .fig__scroll img {
    min-width: 760px;
  }

  .explorer__plot svg {
    min-width: 640px;
  }

  /* Stacked tables: each row becomes a labeled block. */
  table.data--stack,
  table.data--stack caption,
  table.data--stack tbody,
  table.data--stack tr,
  table.data--stack th,
  table.data--stack td {
    display: block;
  }

  table.data--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  table.data--stack tbody tr {
    padding: 0.8rem 0 0.85rem;
    border-bottom: 1px solid var(--border-hairline);
  }

  table.data--stack tbody tr:last-child {
    border-bottom: 0;
  }

  table.data--stack tbody tr.is-na {
    display: none;
  }

  table.data--stack tbody th,
  table.data--stack tbody td,
  table.data--stack tbody td.num {
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
  }

  table.data--stack tbody th {
    margin-bottom: 0.4rem;
    font-weight: 600;
  }

  table.data--stack tbody td {
    padding-top: 0.45rem;
  }

  table.data--stack tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.1rem;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--ink-muted);
  }

  table.data--stack tbody td.is-empty {
    display: none;
  }

  /* Short values: label and value side by side. */
  table.data--kv tbody td {
    display: grid;
    grid-template-columns: 8.75rem minmax(0, 1fr);
    gap: 0 0.75rem;
    align-items: baseline;
    padding-top: 0.4rem;
  }

  table.data--kv tbody td::before {
    margin-bottom: 0;
    grid-row: 1 / span 3;
  }

  table.data--kv tbody td > .sub {
    grid-column: 2;
  }

  table.data--kv tbody td.note-cell {
    display: block;
  }

  table.data--kv tbody td.note-cell::before {
    margin-bottom: 0.15rem;
  }

  .readout {
    table-layout: auto;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media print {
  body {
    background: #fff;
  }

  .site-nav,
  .nav-toggle,
  .skip-link,
  .hero-plate__controls {
    display: none !important;
  }

  .section {
    break-inside: avoid;
  }
}
