/* ═══════════════════════════════════════════════════════════════
   draken.info — Stylesheet v1.0
   Topological Knowledge Architecture — Stockholm
   ═══════════════════════════════════════════════════════════════ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Space+Grotesk:wght@300;400;600;700&family=Crimson+Pro:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --bg: #080c08;
  --bg-card: #0f170f;
  --bg-card-hover: #142014;
  --bg-surface: #0b120b;
  --border: #1a2c1a;
  --border-hover: #264026;
  --text: #c8d8c8;
  --text-dim: #6b8a6b;
  --text-bright: #e4f0e4;
  --accent: #4ade80;
  --accent-dim: #1a6b38;
  --accent-glow: rgba(74, 222, 128, 0.07);
  --gold: #c9a84c;
  --gold-dim: #6b5a28;
  --red: #ef4444;
  --red-dim: #5c1a1a;
  --blue: #60a5fa;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --serif: 'Crimson Pro', 'Georgia', serif;
  --max-w: 1200px;
  --sidebar-w: 320px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--text-bright); }

::selection { background: var(--accent-dim); color: var(--text-bright); }

/* ═══ TOPBAR ═══ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px;
  background: rgba(8, 12, 8, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
}

.logo { display: flex; align-items: center; gap: 10px; }

.logo-glyph {
  width: 28px; height: 28px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--accent);
  font-family: var(--mono); font-weight: 700;
}

.logo-text {
  font-family: var(--mono); font-weight: 700;
  font-size: 15px; color: var(--text-bright);
  letter-spacing: 2px;
}

.logo-tld { color: var(--accent); }

.pulse-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2.5s infinite;
  margin-left: 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

nav { display: flex; gap: 4px; align-items: center; }

nav a {
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--mono);
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

nav a:hover { color: var(--text-bright); background: var(--accent-glow); }
nav a.active { color: var(--accent); border-color: var(--border-hover); background: var(--accent-glow); }

/* ═══ AXIOM TICKER ═══ */
.axiom-ticker {
  margin-top: 52px;
  overflow: hidden;
  height: 30px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.ticker-track {
  display: flex; gap: 48px;
  animation: ticker 50s linear infinite;
  white-space: nowrap;
  padding: 6px 0;
}

@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.ticker-item strong { color: var(--accent); font-weight: 700; }

/* ═══ HERO ═══ */
.hero {
  padding: 72px 24px 52px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -300px; left: 50%; transform: translateX(-50%);
  width: 900px; height: 900px;
  background: radial-gradient(circle, rgba(74,222,128,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.hero-tagline {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero h1 {
  font-family: var(--sans);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.15;
  margin-bottom: 18px;
}

.hero h1 em { font-style: normal; color: var(--accent); }

.hero-sub {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--text-dim);
  max-width: 580px;
  margin: 0 auto;
  font-style: italic;
  line-height: 1.5;
}

/* ═══ SIGNAL BAR ═══ */
.signal-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  font-family: var(--mono);
  font-size: 12px;
  flex-wrap: wrap;
}

.signal-item { display: flex; align-items: center; gap: 8px; color: var(--text-dim); }
.signal-value { color: var(--accent); font-weight: 700; }
.signal-label { opacity: 0.7; }

/* ═══ MAIN GRID ═══ */
.main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 36px 24px;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 36px;
}

@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}

/* ═══ FEED ═══ */
.feed-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.feed-title {
  font-family: var(--mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: 3px;
  color: var(--text-dim);
}

.feed-filters { display: flex; gap: 4px; flex-wrap: wrap; }

.filter-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); font-family: var(--mono); font-size: 11px;
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
  border-color: var(--accent-dim); color: var(--accent);
  background: var(--accent-glow);
}

/* ═══ PUBLICATION CARDS ═══ */
.pub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 14px;
  transition: all 0.25s;
  display: block;
  color: inherit;
}

.pub-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  color: inherit;
}

