/* ==========================================================
   Data Sources page — interactive ecosystem
   ========================================================== */

.ds-page { padding-bottom: 4rem; }

/* ---------- HERO ---------- */
.ds-hero {
  padding: 4rem 0 2rem;
  background:
    radial-gradient(900px 400px at 10% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(700px 400px at 100% 10%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 60%);
}
.ds-hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent-2);
  margin: 0 0 .75rem;
}
.ds-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 1rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.ds-hero h1 .grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  padding-bottom: .12em;
  margin-bottom: -.12em;
}
.ds-hero .lede {
  font-size: 1.1rem;
  color: var(--text-soft);
  max-width: 720px;
  margin: 0 0 1.5rem;
}

.ds-legend {
  display: flex; flex-wrap: wrap; gap: .75rem;
  font-size: .82rem; color: var(--text-soft);
}
.ds-legend .lg { display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); }
.ds-legend .lg i {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
}
.lg-src i   { background: linear-gradient(135deg, #00B294, #0078d4); }
.lg-pipe i  { background: linear-gradient(135deg, #0078d4, #8661c5); }
.lg-rpt i   { background: linear-gradient(135deg, #FFB900, #f7630c); }
.lg-addon i { background: linear-gradient(135deg, #e3008c, #8661c5); }

/* ---------- ECOSYSTEM CANVAS ---------- */
.ds-ecosystem { padding: 2rem 0 3rem; }

.ds-canvas {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(1200px 500px at 50% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg-alt), var(--surface));
  padding: 2rem 1.5rem;
  overflow: hidden;
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, .35);
}

/* SVG connector layer sits behind nodes */
.ds-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.ds-edge {
  fill: none;
  stroke-width: 1.5;
  opacity: .42;
  transition: opacity .25s, stroke-width .25s;
}
.ds-edge-dashed { stroke-dasharray: 6 6; opacity: .28; }
.ds-edge.is-active { opacity: 1; stroke-width: 2.5; filter: drop-shadow(0 0 6px currentColor); }
.ds-edge.is-faded  { opacity: .08; }

/* Node grid */
.ds-nodes {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(var(--ds-cols, 4), 1fr);
  grid-auto-rows: minmax(72px, auto);
  gap: 18px 70px;
  align-items: center;
}

.ds-node {
  position: relative;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem .9rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--border));
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--c) 14%, var(--surface)) 0%,
      color-mix(in srgb, var(--c) 4%, var(--surface)) 100%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-shadow:
    0 1px 0 color-mix(in srgb, white 30%, transparent) inset,
    0 8px 22px -16px color-mix(in srgb, var(--c) 80%, transparent);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s, opacity .18s;
}
.ds-node:hover,
.ds-node:focus-visible {
  transform: translateY(-2px);
  border-color: var(--c);
  box-shadow:
    0 1px 0 color-mix(in srgb, white 30%, transparent) inset,
    0 16px 32px -18px color-mix(in srgb, var(--c) 90%, transparent),
    0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent);
  outline: none;
}
.ds-node.is-related {
  border-color: var(--c);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--c) 50%, transparent),
    0 16px 36px -18px color-mix(in srgb, var(--c) 80%, transparent);
}
.ds-node.is-faded { opacity: .35; }
.ds-node.is-locked {
  border-color: var(--c);
  box-shadow:
    0 0 0 3px var(--c),
    0 20px 44px -16px color-mix(in srgb, var(--c) 90%, transparent);
}

.ds-node-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) 22%, var(--surface));
  font-size: 1.15rem;
  flex-shrink: 0;
}
.ds-node-body { display: flex; flex-direction: column; min-width: 0; }
.ds-node-label { font-weight: 700; font-size: .92rem; line-height: 1.2; }
.ds-node-sub   { font-size: .72rem; color: var(--text-muted); line-height: 1.3; margin-top: 2px; }

/* Kind-specific accents */
.ds-source { border-style: solid; }
.ds-pipe   { border-style: dashed; }
.ds-report { background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--c) 22%, var(--surface)) 0%,
      color-mix(in srgb, var(--c) 8%, var(--surface)) 100%); }
.ds-addon {
  border-style: dotted;
  border-width: 1.5px;
}

/* ---------- DRAWER ---------- */
.ds-drawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: min(420px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 40px -20px rgba(0,0,0,.35);
  padding: 1.5rem;
  overflow-y: auto;
  z-index: 50;
  transform: translateX(100%);
  transition: transform .22s ease;
}
.ds-drawer.is-open { transform: translateX(0); }
.ds-drawer-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-alt);
  cursor: pointer; font-size: 1rem; color: var(--text-soft);
}
.ds-drawer-close:hover { background: var(--surface); color: var(--text); }

