/* ─────────────────────────────────────────────────────────────────
   Synopticon architecture explorer — shared styles
   Loaded from every page under /site/architecture/.
   Inherits the palette + type from site/landing/, with additions for
   stat counters, entry cards, the pipeline force graph, and side panel.
   ───────────────────────────────────────────────────────────────── */

:root {
  --bg: #F0F6FC;
  --bg-deep: #D6E8F8;
  --card: #FFFFFF;
  --text: #0C2F3F;
  --muted: #4A6B7A;
  --subtle: #8BA3B0;
  --border: rgba(12,47,63,0.08);
  --border-strong: rgba(12,47,63,0.18);
  --accent: #0C2F3F;
  --accent-soft: rgba(12,47,63,0.06);
  --cta: #0C2F3F;
  --cta-hover: #183E50;
  --mono: 'DM Mono', 'SF Mono', Consolas, monospace;
  --ok: #0F8A50;
  --warn: #C7873B;
  --gray: #9AAAB5;

  --node-source: #6E94A8;
  --node-feed: #0C2F3F;
  --node-intel: #C77E3B;
  --node-derived: #4A6B7A;
  --node-output: #0F8A50;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.mono { font-family: var(--mono); }

/* ── Nav ─────────────────────────────────────── */
.arch-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(214,232,248,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.arch-nav .nav-left { display: flex; align-items: center; gap: 14px; }
.arch-nav .nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.arch-nav .nav-logo svg { width: 36px; height: 36px; }
.arch-nav .nav-wordmark {
  font-size: 16px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text);
}
.arch-nav .nav-section {
  font-size: 12px; font-weight: 500;
  color: var(--muted);
  letter-spacing: 1px; text-transform: uppercase;
  padding-left: 14px; margin-left: 6px;
  border-left: 1px solid var(--border);
}
.arch-nav .nav-right { display: flex; gap: 22px; align-items: center; }
.arch-nav .nav-right a {
  font-size: 14px; font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.arch-nav .nav-right a:hover { color: var(--text); }
.arch-nav .nav-right a.active { color: var(--text); font-weight: 600; }
.arch-nav .nav-right a.cta {
  font-size: 13px; font-weight: 600;
  color: white; background: var(--cta);
  padding: 8px 16px; border-radius: 8px;
}
.arch-nav .nav-right a.cta:hover { background: var(--cta-hover); text-decoration: none; }

/* ── Layout ──────────────────────────────────── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.wrap-narrow { max-width: 820px; margin: 0 auto; padding: 0 28px; }

/* ── Hero ─────────────────────────────────────── */
.arch-hero {
  padding: 64px 0 32px;
  border-bottom: 1px solid var(--border);
}
.arch-hero .eyebrow {
  font-size: 12px; letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--subtle); margin-bottom: 14px;
}
.arch-hero h1 {
  font-size: clamp(34px, 4.4vw, 52px); font-weight: 700;
  letter-spacing: -1px; line-height: 1.05;
  margin-bottom: 16px;
}
.arch-hero .dek {
  font-size: 18px; color: var(--muted); max-width: 640px; line-height: 1.55;
}
.arch-hero .dek code {
  font-family: var(--mono); font-size: 14px;
  background: var(--accent-soft); padding: 1px 6px; border-radius: 4px;
}
.arch-hero .meta {
  margin-top: 22px; font-size: 13px; color: var(--subtle);
  display: flex; gap: 18px; flex-wrap: wrap;
}
.arch-hero .meta span::before { content: '·'; margin-right: 18px; color: var(--border-strong); }
.arch-hero .meta span:first-child::before { content: ''; margin: 0; }

/* ── Stats grid ──────────────────────────────── */
.stats-section { padding: 40px 0; border-bottom: 1px solid var(--border); }
.stats-section h2 {
  font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 24px; font-weight: 600;
}
.stats-grid {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.stat {
  background: var(--card);
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat .num {
  font-size: 32px; font-weight: 700; letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat .num small { font-size: 16px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.stat .lbl {
  font-size: 12px; color: var(--muted);
  letter-spacing: 0.4px;
}
.stat .sub {
  font-size: 11px; color: var(--subtle); margin-top: 2px;
  font-family: var(--mono);
}

/* ── Entry cards ─────────────────────────────── */
.cards-section { padding: 48px 0 64px; }
.cards-section h2 {
  font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 22px; font-weight: 600;
}
.cards-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.card:hover {
  border-color: var(--border-strong);
  text-decoration: none;
  transform: translateY(-1px);
}
.card .num {
  font-size: 11px; letter-spacing: 1.5px;
  color: var(--subtle);
  margin-bottom: 14px;
  font-family: var(--mono);
}
.card h3 {
  font-size: 22px; font-weight: 700; margin-bottom: 10px;
  letter-spacing: -0.3px;
}
.card p {
  font-size: 14px; color: var(--muted); line-height: 1.55;
}
.card .arrow {
  position: absolute; right: 22px; top: 26px;
  font-size: 18px; color: var(--subtle);
  transition: transform 0.15s, color 0.15s;
}
.card:hover .arrow { color: var(--accent); transform: translateX(2px); }

/* ── Daily clock (home page hero animation) ───── */
.clock-strip {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
}
.clock-pip {
  text-align: center;
  padding: 10px 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
}
.clock-pip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gray);
  display: inline-block; margin-bottom: 6px;
}
.clock-pip.active .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(15,138,80,0.18); }
.clock-pip.stale .dot { background: var(--warn); }
.clock-pip.pipeline .dot { background: var(--node-intel); }
.clock-pip .name { color: var(--muted); display: block; }

/* ── Pipeline page (force graph) ──────────────── */
.pipeline-toolbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pipeline-toolbar .title {
  font-weight: 600;
  color: var(--text);
  margin-right: 8px;
}
.pipeline-toolbar .legend {
  display: flex; gap: 14px; flex-wrap: wrap;
}
.pipeline-toolbar .legend-item {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 12px;
}
.pipeline-toolbar .legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gray);
}
.pipeline-toolbar .toggles {
  margin-left: auto; display: flex; gap: 8px;
}
.pipeline-toolbar button {
  font-family: inherit; font-size: 12px;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 11px;
  cursor: pointer;
  transition: all 0.12s;
}
.pipeline-toolbar button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.pipeline-toolbar button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.pipeline-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 380px;
  height: calc(100vh - 64px - 53px);
  min-height: 540px;
}
.pipeline-stage.no-panel { grid-template-columns: 1fr 0; }

