@layer pages, motion, overrides;

@layer pages {
  .no-js .system-map__workspace {
    display: none;
  }

  .system-map {
    --map-width: 2300px;
    --map-height: 1220px;
    color: var(--brand-ink);
    background: var(--brand-white);
  }

  .system-map__intro {
    position: relative;
    z-index: 2;
    padding-block: clamp(2.4rem, 6vw, 5.8rem) clamp(2rem, 4vw, 3.5rem);
    border-block-end: 0.0625rem solid var(--brand-ink);
    background: var(--brand-surface);
  }

  .system-map__intro::before {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    inline-size: clamp(0.5rem, 1.2vw, 1rem);
    background: var(--brand-teal);
    content: "";
  }

  .system-map__intro-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(17rem, 0.7fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: end;
  }

  .system-map__intro h1 {
    max-inline-size: 16ch;
    margin-block: 0.3rem 1.2rem;
    font-size: clamp(3rem, 7vw, 7.4rem);
    letter-spacing: -0.075em;
    line-height: 0.88;
  }

  .system-map__lead {
    max-inline-size: 62ch;
    margin: 0;
    font-size: clamp(1.05rem, 2vw, 1.45rem);
    line-height: 1.45;
  }

  .system-map__brand-story {
    max-inline-size: 62rem;
    display: grid;
    grid-template-columns: minmax(11rem, 0.6fr) minmax(0, 1.4fr);
    gap: 0.75rem 1.25rem;
    margin-block-start: 1.35rem;
    background: var(--brand-white);
  }

  .system-map__brand-story .brand-story__body {
    font-size: 0.9rem;
  }

  .system-map__entry-actions {
    display: grid;
    gap: 0.75rem;
  }

  .system-map__entry-actions .button {
    justify-content: space-between;
    min-block-size: 3.3rem;
    border-width: 0.12rem;
    border-color: var(--brand-ink);
    text-align: start;
  }

  .system-map__entry-actions .button--primary {
    background: var(--brand-teal);
    box-shadow: 0.32rem 0.32rem 0 var(--brand-ink);
    color: var(--brand-ink);
  }

  .system-map__entry-actions .button--outline {
    background: var(--brand-ink);
    box-shadow: 0.32rem 0.32rem 0 var(--brand-teal);
    color: var(--brand-white);
  }

  .system-map__entry-actions .button--quiet {
    background: var(--brand-white);
    box-shadow: 0.32rem 0.32rem 0 var(--brand-ink);
    color: var(--brand-ink);
  }

  .system-map__entry-actions .button:hover,
  .system-map__entry-actions .button:focus-visible {
    border-color: var(--brand-ink);
    background: var(--brand-teal);
    outline: 0.18rem solid var(--brand-ink);
    outline-offset: 0.18rem;
    box-shadow: 0.5rem 0.5rem 0 var(--brand-ink);
    color: var(--brand-ink);
  }

  .system-map__inspector .button--outline,
  .map-story .button--outline {
    border-color: var(--brand-ink);
    background: var(--brand-white);
    color: var(--brand-ink);
  }

  .system-map__workspace {
    position: relative;
    z-index: 1;
    min-block-size: 52rem;
    border-block-end: 0.0625rem solid var(--brand-ink);
    background: var(--brand-ink);
    color: var(--brand-white);
  }

  .system-map__utility {
    position: relative;
    z-index: 14;
    display: flex;
    min-block-size: 5.25rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem max(var(--gutter), calc((100vw - var(--shell)) / 2));
    border-block-end: 0.0625rem solid var(--brand-white);
    background: var(--brand-ink);
  }

  .system-map__utility-primary,
  .system-map__utility-secondary {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .map-icon-button,
  .map-tool-button,
  .map-close-button,
  .system-map__zoom button {
    border: 0.0625rem solid var(--brand-white);
    background: var(--brand-ink);
    color: var(--brand-white);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
  }

  .map-icon-button,
  .map-tool-button {
    display: inline-flex;
    min-block-size: 2.7rem;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
  }

  .map-icon-button:hover,
  .map-icon-button:focus-visible,
  .map-tool-button:hover,
  .map-tool-button:focus-visible,
  .map-tool-button[aria-pressed="true"],
  .system-map__zoom button:hover,
  .system-map__zoom button:focus-visible {
    border-color: var(--brand-teal);
    background: var(--brand-teal);
    color: var(--brand-ink);
  }

  .map-depth {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .map-depth__label,
  .map-field > span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .map-depth__steps {
    display: flex;
    gap: 0.22rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .map-depth__steps li {
    min-inline-size: 2rem;
    padding: 0.22rem 0.3rem;
    border: 0.0625rem solid var(--brand-white);
    color: var(--brand-white);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.68rem;
    text-align: center;
  }

  .map-depth__steps li[data-current="true"] {
    border-color: var(--brand-teal);
    background: var(--brand-teal);
    color: var(--brand-ink);
  }

  .map-field {
    display: grid;
    gap: 0.22rem;
  }

  .map-field select {
    min-block-size: 2.25rem;
    max-inline-size: 13rem;
    padding-inline: 0.55rem 2rem;
    border: 0.0625rem solid var(--brand-white);
    border-radius: 0;
    background: var(--brand-ink);
    color: var(--brand-white);
    font: inherit;
    font-size: 0.8rem;
  }

  .system-map__stage-shell {
    position: relative;
    overflow: clip;
    border-block-end: 0.0625rem solid var(--brand-white);
  }

  .system-map__rail {
    position: absolute;
    z-index: 5;
    inset-block-start: 1.1rem;
    inset-inline: max(var(--gutter), calc((100vw - var(--shell)) / 2));
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    pointer-events: none;
  }

  .system-map__rail span {
    padding-block-end: 0.45rem;
    border-block-end: 0.16rem solid var(--brand-white);
    color: var(--brand-white);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
  }

  .system-map__rail span:first-child,
  .system-map__rail span:last-child {
    border-color: var(--brand-teal);
  }

  .system-map__viewport {
    position: relative;
    block-size: min(72vh, 50rem);
    min-block-size: 40rem;
    overflow: hidden;
    outline: none;
    background-color: var(--brand-ink);
    cursor: grab;
    touch-action: none;
    direction: ltr;
  }

  .system-map__viewport:focus-visible {
    outline: 0.2rem solid var(--brand-teal);
    outline-offset: -0.2rem;
  }

  .system-map__viewport[data-dragging="true"] {
    cursor: grabbing;
  }

  .system-map__canvas {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    inline-size: var(--map-width);
    block-size: var(--map-height);
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: 0 0;
    will-change: transform;
  }

  .system-map__canvas::before,
  .system-map__canvas::after {
    position: absolute;
    z-index: 0;
    content: "";
    pointer-events: none;
  }

  .system-map__canvas::before {
    inset: 4.5rem 4rem 4rem;
    border: 0.0625rem solid var(--brand-white);
  }

  .system-map__canvas::after {
    inset-block: 4.5rem 4rem;
    inset-inline-start: 50%;
    border-inline-start: 0.0625rem dashed var(--brand-white);
  }

  .system-map__zones,
  .system-map__zone-labels,
  .system-map__nodes,
  .system-map__edges {
    position: absolute;
    inset: 0;
  }

  .system-map__edges {
    z-index: 2;
    inline-size: 100%;
    block-size: 100%;
    overflow: visible;
    pointer-events: none;
  }

  .system-map__zone-labels {
    z-index: 3;
    pointer-events: none;
  }

  .map-edge {
    fill: none;
    stroke: var(--brand-surface);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
  }

  .map-edge[data-kind="control"] {
    stroke: var(--brand-white);
    stroke-dasharray: 10 7;
    stroke-width: 3;
  }

  .map-edge[data-kind="evidence"] {
    stroke: var(--brand-teal);
    stroke-dasharray: 3 6;
    stroke-width: 3;
  }

  .map-edge[data-kind="intelligence"] {
    stroke: var(--brand-white);
    stroke-dasharray: 1 8;
    stroke-linecap: round;
    stroke-width: 4;
  }

  .map-edge[data-kind="compatibility"] {
    stroke: var(--brand-surface);
    stroke-dasharray: 2 5 12 5;
    stroke-width: 3;
  }

  .map-edge[data-gap="true"] {
    stroke: var(--brand-teal);
    stroke-dasharray: 44 12 44;
    stroke-width: 4;
  }

  .map-edge[data-active="true"] {
    stroke: var(--brand-teal);
    stroke-width: 5;
  }

  .map-edge-story-rail {
    display: none;
    fill: none;
    stroke: var(--brand-white);
    stroke-width: 10;
  }

  .map-edge-story-packet {
    display: none;
    fill: var(--brand-teal);
    stroke: var(--brand-ink);
    stroke-width: 2;
  }

  .map-edge-group[data-layer-visible="false"] {
    visibility: hidden;
  }

  .map-edge-group[data-route-state="future"] .map-edge {
    stroke: var(--brand-surface);
    stroke-dasharray: 10 8;
    stroke-width: 3;
  }

  .map-edge-group[data-route-state="visited"] .map-edge {
    stroke: var(--brand-white);
    stroke-dasharray: none;
    stroke-width: 4;
  }

  .map-edge-group[data-route-state="current"] .map-edge-story-rail,
  .map-edge-group[data-route-state="current"] .map-edge-story-packet {
    display: block;
  }

  .map-edge-group[data-route-state="current"] .map-edge {
    stroke: var(--brand-teal);
    stroke-dasharray: none;
    stroke-width: 6;
  }

  .map-zone {
    position: absolute;
    z-index: 1;
    border: 0.0625rem solid var(--brand-white);
    background: var(--brand-ink);
    pointer-events: none;
  }

  .map-zone::before {
    position: absolute;
    inset-block-start: -0.5rem;
    inset-inline-start: 1rem;
    inline-size: 2.8rem;
    block-size: 0.5rem;
    background: var(--brand-teal);
    content: "";
  }

  .map-zone[data-focused="true"],
  .map-zone[data-preview="true"] {
    border-width: 0.2rem;
    border-color: var(--brand-teal);
    box-shadow: 0.75rem 0.75rem 0 var(--brand-teal);
  }

  .map-zone[data-muted="true"] {
    border-style: dashed;
  }

  .map-zone-label {
    position: absolute;
    z-index: 3;
    display: grid;
    min-block-size: 2rem;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
    padding: 0.3rem 0.55rem;
    overflow: hidden;
    border: 0.0625rem solid var(--brand-white);
    background: var(--brand-ink);
    color: var(--brand-white);
    font: inherit;
    text-align: start;
    pointer-events: auto;
    cursor: pointer;
  }

  .map-zone-label[data-focused="true"],
  .map-zone-label:hover,
  .map-zone-label:focus-visible {
    border-color: var(--brand-ink);
    background: var(--brand-teal);
    outline: 0.15rem solid var(--brand-white);
    outline-offset: 0.12rem;
    color: var(--brand-ink);
  }

  .map-zone-label[data-muted="true"] {
    border-style: dashed;
  }

  .map-zone__index {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.64rem;
    letter-spacing: 0.12em;
  }

  .map-zone__title {
    display: block;
    min-inline-size: 0;
    margin: 0;
    overflow: hidden;
    color: inherit;
    font-size: 0.84rem;
    letter-spacing: -0.02em;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .map-zone__summary {
    display: block;
    max-inline-size: 26ch;
    margin: 0;
    color: inherit;
    font-size: 0.68rem;
    line-height: 1.35;
  }

  .map-node {
    position: absolute;
    z-index: 4;
    display: grid;
    inline-size: 160px;
    min-block-size: 78px;
    align-content: start;
    gap: 0.28rem;
    padding: 0.7rem;
    border: 0.0625rem solid var(--brand-ink);
    border-radius: 0;
    background: var(--brand-surface);
    box-shadow: 0.34rem 0.34rem 0 var(--brand-white);
    color: var(--brand-ink);
    font: inherit;
    text-align: start;
    cursor: pointer;
  }

  .map-node:hover,
  .map-node:focus-visible {
    outline: 0.2rem solid var(--brand-teal);
    outline-offset: 0.18rem;
    box-shadow: 0.55rem 0.55rem 0 var(--brand-teal);
    transform: translate(-0.15rem, -0.15rem);
  }

  .map-node[data-core="true"] {
    inline-size: 256px;
    min-block-size: 138px;
    padding: 1rem;
    border: 0.2rem solid var(--brand-teal);
    background: var(--brand-white);
    box-shadow: 0.65rem 0.65rem 0 var(--brand-teal);
  }

  .map-node[data-gate="true"] {
    border-block-start: 0.55rem solid var(--brand-teal);
  }

  .map-node[data-decision="true"][data-decision-visible="true"] {
    border-style: double;
    border-width: 0.22rem;
  }

  .map-node[data-decision="true"][data-decision-visible="true"]::after {
    position: absolute;
    inset-block-start: -0.48rem;
    inset-inline-end: 0.55rem;
    inline-size: 0.72rem;
    block-size: 0.72rem;
    border: 0.12rem solid var(--brand-ink);
    background: var(--brand-teal);
    content: "";
    transform: rotate(45deg);
  }

  .map-node[data-muted="true"] {
    border-style: dashed;
    box-shadow: none;
    color: var(--brand-ink);
  }

  .map-node[data-related="true"]:not([data-selected="true"]):not([data-tour-active="true"]):not([data-trace="true"]) {
    border-color: var(--brand-teal);
    box-shadow: 0.28rem 0.28rem 0 var(--brand-teal);
  }

  .map-node[data-selected="true"],
  .map-node[data-tour-active="true"],
  .map-node[data-trace="true"] {
    z-index: 6;
    border-color: var(--brand-teal);
    background: var(--brand-teal);
    box-shadow: 0.6rem 0.6rem 0 var(--brand-white);
    color: var(--brand-ink);
  }

  .map-node[data-tour-state="visited"]:not([data-tour-active="true"]) {
    border-width: 0.16rem;
    border-color: var(--brand-white);
    box-shadow: 0.34rem 0.34rem 0 var(--brand-teal);
  }

  .map-node[data-tour-state="next"] {
    border-width: 0.22rem;
    border-style: double;
    border-color: var(--brand-teal);
    background: var(--brand-white);
    box-shadow: 0.42rem 0.42rem 0 var(--brand-teal);
  }

  .map-node__kind {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.59rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .map-node__title {
    font-size: 0.9rem;
    font-weight: 720;
    letter-spacing: -0.025em;
    line-height: 1.05;
  }

  .map-node[data-core="true"] .map-node__title {
    font-size: 1.45rem;
  }

  .map-node__meta {
    font-size: 0.64rem;
    line-height: 1.25;
  }

  .map-node__status {
    display: inline-flex;
    inline-size: fit-content;
    margin-block-start: 0.15rem;
    padding: 0.1rem 0.32rem;
    border: 0.0625rem solid currentColor;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.54rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .system-map__inspector {
    position: absolute;
    z-index: 13;
    inset-block: 3.8rem 1rem;
    inset-inline-end: max(1rem, calc((100vw - var(--shell)) / 2));
    inline-size: min(29rem, calc(100vw - 2rem));
    overflow: auto;
    padding: clamp(1.2rem, 3vw, 2rem);
    border: 0.0625rem solid var(--brand-ink);
    border-block-start: 0.7rem solid var(--brand-teal);
    background: var(--brand-white);
    box-shadow: 0.8rem 0.8rem 0 var(--brand-teal);
    color: var(--brand-ink);
  }

  .system-map__inspector[hidden] {
    display: none;
  }

  .system-map__inspector-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
  }

  .system-map__inspector h2 {
    max-inline-size: 13ch;
    margin-block: 0.3rem 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: -0.07em;
    line-height: 0.95;
  }

  .map-close-button {
    display: grid;
    inline-size: 2.8rem;
    block-size: 2.8rem;
    flex: none;
    place-items: center;
    border-color: var(--brand-ink);
    background: var(--brand-white);
    color: var(--brand-ink);
    font-size: 1.6rem;
  }

  .map-close-button:hover,
  .map-close-button:focus-visible {
    background: var(--brand-teal);
  }

  .system-map__inspector-summary {
    margin-block: 1.2rem 1.4rem;
    font-size: 1.05rem;
    line-height: 1.45;
  }

  .system-map__facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-block: 0 1.4rem;
    border-block-start: 0.0625rem solid var(--brand-ink);
  }

  .system-map__facts div {
    padding: 0.65rem 0;
    border-block-end: 0.0625rem solid var(--brand-ink);
  }

  .system-map__facts div:nth-child(odd) {
    padding-inline-end: 0.65rem;
    border-inline-end: 0.0625rem solid var(--brand-ink);
  }

  .system-map__facts div:nth-child(even) {
    padding-inline-start: 0.65rem;
  }

  .system-map__facts dt {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .system-map__facts dd {
    margin: 0.18rem 0 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    overflow-wrap: anywhere;
  }

  .system-map__boundary {
    padding: 1rem;
    border: 0.13rem dashed var(--brand-ink);
    background: var(--brand-surface);
  }

  .system-map__boundary h3 {
    margin-block: 0 0.4rem;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .system-map__boundary p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .system-map__inspector-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-block-start: 1.2rem;
  }

  .system-map__zoom {
    position: absolute;
    z-index: 12;
    inset-block-end: 1rem;
    inset-inline-start: max(1rem, calc((100vw - var(--shell)) / 2));
    display: flex;
    border: 0.0625rem solid var(--brand-white);
  }

  .system-map__zoom button {
    inline-size: 2.75rem;
    block-size: 2.75rem;
    border: 0;
    border-inline-end: 0.0625rem solid var(--brand-white);
    font-size: 1.15rem;
  }

  .system-map__zoom button:last-child {
    border-inline-end: 0;
  }

  .system-map__zone-index {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.0625rem;
    padding: 0.0625rem max(var(--gutter), calc((100vw - var(--shell)) / 2));
    border-block-start: 0.0625rem solid var(--brand-white);
    background: var(--brand-white);
  }

  .system-map__zone-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.3rem 0.65rem;
    align-content: start;
    min-block-size: 6.6rem;
    padding: 0.72rem;
    border: 0;
    background: var(--brand-ink);
    color: var(--brand-white);
    font: inherit;
    text-align: start;
    cursor: pointer;
  }

  .system-map__zone-card .map-zone__title {
    font-size: 0.92rem;
    white-space: normal;
  }

  .system-map__zone-card .map-zone__summary {
    grid-column: 1 / -1;
    max-inline-size: 48ch;
    color: var(--brand-surface);
  }

  .system-map__zone-card[data-focused="true"],
  .system-map__zone-card:hover,
  .system-map__zone-card:focus-visible {
    background: var(--brand-teal);
    outline: 0.14rem solid var(--brand-ink);
    outline-offset: -0.3rem;
    color: var(--brand-ink);
  }

  .system-map__zone-card[data-focused="true"] .map-zone__summary,
  .system-map__zone-card:hover .map-zone__summary,
  .system-map__zone-card:focus-visible .map-zone__summary {
    color: var(--brand-ink);
  }

  .system-map__zone-card[data-muted="true"] {
    border: 0.0625rem dashed var(--brand-surface);
  }

  .system-map__legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem 1.4rem;
    min-block-size: 4rem;
    padding: 0.8rem max(var(--gutter), calc((100vw - var(--shell)) / 2));
    background: var(--brand-ink);
  }

  .system-map__legend-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .map-layer-toggle {
    position: relative;
    display: inline-flex;
    min-block-size: 2.75rem;
    align-items: center;
    gap: 0.45rem;
    padding: 0.48rem 0.68rem;
    border: 0.0625rem solid var(--brand-white);
    background: var(--brand-ink);
    color: var(--brand-white);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 680;
    text-align: start;
    cursor: pointer;
  }

  .map-layer-toggle[aria-pressed="true"] {
    border-color: var(--brand-ink);
    background: var(--brand-teal);
    color: var(--brand-ink);
  }

  .map-layer-toggle:hover,
  .map-layer-toggle:focus-visible {
    outline: 0.16rem solid var(--brand-teal);
    outline-offset: 0.12rem;
  }

  .map-layer-toggle[aria-pressed="false"] .map-legend-mark::after {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    inline-size: 0.16rem;
    block-size: 2.15rem;
    background: var(--brand-white);
    content: "";
    transform: translate(-50%, -50%) rotate(55deg);
  }

  .map-legend-mark {
    position: relative;
    display: inline-block;
    inline-size: 1.8rem;
    border-block-start: 0.16rem solid var(--brand-white);
  }

  .map-legend-mark--control {
    border-block-start-style: dashed;
  }

  .map-legend-mark--evidence {
    border-color: var(--brand-teal);
    border-block-start-style: dotted;
  }

  .map-legend-mark--compatibility {
    border-block-start-style: dashed;
    border-block-end: 0.0625rem dotted var(--brand-white);
  }

  .map-legend-mark--decision {
    inline-size: 0.72rem;
    block-size: 0.72rem;
    border: 0.13rem solid var(--brand-white);
    transform: rotate(45deg);
  }

  .map-layer-toggle[aria-pressed="true"] .map-legend-mark {
    border-color: var(--brand-ink);
  }

  .system-map__legend-note {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-block: 0;
    color: var(--brand-white);
    font-size: 0.72rem;
  }

  .system-map__legend-note {
    margin-inline-start: auto !important;
    padding-inline-start: 1rem;
    border-inline-start: 0.0625rem solid var(--brand-white);
  }

  .system-map__mobile-relationships {
    display: none;
    background: var(--brand-ink);
    color: var(--brand-white);
  }

  .system-map__mobile-relationship[data-layer-visible="false"] {
    display: none;
  }

  .map-dialog {
    inline-size: min(52rem, calc(100vw - 2rem));
    max-block-size: min(45rem, calc(100vh - 2rem));
    padding: 0;
    border: 0.0625rem solid var(--brand-ink);
    border-block-start: 0.7rem solid var(--brand-teal);
    border-radius: 0;
    background: var(--brand-white);
    box-shadow: 0.8rem 0.8rem 0 var(--brand-teal);
    color: var(--brand-ink);
  }

  .map-dialog::backdrop {
    background: var(--brand-ink);
  }

  .map-dialog__frame {
    display: grid;
    gap: 1.2rem;
    margin: 0;
    padding: clamp(1.2rem, 4vw, 2.4rem);
  }

  .map-dialog__head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }

  .map-dialog h2 {
    margin-block: 0.25rem 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: -0.06em;
    line-height: 1;
  }

  .map-search input {
    inline-size: 100%;
    min-block-size: 3.5rem;
    padding: 0.7rem 0.9rem;
    border: 0.12rem solid var(--brand-ink);
    border-radius: 0;
    background: var(--brand-white);
    color: var(--brand-ink);
    font: inherit;
    font-size: 1.05rem;
  }

  .map-search__results,
  .map-tour-list {
    display: grid;
    gap: 0.55rem;
    max-block-size: 24rem;
    overflow: auto;
  }

  .map-search-result,
  .map-tour-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: center;
    inline-size: 100%;
    padding: 0.8rem;
    border: 0.0625rem solid var(--brand-ink);
    background: var(--brand-surface);
    color: var(--brand-ink);
    font: inherit;
    text-align: start;
    cursor: pointer;
  }

  .map-tour-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .map-search-result:hover,
  .map-search-result:focus-visible,
  .map-tour-card:hover,
  .map-tour-card:focus-visible {
    border-color: var(--brand-teal);
    background: var(--brand-teal);
    outline: 0.12rem solid var(--brand-ink);
    outline-offset: -0.3rem;
  }

  .map-search-result__index {
    display: grid;
    inline-size: 2.2rem;
    block-size: 2.2rem;
    place-items: center;
    border: 0.0625rem solid currentColor;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.7rem;
  }

  .map-search-result strong,
  .map-tour-card strong {
    display: block;
  }

  .map-search-result small,
  .map-tour-card small {
    display: block;
    margin-block-start: 0.14rem;
    font-size: 0.72rem;
  }

  .map-story {
    position: fixed;
    z-index: 70;
    inset-block-end: max(1rem, env(safe-area-inset-bottom));
    inset-inline: max(1rem, calc((100vw - min(70rem, calc(100vw - 2rem))) / 2));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem 2rem;
    padding: 1.25rem;
    border: 0.0625rem solid var(--brand-ink);
    border-block-start: 0.55rem solid var(--brand-teal);
    background: var(--brand-white);
    box-shadow: 0.7rem 0.7rem 0 var(--brand-teal);
    color: var(--brand-ink);
  }

  .map-story[hidden] {
    display: none;
  }

  .map-story__progress {
    grid-column: 1 / -1;
    block-size: 0.62rem;
    border: 0.12rem solid var(--brand-ink);
    background: var(--brand-surface);
  }

  .map-story__progress span {
    display: block;
    inline-size: 0;
    block-size: 100%;
    border-inline-end: 0.12rem solid var(--brand-ink);
    background: var(--brand-teal);
  }

  .map-story h2 {
    margin-block: 0.2rem 0.35rem;
    font-size: clamp(1.35rem, 3vw, 2.1rem);
    letter-spacing: -0.04em;
  }

  .map-story p {
    max-inline-size: 62ch;
    margin: 0;
    line-height: 1.4;
  }

  .map-story__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: end;
    gap: 0.5rem;
  }

  .system-map__outline {
    display: grid;
    grid-template-columns: minmax(16rem, 0.6fr) minmax(0, 1.4fr);
    gap: clamp(2rem, 6vw, 6rem);
    padding-block: clamp(4rem, 8vw, 8rem);
  }

  .system-map__outline h2 {
    max-inline-size: 12ch;
    margin-block: 0.4rem 1rem;
    font-size: clamp(2.4rem, 5vw, 5rem);
    letter-spacing: -0.065em;
    line-height: 0.95;
  }

  .system-map__outline-intro p:last-child {
    max-inline-size: 48ch;
    line-height: 1.55;
  }

  .system-map__outline-flow {
    display: grid;
    margin: 0;
    padding: 0;
    border-block-start: 0.0625rem solid var(--brand-ink);
    list-style: none;
  }

  .system-map__outline-flow li {
    display: grid;
    grid-template-columns: 2.6rem minmax(8rem, 0.55fr) minmax(12rem, 1fr);
    gap: 1rem;
    padding-block: 1rem;
    border-block-end: 0.0625rem solid var(--brand-ink);
  }

  .system-map__outline-flow span {
    display: grid;
    inline-size: 2.2rem;
    block-size: 2.2rem;
    place-items: center;
    background: var(--brand-ink);
    color: var(--brand-white);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.7rem;
  }

  .system-map__outline-flow small {
    line-height: 1.45;
  }

  .system-map__text-model {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-block-start: 1rem;
  }

  .system-map__text-model > section {
    padding: clamp(1rem, 2.5vw, 1.6rem);
    border: 0.0625rem solid var(--brand-ink);
    border-block-start: 0.4rem solid var(--brand-teal);
    background: var(--brand-surface);
  }

  .system-map__text-model h3 {
    margin-block: 0 1rem;
    font-size: 1.15rem;
  }

  .system-map__text-model ul,
  .system-map__text-model ol {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .system-map__text-model li {
    display: grid;
    gap: 0.18rem;
    padding-block: 0.65rem;
    border-block-start: 0.0625rem solid var(--brand-ink);
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .system-map__text-model li > span,
  .system-map__text-model li > small {
    display: block;
  }

  .system-map__text-model li > span {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.68rem;
  }

  .system-map[data-export="true"] .system-map__intro,
  .system-map[data-export="true"] .system-map__utility,
  .system-map[data-export="true"] .system-map__zoom,
  .system-map[data-export="true"] .system-map__inspector,
  .system-map[data-export="true"] .system-map__outline,
  .system-map[data-export="true"] .map-story,
  .system-map[data-export="true"] .map-dialog {
    display: none;
  }

  html[data-system-map-export="true"] .site-header,
  html[data-system-map-export="true"] .site-footer,
  html[data-system-map-export="true"] .breadcrumbs,
  html[data-system-map-export="true"] .site-return-to-start {
    display: none;
  }

  html[data-system-map-modal="true"] {
    overflow: hidden;
  }

  .system-map[data-export="true"] .system-map__workspace {
    display: grid;
    block-size: 100vh;
    min-block-size: 100vh;
    grid-template-rows: minmax(0, 1fr) auto auto;
    overflow: hidden;
  }

  .system-map[data-export="true"] .system-map__stage-shell {
    min-block-size: 0;
  }

  .system-map[data-export="true"] .system-map__viewport {
    block-size: 100%;
    min-block-size: 0;
  }

  .system-map[data-export="true"] .system-map__legend {
    min-block-size: clamp(4rem, 7vh, 7.5rem);
    padding-block: clamp(0.8rem, 1.5vh, 1.8rem);
    border-block-start: 0.0625rem solid var(--brand-white);
  }

  .system-map[data-export="true"] .system-map__zone-index {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    padding-inline: clamp(1rem, 2vw, 3rem);
  }

  .system-map[data-export="true"] .system-map__zone-card {
    min-block-size: 5.4rem;
    pointer-events: none;
  }

  .system-map[data-export="true"] .map-layer-toggle {
    pointer-events: none;
  }

  .system-map[data-export-format="scene"] .system-map__zone-card[data-muted="true"],
  .system-map[data-export-format="og"] .system-map__zone-index {
    display: none;
  }

  .system-map[data-export-format="og"] .system-map__legend {
    min-block-size: 3.6rem;
    padding-block: 0.55rem;
  }

  .system-map[data-export-format="og"] .system-map__legend-note {
    display: none;
  }

  .system-map[data-export-format="legend"] .system-map__workspace {
    grid-template-rows: 1fr;
  }

  .system-map[data-export-format="legend"] .system-map__stage-shell {
    display: none;
  }

  .system-map[data-export-format="legend"] .system-map__zone-index,
  .system-map[data-export-format="legend"] .system-map__mobile-relationships {
    display: none;
  }

  .system-map[data-export-format="legend"] .system-map__legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(12rem, 24rem));
    place-content: center;
    gap: clamp(1rem, 4vh, 3rem) clamp(2rem, 6vw, 6rem);
    min-block-size: 100vh;
    padding: clamp(2rem, 8vw, 8rem);
  }

  .system-map[data-export-format="legend"] .system-map__legend-filters {
    display: contents;
  }

  .system-map[data-export-format="legend"] .map-layer-toggle {
    min-block-size: clamp(4rem, 10vh, 8rem);
    padding: clamp(1rem, 3vw, 3rem);
    font-size: clamp(1rem, 2vw, 2.5rem);
  }

  .system-map[data-export-format="legend"] .system-map__legend-note {
    font-size: clamp(1rem, 2vw, 2.5rem);
  }

  .system-map[data-export-format="legend"] .system-map__legend-note {
    grid-column: 1 / -1;
    inline-size: 100%;
    margin: 0 !important;
    padding-block-start: 1rem;
    padding-inline-start: 0;
    border-block-start: 0.0625rem solid var(--brand-white);
    border-inline-start: 0;
  }
}

