/* Base reset injected by the original export */
:root {
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  padding: 0;
  font:
    14px -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: #faf9f5;
  color: #141413;
}

img {
  max-width: 100%;
}

[hidden]:not([hidden="until-found" i]) {
  display: none !important;
}

/* Layout: full-height app — header with exam-weight strip, pannable SVG tree map, detail panel (side on desktop, bottom sheet on phone) */
:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --fg: #15202b;
  --muted: #5b6b7a;
  --line: #c9d3dc;
  --accent: #1a6fd1;
  --design: #5b5fc7;
  --ingest: #0f8f87;
  --process: #8a4fd6;
  --store: #c27a0e;
  --analyze: #1f7ae0;
  --govern: #d23f6a;
  --operate: #3b8f3a;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e141a;
    --surface: #17212b;
    --fg: #e5ecf2;
    --muted: #93a3b3;
    --line: #2c3a47;
    --accent: #6aa8ff;
    --design: #9a9df5;
    --ingest: #3cc6bc;
    --process: #b98af2;
    --store: #f0a63c;
    --analyze: #63a7ff;
    --govern: #f27298;
    --operate: #6cc56a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e141a;
  --surface: #17212b;
  --fg: #e5ecf2;
  --muted: #93a3b3;
  --line: #2c3a47;
  --accent: #6aa8ff;
  --design: #9a9df5;
  --ingest: #3cc6bc;
  --process: #b98af2;
  --store: #f0a63c;
  --analyze: #63a7ff;
  --govern: #f27298;
  --operate: #6cc56a;
  color-scheme: dark;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  margin: 0;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 small {
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 6px;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.search {
  position: relative;
}

.search input {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  width: 15rem;
  max-width: 60vw;
}

.results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 16rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
  z-index: 20;
  max-height: 50vh;
  overflow-y: auto;
}

.results button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  padding: 7px 10px;
  cursor: pointer;
}

.results button:hover,
.results button:focus-visible {
  background: var(--bg);
  outline: none;
}

.results small {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
}

.btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  border-radius: 8px;
  cursor: pointer;
}

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

.btn:focus-visible,
.chip:focus-visible,
.sec:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.strip {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.sec {
  font: inherit;
  flex: 1 1 0;
  min-width: 7.5rem;
  display: flex;
  align-items: baseline;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  border-radius: 8px;
  padding: 5px 9px;
  cursor: pointer;
  overflow: hidden;
}

.sec b {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-right: 4px;
}

.sec span {
  font-size: 0.8rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.sec em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 6px;
  white-space: nowrap;
}

.sec[aria-pressed="true"],
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}

.chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dc);
}

main {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
}

#stage {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#stage.dragging {
  cursor: grabbing;
}

svg {
  width: 100%;
  height: 100%;
  display: block;
}

.spoke {
  stroke: var(--dc);
  stroke-width: 1.4;
  opacity: 0.45;
}

.arc {
  fill: none;
  stroke: var(--dc);
  stroke-width: 9;
}

.hub circle {
  fill: var(--fg);
}

