/* Technical UML map resource — utilitarian, no marketing chrome */

:root {
  --bg: #f2f4f5;
  --ink: #1a2228;
  --ink-soft: #5a6570;
  --line: #c5ced4;
  --surface: #ffffff;
  --accent: #0f6e6a;
  --accent-soft: #e2f0ef;
  --danger: #8f3429;
  --danger-soft: #f5e6e3;
  --ok: #1d6336;
  --ok-soft: #e3f0e6;
  --active: #1a4f78;
  --active-soft: #e2ecf4;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --shell: 74rem;
  --radius: 0.4rem;
  --space-2: 0.75rem;
  --space-3: 1.25rem;
  --space-4: 2rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { overflow-x: clip; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.45;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: break-word;
  min-width: 0;
  margin: 0;
}

p { margin: 0; }

.shell {
  width: min(100% - 1.5rem, var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 20;
  padding: 0.45rem 0.7rem;
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 2.75rem;
}

.brand {
  font-weight: 500;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.9rem;
}
.nav a {
  text-decoration: none;
  color: var(--ink-soft);
}
.nav a:hover { color: var(--ink); }

.nav a:focus-visible,
.btn:focus-visible,
.field select:focus-visible,
.map-item:focus-visible,
.chip:focus-visible,
.jump-row:focus-visible,
.node:focus-visible rect,
.node:focus-visible polygon,
.node:focus-visible circle {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.section { padding: var(--space-4) 0; }
.intro { padding-top: var(--space-3); padding-bottom: var(--space-2); }
.intro h1 { font-size: 1.35rem; margin-bottom: 0.35rem; }
.lede { color: var(--ink-soft); font-size: 0.95rem; max-width: 48rem; }

.section > .shell > h2 {
  font-size: 1.05rem;
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
}

.scheme-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.map-group h3 {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  margin-bottom: 0.45rem;
}

.map-list { display: grid; gap: 0.35rem; }

.map-item {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.45rem;
  align-items: start;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.map-item:hover { border-color: var(--ink-soft); }
.map-item.is-active {
  border-color: var(--active);
  background: var(--active-soft);
}
.map-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.map-title { font-size: 0.88rem; }

.explorer-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.controls {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.controls-rich {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: end;
}
.controls-rich .path-toggles {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
}

.field {
  display: grid;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}
.field select {
  min-height: 2.35rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-family: var(--font-body);
}

.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.path-meter { font-family: var(--font-mono); font-size: 0.85rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg);
  color: var(--ink);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-compact { min-height: 2.1rem; padding: 0.3rem 0.65rem; font-size: 0.88rem; }
.btn-primary { background: var(--ink); color: var(--surface); }
.btn-ghost { background: var(--bg); border-color: var(--line); }

.switch-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.switch-field input { accent-color: var(--accent); }

.problem-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: var(--space-3);
}
.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  min-height: 1.9rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.chip strong {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--danger);
  font-size: 0.82rem;
}
.chip span { font-size: 0.82rem; color: var(--ink-soft); }
.chip.is-active { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

.stage-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: end;
  margin-bottom: var(--space-2);
}
.stage-meta h3 { font-size: 1rem; }
.meta { color: var(--ink-soft); font-size: 0.85rem; }

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.legend li { display: inline-flex; align-items: center; gap: 0.3rem; }
.swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 0.12rem;
  border: 1px solid var(--line);
}
.swatch-active { background: var(--active-soft); border-color: var(--active); }
.swatch-path { background: color-mix(in srgb, var(--ink) 12%, var(--surface)); border-color: var(--ink); }
.swatch-danger { background: var(--danger-soft); border-color: var(--danger); }
.swatch-ok { background: var(--ok-soft); border-color: var(--ok); }
.swatch-decision {
  background: var(--surface);
  border-color: var(--ink);
  transform: rotate(45deg);
}

.stage {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.35rem 0.35rem;
  margin-bottom: var(--space-2);
  overflow-x: auto;
}
.stage-hint { margin: 0.4rem 0.4rem 0.15rem; font-size: 0.78rem; font-family: var(--font-mono); }

.detail {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  background: var(--bg);
}
.detail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.7rem;
  margin-bottom: 0.3rem;
}
.detail h4 { font-size: 1rem; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  padding: 0.1rem 0.45rem;
  border-radius: 0.25rem;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  cursor: pointer;
}
.tag:disabled { cursor: default; }
.tag-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); color: var(--danger); }
.tag-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); color: var(--ok); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: var(--space-3);
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td {
  padding: 0.65rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
thead th {
  background: var(--bg);
  font-weight: 500;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
tbody th { font-family: var(--font-mono); font-weight: 500; white-space: nowrap; }
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }
.jump-row { cursor: pointer; }
.jump-row:hover,
.jump-row:focus-visible { background: var(--accent-soft); }

.rules-dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.25rem;
  margin: 0;
}
.rules-dl > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  background: var(--surface);
}
.rules-dl dt {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}
.rules-dl dd { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }

#flow-svg .edge {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.4;
}
#flow-svg .edge.is-path { stroke: var(--ink); stroke-width: 1.8; }
#flow-svg .edge.is-hot,
#flow-svg .edge.is-hover-link { stroke: var(--active); stroke-width: 2; }
#flow-svg .edge.is-dim,
#flow-svg .edge-label-g.is-dim,
#flow-svg .node.is-dim { opacity: 0.22; }
#flow-svg .arrow-head { fill: var(--ink-soft); }
#flow-svg .arrow-head-hot { fill: var(--active); }
#flow-svg .edge-label-bg {
  fill: var(--bg);
  stroke: var(--line);
  stroke-width: 1;
}
#flow-svg .edge-label {
  fill: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
}
#flow-svg .node { cursor: pointer; }
#flow-svg .node rect,
#flow-svg .node polygon,
#flow-svg .node circle {
  fill: var(--surface);
  stroke: var(--ink);
  stroke-width: 1.4;
}
#flow-svg .node.kind-danger rect,
#flow-svg .node.kind-danger polygon,
#flow-svg .node.kind-danger circle {
  fill: var(--danger-soft);
  stroke: var(--danger);
}
#flow-svg .node.kind-ok rect,
#flow-svg .node.kind-ok polygon,
#flow-svg .node.kind-ok circle,
#flow-svg .node.kind-fix rect,
#flow-svg .node.kind-fix polygon,
#flow-svg .node.kind-fix circle {
  fill: var(--ok-soft);
  stroke: var(--ok);
}
#flow-svg .node.is-selected rect,
#flow-svg .node.is-selected polygon,
#flow-svg .node.is-selected circle,
#flow-svg .node:hover rect,
#flow-svg .node:hover polygon,
#flow-svg .node:hover circle {
  fill: var(--active-soft);
  stroke: var(--active);
  stroke-width: 2;
}
#flow-svg .node text {
  fill: var(--ink);
  font-family: var(--font-body);
  font-size: 12px;
  pointer-events: none;
}
#flow-svg .node.is-dim text { fill: var(--ink-soft); }
#flow-svg .node:focus { outline: none; }

@media (max-width: 900px) {
  .scheme-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rules-dl { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .scheme-map,
  .controls-rich { grid-template-columns: 1fr; }
  .chip span { display: none; }
}

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