/* ============================================================
   Social Activity — SHARED SECTION SHELL
   Used by /social and /toptweets (and the remaining tool pages
   as they are implemented). Referenced from each page with
   <link rel="stylesheet" href="./social-activity.css">, which
   Observable Framework resolves and hashes like any other asset.

   Every selector is namespaced wmr-sa-* so this file cannot
   affect any page that does not opt in.

   Design tokens (--wmr-*) come from src/custom.css :root, which
   is NOT modified by the Social Activity work.
   ============================================================ */

.wmr-sa {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  background: var(--wmr-cream, #fbfaf7);
  color: var(--wmr-ink, #0f172a);
}

/* Remove Observable's default cell-wrapper margins so bands meet cleanly */
.wmr-sa .observablehq--block { margin: 0; }

/* Lift the framework's 640px prose cap inside this section only */
.wmr-sa p,
.wmr-sa h1,
.wmr-sa h2,
.wmr-sa h3 { max-width: none; }

.wmr-sa-container {
  max-width: 1240px;
  margin: 0 auto;
  padding-left: 48px;
  padding-right: 48px;
}

.wmr-sa a:focus-visible,
.wmr-sa button:focus-visible,
.wmr-sa summary:focus-visible,
.wmr-sa [tabindex]:focus-visible {
  outline: 2px solid var(--wmr-blue, #1d4ed8);
  outline-offset: 2px;
  border-radius: 4px;
}

.wmr-sa-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Breadcrumb ---- */
.wmr-sa-crumb {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 14px;
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.wmr-sa-crumb a { color: #94a3b8; text-decoration: none; }
.wmr-sa-crumb a:hover { color: var(--wmr-ink, #0f172a); }
.wmr-sa-crumb .cur { color: var(--wmr-ink, #0f172a); font-weight: 700; }
.wmr-sa-crumb .sep { color: #cbd5e1; }

/* ---- Section navigation: real links, deliberately not a control ---- */
.wmr-sa-navwrap {
  border-bottom: 1px solid var(--wmr-border, #e7e3d9);
  background: var(--wmr-cream, #fbfaf7);
}

.wmr-sa-nav {
  display: flex;
  gap: 26px;
  align-items: baseline;
  flex-wrap: wrap;
  padding-top: 8px;
}

.wmr-sa-nav-link {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 0 10px;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.wmr-sa-nav-link:hover { color: var(--wmr-ink, #0f172a); }

.wmr-sa-nav-link.on {
  color: var(--wmr-ink, #0f172a);
  font-weight: 700;
  border-bottom-color: var(--wmr-ink, #0f172a);
}

/* Period sub-label: neutral, mono, words only — never party colours */
.wmr-sa-nav-link .p {
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.wmr-sa-nav-link .s { display: none; }

/* ---- Hero meta line: platform tag · period · optional data date ---- */
.wmr-sa-metaline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wmr-sa-platform {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wmr-sa-platform .x,
.wmr-sa-xtag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wmr-ink, #0f172a);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

.wmr-sa-platform .k {
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
  border: 1px solid var(--wmr-border, #e7e3d9);
  border-radius: 999px;
  padding: 3px 10px;
}

/* Neutral period chip — the words carry the meaning */
.wmr-sa-period {
  display: inline-block;
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #475569;
  background: var(--wmr-cream, #fbfaf7);
  border: 1px solid var(--wmr-border, #e7e3d9);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* Verified data date. Rendered only when the dataset yields one
   unambiguous date; never derived from the visitor's clock. */
.wmr-sa-datadate {
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #64748b;
  white-space: nowrap;
}

/* ---- Hero ---- */
.wmr-sa-hero {
  background: linear-gradient(180deg, var(--wmr-cream, #fbfaf7) 0%, #f3f0e6 100%);
  border-bottom: 1px solid var(--wmr-border, #e7e3d9);
  position: relative;
  overflow: hidden;
}

.wmr-sa-hero-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 70% 50%, black 20%, transparent 70%);
  mask-image: radial-gradient(ellipse at 70% 50%, black 20%, transparent 70%);
  pointer-events: none;
}

.wmr-sa-hero-inner {
  position: relative;
  z-index: 2;
  padding-top: 30px;
  padding-bottom: 40px;
}

.wmr-sa-hero h1 {
  font-size: 50px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.06;
  margin: 18px 0 0;
  color: var(--wmr-ink, #0f172a);
  max-width: 17ch;
}

.wmr-sa-accent {
  color: var(--wmr-muted, #64748b);
  font-style: italic;
  font-family: var(--wmr-serif, 'Fraunces', Georgia, serif);
  font-weight: 400;
}

.wmr-sa-lede {
  font-size: 17px;
  color: var(--wmr-slate, #475569);
  line-height: 1.55;
  margin: 16px 0 0;
  max-width: 640px;
}

.wmr-sa-lede a { color: var(--wmr-blue, #1d4ed8); font-weight: 600; }

/* ---- Bands ---- */
.wmr-sa-band {
  border-bottom: 1px solid var(--wmr-border, #e7e3d9);
  padding-top: 48px;
  padding-bottom: 48px;
}

.wmr-sa-band.white { background: #fff; }
.wmr-sa-band.cream { background: var(--wmr-cream, #fbfaf7); }

/* ---- Amber-ruled method / limits box ---- */
.wmr-sa-method {
  background: var(--wmr-cream, #fbfaf7);
  border: 1px solid var(--wmr-border, #e7e3d9);
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 18px 22px;
}

.wmr-sa-method h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--wmr-ink, #0f172a);
  margin: 0 0 6px;
}

.wmr-sa-method p {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
  margin: 0;
}

.wmr-sa-method ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.wmr-sa-method li {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
}

.wmr-sa-method code,
.wmr-sa-formula {
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 12px;
  color: var(--wmr-ink, #0f172a);
  background: none;
}

/* ---- Related views ---- */
.wmr-sa-relwrap { display: grid; gap: 10px; }

.wmr-sa-kicker {
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.wmr-sa-related {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wmr-sa-relpill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--wmr-border, #e7e3d9);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  white-space: nowrap;
}

.wmr-sa-relpill:hover { border-color: #94a3b8; color: var(--wmr-ink, #0f172a); }

.wmr-sa-relpill.on {
  border-color: var(--wmr-ink, #0f172a);
  color: var(--wmr-ink, #0f172a);
  font-weight: 700;
}

.wmr-sa-relpill .p {
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* ---- Source / disclaimer ---- */
.wmr-sa-source p {
  font-family: var(--wmr-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.7;
  letter-spacing: 0.02em;
  margin: 0;
}

/* ---- Party labels (party colour carries party meaning only) ---- */
.wmr-sa-party {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wmr-sa-party.dem { color: #2a6fdb; }
.wmr-sa-party.gop { color: #d13a4b; }
.wmr-sa-party.ind { color: #8b5cf6; }

/* Monogram avatar with a party ring. No photo data exists on the
   ranked-list dataset, so initials stand in for the portrait. */
.wmr-sa-mono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #cbd5e1;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #475569;
  flex-shrink: 0;
}

.wmr-sa-mono.dem { border-color: #2a6fdb; color: #2a6fdb; }
.wmr-sa-mono.gop { border-color: #d13a4b; color: #d13a4b; }
.wmr-sa-mono.ind { border-color: #8b5cf6; color: #8b5cf6; }

/* ============ Responsive ============ */
@media (max-width: 1023px) {
  .wmr-sa-container { padding-left: 24px; padding-right: 24px; }
  .wmr-sa-hero h1 { font-size: 40px; }
}

@media (max-width: 768px) {
  .wmr-sa-container { padding-left: 16px; padding-right: 16px; }
  .wmr-sa-hero-grid { display: none; }
  .wmr-sa-hero h1 { font-size: 30px; max-width: none; }
  .wmr-sa-lede { font-size: 15px; }
  .wmr-sa-band { padding-top: 32px; padding-bottom: 32px; }

  /* Three destinations on mobile; Overview is reached via the breadcrumb */
  .wmr-sa-nav { gap: 18px; }
  .wmr-sa-nav-link.wmr-sa-nav-overview { display: none; }
  .wmr-sa-nav-link .t { display: none; }
  .wmr-sa-nav-link .s { display: inline; }
  .wmr-sa-nav-link .p { display: none; }
  .wmr-sa-nav-link {
    padding: 10px 0;
    min-height: 44px;
    align-items: center;
  }

  .wmr-sa-relpill { min-height: 44px; align-items: center; }
}
