/* ===================================================================
   V1 STAGE 8 — THE INTELLIGENCE NETWORK DIRECTORY

   ~191 registered sources, so density is the design constraint. Each
   entry is one to three compact metadata lines carried by typography
   and hairlines — not a card, not a tile, and never a miniature
   dashboard. Anything absent is omitted rather than printed as a zero,
   because most of the registry is legitimately quiet.

   SPECIFICITY NOTE — WHY THESE BUTTONS CARRY `.btn-flagship`.

   components.css styles buttons with `button:not(.a):not(.b)...` — seven
   :not() clauses, specificity (0,7,1). That beats ANY ordinary class
   rule a feature stylesheet can write: a `.content-sources` prefix only reaches
   (0,2,0), so it loses on every property the primitive also sets.

   Stage 8 measured this live and found the Apply button rendering in the
   primitive's grey instead of its own accent — the rules below were
   correct and simply never applied. The fix is not more specificity, it
   is to stop matching the primitive: `.btn-flagship` is a clause in that
   :not() chain, so a button carrying it is styled here and nowhere else.
   Every rule below must therefore be complete on its own.
   =================================================================== */

.content-sources { max-width: 1100px; }

/* -------------------------------------------------------------------
   MASTHEAD + NETWORK OVERVIEW
   ------------------------------------------------------------------- */
.src-masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
}
.src-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-page-title);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text-primary);
}
.src-standfirst {
  margin: var(--sp-3) 0 0;
  font-size: var(--fs-body);
  color: var(--text-muted);
}
.src-admin-link {
  flex: none;
  font-size: var(--fs-meta);
  color: var(--text-muted);
  white-space: nowrap;
}
.src-admin-link:hover { color: var(--accent-primary); }
.src-admin-foot {
  margin: var(--sp-9) 0 0;
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-subtle);
}

/* A rail of figures, not KPI cards: four numbers with labels, separated
   by hairlines. */
.src-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 var(--sp-4);
  padding: var(--sp-5) 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.src-metric {
  flex: 1 1 auto;
  min-width: 140px;
  padding: 0 var(--sp-7);
  border-left: 1px solid var(--border-subtle);
}
.src-metric:first-child { padding-left: 0; border-left: 0; }
.src-metric dt {
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.src-metric dd {
  margin: var(--sp-2) 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-headline);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
  line-height: 1.1;
  color: var(--text-primary);
}

/* The deterministic rule, stated plainly. It claims nothing about
   corporate ownership — only how ProcIntel counts independence. */
.src-independence-note {
  margin: 0 0 var(--sp-6);
  font-size: var(--fs-caption);
  line-height: var(--lh-normal);
  color: var(--text-muted);
  max-width: 70ch;
}

/* -------------------------------------------------------------------
   CONTROLS
   ------------------------------------------------------------------- */
.src-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.src-search {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-5);
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}
.src-search svg { flex: none; color: var(--text-disabled); }
.src-search input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  padding: var(--sp-4) 0;
}
.src-search input::placeholder { color: var(--text-disabled); }
.src-search input:focus { outline: none; }
.src-search:focus-within { border-color: var(--accent-muted); }

.content-sources .src-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 0;
  padding: var(--sp-4) var(--sp-6);
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--fs-meta);
  font-weight: var(--fw-medium);
  line-height: 1;
  cursor: pointer;
}
.content-sources .src-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.content-sources .src-btn:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.content-sources .src-btn[aria-expanded="true"] {
  color: var(--accent-primary);
  border-color: var(--accent-muted);
}
.src-btn-badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------
   FILTER POPOVER — the Stage 6.1 / Stage 7 control language
   ------------------------------------------------------------------- */
