/* ============ TOKENS ============ */
:root {
  --bg: #0a0e17;
  --bg-alt: #0e1420;
  --surface: #121926;
  --surface-2: #182233;
  --border: #24304a;
  --text: #e8edf7;
  --text-dim: #9aa7c2;
  --text-faint: #6b7690;
  --accent: #35e0c8;
  --accent-2: #7b9fff;
  --amber: #f2b84b;
  --red: #ff6b6b;
  --green: #6fd67f;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fb;
    --bg-alt: #eef1f8;
    --surface: #ffffff;
    --surface-2: #f0f3fa;
    --border: #dde3ef;
    --text: #131a29;
    --text-dim: #4b5670;
    --text-faint: #7a869c;
    --accent: #0d9488;
    --accent-2: #3b5bdb;
    --amber: #b7791f;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

.wrap {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ SCANLINE DECOR ============ */
.scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.012) 0px,
    rgba(255,255,255,0.012) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ============ HEADER ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark { font-size: 1.6rem; line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 0.95rem; letter-spacing: 0.04em; }
.brand-text small { color: var(--text-faint); font-size: 0.72rem; font-family: var(--mono); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 0.92rem;
}
.site-nav a {
  text-decoration: none;
  color: var(--text-dim);
  transition: color 0.15s ease;
}
.site-nav a:hover { color: var(--text); }
.nav-cta {
  background: var(--accent);
  color: #06120f !important;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-cta:hover { opacity: 0.9; color: #06120f !important; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); display: block; }

/* ============ HERO ============ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 72px;
  border-bottom: 1px solid var(--border);
}
.radar-bg {
  position: absolute;
  top: 50%;
  right: -180px;
  transform: translateY(-50%);
  width: 620px;
  height: 620px;
  pointer-events: none;
  opacity: 0.5;
}
.radar-ring {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 50%;
  inset: 0;
}
.radar-ring.r2 { inset: 90px; }
.radar-ring.r3 { inset: 180px; }
.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 45%, transparent), transparent 32%);
  animation: sweep 6s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .radar-sweep { animation: none; } }

.hero-inner { position: relative; max-width: 760px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 18px;
}
.hero h1 {
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.15;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}
.accent { color: var(--accent); }
.lede {
  color: var(--text-dim);
  font-size: 1.08rem;
  max-width: 620px;
  margin: 0 0 32px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 56px; }

.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #06120f; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  max-width: 640px;
}
.hero-stats div { display: flex; flex-direction: column; gap: 4px; }
.hero-stats strong { font-size: 1.7rem; color: var(--accent); font-family: var(--mono); }
.hero-stats span { font-size: 0.8rem; color: var(--text-faint); }

/* ============ SECTIONS ============ */
.section { padding: 88px 0; }
.section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
}
.section-lede {
  color: var(--text-dim);
  max-width: 680px;
  font-size: 1.02rem;
  margin: 0 0 40px;
}

/* ============ GRIDS / CARDS ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; margin-bottom: 40px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.card h3 { margin: 0 0 10px; font-size: 1.05rem; }
.card p { color: var(--text-dim); margin: 0; font-size: 0.95rem; }

.mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.mini-card h4 { margin: 0 0 6px; font-size: 0.92rem; color: var(--accent); }
.mini-card p { margin: 0; font-size: 0.86rem; color: var(--text-dim); }

.checklist { margin: 0; padding-left: 20px; color: var(--text-dim); font-size: 0.95rem; }
.checklist li { margin-bottom: 8px; }

.motto {
  margin: 40px 0 0;
  padding: 28px 32px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text);
}

/* badges */
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 5px;
  margin: 2px 2px 2px 0;
  font-style: normal;
}
.badge.fakt { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.badge.sygnal { background: color-mix(in srgb, var(--accent-2) 20%, transparent); color: var(--accent-2); }
.badge.wniosek { background: color-mix(in srgb, var(--text-dim) 20%, transparent); color: var(--text-dim); }
.badge.predykcja { background: color-mix(in srgb, var(--amber) 20%, transparent); color: var(--amber); }
.badge.spekulacja { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.badge.blackswan { background: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); font-weight: 700; }

/* ============ PIPELINE ============ */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 44px;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.pipeline > div[role="listitem"] {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--accent);
}
.pipeline .arrow { color: var(--text-faint); }

/* ============ AGENT GRID ============ */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
}
.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.agent-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.agent-num { font-family: var(--mono); color: var(--accent); font-size: 0.75rem; }
.agent-name { display: block; font-weight: 600; margin: 4px 0 6px; font-size: 0.92rem; }
.agent-q { color: var(--text-dim); font-size: 0.82rem; margin: 0; }

/* ============ SESSION SECTION ============ */
.session-date {
  font-family: var(--mono);
  color: var(--text-faint);
  font-size: 0.82rem;
  margin: 0 0 10px;
}
.session-title { font-size: 1.3rem; max-width: 780px; margin: 0 0 36px; line-height: 1.4; }

.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 0.8rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 2.1rem; font-weight: 700; color: var(--accent); font-family: var(--mono); }
.stat-sub { font-size: 0.85rem; color: var(--text-dim); }

.belief-update { display: flex; align-items: center; gap: 16px; margin: 14px 0; }
.belief-update > div { display: flex; flex-direction: column; align-items: center; }
.belief-update span { font-size: 0.72rem; color: var(--text-faint); font-family: var(--mono); }
.belief-update strong { font-size: 1.5rem; font-family: var(--mono); }
.belief-update > div:first-child strong { color: var(--text-faint); }
.belief-update > div:last-child strong { color: var(--accent); }
.belief-arrow { color: var(--text-faint); font-size: 1.3rem; }
.belief-reason { font-size: 0.88rem; margin-top: 4px; }

