
:root {
  color-scheme: light;
  --paper: #f5f1e8;
  --panel: rgba(255, 254, 250, 0.94);
  --ink: #18211f;
  --muted: #68716d;
  --line: #c9c8be;
  --green: #176b5b;
  --green-soft: #dcebe3;
  --blue: #315f8c;
  --blue-soft: #e0e9f2;
  --red: #bd4029;
  --red-soft: #f4dfd8;
  --amber: #93611f;
  --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 82% 6%, rgba(49, 95, 140, 0.09), transparent 24rem),
    linear-gradient(rgba(31, 75, 64, 0.042) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 75, 64, 0.042) 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, 118px) 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.45fr) minmax(320px, .55fr); gap: 64px; align-items: end; }
.eyebrow, .section-kicker { margin: 0 0 14px; color: var(--red); font: 700 12px/1.2 var(--mono); letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 0; max-width: 980px; font: 500 clamp(52px, 8vw, 116px)/.9 var(--serif); letter-spacing: -.05em; }
.hero-copy { margin: 30px 0 0; max-width: 800px; color: #4e5a56; font-size: clamp(18px, 2vw, 25px); line-height: 1.5; }
.hero-meta { min-width: 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: 880px; }
.section-heading h2 { margin: 0; font: 500 clamp(34px, 4vw, 58px)/.98 var(--serif); letter-spacing: -.02em; }
.section-heading > p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.section-heading code { font-size: .85em; }
.target-section, .cascade-section, .route-space-section, .load-section, .boundary { border: 1px solid var(--line); background: var(--panel); }
.target-section, .cascade-section { padding: clamp(24px, 4vw, 50px); }
.target-controls, .cost-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0; }
.target-button, .cost-button { padding: 10px 14px; border: 1px solid var(--line); background: #fffefa; color: var(--ink); cursor: pointer; }
.target-button:hover, .cost-button:hover { border-color: var(--green); }
.target-button[data-active="true"], .cost-button[data-active="true"] { color: white; border-color: var(--green); background: var(--green); }
.target-button:focus-visible, .cost-button:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 35%, transparent); outline-offset: 2px; }

