/* Platform console: the Map and Docs tabs. Colours come only from the tokens in status.css whose
   pairs the contrast test checks (--bg --surface --ink --ink-muted --line --line-strong --neutral-bg
   --focus --link), so these views stay readable in the light and dark themes. Desktop first; under
   900 px the docs stack and the map scrolls inside its own box. */

/* ---- Map ------------------------------------------------------------------------------------ */

.map-view {
  margin-top: 4px;
}

.map-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 9px;
}

.map-head h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

.map-head p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 0.85rem;
  max-width: 860px;
}

.map-head .map-facts {
  color: var(--ink);
}

.map-envsw {
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-size: 0.8rem;
}

.map-envsw-label {
  margin-right: 8px;
  color: var(--ink-muted);
}

.map-envsw button {
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 3px 10px;
  margin-left: -1px;
  cursor: pointer;
}

.map-envsw button.on,
.map-envsw button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.map-envsw button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  position: relative;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.map-legend b {
  color: var(--ink);
  font-weight: 600;
  margin-right: 3px;
}

.map-legend svg {
  vertical-align: middle;
  margin-right: 5px;
}

.map-sep {
  width: 1px;
  height: 14px;
  background: var(--line);
}

.map-sw {
  display: inline-block;
  width: 22px;
  height: 12px;
  vertical-align: -2px;
  margin-right: 6px;
  border: 1px solid var(--ink);
  background: var(--surface);
}

.map-sw.ours {
  background: var(--ink);
  border-width: 2px;
}

.map-sw.out {
  background: var(--neutral-bg);
  border-color: var(--ink-muted);
  border-radius: 4px;
}

.map-sw.ppl {
  border-radius: 7px;
}

.map-sw.planned {
  border-style: dashed;
}

.map-diagram {
  margin: 14px 0 6px;
}

.map-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--sans);
}

.map-col {
  font-size: 10px;
  letter-spacing: 0.08em;
  fill: var(--ink-muted);
}

.map-band {
  stroke: var(--line);
  stroke-width: 1;
}

.map-edge {
  stroke: var(--ink);
  stroke-width: 1.4;
  fill: none;
}

.map-edge.planned {
  stroke-width: 1.2;
}

.map-arrowhead {
  fill: var(--ink);
}

.map-elabel {
  font-size: 10.5px;
  fill: var(--ink-muted);
}

.map-note {
  font-size: 10.5px;
  fill: var(--ink-muted);
}

.map-box {
  fill: var(--surface);
  stroke: var(--ink);
  stroke-width: 1.1;
}

.map-title {
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink);
}

.map-sub {
  font-size: 11px;
  fill: var(--ink-muted);
}

.map-go {
  font-size: 11px;
  fill: var(--ink);
  text-decoration: underline;
}

.map-node {
  cursor: pointer;
}

.map-node.ours .map-box {
  fill: var(--ink);
  stroke: var(--ink);
  stroke-width: 2;
}

.map-node.ours .map-title,
.map-node.ours .map-go,
.map-node.ours .map-sub {
  fill: var(--bg);
}

.map-node.out .map-box {
  fill: var(--neutral-bg);
  stroke: var(--ink-muted);
}

.map-node:hover .map-box {
  stroke-width: 2.4;
}

.map-node.az:hover .map-box,
.map-node.ppl:hover .map-box {
  fill: var(--neutral-bg);
}

.map-node:focus {
  outline: none;
}

.map-node:focus-visible .map-box {
  stroke: var(--focus);
  stroke-width: 3;
}

.map-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 12px;
}

table.map-info {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

table.map-info caption {
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
  padding-bottom: 6px;
}

table.map-info thead th {
  text-align: left;
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--ink);
  padding: 3px 8px 3px 0;
}

table.map-info td,
table.map-info tbody th {
  border-bottom: 1px solid var(--line);
  padding: 5px 8px 5px 0;
  vertical-align: top;
  text-align: left;
  color: var(--ink-muted);
}

