/* The content map (review.html). Builds on main.css and uses its tokens:
   monospace labels, hairline panels, pill controls. */

.container.wide {
  max-width: 88rem;
}

/* ---------- Filters ---------- */

.cmap-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: end;
  margin: 0 0 0.9rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--grad-soft);
}

.cmap-filters label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cmap-filters label:not(.check) {
  flex: 1 1 11rem;
}

.cmap-filters .grow {
  flex: 3 1 16rem;
}

.cmap-filters .check {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  min-height: 46px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: none;
}

.cmap-filters .check input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--accent);
}

.cmap-filters select,
.cmap-filters input[type="search"] {
  min-height: 46px;
  padding: 0.45rem 1rem;
  border: 1px solid var(--control);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-family: var(--font-sans);
  font-size: 0.97rem;
  letter-spacing: 0;
  text-transform: none;
}

.cmap-counts {
  margin: 0 0 3rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

/* ---------- The diagram ---------- */

.cmap-diagram-section {
  margin: 0 0 3.5rem;
}

.cmap-diagram-section h2 {
  margin: 0.8rem 0 0.4rem;
  font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.3rem);
}

.cmap-diagram {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 1.5px) 0 0 / 22px 22px,
    var(--bg-soft);
}

/* The boxes are sized for a compact system font, so the diagram keeps it. */
.cmap {
  display: block;
  font: 11px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.cmap-col {
  fill: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.cmap-edge {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.1;
}

.cmap-edge.is-related {
  stroke: var(--accent);
  stroke-width: 2.2;
}

.cmap-edge.is-dim {
  opacity: 0.3;
}

.cmap-node {
  cursor: pointer;
}

.cmap-node rect {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1;
}

.cmap-node.is-draft rect {
  fill: var(--draft-bg);
  stroke: var(--draft-line);
}

.cmap-node.is-clinician_reviewed rect {
  fill: var(--reviewed-bg);
  stroke: var(--reviewed-line);
}

.cmap-node.is-published rect {
  fill: var(--accent-soft);
  stroke: var(--accent);
}

.cmap-node.is-selected rect {
  stroke: var(--heading);
  stroke-width: 2.5;
}

.cmap-node.is-dim {
  opacity: 0.3;
}

.cmap-node text {
  fill: var(--text);
  pointer-events: none;
}

.cmap-node:focus-visible rect {
  stroke: var(--focus);
  stroke-width: 3;
}

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

/* ---------- List and detail ---------- */

.cmap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 900px) {
  .cmap-layout {
    grid-template-columns: 20rem minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }

  .cmap-list {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    max-height: calc(100vh - var(--header-h) - 2rem);
    overflow: auto;
  }
}

.cmap-list {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.cmap-group h3 {
  display: flex;
  justify-content: space-between;
  margin: 1.1rem 0.6rem 0.35rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cmap-group:first-child h3 {
  margin-top: 0.4rem;
}

.count-inline {
  color: var(--accent);
}

.cmap-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.node-button {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  width: 100%;
  min-height: 36px;
  padding: 0.4rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.93rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.node-button:hover {
  background: var(--bg-soft);
}

.node-button[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--heading);
  font-weight: 500;
}

.status-dot {
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--draft-line);
}

.node-button.is-clinician_reviewed .status-dot {
  background: var(--reviewed-line);
}

.node-button.is-published .status-dot {
  background: var(--accent);
}

.cmap-detail {
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.cmap-detail h2 {
  margin: 0.9rem 0 0.35rem;
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem);
}

.cmap-detail h3 {
  margin: 2rem 0 0.7rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cmap-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}

.badge {
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--heading);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge.status-draft {
  border-color: transparent;
  background: var(--draft-bg);
  color: var(--draft-text);
}

.badge.status-clinician_reviewed {
  border-color: transparent;
  background: var(--reviewed-bg);
  color: var(--reviewed-text);
}

.badge.status-published {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge-step {
  border-color: var(--step-line);
  background: var(--step-soft);
  color: var(--step);
}

.cmap-id {
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.cmap-id code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.cmap-facts {
  display: grid;
  margin: 1.25rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.cmap-facts:empty {
  display: none;
}

.cmap-facts div {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.cmap-facts dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  line-height: 1.9;
  text-transform: uppercase;
}

.cmap-facts dd {
  margin: 0;
  color: var(--heading);
  overflow-wrap: anywhere;
}

.cmap-summary {
  margin: 1.25rem 0;
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text);
}

.cmap-links {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cmap-edge-label {
  display: inline-block;
  min-width: 11rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hint-inline {
  color: var(--muted);
  font-size: 0.85rem;
}

.hint.warn {
  color: var(--error-text);
}

.cmap-actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 600px) {
  .cmap-detail {
    padding: 1.25rem;
  }

  .cmap-facts div {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .cmap-edge-label {
    display: block;
  }
}

/* Credit for the standard codes shown on this page (the LOINC license asks for it). */
.footer-notice p {
  max-width: 72ch;
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  line-height: 1.55;
}