.src-popover-host { position: relative; }
.src-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + var(--sp-4));
  right: 0;
  width: 460px;
  max-width: calc(100vw - 2 * var(--sp-6));
  max-height: min(70vh, 620px);
  overflow-y: auto;
  padding: var(--sp-6);
  background: var(--surface-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), var(--sheen-top);
}
.src-popover-heading {
  margin: 0 0 var(--sp-5);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.src-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.src-filter { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.src-filter label {
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.src-filter select {
  width: 100%;
  min-width: 0;
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--fs-meta);
  padding: var(--sp-4);
}
.src-filter select:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 1px; }

/* Sticky, because the popover scrolls internally on a short viewport and
   measurement at 375x812 put Apply 36px below the fold. A primary action
   a reader has to discover by scrolling is a primary action they will
   miss. */
.src-popover-actions {
  position: sticky;
  bottom: calc(-1 * var(--sp-6));
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  margin: var(--sp-6) calc(-1 * var(--sp-6)) calc(-1 * var(--sp-6));
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  background: var(--surface-panel);
  border-top: 1px solid var(--border-subtle);
}
.content-sources .src-apply {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: var(--sp-4) var(--sp-7);
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  font-family: var(--font-ui);
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  line-height: 1;
  cursor: pointer;
}
.content-sources .src-apply:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.src-clear { font-size: var(--fs-meta); color: var(--text-muted); }
.src-clear:hover { color: var(--text-primary); }

/* -------------------------------------------------------------------
   SUBCONTROLS
   ------------------------------------------------------------------- */
.src-subcontrols {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-7);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-7);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-meta);
}
.src-result-count { margin: 0; color: var(--text-muted); }
.src-result-count .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.src-sort { display: flex; align-items: center; gap: var(--sp-4); margin-left: auto; }
.src-sort-label {
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.src-sort-option { color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.src-sort-option:hover { color: var(--text-primary); }
.src-sort-option[aria-current="true"] { color: var(--accent-primary); font-weight: var(--fw-medium); }

/* -------------------------------------------------------------------
   TRUST GROUPS
   ------------------------------------------------------------------- */
.src-group { margin-bottom: var(--sp-9); }
.src-group-heading {
  display: flex;
  align-items: baseline;
  gap: var(--sp-5);
  margin: 0 0 var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-default);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-secondary);
}
.src-group-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------
   SOURCE ENTRY
   ------------------------------------------------------------------- */
.src-list { list-style: none; margin: 0; padding: 0; }
.src-item {
  padding: var(--sp-5) var(--sp-5) var(--sp-5) var(--sp-6);
  margin-left: calc(-1 * var(--sp-6));
  border-bottom: 1px solid var(--border-subtle);
  border-left: 2px solid transparent;
  border-radius: var(--radius-xs);
  transition: background var(--dur-fast, 120ms) ease, border-color var(--dur-fast, 120ms) ease;
}
.src-item:hover { background: var(--surface-panel); border-left-color: var(--accent-muted); }
.src-item:last-child { border-bottom: 0; }

.src-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-5);
}
.src-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-card-title);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}
.src-name a { color: var(--text-primary); text-decoration: none; }
.src-name a:hover { color: var(--accent-hover); }
.src-name a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Trust as TEXT. Never colour alone, never a star, never a score — it is
   a descriptive classification, not an endorsement. */
.src-trust {
  flex: none;
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.src-identity,
.src-observed,
.src-activity {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-caption);
  color: var(--text-muted);
}
.src-identity > * + *::before,
.src-activity > * + *::before {
  content: "·";
  margin-right: var(--sp-4);
  color: var(--border-strong);
}
.src-org { color: var(--text-secondary); font-weight: var(--fw-medium); }
/* An operational state, not a quality judgement. */
.src-inactive { color: var(--text-muted); font-style: italic; }