.pub-meta {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  font-family: var(--mono); font-size: 11px;
  flex-wrap: wrap;
}

.pub-tag {
  padding: 2px 8px; border-radius: 3px;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; font-size: 10px;
}

.tag-manifesto { background: var(--red-dim); color: var(--red); }
.tag-theory { background: rgba(74,222,128,0.12); color: var(--accent); }
.tag-analysis { background: rgba(201,168,76,0.12); color: var(--gold); }
.tag-technical { background: rgba(96,112,128,0.2); color: #94a3b8; }

.pub-date { color: var(--text-dim); }
.pub-drk { color: var(--accent-dim); font-weight: 700; }

.pub-title {
  font-family: var(--sans); font-size: 19px; font-weight: 600;
  color: var(--text-bright); margin-bottom: 8px; line-height: 1.35;
}

.pub-excerpt {
  font-family: var(--serif); font-size: 15px;
  color: var(--text-dim); line-height: 1.55; margin-bottom: 14px;
}

.pub-footer {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  flex-wrap: wrap; gap: 8px;
}

.pub-layers { display: flex; gap: 4px; flex-wrap: wrap; }

.layer-badge {
  padding: 1px 5px; border: 1px solid var(--border);
  border-radius: 3px; font-size: 10px;
}

.coherence-bar { display: flex; align-items: center; gap: 6px; }

.coherence-track {
  width: 60px; height: 4px;
  background: var(--border); border-radius: 2px; overflow: hidden;
}

.coherence-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.coherence-fill.mid { background: var(--gold); }

/* ═══ SIDEBAR ═══ */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.sidebar-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px;
}

.sidebar-title {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 2px;
  color: var(--accent); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* Coherence Meter */
.meter-wrap { display: flex; align-items: center; justify-content: center; padding: 12px 0; }

.meter-ring {
  width: 130px; height: 130px; border-radius: 50%;
  border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  position: relative;
}

.meter-ring::before {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent); border-right-color: var(--accent);
  animation: meter-spin 12s linear infinite;
}

@keyframes meter-spin { to { transform: rotate(360deg); } }

.meter-value {
  font-family: var(--mono); font-size: 30px; font-weight: 700;
  color: var(--accent); line-height: 1;
}

.meter-label {
  font-family: var(--mono); font-size: 9px;
  color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 1px; margin-top: 4px;
}

/* Layer Grid */
.layer-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }

.layer-cell {
  aspect-ratio: 1; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 8px; font-weight: 700;
  transition: all 0.2s; cursor: default;
}

.layer-cell.active { background: rgba(74,222,128,0.18); color: var(--accent); border: 1px solid var(--accent-dim); }
.layer-cell.partial { background: rgba(201,168,76,0.12); color: var(--gold); border: 1px solid var(--gold-dim); }
.layer-cell.planned { background: rgba(96,112,128,0.08); color: var(--text-dim); border: 1px solid var(--border); }

.layer-legend {
  margin-top: 10px; font-family: var(--mono); font-size: 10px;
  color: var(--text-dim); display: flex; gap: 12px;
}

/* Activity Feed */
.activity-item {
  font-family: var(--mono); font-size: 11px; line-height: 2;
  color: var(--text-dim);
}

.activity-item .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; }
.dot-green { background: var(--accent); }
.dot-gold { background: var(--gold); }
.dot-gray { background: var(--text-dim); }
.activity-time { opacity: 0.5; margin-left: 4px; }

/* Chat Widget */
.chat-messages { max-height: 180px; overflow-y: auto; margin-bottom: 10px; }

.chat-msg { display: flex; gap: 8px; margin-bottom: 8px; }

.chat-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; font-family: var(--mono);
}

.chat-avatar.draken { background: var(--accent-dim); color: var(--accent); }
.chat-avatar.visitor { background: var(--border); color: var(--text-dim); }