table.map-info tbody th[scope="row"] {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

table.map-info tr.map-grp th {
  border-bottom: 0;
  padding-top: 10px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--ink-muted);
}

/* ---- Docs ----------------------------------------------------------------------------------- */

.docs-view {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  margin-top: 4px;
}

.docs-idx {
  border-right: 1px solid var(--line);
  padding-right: 18px;
  min-width: 0;
}

.docs-idx input[type="search"] {
  width: 100%;
  font: 0.8rem var(--sans);
  padding: 5px 8px;
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  margin-bottom: 10px;
}

.docs-idx input[type="search"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.docs-group {
  margin: 12px 0 4px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 400;
}

.docs-idx a {
  display: block;
  padding: 3px 6px;
  margin: 0 -6px;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--ink);
}

.docs-idx a:hover {
  background: var(--neutral-bg);
}

.docs-idx a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.docs-idx a.on {
  background: var(--ink);
  color: var(--bg);
}

.docs-idx .who {
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-left: 6px;
}

.docs-idx a.on .who {
  color: var(--bg);
}

.docs-idx [hidden] {
  display: none;
}

.docs-note,
.docs-empty {
  margin-top: 16px;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.docs-note {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.docs-reader {
  max-width: 780px;
  min-width: 0;
}

.docs-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  font-size: 0.74rem;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.docs-crumb .m {
  font-family: var(--mono);
  color: var(--ink);
}

.docs-crumb a {
  margin-left: auto;
  color: var(--link);
}

.docs-error {
  color: var(--bad);
}

.docs-loading {
  color: var(--ink-muted);
}

.docs-body h1 {
  font-size: 1.45rem;
  margin: 12px 0 6px;
  line-height: 1.25;
}

.docs-body h2 {
  font-size: 1.07rem;
  margin: 20px 0 6px;
  line-height: 1.3;
}

.docs-body h3 {
  font-size: 0.92rem;
  margin: 14px 0 4px;
}

.docs-body h4,
.docs-body h5,
.docs-body h6 {
  font-size: 0.85rem;
  margin: 12px 0 4px;
}

.docs-body p,
.docs-body li {
  font-size: 0.87rem;
  line-height: 1.55;
  color: var(--ink);
}

.docs-body ul,
.docs-body ol {
  padding-left: 22px;
  margin: 6px 0;
}

.docs-body li > ul,
.docs-body li > ol {
  margin: 2px 0;
}

.docs-body a {
  color: var(--link);
}

.docs-body code {
  font: 0.8rem var(--mono);
  background: var(--neutral-bg);
  padding: 0 3px;
}

.docs-body pre.md-code {
  background: var(--neutral-bg);
  border: 1px solid var(--line);
  padding: 8px 10px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.45;
}

.docs-body pre.md-code code {
  background: none;
  padding: 0;
}

.docs-body blockquote {
  margin: 8px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-muted);
}

.docs-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.docs-body .md-table {
  overflow-x: auto;
  margin: 8px 0;
}

.docs-body table {
  border-collapse: collapse;
  font-size: 0.8rem;
}

.docs-body th,
.docs-body td {
  border-bottom: 1px solid var(--line);
  padding: 4px 10px 4px 0;
  text-align: left;
  vertical-align: top;
}

.docs-body thead th {
  border-bottom: 1px solid var(--ink);
  font-weight: 600;
}

.docs-body .md-ac {
  text-align: center;
}

.docs-body .md-ar {
  text-align: right;
}

.docs-body .md-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  padding: 6px 10px;
  margin: 10px 0;
}

.docs-body .md-img {
  font-style: italic;
  color: var(--ink-muted);
}

/* ---- Narrow screens -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .map-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .map-diagram {
    overflow-x: auto;
  }

  .map-svg {
    min-width: 760px;
  }

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

  table.map-info tbody th[scope="row"] {
    white-space: normal;
  }

  .docs-view {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .docs-idx {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 12px;
  }
}