@layer motion {
  .system-map__canvas {
    transition: transform 900ms cubic-bezier(.16, 1, .3, 1);
  }

  .system-map__viewport[data-dragging="true"] .system-map__canvas {
    transition: none;
  }

  .map-node,
  .map-zone-label,
  .system-map__zone-card,
  .map-layer-toggle,
  .map-zone,
  .system-map__inspector {
    transition:
      transform 220ms cubic-bezier(.16, 1, .3, 1),
      box-shadow 220ms cubic-bezier(.16, 1, .3, 1),
      background-color 220ms cubic-bezier(.16, 1, .3, 1),
      color 220ms cubic-bezier(.16, 1, .3, 1),
      border-color 220ms cubic-bezier(.16, 1, .3, 1);
  }

  .map-story__progress span {
    transition: inline-size 620ms cubic-bezier(.16, 1, .3, 1);
  }

  .system-map:not([data-export="true"])[data-flow-mode="platform"]
    .map-edge-group[data-flow-state="platform"] .map-edge-story-rail,
  .system-map:not([data-export="true"])[data-flow-mode="focus"]
    .map-edge-group[data-flow-state="focus"] .map-edge-story-rail {
    display: block;
    stroke: var(--brand-teal);
    stroke-width: 2;
    stroke-dasharray: 1 24;
    stroke-linecap: round;
    animation: map-platform-flow var(--map-flow-duration, 4.2s) linear infinite;
    animation-delay: var(--map-flow-delay, 0s);
  }

  .system-map:not([data-export="true"])[data-flow-mode="focus"]
    .map-edge-group[data-flow-state="focus"] .map-edge-story-rail {
    stroke-width: 4;
    stroke-dasharray: 3 12;
    animation-duration: 1.8s;
  }

  .system-map[data-story-active="true"] .map-node[data-tour-state="current"] {
    animation: map-story-node 1.35s cubic-bezier(.16, 1, .3, 1) infinite;
  }

  .system-map[data-story-active="true"] .map-edge-group[data-route-state="current"] .map-edge-story-rail {
    stroke-dasharray: 12 6;
    animation: map-story-rail 900ms linear infinite;
  }

  .system-map[data-motion="paused"] .map-node[data-tour-state="current"],
  .system-map[data-motion="paused"] .map-edge-story-rail {
    animation-play-state: paused;
  }

  .system-map[data-motion-preference="off"] .map-edge-story-packet {
    display: none;
  }

  .system-map[data-motion-preference="off"] .map-node[data-tour-state="current"],
  .system-map[data-motion-preference="off"] .map-edge-story-rail {
    animation: none;
  }

  @keyframes map-story-rail {
    from {
      stroke-dashoffset: 0;
    }
    to {
      stroke-dashoffset: -18;
    }
  }

  @keyframes map-platform-flow {
    from {
      stroke-dashoffset: 0;
    }
    to {
      stroke-dashoffset: -50;
    }
  }

  @keyframes map-story-node {
    0%,
    100% {
      box-shadow: 0.45rem 0.45rem 0 var(--brand-white);
      transform: translate(0, 0);
    }
    50% {
      box-shadow: 0.8rem 0.8rem 0 var(--brand-teal);
      transform: translate(-0.18rem, -0.18rem);
    }
  }
}