.ds-drawer-head {
  display: flex; gap: .85rem; align-items: flex-start;
  padding-bottom: 1rem; margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.ds-drawer-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  background: color-mix(in srgb, var(--c) 22%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 40%, var(--border));
  flex-shrink: 0;
}
.ds-drawer-kind {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c); font-weight: 700; margin-bottom: .15rem;
}
.ds-drawer-head h3 { margin: 0; font-size: 1.15rem; }
.ds-drawer-sub { margin: .2rem 0 0; font-size: .82rem; color: var(--text-muted); }
.ds-drawer-detail { color: var(--text-soft); line-height: 1.55; margin: 0 0 1rem; }
.ds-drawer-role { font-size: .85rem; color: var(--text-soft); margin: 0 0 1.25rem;
  padding: .6rem .8rem; border-radius: 10px;
  background: var(--bg-alt); border: 1px solid var(--border); }

.ds-drawer h4 {
  margin: 1rem 0 .5rem; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted);
}
.ds-empty { color: var(--text-muted); font-style: italic; margin: 0 0 .25rem; }

.ds-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .25rem; }
.ds-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  font: inherit; font-size: .8rem;
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--border));
  color: var(--text);
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.ds-chip:hover {
  background: color-mix(in srgb, var(--c) 28%, var(--surface));
  transform: translateY(-1px);
}
.ds-drawer-cta { display: inline-block; margin-top: 1.25rem; }

/* ---------- SOURCE CARDS ---------- */
.ds-cards { padding: 2rem 0 0; }
.ds-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 1.5rem;
}
.ds-card {
  position: relative;
  padding: 1.25rem;
  border-radius: var(--radius, 14px);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column; gap: .6rem;
  overflow: hidden;
}
.ds-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--ic);
}
.ds-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: color-mix(in srgb, var(--ic) 18%, var(--surface));
  font-size: 1.15rem;
}
.ds-card h3 { margin: 0; font-size: 1.05rem; }
.ds-card p  { margin: 0; color: var(--text-soft); font-size: .9rem; line-height: 1.5; }
.ds-card-role {
  font-size: .78rem; color: var(--text-muted);
  padding: .4rem .6rem; border-radius: 8px;
  background: var(--bg-alt); border: 1px dashed var(--border);
}
.ds-card .data-tools { margin-top: .25rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.ds-card .tool-tag {
  font-size: .72rem; padding: .25rem .55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--ic) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--ic) 28%, var(--border));
  color: var(--text-soft);
}
.ds-card-link {
  margin-top: auto;
  align-self: flex-start;
  background: none; border: none; color: var(--accent);
  font-weight: 600; font-size: .85rem; cursor: pointer; padding: 0;
}
.ds-card-link:hover { text-decoration: underline; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 960px) {
  .ds-canvas { padding: 1.25rem .75rem; }
  .ds-nodes { gap: 14px 24px; }
  .ds-node-sub { display: none; }
  .ds-node-label { font-size: .78rem; }
}
@media (max-width: 720px) {
  .ds-canvas {
    overflow-x: auto;
    overflow-y: hidden;
  }
  .ds-nodes {
    min-width: 760px; /* allow horizontal scroll to keep layout */
  }
}

.ds-drawer-home { display:inline-block; margin-top:.6rem; margin-left:.5rem; }

/* CATEGORY FILTER BAND */
.ds-filter-band {
  padding: 1rem 0 1.25rem;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ds-filter-label {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 .75rem;
}
.ds-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.ds-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s ease;
}
.ds-filter-chip:hover {
  border-color: color-mix(in srgb, var(--c, var(--accent)) 50%, var(--border));
  transform: translateY(-1px);
}
.ds-filter-chip.is-active {
  background: color-mix(in srgb, var(--c, var(--accent)) 18%, var(--surface));
  border-color: var(--c, var(--accent));
  color: var(--text);
  box-shadow: 0 4px 14px -8px color-mix(in srgb, var(--c, var(--accent)) 70%, transparent);
}
.ds-filter-count {
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--accent)) 25%, var(--bg-alt));
  color: color-mix(in srgb, var(--c, var(--accent)) 80%, var(--text));
}
.ds-filter-chip.is-active .ds-filter-count {
  background: var(--c, var(--accent));
  color: #fff;
}
.ds-filter-clear {
  border-style: dashed;
  opacity: .85;
}

/* highlight reports that match the active topic with a glow */
.ds-node.is-match {
  outline: 2px solid var(--c);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent),
              0 10px 30px -10px color-mix(in srgb, var(--c) 50%, transparent);
}

/* Drawer action group — each button on its own row */
.ds-drawer-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .55rem;
  margin-top: 1.25rem;
}
.ds-drawer-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}
.ds-drawer-cta { margin: 0; }
.ds-drawer-star { margin: 0; font-weight: 600; }
.ds-drawer-home { margin: 0; }