.target-identity { min-width: 0; padding: 22px 24px; border-left: 4px solid var(--blue); background: var(--blue-soft); }
.target-identity > span { display: block; color: var(--blue); font: 700 12px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.target-identity code { display: block; margin-top: 12px; font-size: clamp(14px, 1.6vw, 21px); line-height: 1.45; overflow-wrap: anywhere; }
.target-identity p { margin: 12px 0 0; color: #4f6171; line-height: 1.5; }

.comparison-grid { display: grid; grid-template-columns: minmax(0, 1fr) 180px minmax(0, 1fr); margin-top: 28px; border: 1px solid var(--line); }
.comparison-grid > div { min-width: 0; }
.same-product { padding: 22px 14px; display: grid; place-content: center; text-align: center; border-inline: 1px solid var(--line); background: var(--green-soft); }
.same-product span { color: var(--green); font: 700 12px/1.3 var(--mono); letter-spacing: .1em; }
.same-product strong { margin: 8px 0; font: 500 54px/.8 var(--serif); }
.same-product small { color: var(--muted); line-height: 1.35; }
.route-card { min-width: 0; height: 100%; background: #fffefa; }
.route-card header { display: flex; justify-content: space-between; gap: 20px; align-items: end; padding: 22px; border-bottom: 1px solid var(--line); }
.route-card header span { color: var(--muted); font: 12px/1.2 var(--mono); text-transform: uppercase; }
.yield-value { color: var(--green); font: 500 clamp(34px, 4vw, 58px)/.8 var(--serif); }
.route-card[data-side="left"] .yield-value { color: var(--red); }
.route-details { margin: 0; }
.route-field { min-width: 0; display: grid; grid-template-columns: minmax(90px, .34fr) minmax(0, 1fr); gap: 14px; padding: 10px 22px; border-bottom: 1px solid #e1dfd6; }
.route-field dt { color: var(--muted); font: 12px/1.4 var(--mono); text-transform: uppercase; }
.route-field dd { min-width: 0; margin: 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.route-field dd.mono { font-size: 12px; }
.route-identity { display: block; padding: 15px 22px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.identity-result { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); border-top: 0; }
.identity-result div { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.identity-result div:last-child { border-right: 0; }
.identity-result dt { color: var(--muted); font: 12px/1.3 var(--mono); text-transform: uppercase; }
.identity-result dd { margin: 8px 0 0; color: var(--red); font: 700 22px/1 var(--mono); overflow-wrap: anywhere; }
.identity-result div:first-child dd, .identity-result div:last-child dd { color: var(--green); }

.cascade-section { margin-top: 38px; }
.cascade-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch; margin-top: 30px; }
.cascade-card { min-width: 0; padding: 22px; border: 1px solid var(--line); background: #fffefa; }
.cascade-card > span { color: var(--red); font: 12px/1.2 var(--mono); text-transform: uppercase; }
.cascade-card strong { display: block; margin: 10px 0; font-family: var(--serif); font-size: 24px; line-height: 1.05; }
.cascade-card p { color: var(--green); font-weight: 700; }
.cascade-card code { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.native-reference { display: block; margin-top: 14px; padding: 8px; color: var(--blue); background: var(--blue-soft); font: 12px/1.35 var(--mono); }
.cascade-arrow { display: grid; place-items: center; color: var(--blue); font-size: 28px; }
.continuity-note { margin: 24px 0 0; padding: 17px 20px; border-left: 3px solid var(--blue); background: var(--blue-soft); line-height: 1.55; }

.lower-grid { margin-top: 38px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); }
.route-space-section, .load-section { min-width: 0; padding: clamp(24px, 4vw, 44px); }
.route-space-section { border-right: 0; }
.route-space { display: grid; gap: 8px; margin-top: 28px; }
.analysis-route { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 15px 17px; border: 1px solid var(--line); border-left: 4px solid var(--red); background: #fffefa; }
.analysis-route[data-admissible="true"] { border-left-color: var(--green); }
.analysis-route strong { font-size: 14px; }
.analysis-route p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.route-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.route-tags span { padding: 4px 7px; color: var(--muted); background: #ece9df; font: 12px/1.2 var(--mono); text-transform: uppercase; }
.route-verdict { color: var(--red); font: 700 12px/1 var(--mono) !important; }
.analysis-route[data-admissible="true"] .route-verdict { color: var(--green); }
.load-result { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 26px; align-items: center; margin-top: 34px; }
.load-result > strong { color: var(--green); font: 500 clamp(82px, 9vw, 142px)/.72 var(--serif); }
.load-result code { display: block; font-size: clamp(18px, 2vw, 26px); overflow-wrap: anywhere; }
.load-result p { margin: 12px 0 0; color: #485651; line-height: 1.55; }
.load-definition { margin: 30px 0 0; padding: 18px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #5f4d31; line-height: 1.55; }

.boundary { margin-top: 38px; padding: 30px; background: #ece9df; }
.boundary h2 { margin: 0 0 20px; font: 500 36px/1 var(--serif); }
.boundary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.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: 1100px) {
  .comparison-grid { grid-template-columns: 1fr; }
  .same-product { border-inline: 0; border-block: 1px solid var(--line); }
  .cascade-flow { grid-template-columns: 1fr; gap: 8px; }
  .cascade-arrow { transform: rotate(90deg); min-height: 30px; }
  .lower-grid { grid-template-columns: 1fr; }
  .route-space-section { border-right: 1px solid var(--line); border-bottom: 0; }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .identity-result, .boundary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .identity-result div:nth-child(2) { border-right: 0; }
  .identity-result div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 620px) {
  .hero { padding-top: 44px; }
  .identity-result, .boundary-grid, .load-result { grid-template-columns: 1fr; }
  .identity-result div { border-right: 0; border-bottom: 1px solid var(--line); }
  .identity-result div:last-child { border-bottom: 0; }
  .analysis-route, .route-field { grid-template-columns: 1fr; }
  .route-verdict { justify-self: start; }
}