.src-observed-group { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-3); }
.src-observed-label {
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.src-reported { margin-left: var(--sp-5); }
.src-category,
.src-geo {
  padding: 1px var(--sp-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  font-size: var(--fs-micro);
  color: var(--text-secondary);
  white-space: nowrap;
}
.src-geo { border-color: var(--border-subtle); color: var(--text-muted); }
.src-more { color: var(--text-muted); }

.src-latest { color: var(--text-secondary); }
.src-signals, .src-events { font-variant-numeric: tabular-nums; }
.src-homepage {
  margin-left: auto;
  color: var(--accent-primary);
  font-weight: var(--fw-medium);
  text-decoration: none;
  white-space: nowrap;
}
.src-homepage:hover { color: var(--accent-hover); }
.src-activity > .src-homepage::before { content: none; }

/* -------------------------------------------------------------------
   DETAIL PAGE
   ------------------------------------------------------------------- */
.src-breadcrumb { margin: 0 0 var(--sp-5); font-size: var(--fs-meta); }
.src-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.src-breadcrumb a:hover { color: var(--accent-primary); }

.src-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-7);
  padding-bottom: var(--sp-6);
  margin-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}
.src-detail-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-page-title);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text-primary);
  text-wrap: balance;
}
.src-detail-aside {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-3);
  text-align: right;
}
.src-domain { font-size: var(--fs-micro); color: var(--text-muted); }
.src-detail-overview { margin-bottom: var(--sp-8); }

.src-section { margin-bottom: var(--sp-8); }
.src-section-title {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.src-section-note {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-caption);
  line-height: var(--lh-normal);
  color: var(--text-muted);
  max-width: 70ch;
}
.src-chips { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin: 0; }

.src-signal-list, .src-event-list, .src-sibling-list { list-style: none; margin: 0; padding: 0; }
.src-signal, .src-event {
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.src-signal:last-child, .src-event:last-child { border-bottom: 0; }
.src-signal-link, .src-event a {
  color: var(--text-primary);
  font-size: var(--fs-body);
  line-height: var(--lh-snug);
  text-decoration: none;
}
.src-signal-link:hover, .src-event a:hover { color: var(--accent-hover); }
.src-signal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-micro);
  color: var(--text-muted);
}
.src-signal-meta a { color: var(--accent-primary); text-decoration: none; }

.src-sibling-list li {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.src-sibling-list li:last-child { border-bottom: 0; }
.src-sibling-list a { color: var(--text-primary); text-decoration: none; }
.src-sibling-list a:hover { color: var(--accent-hover); }

/* -------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .content-sources { max-width: none; }
}

@media (max-width: 860px) {
  .src-masthead { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
  .src-metric { min-width: 120px; padding: 0 var(--sp-5); }
  .src-popover {
    position: fixed;
    top: auto;
    left: var(--sp-5);
    right: var(--sp-5);
    bottom: var(--sp-5);
    width: auto;
    max-width: none;
  }
  .src-detail-head { flex-direction: column; }
  .src-detail-aside { align-items: flex-start; text-align: left; }
}

@media (max-width: 560px) {
  .src-filter-grid { grid-template-columns: 1fr; }
  /* Five sort options do not fit one 375px row. Measured: the row ran to
     x=522 and, because the page body correctly refuses to scroll
     sideways, the last two options were simply unreachable -- silently.
     They wrap onto a second line instead; nothing is ever hidden behind
     a horizontal scroll a reader cannot see. */
  .src-subcontrols { align-items: flex-start; }
  .src-sort { flex-wrap: wrap; margin-left: 0; width: 100%; }
  .src-sort-label { width: 100%; }
  /* The trust label moves under the name rather than being squeezed
     against it on a narrow row. */
  .src-item-head { flex-direction: column; gap: var(--sp-2); }
  .src-item { padding-left: var(--sp-5); margin-left: calc(-1 * var(--sp-5)); }
  .src-homepage { margin-left: 0; }
  .src-reported { margin-left: 0; }
  .src-overview { gap: var(--sp-4) 0; }
  .src-metric { flex: 1 1 45%; border-left: 0; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .src-item { transition: none; }
}