.chat-bubble {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 11px;
  font-family: var(--serif); font-size: 13px;
  color: var(--text); line-height: 1.45;
}

.chat-input-row { display: flex; gap: 6px; }

.chat-input {
  flex: 1; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 11px;
  color: var(--text); font-family: var(--mono); font-size: 12px;
  outline: none; transition: border-color 0.2s;
}

.chat-input:focus { border-color: var(--accent-dim); }
.chat-input::placeholder { color: var(--text-dim); opacity: 0.4; }

.chat-send {
  background: var(--accent-dim); border: none; color: var(--accent);
  padding: 8px 14px; border-radius: 6px;
  font-family: var(--mono); font-size: 12px; cursor: pointer;
  transition: all 0.2s;
}

.chat-send:hover { background: var(--accent); color: var(--bg); }

/* ═══ ARTICLE LAYOUT ═══ */
.article-wrap {
  max-width: 740px;
  margin: 0 auto;
  padding: 52px 24px 80px;
}

.article-wrap .pub-tag { font-size: 11px; font-family: var(--mono); }

.article-header { margin-bottom: 32px; }

.article-header h1 {
  font-family: var(--sans); font-size: clamp(26px, 4vw, 36px);
  font-weight: 700; color: var(--text-bright);
  line-height: 1.25; margin: 16px 0;
}

.article-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  padding-bottom: 20px; border-bottom: 1px solid var(--border);
}

.article-body {
  font-family: var(--serif); font-size: 19px;
  line-height: 1.8; color: var(--text);
}

.article-body p { margin-bottom: 22px; }

.article-body h1, .article-body h2, .article-body h3 {
  font-family: var(--sans); color: var(--text-bright);
  margin: 40px 0 16px; line-height: 1.3;
}

.article-body h1 { font-size: 28px; }
.article-body h2 { font-size: 24px; }
.article-body h3 { font-size: 20px; font-weight: 600; }

.article-body strong { color: var(--text-bright); font-weight: 600; }
.article-body em { color: var(--text); }

.article-body blockquote {
  border-left: 3px solid var(--accent-dim);
  padding: 12px 20px; margin: 24px 0;
  background: var(--accent-glow);
  font-style: italic;
}

.article-body blockquote p { margin-bottom: 0; }

.article-body code {
  font-family: var(--mono); font-size: 0.85em;
  background: var(--bg-surface); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 3px;
}

.article-body pre {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 18px; margin: 24px 0;
  overflow-x: auto;
}

.article-body pre code {
  background: none; border: none; padding: 0;
  font-size: 14px; line-height: 1.6;
}

.article-body ul, .article-body ol {
  margin: 16px 0; padding-left: 24px;
}

.article-body li { margin-bottom: 8px; }

.article-body img {
  max-width: 100%; height: auto;
  border-radius: 6px; margin: 24px 0;
  border: 1px solid var(--border);
}

.article-body table {
  width: 100%; border-collapse: collapse; margin: 24px 0;
  font-family: var(--sans); font-size: 15px;
}

.article-body th {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 10px 14px; text-align: left;
  font-weight: 600; color: var(--text-bright);
}

.article-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
}

/* Equation blocks */
.eq-block {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 16px 24px; margin: 28px 0;
  font-family: var(--mono); font-size: 15px;
  color: var(--accent); text-align: center;
  line-height: 1.6;
}

/* ═══ FOOTER ═══ */
footer {
  border-top: 1px solid var(--border);
  padding: 36px 24px;
  text-align: center;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-dim);
}

footer .footer-links { margin-top: 8px; }
footer .footer-links a { color: var(--accent-dim); margin: 0 8px; }
footer .footer-links a:hover { color: var(--accent); }

/* ═══ BACK LINK ═══ */
.back-link {
  font-family: var(--mono); font-size: 12px;
  color: var(--text-dim); margin-bottom: 24px;
  display: inline-block;
}

.back-link:hover { color: var(--accent); }