/* ============ LEDGER TABLE ============ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.ledger { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 0.9rem; }
table.ledger th, table.ledger td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border); }
table.ledger th { background: var(--surface-2); font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; color: var(--text-faint); }
table.ledger tbody tr:last-child td { border-bottom: none; }
table.ledger tbody tr:hover { background: var(--surface); }
.prob-cell { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.prob-bar-track { flex: 1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.prob-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.status-pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 18%, transparent);
  color: var(--accent-2);
}

/* ============ CTA ============ */
.cta-section { text-align: center; }
.cta-wrap { max-width: 560px; }
.cta-section h2 { justify-content: center; margin-bottom: 14px; font-size: 1.6rem; }
.cta-section p { color: var(--text-dim); margin-bottom: 28px; }

/* ============ FOOTER ============ */
.site-footer { padding: 40px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.footer-inner p { color: var(--text-faint); font-size: 0.85rem; max-width: 380px; margin: 4px 0 0; }
.footer-year { max-width: 340px; text-align: right; }

/* ============ TAG FILTER ============ */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 28px;
}
.tag-filter button {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.tag-filter button:hover { color: var(--text); border-color: var(--accent); }
.tag-filter button.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* ============ ARTICLE CARDS (listing) ============ */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.article-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.article-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.article-card-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.article-card h3 { margin: 0; font-size: 1.2rem; line-height: 1.35; }
.article-card p { margin: 0; color: var(--text-dim); font-size: 0.92rem; }
.article-card-date { margin-top: auto; font-family: var(--mono); font-size: 0.78rem; color: var(--text-faint); }

/* ============ ARTICLE PAGE ============ */
.article-hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
}
.article-hero .wrap { max-width: 760px; }
.breadcrumb {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 22px;
}
.breadcrumb:hover { color: var(--accent); }
.article-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.article-meta .article-card-tag { font-size: 0.72rem; }
.article-hero h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.25;
  margin: 0 0 18px;
}
.article-lede {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin: 0;
}

.article-body {
  padding: 48px 0 96px;
}
.article-body .wrap { max-width: 720px; }
.prose { font-size: 1.05rem; line-height: 1.75; }
.prose h2 {
  font-size: 1.5rem;
  margin: 48px 0 18px;
  padding-top: 4px;
}
.prose h3 { font-size: 1.15rem; margin: 32px 0 12px; }
.prose p { margin: 0 0 20px; color: var(--text); }
.prose p.dim { color: var(--text-dim); }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 22px; color: var(--text); }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--text); }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.prose > *:first-child { margin-top: 0; }

.pull-quote {
  margin: 28px 0;
  padding: 22px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.pull-quote p { margin: 0 0 10px; font-size: 1.02rem; font-style: italic; color: var(--text); }
.pull-quote p:last-child { margin-bottom: 0; }
.pull-quote cite {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
}

.callout {
  margin: 32px 0;
  padding: 24px 26px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.callout h4 {
  margin: 0 0 14px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-family: var(--mono);
}
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }

.scenario-list { display: grid; gap: 12px; margin: 0 0 20px; }
.scenario-list .item { display: flex; gap: 14px; align-items: baseline; }
.scenario-list .letter {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  min-width: 22px;
}
.scenario-list .item p { margin: 0; color: var(--text-dim); font-size: 0.96rem; }
.scenario-list .item strong { color: var(--text); }

.mini-predictions { display: grid; gap: 10px; margin: 0; }
.mini-predictions .row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.mini-predictions .row:last-child { border-bottom: none; padding-bottom: 0; }
.mini-predictions .p-text { color: var(--text); }
.mini-predictions .p-date { font-family: var(--mono); font-size: 0.78rem; color: var(--text-faint); white-space: nowrap; }
.mini-predictions .p-prob { font-family: var(--mono); font-weight: 700; color: var(--accent); white-space: nowrap; }

.article-sources { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border); }
.article-sources h2 { font-size: 1.1rem; margin: 0 0 16px; }
.article-sources ol { padding-left: 20px; margin: 0; font-size: 0.88rem; color: var(--text-faint); }
.article-sources li { margin-bottom: 8px; }
.article-sources a { color: var(--text-dim); }

.article-nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

/* ============ BELIEF TIMELINE (agenci.html) ============ */
.belief-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}
.belief-timeline {
  display: grid;
  gap: 16px;
}
.belief-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
}
.belief-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.belief-agent {
  font-weight: 700;
  font-size: 0.98rem;
}
.belief-session {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-faint);
  text-decoration: none;
}
.belief-session:hover { color: var(--accent); }
.belief-claim { color: var(--text-dim); font-size: 0.95rem; margin: 0 0 16px; }
.belief-card .belief-update { margin: 0 0 12px; gap: 20px; }
.belief-delta {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 4px 10px;
  border-radius: 999px;
  align-self: center;
}
.belief-delta.down { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.belief-delta.up { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.belief-card .belief-reason { margin: 0; font-size: 0.88rem; }

/* ============ RESPONSIVE ============ */
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .agent-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .radar-bg { opacity: 0.25; width: 420px; height: 420px; right: -140px; }
  .articles-grid { grid-template-columns: 1fr; }
  .mini-predictions .row { grid-template-columns: 1fr; gap: 4px; }
  .belief-stats { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
    gap: 16px;
    display: none;
  }
  .site-nav.open { display: flex; }
  .agent-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
  .footer-year { text-align: left; }
}
