:root {
  --bg: #ffffff;
  --bg-soft: #f4f4f4;
  --surface: #ffffff;
  --surface-strong: #f7f7f7;
  --line: #d9d9d9;
  --text: #111111;
  --muted: #5a5a5a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(0, 0, 0, 0.06), transparent 30%),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  color: var(--text);
  font-family: Inter, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-brand {
  display: flex;
  align-items: center;
  justify-self: start;
}

.site-title {
  color: #006DBC;
  justify-self: center;
  text-align: center;
  font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.site-brand__logo {
  width: min(13rem, 46vw);
  height: auto;
  max-height: 4.25rem;
  object-fit: contain;
  display: block;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
  gap: 1rem;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

main {
  padding-top: 5.4rem;
}

.hero,
.detail-page {
  min-height: calc(100vh - 5.4rem);
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem 4rem;
}

.home-hero {
  position: relative;
  min-height: calc(100vh - 9rem);
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 2rem 1.25rem 3.5rem;
  isolation: isolate;
}

.home-hero__video,
.home-hero__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.home-hero__video {
  z-index: -2;
  object-fit: cover;
}

.home-hero__overlay {
  z-index: -1;
  background: rgba(0, 0, 0, 0.42);
}

.home-hero__content {
  width: min(1100px, 100%);
  color: #ffffff;
  text-align: center;
}

/* Compact at rest; grows to full size as it flips to the country picker. */
.home-flip-card {
  width: min(40rem, 100%);
  height: clamp(25rem, calc(100vh - 15rem), 28.5rem);
  margin: 0 auto;
  -webkit-perspective: 1400px;
  perspective: 1400px;
  text-align: left;
  transition: width 460ms ease, height 460ms ease;
}

.home-flip-card.is-flipped {
  width: min(1100px, 100%);
  height: clamp(34rem, calc(100vh - 10rem), 38rem);
}

.home-flip-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transition: -webkit-transform 460ms ease;
  transition: transform 460ms ease;
  will-change: transform;
}

.home-flip-card.is-flipped .home-flip-card__inner {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.home-flip-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: rotateY(0deg) translateZ(1px);
  transform: rotateY(0deg) translateZ(1px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

.home-flip-card__front {
  padding: clamp(1.3rem, 3vw, 2.5rem);
  /* Same glass texture as the country picker face. */
  background: rgba(12, 18, 18, 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  backdrop-filter: blur(14px) saturate(115%);
  color: #ffffff;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .home-flip-card__front {
    background: rgba(12, 18, 18, 0.92);
  }
}

.home-flip-card__front .home-card-kicker {
  color: #6fd8b4;
}

.home-flip-card__front .home-card-heading > p:last-child {
  color: rgba(255, 255, 255, 0.85);
}

.home-flip-card__front .home-card-heading h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.home-flip-card__front .home-card-heading > p:last-child {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.home-card-brief {
  display: grid;
  gap: 1rem;
  align-content: start;
  margin-top: 1.1rem;
}

.home-card-tool h3 {
  margin: 0;
  font-size: 1rem;
  color: #6fd8b4;
}

.home-card-tool > p {
  margin: 0.3rem 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.87rem;
  line-height: 1.4;
}

.home-card-terms {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

.home-card-terms > div + div {
  margin-top: 0.28rem;
}

.home-card-terms dt,
.home-card-terms dd {
  display: inline;
  margin: 0;
}

.home-card-terms dt {
  color: #cdf1e3;
  font-weight: 800;
}

.home-card-terms dt::after {
  content: ": ";
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
}

.home-card-terms dd {
  color: rgba(255, 255, 255, 0.78);
}

.home-flip-card__back {
  padding: clamp(1rem, 2vw, 1.75rem);
  background: rgba(12, 18, 18, 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  backdrop-filter: blur(14px) saturate(115%);
  color: #ffffff;
  -webkit-transform: rotateY(180deg) translateZ(1px);
  transform: rotateY(180deg) translateZ(1px);
}

.home-card-heading {
  max-width: 48rem;
}

.home-card-kicker {
  margin: 0 0 0.45rem;
  color: #13755b;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-card-heading h2,
.home-map-card-header h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.6vw, 2.15rem);
  line-height: 1.1;
}

.home-card-heading > p:last-child {
  max-width: 46rem;
  margin: 0.7rem 0 0;
  color: #4d4d4d;
  font-size: 1rem;
  line-height: 1.55;
}

.home-card-interaction-hint {
  align-self: flex-end;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.35rem 0.6rem;
  border: 0;
  border-bottom: 1px solid rgba(143, 214, 192, 0.7);
  background: transparent;
  color: #6fd8b4;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.home-card-interaction-hint:hover,
.home-card-interaction-hint:focus-visible {
  background: rgba(143, 214, 192, 0.14);
  outline: 3px solid rgba(143, 214, 192, 0.3);
  outline-offset: 2px;
}

.home-card-interaction-hint__mobile {
  display: none;
}

.home-map-card-header {
  display: flex;
  align-items: center;
  padding: 0 0 0.8rem;
}

@media (hover: hover) and (pointer: fine) {
  .home-flip-card:hover {
    width: min(1100px, 100%);
    height: clamp(34rem, calc(100vh - 10rem), 38rem);
  }

  .home-flip-card:hover .home-flip-card__inner {
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
  }
}

.home-map-shell {
  --map-edge-fade: radial-gradient(
    ellipse 88% 84% at 60% center,
    #000 0%,
    #000 28%,
    rgba(0, 0, 0, 0.88) 45%,
    rgba(0, 0, 0, 0.62) 60%,
    rgba(0, 0, 0, 0.28) 76%,
    transparent 100%
  );
  position: relative;
  width: min(1100px, 100%);
  aspect-ratio: 1655 / 834;
  margin: 0 auto;
}

.home-map-image {
  width: 100%;
  height: 100%;
  display: block;
  -webkit-mask-image: var(--map-edge-fade);
  mask-image: var(--map-edge-fade);
}

.home-map-hotspots {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: var(--map-edge-fade);
  mask-image: var(--map-edge-fade);
}

.home-map-hotspots a {
  pointer-events: visiblePainted;
  cursor: pointer;
}

.home-map-hotspots a:focus-visible use {
  filter: brightness(1.25) drop-shadow(0 0 4px #ffffff);
}

.home-map-region {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 1.45rem;
  min-height: 1.45rem;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.92);
  white-space: nowrap;
}

.home-map-region::before {
  content: "";
  position: absolute;
  inset: 0;
  display: none;
}

.home-map-region span {
  position: relative;
  z-index: 1;
  padding: 0.22rem 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 4px;
  background: rgba(17, 17, 17, 0.82);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.3);
}

.home-map-region:hover span,
.home-map-region:focus-visible span {
  border-color: var(--region-color);
  background: rgba(17, 17, 17, 0.96);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--region-color) 60%, transparent), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.home-map-region:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.65);
  outline-offset: 2px;
}

.home-map-region--taiwan { --region-color: #facc15; left: 52.4%; top: 0.4%; width: 4.8%; height: 10.4%; }
.home-map-region--hong-kong { --region-color: #ef4444; left: 46.6%; top: 9.5%; }
.home-map-region--philippines { --region-color: #8b5cf6; left: 50.2%; top: 17.2%; width: 12.4%; height: 43.5%; }
.home-map-region--malaysia { --region-color: #22c55e; left: 27.0%; top: 56.5%; width: 6.8%; height: 15.8%; }
.home-map-region--singapore { --region-color: #fb7185; left: 31.7%; top: 75.1%; }
.home-map-region--indonesia { --region-color: #00b7ff; left: 36.3%; top: 71.5%; width: 17.2%; height: 16%; }

.home-map-region--small span {
  position: absolute;
  left: calc(100% + 0.45rem);
  top: 50%;
  transform: translateY(-50%);
}

.home-map-region--hong-kong span {
  right: calc(100% + 0.45rem);
  left: auto;
  top: 50%;
  transform: translateY(-50%);
}
.home-map-region--singapore span {
  right: calc(100% + 0.45rem);
  left: auto;
}
.home-map-region--hong-kong::after,
.home-map-region--singapore::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: 1.2rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.9);
  transform-origin: left center;
}

.home-map-region--hong-kong::after { right: 100%; top: 50%; transform-origin: right center; }
.home-map-region--singapore::after { right: 100%; top: 50%; transform-origin: right center; }

.home-purpose {
  padding: 4rem 1.25rem 5rem;
  background: var(--surface);
}

.home-purpose__inner {
  width: min(980px, 100%);
  margin: 0 auto;
}

.home-purpose__intro {
  max-width: 48rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}

.home-purpose h2 {
  margin: 0 0 0.8rem;
  font-size: 1.35rem;
}

.home-purpose p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.home-explainer {
  display: grid;
  gap: 2.5rem;
  padding-top: 2.5rem;
}

.home-explainer article {
  display: grid;
  gap: 1rem;
}

.home-relationship-list,
.home-feature-list {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.home-relationship-list {
  display: grid;
  gap: 0.8rem;
}

.home-relationship-list div {
  display: grid;
  grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr);
  gap: 1rem;
}

.home-relationship-list dt {
  color: var(--text);
  font-weight: 700;
}

.home-relationship-list dd {
  margin: 0;
}

.home-feature-list {
  display: grid;
  gap: 0.65rem;
  padding-left: 1.2rem;
}

.home-feature-list strong {
  color: var(--text);
}

.hero__panel,
.detail-card {
  width: min(760px, 100%);
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.hero__kicker {
  margin: 0;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
}

.hero h1,
.detail-card h1 {
  margin: 0.35rem 0 0.9rem;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  line-height: 1;
}

.hero__group + .hero__group {
  margin-top: 1.6rem;
}

.hero__group h2 {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
}

.nav-button,
.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 10rem;
  padding: 0.9rem 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 600;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nav-button:hover,
.detail-link:hover {
  transform: translateY(-1px);
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.detail-copy {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.graph-page {
  min-height: calc(100vh - 5.4rem);
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2rem;
}

.graph-header {
  width: min(1440px, 100%);
  margin: 0 auto 1rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.graph-header h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  line-height: 1.02;
}

.relationship-graph {
  width: min(1440px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.graph-sidebar,
.graph-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
}

.graph-sidebar {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.graph-field {
  display: grid;
  gap: 0.45rem;
}

.graph-field > label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.graph-field input,
.graph-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.8rem;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
}

.graph-combobox {
  position: relative;
  display: block;
}

.graph-search-options {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 14rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.graph-search-option {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.8rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.graph-search-option:last-child {
  border-bottom: 0;
}

.graph-search-option:hover,
.graph-search-option[aria-selected="true"] {
  background: var(--surface-strong);
  color: var(--text);
}

.graph-search {
  display: grid;
  gap: 0.6rem;
}

.graph-search > button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111111;
  color: #ffffff;
  min-height: 2.5rem;
  padding: 0.65rem 0.7rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.graph-search-message {
  min-height: 1.2rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.graph-legend {
  display: grid;
  gap: 1rem;
}

.graph-control-group {
  display: grid;
  gap: 0.65rem;
  padding-top: 0.1rem;
}

.graph-control-group h2,
.graph-legend h2 {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.graph-control-group h2 {
  margin-bottom: 0;
}

.graph-check-list {
  display: grid;
  gap: 0.45rem;
}

.graph-check,
.graph-switch {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.25;
  cursor: pointer;
}

.graph-check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: #111111;
}

.graph-check span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.graph-switch input {
  appearance: none;
  position: relative;
  width: 2.2rem;
  height: 1.2rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #d9d9d9;
  cursor: pointer;
  transition: background 160ms ease;
}

.graph-switch input::after {
  content: "";
  position: absolute;
  top: 0.12rem;
  left: 0.12rem;
  width: 0.84rem;
  height: 0.84rem;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: transform 160ms ease;
}

.graph-switch input:checked {
  background: #111111;
}

.graph-switch input:checked::after {
  transform: translateX(1rem);
}

.graph-switch input:focus-visible,
.graph-check input:focus-visible,
.graph-view-controls button:focus-visible,
.graph-search button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.graph-search-option:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: -3px;
}

.graph-legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.graph-legend li {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.25;
}

.legend-swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border: 1px solid #111111;
  flex: 0 0 auto;
}

.legend-node {
  border-radius: 999px;
}

.legend-edge {
  height: 0.18rem;
  border: 0;
}

.graph-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(560px, 72vh) auto;
  overflow: hidden;
}

.graph-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#agency-graph-canvas,
#agency-graph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#agency-graph-canvas {
  background:
    linear-gradient(rgba(17, 17, 17, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.04) 1px, transparent 1px),
    #ffffff;
  background-size: 32px 32px;
  pointer-events: none;
}

.graph-view-controls {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.graph-view-controls button {
  min-width: 2.3rem;
  min-height: 2.3rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111111;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#reset-graph {
  min-width: 4.2rem;
  padding: 0 0.65rem;
}

.edge-tooltip {
  position: absolute;
  z-index: 4;
  max-width: min(20rem, calc(100% - 2rem));
  padding: 0.45rem 0.6rem;
  border: 1px solid #111111;
  border-radius: 7px;
  background: #ffffff;
  color: #111111;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  pointer-events: none;
  transform: translate(0.65rem, -50%);
  opacity: 0;
  transition: opacity 120ms ease;
}

.edge-tooltip.is-visible {
  opacity: 1;
}

.graph-link {
  stroke: #111111;
  stroke-opacity: 0.48;
  stroke-width: 1.25;
}

.graph-link.is-faded {
  stroke-opacity: 0.08;
}

.graph-link.is-focused {
  stroke-opacity: 0.92;
}

.graph-link.is-hovered {
  stroke-opacity: 0.95;
  stroke-width: 3;
}

.graph-link[data-type="Bounding Address"],
.legend-edge.bounding-address {
  stroke: #16a34a;
  background: #16a34a;
}

.graph-link[data-type="Same Address"],
.legend-edge.same-address {
  stroke: #2563eb;
  background: #2563eb;
}

.graph-link[data-type="Fax"],
.legend-edge.fax {
  stroke: #92400e;
  background: #92400e;
}

.graph-link[data-type="Phone"],
.legend-edge.telephone,
.legend-edge.phone {
  stroke: #7c3aed;
  background: #7c3aed;
}

.graph-link[data-type="Email"],
.legend-edge.email {
  stroke: #111111;
  background: #111111;
}

.graph-node {
  fill: #00b7ff;
  stroke: #111111;
  stroke-width: 1.7;
  cursor: pointer;
}

.graph-node.is-faded {
  opacity: 0.12;
}

.graph-node.is-focused {
  opacity: 1;
}

.graph-node[data-category="normal"],
.legend-node.normal {
  fill: #00b7ff;
  background: #00b7ff;
}

.graph-node[data-category="accredited-ph"],
.legend-node.accredited-ph {
  fill: #16a34a;
  background: #16a34a;
}

.graph-node[data-category="accredited-ind"],
.legend-node.accredited-ind {
  fill: #7c3aed;
  background: #7c3aed;
}

.graph-node[data-category="accredited-both"],
.legend-node.accredited-both {
  fill: #facc15;
  background: #facc15;
}

.graph-node[data-category="money-lender"],
.legend-node.money-lender {
  fill: #dc2626;
  background: #dc2626;
}

.graph-node.is-selected {
  stroke: #111111;
  stroke-width: 4;
}

.graph-label {
  fill: #202020;
  font-size: 0.72rem;
  font-weight: 700;
  paint-order: stroke;
  pointer-events: none;
  stroke: #ffffff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.graph-detail {
  min-height: 6.5rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.graph-detail h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.graph-detail p {
  margin: 0.35rem 0;
  color: var(--muted);
  line-height: 1.4;
}

.graph-detail strong {
  color: var(--text);
}

.agency-search-page {
  min-height: calc(100vh - 5.4rem);
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2rem;
}

.agency-search-header {
  width: min(1440px, 100%);
  margin: 0 auto 1rem;
}

.agency-search-header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.agency-search-layout {
  width: min(960px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
  align-items: start;
}

.agency-list-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
  padding: 1rem;
}

.agency-search-field {
  display: grid;
  gap: 0.45rem;
}

.agency-search-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agency-search-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.8rem;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
}

.agency-search-field input:focus-visible,
.agency-result:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.agency-search-count {
  margin: 0.8rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.agency-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  max-height: calc(100vh - 15rem);
  overflow: auto;
}

.agency-result {
  width: 100%;
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.agency-result:hover,
.agency-result[aria-pressed="true"] {
  border-color: #111111;
  background: var(--surface-strong);
}

.agency-result span {
  font-weight: 750;
  line-height: 1.25;
}

.agency-result small {
  color: var(--muted);
  line-height: 1.35;
}

.agency-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.28);
}

.agency-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(36rem, 100vw);
  overflow: auto;
  padding: 1rem;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -16px 0 36px rgba(0, 0, 0, 0.18);
}

.agency-detail-back {
  min-height: 2.35rem;
  margin: 0 0 1rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111111;
  color: #ffffff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.agency-detail-back:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.agency-detail-heading {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.agency-detail-heading h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.2rem, 2.4vw, 1.75rem);
  line-height: 1.15;
}

.agency-detail-heading p {
  margin: 0;
  color: var(--muted);
}

.agency-detail-list {
  margin: 0;
  display: grid;
  gap: 0.7rem;
}

.agency-detail-list div {
  display: grid;
  gap: 0.2rem;
}

.agency-detail-list dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agency-detail-list dd {
  margin: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.agency-relationships {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.agency-relationships h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.agency-relationships ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
  max-height: 24rem;
  overflow: auto;
}

.agency-relationships li {
  display: grid;
  gap: 0.25rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

/* Alternate home layout: both card faces shown side by side. */
.home-alt .home-hero__content {
  width: min(1500px, 100%);
}

.home-alt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.5rem;
  align-items: stretch;
  text-align: left;
}

.home-alt-panel {
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 2.2vw, 2rem);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  /* Shared texture: translucent dark glass, blurred so the video behind
     never competes with the text on top of it. */
  background: rgba(12, 18, 18, 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  backdrop-filter: blur(14px) saturate(115%);
  color: #ffffff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

/* Browsers without backdrop-filter get a more opaque panel instead. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .home-alt-panel {
    background: rgba(12, 18, 18, 0.92);
  }
}

.home-alt-panel--map {
  justify-content: center;
}

.home-alt-tools {
  display: grid;
  gap: 1.4rem;
  margin-top: clamp(1.2rem, 2.4vw, 1.9rem);
}

.home-alt-tool h3 {
  margin: 0;
  font-size: 1.05rem;
}

.home-alt-tool > p {
  margin: 0.4rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
  line-height: 1.45;
}

.home-alt-panel--purpose .home-card-kicker {
  color: #6fd8b4;
}

.home-alt-panel--purpose .home-card-heading > p:last-child {
  color: rgba(255, 255, 255, 0.85);
}

.home-alt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.home-alt-tags li {
  padding: 0.32rem 0.7rem;
  border: 1px solid rgba(143, 214, 192, 0.55);
  border-radius: 999px;
  background: rgba(143, 214, 192, 0.14);
  color: #cdf1e3;
  font-size: 0.82rem;
  font-weight: 700;
}

.home-alt-panel--map .home-map-card-header {
  padding-bottom: 0.6rem;
}

.home-alt-panel--map .home-map-shell {
  width: 100%;
}

/* Long-form text pages (region About, privacy policy, terms). */
.doc-page {
  padding: 2.5rem clamp(1.25rem, 6vw, 4rem) 4rem;
}

/* A plain reading column, comfortably inset from both edges. */
.doc-page__inner {
  width: min(46rem, 100%);
  margin: 0 auto;
}

.doc-page h1 {
  margin: 0 0 1.75rem;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.doc-page h2 {
  margin: 2.4rem 0 0.7rem;
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  line-height: 1.25;
}

.doc-page p,
.doc-page li,
.doc-page dd {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.doc-page p {
  margin: 0 0 1rem;
}

.doc-page ul {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
}

.doc-page li {
  margin-bottom: 0.55rem;
}

.doc-page li > strong:first-child {
  color: var(--text);
}

/* The explanation notes nested under a result. */
.doc-page li ul {
  margin: 0.45rem 0 0.9rem;
}

.doc-page li li {
  font-size: 0.95rem;
}

/* Glossary of relationship types, e.g. "Bounding Address: ...". */
.doc-page dl {
  margin: 0 0 1.25rem;
}

.doc-page dt {
  margin-top: 0.9rem;
  color: var(--text);
  font-weight: 600;
}

.doc-page dd {
  margin: 0.15rem 0 0;
}

.doc-page a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc-page sup a {
  text-decoration: none;
}

.site-footer {
  margin-top: 3rem;
  padding: 2.25rem 1.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
  text-align: center;
}

.site-footer__inner {
  width: min(1100px, 100%);
  margin: 0 auto;
}

.site-footer__social {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  margin-bottom: 1.1rem;
}

.site-footer__social a {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  transition: color 160ms ease, border-color 160ms ease;
}

.site-footer__social a:hover,
.site-footer__social a:focus-visible {
  color: var(--text);
  border-color: var(--text);
}

.site-footer__social svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.site-footer__legal {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--muted);
}

.site-footer__legal a {
  color: var(--text);
}

.site-footer__legal a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.6rem;
  }

  .site-brand,
  .site-nav {
    justify-self: center;
  }

  .site-nav {
    justify-content: center;
  }

  main {
    padding-top: 10rem;
  }

  .relationship-graph {
    grid-template-columns: 1fr;
  }

  .graph-sidebar {
    order: 2;
  }

  .graph-stage {
    grid-template-rows: minmax(430px, 62vh) auto;
  }

  .agency-results {
    max-height: 28rem;
  }
}

@media (max-width: 1000px) {
  .home-alt-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .home-hero {
    padding-top: 2.5rem;
  }

  .home-flip-card {
    width: 100%;
    height: clamp(26rem, calc(100vh - 13rem), 31rem);
    transition: height 260ms ease;
  }

  .home-flip-card.is-flipped {
    width: 100%;
    height: min(21rem, calc(100vh - 10rem));
  }

  .home-flip-card__face {
    overflow: hidden;
  }

  .home-flip-card__front {
    padding: 1.35rem;
    overflow-y: auto;
  }

  .home-flip-card__back {
    margin-top: 0;
  }

  .home-card-interaction-hint__desktop {
    display: none;
  }

  .home-card-interaction-hint__mobile {
    display: inline;
  }

  .home-flip-card__back .home-map-shell {
    width: 135%;
    margin-left: -17.5%;
  }

}

@media (max-width: 640px) {
  .site-header {
    padding: 0.9rem 1rem;
  }

  .site-brand__logo {
    width: min(11rem, 58vw);
    max-height: 3.5rem;
  }

  .site-title {
    font-size: 1.6rem;
  }

  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-button {
    width: 100%;
  }

  .home-hero {
    min-height: calc(100vh - 8.5rem);
    padding-bottom: 2.5rem;
  }

  .home-map-shell {
    width: 100%;
  }

  .home-map-region {
    min-width: 1.2rem;
    min-height: 1.2rem;
    font-size: 0.63rem;
  }

  .home-map-region span {
    padding: 0.16rem 0.3rem;
  }

  .home-relationship-list div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .graph-header {
    align-items: stretch;
    flex-direction: column;
  }

  .graph-stage {
    grid-template-rows: minmax(360px, 58vh) auto;
  }

  .graph-view-controls {
    right: 0.6rem;
    bottom: 0.6rem;
  }
}
