:root {
  --ink: #102233;
  --muted: #536777;
  --navy: #08131f;
  --navy-2: #102a3e;
  --paper: #f7f3ec;
  --paper-2: #ece5d8;
  --white: #fffdf9;
  --line: #d5cbbb;
  --cyan: #46d7cb;
  --cyan-dark: #087f78;
  --amber: #f0b65a;
  --coral: #ec735d;
  --blue: #4ca9d9;
  --green: #4d9f75;
  --shadow: 0 18px 50px rgba(8, 19, 31, .12);
  --radius: 18px;
  --shell: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.62;
}

a { color: #076b6a; text-underline-offset: .16em; }
a:hover { color: #064a50; }
img { max-width: 100%; height: auto; }
button, input, select { font: inherit; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.narrow { max-width: 830px; }
.skip-link { position: fixed; left: 18px; top: -80px; z-index: 20; padding: 10px 14px; background: var(--cyan); color: var(--navy); font-weight: 800; }
.skip-link:focus { top: 14px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  color: #eaf9f5;
  background: rgba(8, 19, 31, .96);
  border-bottom: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(14px);
}
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand-text { margin: 0; letter-spacing: .09em; text-transform: uppercase; font-size: .78rem; font-weight: 800; }
.site-header nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 18px; }
.site-header a { color: #dff5f1; text-decoration: none; font-size: .9rem; }
.site-header a:hover { color: var(--cyan); }

.hero {
  color: #f8fbfa;
  background:
    radial-gradient(circle at 78% 18%, rgba(70, 215, 203, .17), transparent 34%),
    radial-gradient(circle at 12% 70%, rgba(240, 182, 90, .12), transparent 30%),
    var(--navy);
  padding: 88px 0 78px;
  overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .7fr); gap: 62px; align-items: center; }
.eyebrow { margin: 0 0 12px; color: var(--cyan-dark); font-size: .76rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.hero .eyebrow, .dark .eyebrow { color: var(--cyan); }
h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; line-height: 1.12; text-wrap: balance; }
h1 { max-width: 850px; margin: 0; font-size: clamp(3rem, 7vw, 6rem); letter-spacing: -.045em; }
h2 { margin: 0 0 18px; font-size: clamp(2.1rem, 4vw, 3.8rem); letter-spacing: -.032em; }
h3 { margin: 0 0 12px; font-size: clamp(1.35rem, 2vw, 1.8rem); }
h4 { margin: 18px 0 8px; font-size: 1.14rem; }
.hero-answer { max-width: 820px; margin: 28px 0 0; font-size: clamp(1.18rem, 2vw, 1.55rem); line-height: 1.48; }
.hero-copy { max-width: 760px; color: #b9c9d4; }
.hero-actions, .form-actions, .export-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { color: var(--navy); background: var(--cyan); }
.button.secondary { color: inherit; background: transparent; border-color: currentColor; }
button:disabled { opacity: .42; cursor: not-allowed; }
.fact-card { padding: 28px; border: 1px solid rgba(255,255,255,.17); border-radius: var(--radius); background: rgba(255,255,255,.055); box-shadow: 0 20px 70px rgba(0,0,0,.22); }
.fact-card h2 { font-size: 1.55rem; }
.fact-card dl, .result-facts, .method-facts, .boundary-list, .tco-cards dl { margin: 0; }
.fact-card dl div, .result-facts div, .method-facts div, .boundary-list div, .tco-cards dl div { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 1fr); gap: 14px; padding: 11px 0; border-top: 1px solid rgba(255,255,255,.12); }
.fact-card dt, .result-facts dt, .method-facts dt, .boundary-list dt, .tco-cards dt { font-weight: 800; }
.fact-card dd, .result-facts dd, .method-facts dd, .boundary-list dd, .tco-cards dd { margin: 0; }

.section { padding: 92px 0; }
.section.light { background: var(--white); }
.section.dark { color: #eaf4f5; background: var(--navy); }
.section-intro { padding-block: 60px; }
.section-heading { max-width: 900px; margin-bottom: 38px; }
.section-heading > p:last-child { font-size: 1.12rem; }
.notice { margin-top: 28px; padding: 18px 20px; border-left: 4px solid var(--cyan-dark); background: var(--white); box-shadow: var(--shadow); }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 58px; }

.scorecard-section { background: var(--paper-2); }
.scorecard-form { display: grid; gap: 18px; }
.form-toolbar { position: sticky; top: 84px; z-index: 5; display: grid; grid-template-columns: auto minmax(220px, 360px) minmax(0, 1fr); align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: var(--navy-2); color: #edf8f7; box-shadow: var(--shadow); }
.form-toolbar label { font-weight: 800; }
.form-toolbar select { min-height: 42px; border: 1px solid #76909f; border-radius: 8px; padding: 7px 10px; background: #f8fbfa; color: var(--ink); }
.toolbar-note { margin: 0; color: #c8d7df; font-size: .9rem; }
fieldset { min-width: 0; margin: 0; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
legend { padding: 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; font-weight: 800; }
legend > span { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 9px; border-radius: 50%; background: var(--navy); color: var(--cyan); font: 800 .78rem/1 Inter, sans-serif; }
legend small { margin-left: 9px; color: var(--muted); font: 700 .78rem/1.3 Inter, sans-serif; }
.option-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.option-grid label { display: flex; gap: 10px; align-items: flex-start; min-height: 118px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.option-grid label:hover { border-color: var(--cyan-dark); }
.option-grid label:has(input:checked) { border-color: var(--cyan-dark); background: #e7f8f5; box-shadow: inset 0 0 0 1px var(--cyan-dark); }
.option-grid input { margin-top: 4px; accent-color: var(--cyan-dark); }
.option-grid strong { display: block; margin-bottom: 5px; line-height: 1.25; }
.option-grid span { font-size: .9rem; line-height: 1.42; }

.result-panel, .tco-result { margin-top: 32px; padding: 30px; border-radius: var(--radius); background: var(--navy); color: #e9f5f5; box-shadow: var(--shadow); }
.result-panel[data-status="DECISION_READY"] { border-left: 7px solid var(--green); }
.result-panel[data-status="CONSTRAINT_REVIEW_REQUIRED"] { border-left: 7px solid var(--amber); }
.result-panel[data-status="INSUFFICIENT_DECISION_EVIDENCE"] { border-left: 7px solid var(--coral); }
.result-panel[data-stale="true"], .tco-result[data-stale="true"] { outline: 3px dashed rgba(240, 182, 90, .55); outline-offset: -10px; }
.result-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 22px 0; }
.result-facts div { display: block; border-color: rgba(255,255,255,.13); }
.result-facts dd { color: var(--cyan); font-weight: 900; overflow-wrap: anywhere; }
.result-notes { padding: 20px; border-radius: 12px; background: rgba(255,255,255,.06); }
.result-notes h4 { color: var(--cyan); }
.boundary-warning { padding-left: 14px; border-left: 4px solid var(--amber); }
.formula-trace { color: #b8c8d3; font-family: "SFMono-Regular", Consolas, monospace; font-size: .86rem; }
.export-actions button { color: #eaf4f5; background: transparent; border-color: #67808e; }

.formula { overflow-x: auto; padding: 16px 18px; border-radius: 10px; background: var(--navy); color: var(--cyan); font-size: 1.02rem; }
.check-list, .number-list, .source-list { padding-left: 1.3rem; }
.check-list li, .number-list li, .source-list li { margin: 9px 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
table { width: 100%; border-collapse: collapse; }
caption { padding: 16px 18px; color: var(--muted); text-align: left; font-weight: 800; }
th, td { padding: 14px 16px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { color: #edf8f6; background: var(--navy-2); border-color: var(--navy-2); }
tbody th { width: 21%; }

.visual-section { background: #e7eee9; }
.figure-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); gap: 60px; align-items: center; }
.figure-grid.reverse { grid-template-columns: minmax(420px, 1.1fr) minmax(0, .9fr); }
figure { margin: 0; }
figure img { display: block; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--navy); }
figcaption { margin-top: 12px; color: var(--muted); font-size: .86rem; }
.boundary-list div { border-color: var(--line); }

.tco-section { background: var(--paper-2); }
.tco-form input { width: 145px; min-height: 42px; border: 1px solid #a99e8c; border-radius: 8px; padding: 7px 9px; background: #fff; }
.tco-form tbody th { min-width: 270px; }
.tco-result h3 { color: var(--cyan); }
.tco-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tco-cards article { padding: 22px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(255,255,255,.05); }
.tco-cards h4 { margin-top: 0; color: #f1f7f7; }
.tco-total { margin: 4px 0 14px; color: var(--cyan); font: 800 clamp(1.8rem, 4vw, 2.8rem)/1 Georgia, serif; }
.result-boundary { color: #b8c8d3; }

.scenario-grid, .failure-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.scenario-grid article { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.failure-grid article { padding: 22px; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; background: rgba(255,255,255,.045); }
.failure-grid article:nth-child(3n+1) { border-top-color: var(--cyan); }
.failure-grid article:nth-child(3n+2) { border-top-color: var(--amber); }
.failure-grid article:nth-child(3n) { border-top-color: var(--coral); }
.method-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 34px; margin-bottom: 48px; }
.method-facts div { border-color: var(--line); }
.source-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 54px; }
.source-list span { display: block; color: var(--muted); font-size: .88rem; }
details { padding: 17px 0; border-top: 1px solid var(--line); }
details:last-child { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 850; }
details p { padding-left: 22px; }

.site-footer { padding: 42px 0; color: #b8c8d3; background: #050d15; }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: end; }
.site-footer a { color: var(--cyan); }
.site-footer p { margin: 5px 0; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

@media (max-width: 980px) {
  .hero-grid, .split, .figure-grid, .figure-grid.reverse, .source-grid { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-toolbar { position: static; grid-template-columns: 1fr 1fr; }
  .toolbar-note { grid-column: 1 / -1; }
  .figure-grid.reverse figure { order: 2; }
}

@media (max-width: 720px) {
  .shell { width: min(calc(100% - 24px), var(--shell)); }
  .header-inner { align-items: flex-start; flex-direction: column; padding-block: 14px; }
  .site-header { position: static; }
  .site-header nav { justify-content: flex-start; gap: 10px 16px; }
  .hero, .section { padding-block: 64px; }
  .option-grid, .tco-cards, .scenario-grid, .failure-grid, .method-facts, .footer-grid { grid-template-columns: 1fr; }
  .form-toolbar, .result-facts { grid-template-columns: 1fr; }
  fieldset, .result-panel, .tco-result { padding: 20px; }
  legend small { display: block; margin: 6px 0 0 44px; }
  .option-grid label { min-height: 0; }
  th, td { padding: 11px 12px; }
  .tco-form input { width: 118px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