.pipeline-canvas {
  position: relative;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.4) 0%, transparent 50%),
    var(--bg-deep);
  overflow: hidden;
}
.pipeline-canvas svg {
  display: block; width: 100%; height: 100%;
}
.pipeline-canvas .col-label {
  position: absolute; top: 12px;
  font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--subtle); font-weight: 600;
  pointer-events: none;
}

.pipeline-side {
  background: var(--card);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 22px 24px 32px;
}
.pipeline-side .empty {
  color: var(--subtle); font-size: 13px; line-height: 1.6;
}
.pipeline-side h3 {
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--subtle); margin-top: 22px; margin-bottom: 8px;
  font-weight: 600;
}
.pipeline-side h3:first-child { margin-top: 0; }
.pipeline-side .node-name {
  font-size: 22px; font-weight: 700; letter-spacing: -0.3px;
  margin-bottom: 6px; line-height: 1.2;
}
.pipeline-side .node-kind {
  display: inline-block;
  font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-weight: 600;
}
.pipeline-side p { font-size: 14px; color: var(--muted); line-height: 1.55; }
.pipeline-side .kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 13px; }
.pipeline-side .kv dt { color: var(--subtle); }
.pipeline-side .kv dd { color: var(--text); font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.pipeline-side ul { list-style: none; padding: 0; margin: 0; }
.pipeline-side ul li {
  font-size: 13px; padding: 4px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--muted);
}
.pipeline-side ul li:last-child { border-bottom: 0; }
.pipeline-side ul li code {
  font-family: var(--mono); font-size: 12px;
  color: var(--text);
}
.pipeline-side .pill {
  display: inline-block;
  font-size: 11px; padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  margin-right: 4px; margin-bottom: 4px;
}
.pipeline-side .pill.ok { background: rgba(15,138,80,0.12); color: var(--ok); }
.pipeline-side .pill.warn { background: rgba(199,135,59,0.14); color: var(--warn); }
.pipeline-side .pill.muted { background: var(--accent-soft); color: var(--muted); }

.pipeline-side .close {
  position: absolute; top: 14px; right: 14px;
  background: transparent; border: none; cursor: pointer;
  font-size: 20px; color: var(--subtle);
  padding: 4px 8px; border-radius: 6px;
}
.pipeline-side .close:hover { background: var(--accent-soft); color: var(--text); }

/* ── D3 nodes + links ─────────────────────────── */
.node circle { stroke: var(--card); stroke-width: 1.5px; }
.node.kind-sources circle { fill: var(--node-source); }
.node.kind-feed circle { fill: var(--node-feed); }
.node.kind-intelligence circle { fill: var(--node-intel); }
.node.kind-derived circle { fill: var(--node-derived); }
.node.kind-article circle { fill: var(--node-output); }
.node.kind-research circle { fill: var(--node-output); opacity: 0.75; }
.node.dim circle { opacity: 0.18; }
.node.selected circle { stroke: var(--text); stroke-width: 3px; }

.node text {
  font-family: 'DM Sans', sans-serif;
  font-size: 11.5px;
  fill: var(--text);
  pointer-events: none;
  font-weight: 500;
}
.node.kind-sources text { font-weight: 700; }
.node text.sub {
  font-size: 9.5px;
  fill: var(--subtle);
  font-family: var(--mono);
}
.node.dim text { opacity: 0.25; }

.link {
  stroke: var(--border-strong);
  stroke-width: 1px;
  fill: none;
}
.link.dim { stroke-opacity: 0.12; }
.link.highlight { stroke: var(--accent); stroke-width: 2px; }

/* ── Footer ─────────────────────────────────── */
.arch-footer {
  border-top: 1px solid var(--border);
  padding: 24px 28px;
  font-size: 12px;
  color: var(--subtle);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  font-family: var(--mono);
}
.arch-footer a { color: var(--muted); }

/* ── Mobile ─────────────────────────────────── */
@media (max-width: 900px) {
  .pipeline-stage { grid-template-columns: 1fr; height: auto; }
  .pipeline-stage.no-panel { grid-template-columns: 1fr; }
  .pipeline-canvas { height: 70vh; }
  .pipeline-side {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 60vh;
  }
}
