:root {
  color-scheme: dark;
  --bg: #071013;
  --bg-deep: #04090b;
  --surface: #101d21;
  --surface-raised: #16272c;
  --surface-soft: #1b3036;
  --ink: #f3faf7;
  --muted: #bfd2cc;
  --quiet: #9db2ac;
  --line: #6f8885;
  --line-strong: #9eb5ae;
  --accent: #9af2c8;
  --accent-ink: #052119;
  --signal: #ffd68d;
  --signal-ink: #251804;
  --danger: #ffb7aa;
  --danger-deep: #4d1e1a;
  --max: 1600px;
  --content: 1160px;
  --focus: #ffe09f;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-deep);
}

body {
  min-width: 0;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 0.11em;
}

a:hover {
  color: #d5ffea;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

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

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  min-height: 44px;
  padding: 0.65rem 1rem;
  background: var(--focus);
  color: #171004;
  font-weight: 800;
  transform: translateY(-180%);
}

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

.site-head {
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 19, 0.98);
}

.prototype-band {
  margin: 0;
  padding: 0.7rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid #8f7443;
  background: #201a10;
  color: #fff0d2;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  text-align: center;
}

.head-rail {
  width: min(100%, var(--max));
  margin-inline: auto;
  padding: 0.85rem clamp(1rem, 4vw, 4rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand-lockup {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
  background: #10241e;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  line-height: 1.25;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.brand-context {
  color: var(--muted);
  font-size: 0.875rem;
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.primary-nav a {
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.primary-nav a:hover {
  background: var(--surface-raised);
  color: var(--ink);
}

main,
.site-footer {
  width: min(100%, var(--max));
  margin-inline: auto;
}

section {
  scroll-margin-top: 1rem;
}

.overview,
.board-section,
.scope-section,
.boundary-section,
.handoff-section,
.request-section {
  padding: clamp(3.2rem, 8vw, 7rem) clamp(1rem, 4vw, 4rem);
}

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(19rem, 0.75fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.overview-copy {
  max-width: 850px;
}

.eyebrow,
.tray-code {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

h1 {
  max-width: 15ch;
  margin-bottom: 1.5rem;
  font-size: clamp(2.55rem, 6.2vw, 5.5rem);
}

h2 {
  font-size: clamp(2rem, 4.2vw, 3.75rem);
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.7rem);
}

h4 {
  font-size: 1.12rem;
}

p,
dd,
li,
label,
input,
textarea,
button {
  font-size: 1rem;
}

.service-definition {
  max-width: 65ch;
  margin: 0 0 1.2rem;
  color: var(--ink);
  font-size: clamp(1.18rem, 1.8vw, 1.45rem);
  line-height: 1.55;
}

.overview-copy > p:not(.eyebrow):not(.service-definition) {
  max-width: 69ch;
}

.boundary-callout {
  margin-top: 1.5rem;
  padding: 1rem 1rem 1rem 1.25rem;
  border-left: 5px solid var(--signal);
  background: #201b13;
  color: #fff2d9;
}

.opening-actions {
  display: grid;
  gap: 1rem;
}

.action-tray {
  padding: 1.25rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 8px 8px 0 rgba(154, 242, 200, 0.07);
}

.action-tray-secondary {
  background: var(--surface-raised);
  box-shadow: 8px 8px 0 rgba(255, 214, 141, 0.07);
}

.action-tray h2 {
  margin-bottom: 0.75rem;
  font-size: 1.2rem;
}

.action-tray p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.primary-action,
.secondary-action,
.reset-action {
  min-height: 48px;
  padding: 0.8rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 0;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-action {
  background: var(--accent);
  color: var(--accent-ink);
}

.primary-action:hover {
  background: #c7ffe4;
  color: #031812;
}

.secondary-action,
.reset-action {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.secondary-action:hover,
.reset-action:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
  color: var(--ink);
}

.utility-rail {
  grid-column: 1 / -1;
  margin: clamp(2rem, 5vw, 4.5rem) 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.utility-rail > div {
  min-width: 0;
  padding: 1rem;
  border-right: 1px solid var(--line);
}

.utility-rail > div:last-child {
  border-right: 0;
}

.utility-rail dt,
.workcell-grid dt {
  color: var(--quiet);
  font-size: 0.875rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.utility-rail dd,
.workcell-grid dd {
  margin: 0.35rem 0 0;
}

.utility-rail dd {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 750;
}

.signal {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  color: var(--accent);
}

.signal-hatch {
  background: repeating-linear-gradient(135deg, currentColor 0 2px, transparent 2px 5px);
}

.signal-ring {
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 5px currentColor;
}

.signal-square {
  background: currentColor;
  box-shadow: inset 0 0 0 4px var(--surface);
}

.signal-stripe {
  color: var(--signal);
  background: linear-gradient(90deg, currentColor 0 30%, transparent 30% 65%, currentColor 65% 100%);
}

.board-section {
  border-bottom: 1px solid var(--line);
  background: var(--bg-deep);
}

.section-intro {
  max-width: 850px;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-intro h2 {
  margin-bottom: 0.8rem;
}

.section-intro > p:last-child {
  max-width: 72ch;
  color: var(--muted);
}

.stage-spotlight {
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.spotlight-heading {
  padding: 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.7fr);
  gap: 1.25rem;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.spotlight-heading h3 {
  margin-bottom: 0;
}

.spotlight-status {
  margin: 0;
  padding: 0.75rem 1rem;
  border-left: 4px double var(--signal);
  background: #211c13;
  color: #fff1d5;
  font-weight: 700;
}

.stage-controls {
  min-width: 0;
  margin: 0;
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.stage-controls legend {
  width: 100%;
  padding: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 800;
}

.stage-button {
  position: relative;
  min-height: 48px;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
}

.stage-button:hover {
  border-color: var(--accent);
}

.stage-button[aria-pressed="true"] {
  border: 4px double var(--accent);
  background: #16342b;
  box-shadow: inset 0 -4px 0 var(--accent);
}

.relay-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.workcell {
  position: relative;
  min-width: 0;
  padding: 1.15rem;
  background: var(--surface-raised);
  box-shadow: inset 0 5px 0 var(--line-strong);
}

.workcell + .workcell {
  border-left: 3px double var(--line-strong);
}

.workcell[data-emphasis="selected"] {
  z-index: 1;
  background: #18332d;
  box-shadow: inset 0 7px 0 var(--accent), inset 0 0 0 2px var(--accent);
}

.workcell[data-emphasis="muted"] {
  background: #101c20;
  box-shadow: inset 0 5px 0 #506561;
}

.workcell-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.stage-number {
  margin: 0;
  color: var(--accent);
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.stage-state {
  margin: 0;
  color: #d8e8e3;
  font-size: 0.875rem;
  font-weight: 800;
  text-align: right;
}

.workcell h4 {
  min-height: 2.5em;
  margin: 1rem 0;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.workcell-grid {
  margin: 0;
}

.workcell-grid > div {
  padding: 0.8rem 0;
  border-bottom: 1px dotted var(--line);
}

.workcell-grid dd {
  color: var(--muted);
}

.responsibility,
.exception {
  margin: 1rem 0 0;
  padding: 0.8rem;
  display: grid;
  gap: 0.3rem;
  border-left: 4px solid var(--accent);
  background: #0c1a18;
}

.exception {
  border-left-color: var(--signal);
  background: #211b12;
  color: #fff0d1;
}

.responsibility strong,
.exception strong {
  font-size: 0.875rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.static-equivalent {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: #0d171a;
}

.static-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr);
  gap: 0 1.5rem;
  align-items: baseline;
}

.static-heading .eyebrow,
.static-heading h3 {
  margin-bottom: 0.5rem;
}

.static-heading p:last-child {
  grid-column: 2;
  margin-top: 0;
  color: var(--muted);
}

.stage-cards {
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  counter-reset: static-stage;
}

.stage-cards > li {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.canonical-step h4 {
  margin-bottom: 0.65rem;
  color: var(--accent);
}

.canonical-step p,
.stage-cards > li > p {
  margin: 0.55rem 0 0;
}

.stage-cards > li > p {
  color: var(--muted);
}

.stage-cards .static-exception {
  padding-top: 0.6rem;
  border-top: 1px dashed var(--signal);
  color: #ffe5b8;
}

.scope-section {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

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

.question-trays article {
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  box-shadow: inset 0 5px 0 var(--accent);
}

.question-trays article:nth-child(even) {
  box-shadow: inset 0 5px 0 var(--signal);
}

.question-trays h3 {
  min-height: 3.4em;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.2rem;
}

.question-trays article > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.boundary-section {
  display: grid;
  grid-template-columns: minmax(17rem, 0.65fr) minmax(0, 1.35fr);
  gap: clamp(2rem, 5vw, 5rem);
  border-bottom: 1px solid var(--line);
  background: #13130f;
}

.boundary-ledger {
  border: 1px solid #927848;
  background: #1d1911;
}

.boundary-ledger p {
  position: relative;
  margin: 0;
  padding: 1.2rem 1.2rem 1.2rem 3.2rem;
  border-bottom: 1px solid #806a42;
  color: #fff0d1;
}

.boundary-ledger p:last-child {
  border-bottom: 0;
}

.boundary-ledger p::before {
  position: absolute;
  top: 1.25rem;
  left: 1.2rem;
  color: var(--signal);
  content: "!";
  font-size: 1.2rem;
  font-weight: 950;
}

.handoff-section {
  display: grid;
  grid-template-columns: auto minmax(0, 850px);
  justify-content: center;
  gap: clamp(1.25rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.handoff-marker {
  width: clamp(74px, 9vw, 120px);
  height: clamp(74px, 9vw, 120px);
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
  background: #10251f;
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 900;
}

.handoff-section h2 {
  margin-bottom: 1rem;
}

.handoff-section p:last-child {
  max-width: 72ch;
  color: var(--muted);
  font-size: 1.1rem;
}

.request-section {
  background: var(--bg-deep);
}

.request-intro {
  max-width: 900px;
}

.request-intro h2 {
  margin-bottom: 1rem;
}

.request-intro > p:not(.eyebrow) {
  max-width: 76ch;
}

.sensitive-note {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid #9e8450;
  background: #201a10;
  color: #fff0d2;
  font-weight: 700;
}

.request-form {
  margin-top: 2rem;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

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

.field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 0.45rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--ink);
  font-weight: 800;
}

.field-requirement,
.field-help,
.field-error {
  display: block;
  font-size: 0.875rem;
  line-height: 1.45;
}

.field-requirement,
.field-help {
  color: var(--muted);
}

.field-error {
  padding-left: 0.75rem;
  border-left: 4px solid var(--danger);
  color: #ffd9d2;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem;
  border: 2px solid var(--line-strong);
  border-radius: 0;
  background: #071114;
  color: var(--ink);
}

textarea {
  min-height: 7.5rem;
  resize: vertical;
}

input:hover,
textarea:hover {
  border-color: var(--accent);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: #17100f;
}

.error-summary {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 2px solid var(--danger);
  background: var(--danger-deep);
  color: #ffe8e4;
}

.error-summary h3 {
  margin-bottom: 0.5rem;
  color: #fff0ed;
}

.error-summary ul {
  margin-bottom: 0;
}

.error-summary a {
  color: #fff0ed;
}

.request-preview {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 2px solid var(--accent);
  background: #0d2921;
}

.request-preview h3 {
  color: var(--accent);
}

.request-preview dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(9rem, 0.4fr) minmax(0, 1fr);
  gap: 0;
}

.request-preview dt,
.request-preview dd {
  min-width: 0;
  margin: 0;
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.request-preview dt {
  color: var(--muted);
  font-weight: 800;
}

.form-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.request-confirmation {
  margin: 1rem 0 0;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.request-confirmation[data-preview-state="ready"] {
  border: 2px solid var(--accent);
  background: #0d2921;
  color: var(--ink);
  box-shadow: inset 6px 0 0 var(--accent);
}

.status-region {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.no-js-note {
  margin: 1.25rem 0 0;
  padding: 1rem;
  border: 1px dashed var(--signal);
  color: #ffe7bd;
}

.js .no-js-note {
  display: none;
}

.no-js [data-enhancement-control] {
  display: none;
}

.site-footer {
  min-height: 110px;
  padding: 1.5rem clamp(1rem, 4vw, 4rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.site-footer a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 1120px) {
  .overview {
    grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.9fr);
  }

  .relay-board,
  .question-trays {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .utility-rail > div:nth-child(2) {
    border-right: 0;
  }

  .utility-rail > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 820px) {
  .head-rail,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-nav {
    width: 100%;
    justify-content: flex-start;
  }

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

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

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

@media (max-width: 700px) {
  .prototype-band {
    text-align: left;
  }

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

  .primary-nav a {
    border: 1px solid var(--line);
  }

  .overview,
  .board-section,
  .scope-section,
  .boundary-section,
  .handoff-section,
  .request-section {
    padding-block: 3.5rem;
  }

  .opening-actions,
  .utility-rail,
  .relay-board,
  .stage-cards,
  .question-trays,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .utility-rail > div,
  .utility-rail > div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .utility-rail > div:last-child {
    border-bottom: 0;
  }

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

  .stage-button {
    width: 100%;
    justify-self: stretch;
    text-align: left;
  }

  .workcell h4 {
    min-height: 0;
  }

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

  .static-heading p:last-child {
    grid-column: auto;
  }

  .question-trays h3 {
    min-height: 0;
  }

  .handoff-section {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }

  .handoff-marker {
    width: 74px;
    height: 74px;
  }

  .field-wide {
    grid-column: auto;
  }

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

  .request-preview dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .form-actions {
    display: grid;
  }

  .form-actions button {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .head-rail,
  .overview,
  .board-section,
  .scope-section,
  .boundary-section,
  .handoff-section,
  .request-section,
  .site-footer {
    padding-inline: 0.9rem;
  }

  .brand-context {
    max-width: 17ch;
  }

  .action-tray,
  .stage-spotlight,
  .static-equivalent,
  .request-form {
    box-shadow: none;
  }

  .workcell-topline {
    display: grid;
  }

  .stage-state {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .brand-mark,
  .action-tray,
  .utility-rail,
  .stage-spotlight,
  .workcell,
  .static-equivalent,
  .stage-cards > li,
  .question-trays article,
  .boundary-ledger,
  .request-form,
  .request-confirmation {
    border: 2px solid CanvasText;
  }

  .signal,
  .stage-button[aria-pressed="true"] {
    forced-color-adjust: none;
    border-color: Highlight;
  }

  .stage-button[aria-pressed="true"] {
    background: Highlight;
    color: HighlightText;
  }

  :focus-visible {
    outline-color: Highlight;
  }
}