.hub text {
  fill: var(--bg);
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.svc .card {
  fill: color-mix(in srgb, var(--dc) 15%, var(--surface));
  stroke: var(--dc);
  stroke-width: 1.5;
}

.svc.open .card {
  fill: var(--surface);
  filter: drop-shadow(0 8px 18px rgb(0 0 0 / 0.22));
}

.svc.sel .card {
  stroke-width: 3;
}

.svc.hit .card {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: 5 3;
}

.head,
.row {
  cursor: pointer;
}

.head:focus,
.row:focus {
  outline: none;
}

.head .hit-area {
  fill: transparent;
}

.head:hover .hit-area,
.head:focus-visible .hit-area {
  fill: color-mix(in srgb, var(--dc) 14%, transparent);
}

.head text {
  fill: var(--fg);
  font-family: var(--body);
  font-weight: 700;
  font-size: 13.5px;
  dominant-baseline: central;
  pointer-events: none;
}

.icon rect {
  fill: var(--dc);
}

.icon line {
  stroke: var(--surface);
  stroke-width: 2;
  stroke-linecap: round;
}

.sep {
  stroke: color-mix(in srgb, var(--dc) 40%, var(--surface));
  stroke-width: 1;
}

.row .rowbg {
  fill: transparent;
}

.row:hover .rowbg,
.row:focus-visible .rowbg {
  fill: color-mix(in srgb, var(--dc) 14%, var(--surface));
}

.row.sel .rowbg {
  fill: var(--dc);
}

.row.rhit .rowbg {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.row text {
  fill: var(--fg);
  font-family: var(--body);
  font-weight: 500;
  font-size: 12.5px;
  dominant-baseline: central;
  pointer-events: none;
}

.row circle {
  fill: var(--dc);
}

.row.sel text {
  fill: var(--surface);
}

.row.sel circle {
  fill: var(--surface);
}

.dim {
  opacity: 0.18;
}

.hint {
  position: absolute;
  left: 16px;
  bottom: 12px;
  font-size: 0.75rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
}

aside {
  width: 380px;
  flex: none;
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 18px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

aside .crumb {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

aside .crumb button {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
}

aside h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.45rem;
  margin: 0;
  line-height: 1.15;
  text-wrap: balance;
  border-left: 5px solid var(--dc);
  padding-left: 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
}

aside ul {
  margin: 0;
  padding-left: 1.1em;
  display: flex;
  flex-direction: column;
  gap: 7px;
  line-height: 1.45;
  max-width: 65ch;
}

aside li strong {
  font-weight: 700;
  color: var(--fg);
}

aside li.ua {
  list-style: none;
  margin-left: -1.1em;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--bg);
}

aside li.ua .lab {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 6px;
  color: var(--surface);
}

aside li.ua.use .lab {
  background: var(--operate);
}

aside li.ua.avoid .lab {
  background: var(--govern);
}

aside h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 6px 0 0;
  font-weight: 600;
}

.kids {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kids .chip {
  border-color: color-mix(in srgb, var(--dc) 50%, var(--line));
}

.empty {
  color: var(--muted);
  line-height: 1.5;
}

.empty strong {
  color: var(--fg);
}

.close {
  display: none;
}

@media (max-width: 760px) {
  aside {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 58%;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 30px rgb(0 0 0 / 0.2);
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .close {
    display: inline;
  }

  .search input {
    width: 11rem;
  }

  .sec {
    min-width: 44%;
  }

  .hint {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  #world {
    transition: none;
  }
}
/* Acronym tooltips: shown by tooltip.js on hover, no underline on the acronym itself */
abbr[data-tip] {
  text-decoration: none;
}

.tip {
  position: fixed;
  z-index: 50;
  max-width: 280px;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--surface);
  font: 500 12px/1.35 var(--body);
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.18);
}

/* map acronyms only need hover for their tooltip; a click goes to the card as usual */
#world [data-acr] {
  pointer-events: auto;
}

/* in the side panel an acronym opens the glossary: give it the link cursor */
#panel abbr[data-acr] {
  cursor: pointer;
}

/* Glossary: opened from the legend button or by clicking an acronym in the side panel */
.gloss-btn {
  margin-left: auto;
}

/* glossary header stays pinned so Close is reachable from anywhere in the list; it bleeds over the panel padding */
aside .crumb.sticky {
  position: sticky;
  top: -18px;
  z-index: 1;
  margin: -18px -20px 0;
  padding: 18px 20px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

aside .crumb .back {
  font-family: var(--body);
  font-size: 0.8rem;
  font-weight: 600;
}

.gloss {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gloss div {
  display: grid;
  grid-template-columns: 4.8rem 1fr;
  gap: 10px;
  padding: 5px 9px;
  border-radius: 7px;
  border-left: 3px solid transparent;
  line-height: 1.35;
}

.gloss dt {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
}

.gloss dd {
  margin: 0;
}

.gloss .on {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border-left-color: var(--accent);
}
