
:root {
  color-scheme: light;
  --paper: #f4f0e7;
  --panel: rgba(255, 254, 250, 0.95);
  --ink: #17211f;
  --muted: #66706c;
  --line: #c9c8bf;
  --blue: #285d8b;
  --blue-soft: #dfeaf3;
  --green: #176b5b;
  --green-soft: #dcebe3;
  --red: #bd4029;
  --red-soft: #f4dfd8;
  --amber: #92601e;
  --amber-soft: #f1e6cd;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --serif: Iowan Old Style, Baskerville, "Times New Roman", serif;
  --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;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 3%, rgba(40, 93, 139, 0.1), transparent 26rem),
    linear-gradient(rgba(31, 75, 64, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 75, 64, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 48px 48px, 48px 48px, auto;
  font-family: var(--sans);
}
a { color: inherit; }
button { font: inherit; }
code, .mono { font-family: var(--mono); }
.ui-icon { width: 1em; height: 1em; fill: currentColor; vertical-align: -0.12em; }

.hero { padding: clamp(54px, 8vw, 116px) clamp(18px, 7vw, 112px) 54px; border-bottom: 1px solid var(--line); }
.hero-grid { max-width: 1500px; margin: auto; display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(320px, .58fr); gap: 64px; align-items: end; }
.eyebrow, .section-kicker { margin: 0 0 14px; color: var(--red); font: 700 12px/1.2 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; max-width: 1000px; font: 500 clamp(54px, 8vw, 116px)/.9 var(--serif); letter-spacing: -.05em; }
.hero-copy { margin: 30px 0 0; max-width: 820px; color: #4e5955; font-size: clamp(18px, 2vw, 25px); line-height: 1.5; }
.hero-meta { min-width: 0; margin: 0; border: 1px solid var(--line); background: var(--panel); }
.hero-meta div { min-width: 0; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.hero-meta div:last-child { border: 0; }
.hero-meta dt { margin-bottom: 7px; color: var(--muted); font: 12px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.hero-meta dd { margin: 0; font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }

.workspace { max-width: 1600px; margin: auto; padding: 42px clamp(18px, 4vw, 64px) 90px; }
.section-heading { max-width: 900px; }
.section-heading h2 { margin: 0; font: 500 clamp(34px, 4vw, 58px)/.98 var(--serif); letter-spacing: -.025em; }
.section-heading > p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.comparison-section, .regime-section, .matrix-section, .contract-section, .load-boundary, .meaning-section, .boundary { border: 1px solid var(--line); background: var(--panel); }
.comparison-section, .regime-section, .matrix-section, .meaning-section { padding: clamp(24px, 4vw, 50px); }

.pair-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 28px 0 16px; }
.pair-button, .regime-button { min-width: 0; border: 1px solid var(--line); background: #fffefa; color: var(--ink); cursor: pointer; }
.pair-button { padding: 13px 15px; text-align: left; font-size: 13px; line-height: 1.4; }
.pair-button:hover, .regime-button:hover { border-color: var(--blue); }
.pair-button[data-active="true"] { border-color: var(--blue); background: var(--blue); color: white; }
.pair-button:focus-visible, .regime-button:focus-visible { outline: 3px solid rgba(40, 93, 139, 0.35); outline-offset: 2px; }
.pair-label { margin: 0; padding: 13px 16px; border-left: 4px solid var(--blue); background: var(--blue-soft); color: #294f71; font: 700 12px/1.4 var(--mono); }
.history-grid { display: grid; grid-template-columns: minmax(0, 1fr) 156px minmax(0, 1fr); margin-top: 22px; border: 1px solid var(--line); }
.history-grid > div { min-width: 0; }
.history-card { min-width: 0; height: 100%; background: #fffefa; }
.history-card header { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.history-card header span { display: block; color: var(--red); font: 700 12px/1.2 var(--mono); letter-spacing: .12em; }
.history-card header strong { display: block; margin-top: 8px; font: 500 clamp(23px, 2.4vw, 34px)/1 var(--serif); overflow-wrap: anywhere; }
.history-details { margin: 0; }
.history-field { min-width: 0; display: grid; grid-template-columns: minmax(96px, .34fr) minmax(0, 1fr); gap: 14px; padding: 10px 22px; border-bottom: 1px solid #e1dfd6; }
.history-field:last-child { border-bottom: 0; }
.history-field[data-excluded="true"] { background: var(--amber-soft); }
.history-field dt { color: var(--muted); font: 12px/1.4 var(--mono); text-transform: uppercase; }
.history-field dd { min-width: 0; margin: 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.history-field dd.mono { font-size: 12px; }
.relation-mark { display: grid; grid-template-columns: auto auto auto; gap: 8px; place-content: center; align-items: center; text-align: center; border-inline: 1px solid var(--line); background: var(--green-soft); }
.relation-mark span { color: var(--green); font: 700 12px/1 var(--mono); }
.relation-mark strong { font: 500 44px/.9 var(--serif); }
.relation-mark small { grid-column: 1 / -1; color: var(--muted); font: 12px/1.3 var(--mono); }

.regime-section { margin-top: 38px; }
.regime-controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 30px 0; }
.regime-button { display: flex; min-height: 64px; padding: 11px 13px; justify-content: space-between; gap: 12px; align-items: center; text-align: left; }
.regime-button span { min-width: 0; font-size: 12px; line-height: 1.3; }
.regime-button strong { color: var(--red); font: 700 19px/1 var(--mono); }
.regime-button[data-equal="true"] strong { color: var(--green); }
.regime-button[data-active="true"] { border-color: var(--blue); box-shadow: inset 0 -4px var(--blue); }
.verdict-panel { display: grid; grid-template-columns: minmax(230px, .38fr) minmax(0, 1fr); border: 1px solid var(--line); background: #fffefa; }
.verdict-core { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; padding: 28px; border-right: 1px solid var(--line); }
.verdict-core span { font: 500 clamp(54px, 6vw, 88px)/.7 var(--serif); }
.verdict-core strong { color: var(--red); font: 700 clamp(17px, 2vw, 25px)/1 var(--mono); overflow-wrap: anywhere; }
.verdict-core strong[data-equal="true"] { color: var(--green); }
.verdict-copy { min-width: 0; padding: 25px 28px; }
.verdict-copy h3 { margin: 0; font: 500 25px/1.15 var(--serif); }
.verdict-copy p { margin: 12px 0 0; color: var(--muted); line-height: 1.55; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-top: 0; }
.field-grid article { min-width: 0; padding: 20px; border-right: 1px solid var(--line); }
.field-grid article:last-child { border-right: 0; }
.field-grid h3 { margin: 0; color: var(--red); font: 700 12px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.field-grid ul { margin: 13px 0 0; padding-left: 18px; color: #4e5955; font: 12px/1.55 var(--mono); overflow-wrap: anywhere; }
.field-grid ul[data-empty="true"] { color: var(--green); }
.projection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-top: 0; background: var(--blue-soft); }
.projection-grid div { min-width: 0; padding: 15px 19px; border-right: 1px solid var(--line); }
.projection-grid div:last-child { border-right: 0; }
.projection-grid span { display: block; color: var(--blue); font: 700 12px/1.2 var(--mono); text-transform: uppercase; }
.projection-grid code { display: block; margin-top: 7px; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }

.matrix-section { margin-top: 38px; }
.matrix-scroll { margin-top: 28px; overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; min-width: 820px; border-collapse: collapse; background: #fffefa; }
th, td { padding: 15px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; }
tr:last-child th, tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { border-right: 0; }
thead th { color: var(--muted); background: #ece9df; font: 700 12px/1.3 var(--mono); text-transform: uppercase; }
tbody th { max-width: 260px; font: 600 13px/1.4 var(--sans); }
.matrix-verdict { color: var(--red); font: 700 12px/1 var(--mono); }
.matrix-verdict[data-equal="true"] { color: var(--green); background: var(--green-soft); }

.lower-grid { margin-top: 38px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.contract-section, .load-boundary { min-width: 0; padding: clamp(24px, 4vw, 44px); }
.contract-section { border-right: 0; }
.instruction-profile { margin: 26px 0 0; padding: 15px 17px; border-left: 4px solid var(--blue); background: var(--blue-soft); color: #294f71; font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.output-list { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.output-list li { min-width: 0; padding: 13px 15px; border: 1px solid var(--line); background: #fffefa; }
.output-list strong { display: block; font-size: 13px; }
.output-list code { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.contract-note, .load-boundary > p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.load-boundary { background: var(--amber-soft); }
.load-boundary > strong { display: block; margin-top: 30px; color: var(--amber); font: 700 clamp(22px, 3vw, 36px)/1 var(--mono); }
.not-zero { margin-top: 24px; font: 500 clamp(32px, 4vw, 52px)/1 var(--serif); }
.not-zero span { color: var(--red); }

.meaning-section { margin-top: 38px; }
.meaning-grid, .boundary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 28px; }
.meaning-grid article { padding: 23px; border: 1px solid var(--line); background: #fffefa; }
.meaning-grid h3 { margin: 0; font: 500 25px/1 var(--serif); }
.meaning-grid p { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.boundary { margin-top: 38px; padding: 30px; background: #ece9df; }
.boundary h2 { margin: 0; font: 500 36px/1 var(--serif); }
.boundary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.boundary-grid h3 { margin: 0 0 8px; color: var(--red); font: 12px/1.2 var(--mono); text-transform: uppercase; }
.boundary-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.fatal-error { margin: 30px; padding: 20px; color: #7c2215; border: 1px solid var(--red); background: var(--red-soft); }
.study-footer { padding: 28px clamp(18px, 4vw, 64px); border-top: 1px solid var(--line); color: var(--muted); font: 12px/1.5 var(--mono); }

@media (max-width: 1120px) {
  .history-grid { grid-template-columns: 1fr; }
  .relation-mark { min-height: 92px; border-inline: 0; border-block: 1px solid var(--line); }
  .regime-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lower-grid { grid-template-columns: 1fr; }
  .contract-section { border-right: 1px solid var(--line); border-bottom: 0; }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .pair-controls, .field-grid, .meaning-grid { grid-template-columns: 1fr; }
  .field-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .field-grid article:last-child { border-bottom: 0; }
  .boundary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .hero { padding-top: 44px; }
  .regime-controls, .projection-grid, .boundary-grid, .verdict-panel { grid-template-columns: 1fr; }
  .verdict-core { border-right: 0; border-bottom: 1px solid var(--line); }
  .projection-grid div { border-right: 0; border-bottom: 1px solid var(--line); }
  .projection-grid div:last-child { border-bottom: 0; }
  .history-field { grid-template-columns: 1fr; gap: 4px; }
}