@layer overrides {
  @media (min-width: 52.001rem) {
    .system-map[data-level="1"] .system-map__edges,
    .system-map[data-level="1"] .map-node {
      visibility: hidden;
      pointer-events: none;
    }

    .system-map[data-level="1"] .map-zone-label[data-focused="true"] {
      border-width: 0.2rem;
    }
  }

  @media (max-width: 78rem) {
    .system-map__utility {
      align-items: stretch;
      flex-direction: column;
    }

    .system-map__utility-primary,
    .system-map__utility-secondary {
      justify-content: space-between;
    }

    .system-map__utility-secondary {
      overflow-x: auto;
      padding-block-end: 0.2rem;
    }

    .map-tool-button,
    .map-field {
      flex: none;
    }

    .system-map__rail {
      display: none;
    }
  }

  @media (max-width: 52rem) {
    .system-map__intro-layout,
    .system-map__brand-story,
    .system-map__outline,
    .system-map__text-model {
      grid-template-columns: 1fr;
    }

    .system-map__intro h1 {
      font-size: clamp(3.2rem, 16vw, 5.8rem);
    }

    .system-map__workspace {
      min-block-size: auto;
    }

    .map-depth__label,
    .map-depth__steps li:nth-child(2),
    .map-depth__steps li:nth-child(3),
    .map-depth__steps li:nth-child(5) {
      display: none;
    }

    .map-icon-button [data-map-exit-label] {
      display: none;
    }

    .system-map__viewport {
      block-size: auto;
      min-block-size: auto;
      padding: 1rem;
      overflow: visible;
      cursor: default;
      touch-action: auto;
    }

    .system-map__canvas {
      position: relative;
      inline-size: auto;
      block-size: auto;
      transform: none !important;
    }

    .system-map__canvas::before,
    .system-map__canvas::after,
    .system-map__edges,
    .system-map__zones,
    .system-map__zone-labels {
      display: none;
    }

    .system-map__nodes {
      position: relative;
      display: grid;
      gap: 0.7rem;
    }

    .map-node,
    .map-node[data-core="true"] {
      position: relative;
      inset: auto !important;
      inline-size: 100%;
      min-block-size: auto;
      transform: none;
    }

    .map-node[data-muted="true"] {
      display: grid;
      border-style: dashed;
      box-shadow: none;
    }

    .map-node[data-tour-state="current"] {
      animation: none !important;
    }

    .system-map__zoom {
      display: none;
    }

    .system-map__inspector {
      position: fixed;
      z-index: 75;
      inset: 1rem;
      inline-size: auto;
      max-block-size: calc(100vh - 2rem);
      box-shadow: 0 0 0 100vmax var(--brand-ink);
    }

    .system-map__legend-note {
      inline-size: 100%;
      margin-inline-start: 0 !important;
      padding-block-start: 0.65rem;
      padding-inline-start: 0;
      border-block-start: 0.0625rem solid var(--brand-white);
      border-inline-start: 0;
    }

    .system-map__zone-index {
      display: flex;
      gap: 0.0625rem;
      padding-inline: 1rem;
      overflow-x: auto;
    }

    .system-map__zone-card {
      min-inline-size: min(18rem, calc(100vw - 3rem));
    }

    .system-map__legend {
      align-items: stretch;
    }

    .system-map__legend-filters {
      display: grid;
      inline-size: 100%;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .map-layer-toggle {
      inline-size: 100%;
    }

    .system-map__mobile-relationships {
      display: block;
      padding: 0 max(1rem, var(--gutter)) 1rem;
    }

    .system-map__mobile-relationships summary {
      min-block-size: 2.75rem;
      padding: 0.7rem;
      border: 0.0625rem solid var(--brand-white);
      color: var(--brand-white);
      font-weight: 700;
      cursor: pointer;
    }

    .system-map__mobile-relationships ol {
      display: grid;
      max-block-size: 26rem;
      gap: 0.0625rem;
      margin: 0;
      padding: 0;
      overflow: auto;
      background: var(--brand-white);
      list-style: none;
    }

    .system-map__mobile-relationship {
      padding: 0.72rem;
      background: var(--brand-ink);
      color: var(--brand-white);
      font-size: 0.75rem;
      line-height: 1.35;
    }

    .map-story {
      grid-template-columns: 1fr;
      max-block-size: calc(100vh - 2rem);
      overflow: auto;
    }

    .map-story__actions {
      justify-content: start;
    }

    .system-map__outline-flow li {
      grid-template-columns: 2.6rem minmax(0, 1fr);
    }

    .system-map__outline-flow small {
      grid-column: 2;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .system-map__canvas,
    .map-node,
    .map-zone-label,
    .system-map__zone-card,
    .map-layer-toggle,
    .map-story__progress span,
    .map-zone,
    .system-map__inspector {
      transition: none;
    }

    .map-edge-story-packet {
      display: none;
    }

    .system-map[data-flow-mode="platform"]
      .map-edge-group[data-flow-state="platform"] .map-edge-story-rail,
    .system-map[data-flow-mode="focus"]
      .map-edge-group[data-flow-state="focus"] .map-edge-story-rail {
      display: none;
    }

    .map-node[data-tour-state="current"],
    .map-edge-story-rail {
      animation: none;
    }
  }

  @media (forced-colors: active) {
    .map-node,
    .map-zone,
    .map-zone-label,
    .system-map__zone-card,
    .map-layer-toggle,
    .system-map__inspector,
    .map-dialog,
    .map-story {
      box-shadow: none;
    }

    .map-node[data-selected="true"],
    .map-node[data-tour-active="true"],
    .map-node[data-trace="true"] {
      outline: 0.25rem solid currentColor;
    }

    .map-layer-toggle[aria-pressed="false"] {
      border-style: dashed;
    }
  }

  [dir="rtl"] .system-map .map-zone__index,
  [dir="rtl"] .system-map .map-node__kind,
  [dir="rtl"] .system-map .map-node__status,
  [dir="rtl"] .system-map .map-depth__label,
  [dir="rtl"] .system-map .map-field > span {
    letter-spacing: 0;
    text-transform: none;
  }

  @media print {
    .system-map__entry-actions,
    .system-map__workspace,
    .site-header,
    .site-footer,
    .site-return-to-start {
      display: none !important;
    }

    .system-map__intro {
      padding-block: 1.5rem;
      background: var(--brand-white);
    }

    .system-map__intro h1 {
      max-inline-size: none;
      font-size: 3rem;
      line-height: 1;
    }

    .system-map__brand-story {
      gap: 3mm;
      margin-block-start: 4mm;
      padding: 3mm;
      border-color: currentColor;
    }

    .system-map__outline {
      display: block;
      padding-block: 1.5rem;
    }

    .system-map__text-model {
      grid-template-columns: 1fr;
      margin-block-start: 1.5rem;
    }

    .system-map__text-model > section {
      break-inside: avoid;
    }
  }
}
