/* ═══════════════════════════════════════════════════════════
   Project Muninn — style.css
   Single source of truth for all site styles.
   See STYLE.md for usage guidance and component reference.
   ═══════════════════════════════════════════════════════════ */

/* ── Custom Properties ──────────────────────────────────── */
:root {
  /* Background */
  --bg: #08080e;

  /* Glass surfaces */
  --surface:       rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border:        rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.13);
  --border-hover:  rgba(255, 255, 255, 0.18);

  /* Text */
  --text-primary: #e2e2ef;
  --text-muted:   #7878a0;
  --text-dim:     #3a3a5a;

  /* Accent — blood red */
  --red:       #8b1a1a;
  --red-vivid: #c0392b;
  --red-glow:  rgba(192, 57, 43, 0.18);

  /* Accent — old gold */
  --gold:     #c9a227;
  --gold-dim: #7a621a;

  /* Accent — deep glowing teal */
  --teal:            #00b8c8;
  --teal-glow:       rgba(0, 184, 200, 0.18);
  --teal-glow-hover: rgba(0, 184, 200, 0.30);

  /* Glass blur */
  --blur:      18px;
  --radius:    14px;
  --radius-sm: 9px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Floating Rune Background ───────────────────────────── */
#rune-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.rune {
  position: absolute;
  color: rgba(200, 205, 240, 1);
  user-select: none;
  pointer-events: none;
  animation: runeFloat linear forwards;
  will-change: transform, opacity;
  line-height: 1;
}

@keyframes runeFloat {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  15%  { opacity: var(--peak, 0.22); }
  85%  { opacity: var(--peak, 0.22); }
  100% {
    opacity: 0;
    transform: translate(var(--dx, 25px), var(--dy, -70px)) rotate(var(--dr, 10deg));
  }
}

/* ── Page Layout ────────────────────────────────────────── */

/* Centered, vertically aligned — used by index + topic index */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

/* Top-aligned — used by article pages */
.article-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2.5rem 1rem;
}

/* ── Glass Card ─────────────────────────────────────────── */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-top-color: var(--border-bright);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 820px;
}

.article-card {
  max-width: 740px;
}

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Cinzel', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.04em;
}

/* ── Site Header ────────────────────────────────────────── */
.site-title {
  font-family: 'Cinzel Decorative', Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 6vw, 3rem);
  text-align: center;
  letter-spacing: 0.14em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* Runic glyph subtitle beneath main title */
.rune-label {
  display: block;
  text-align: center;
  font-size: 1.05rem;
  letter-spacing: 0.65em;
  color: var(--text-dim);
  margin-bottom: 1.75rem;
}

.site-description {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.925rem;
  max-width: 580px;
  margin: 0 auto 2.25rem;
  line-height: 1.8;
}

/* ── Section Label ──────────────────────────────────────── */
.section-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.9rem;
}

/* ── Rune Divider ───────────────────────────────────────── */
.rune-divider {
  text-align: center;
  letter-spacing: 0.75em;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 2rem 0;
  padding: 0 1rem;
  user-select: none;
}

/* ── Topic Cards (index page) ───────────────────────────── */
.topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.topic-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.35rem;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.topic-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  box-shadow: 0 0 28px var(--teal-glow-hover);
}

.topic-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.3rem;
}

.topic-rune {
  font-size: 1.2rem;
  color: var(--teal);
  line-height: 1;
  flex-shrink: 0;
}

.topic-card h3 {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.topic-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-left: calc(1.2rem + 0.65rem);
  margin-bottom: 0.55rem;
}

.last-updated {
  display: block;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: calc(1.2rem + 0.65rem);
  letter-spacing: 0.02em;
}

.last-updated.active {
  color: var(--gold-dim);
}

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 2rem;
  text-transform: uppercase;
}

.breadcrumb a:hover {
  color: var(--teal);
}

/* ── Article Header ─────────────────────────────────────── */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.article-title {
  font-size: clamp(1.2rem, 4vw, 1.9rem);
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.article-date {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.76rem;
  color: var(--gold-dim);
  letter-spacing: 0.07em;
}

/* ── Article Body ───────────────────────────────────────── */
.article-body {
  font-size: 0.915rem;
  line-height: 1.85;
}

.article-body h2 {
  font-size: 1.05rem;
  margin-top: 2rem;
  margin-bottom: 0.7rem;
  color: var(--text-primary);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  font-size: 0.88rem;
  margin-top: 1.5rem;
  margin-bottom: 0.45rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.article-body p {
  margin-bottom: 0.9rem;
  color: var(--text-muted);
}

.article-body strong {
  color: var(--text-primary);
  font-weight: 500;
}

.article-body a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(0, 184, 200, 0.4);
}

.article-body a:hover {
  color: var(--text-primary);
  text-decoration-color: var(--text-primary);
}

.article-body ul,
.article-body ol {
  margin: 0.5rem 0 0.9rem 1.4rem;
  color: var(--text-muted);
}

.article-body li {
  margin-bottom: 0.3rem;
}

/* ── Callout / Stat Block ───────────────────────────────── */
.stat-block {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.75rem 1rem;
  margin: 1.1rem 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.stat-block.red  { border-left-color: var(--red-vivid); }
.stat-block.gold { border-left-color: var(--gold); }

/* ── Probability Badges ─────────────────────────────────── */
.prob {
  display: inline-block;
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold;
  font-size: 0.88em;
  padding: 0.1em 0.45em;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

.prob-low  { color: var(--teal);      background: rgba(0, 184, 200, 0.10); }
.prob-mid  { color: var(--gold);      background: rgba(201, 162, 39, 0.10); }
.prob-high { color: var(--red-vivid); background: rgba(192, 57, 43, 0.10); }

/* ── Text Accent Helpers ────────────────────────────────── */
.text-red   { color: var(--red-vivid); }
.text-gold  { color: var(--gold); }
.text-teal  { color: var(--teal); }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }

/* ── Topic Index Article List ───────────────────────────── */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.article-entry {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.article-entry:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  box-shadow: 0 0 18px var(--teal-glow);
}

.article-entry-date {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.73rem;
  color: var(--gold-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.article-entry-title {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .glass-card {
    padding: 1.5rem 1.2rem;
    border-radius: var(--radius-sm);
  }

  .site-title {
    letter-spacing: 0.07em;
  }

  .topic-desc,
  .last-updated {
    margin-left: 0;
  }

  .article-entry {
    flex-direction: column;
    gap: 0.2rem;
  }

  .breadcrumb {
    font-size: 0.65rem;
  }
}
