/* ============================================================
   Obsidius — Arcane Grimoire Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@100..900&family=Outfit:wght@300;400;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg:           #070510;
  --bg-sidebar:   #0d0a1a;
  --bg-card:      #110d21;
  --border:       #1e1535;
  --accent:       #7c3aed;
  --accent-light: #9f67ff;
  --accent-glow:  rgba(124, 58, 237, 0.25);
  --accent-glow2: rgba(124, 58, 237, 0.12);
  --text:         #ede8f5;
  --text-muted:   #9d8bc0;
  --sidebar-w:    280px;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-heading: 'Outfit', system-ui, sans-serif;
  --font-logo:    'Cinzel', serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  overflow-x: hidden;
}

/* ── Background Blooms ─────────────────────────────────────── */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 70%);
  top: -200px; right: -100px;
}
body::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(124,58,237,0.10) 0%, transparent 70%);
  bottom: -150px; left: 100px;
}

/* ── Sidebar ───────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--accent);
  box-shadow: 4px 0 24px rgba(124, 58, 237, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

/* Logo */
.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo a {
  text-decoration: none;
  display: block;
}

.logo-title {
  font-family: var(--font-logo);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px rgba(159, 103, 255, 0.6), 0 0 40px rgba(124, 58, 237, 0.3);
  transition: text-shadow 0.3s ease;
  display: block;
}

.sidebar-logo a:hover .logo-title {
  text-shadow: 0 0 30px rgba(159, 103, 255, 0.9), 0 0 60px rgba(124, 58, 237, 0.5);
  animation: shimmer 1.5s ease infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.logo-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
  font-family: var(--font-heading);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-campaign {
  margin-bottom: 8px;
}

.nav-campaign-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px 6px;
  font-family: var(--font-logo);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-light);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.nav-campaign-header:hover { color: #fff; }

.nav-campaign-toggle {
  font-size: 0.6rem;
  transition: transform 0.2s;
}

.nav-campaign.collapsed .nav-campaign-toggle { transform: rotate(-90deg); }
.nav-campaign.collapsed .nav-campaign-body { display: none; }

.nav-section {
  margin: 4px 0;
}

.nav-section-header {
  padding: 6px 20px 4px 28px;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.nav-section-header:hover { color: var(--text); }

.nav-section.collapsed .nav-section-files { display: none; }

.nav-section-toggle {
  font-size: 0.55rem;
  transition: transform 0.2s;
}

.nav-section.collapsed .nav-section-toggle { transform: rotate(-90deg); }

.nav-file {
  display: block;
  padding: 5px 16px 5px 38px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-file:hover {
  color: var(--text);
  background: var(--accent-glow2);
}

.nav-file.active {
  color: var(--accent-light);
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
  font-weight: 500;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-footer a { color: var(--accent-light); text-decoration: none; }
.sidebar-footer a:hover { text-decoration: underline; }

/* ── Main Content ──────────────────────────────────────────── */
#main {
  grid-column: 2;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.content-area {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ── Hamburger (mobile) ────────────────────────────────────── */
#hamburger {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#hamburger:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Typography ────────────────────────────────────────────── */
.content-area h1,
.content-area h2,
.content-area h3,
.content-area h4,
.content-area h5,
.content-area h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.6em;
  color: var(--text);
}

.content-area h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-light);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4em;
  margin-top: 0;
}

.content-area h2 { font-size: 1.4rem; }
.content-area h3 { font-size: 1.15rem; color: var(--accent-light); }
.content-area h4 { font-size: 1rem; }

.content-area p { margin-bottom: 1em; }

.content-area a {
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: 1px solid rgba(159, 103, 255, 0.3);
  transition: border-color 0.15s, color 0.15s;
}

.content-area a:hover {
  color: #fff;
  border-bottom-color: var(--accent-light);
}

.broken-link {
  color: #e57373;
  border-bottom: 1px dashed #e57373;
  font-style: italic;
  cursor: not-allowed;
}

/* ── Lists ─────────────────────────────────────────────────── */
.content-area ul,
.content-area ol {
  padding-left: 1.6em;
  margin-bottom: 1em;
}

.content-area li { margin-bottom: 0.3em; }

/* ── Blockquotes (lore cards) ──────────────────────────────── */
.content-area blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-card);
  margin: 1.5em 0;
  padding: 1em 1.4em;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-muted);
  position: relative;
}

.content-area blockquote::before {
  content: '"';
  position: absolute;
  top: -8px; left: 14px;
  font-size: 3rem;
  color: var(--accent);
  opacity: 0.3;
  font-family: Georgia, serif;
  line-height: 1;
}

.content-area blockquote p { margin-bottom: 0; color: var(--text-muted); }

/* ── Tables ────────────────────────────────────────────────── */
.content-area table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9rem;
}

.content-area th {
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  letter-spacing: 0.04em;
}

.content-area td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.content-area tr:nth-child(even) td { background: var(--bg-card); }
.content-area tr:hover td { background: var(--accent-glow2); }

/* ── Code ──────────────────────────────────────────────────── */
.content-area code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-card);
  color: var(--accent-light);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.content-area pre {
  background: #0a0717;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2em 1.4em;
  overflow-x: auto;
  margin: 1.5em 0;
  box-shadow: inset 0 0 24px rgba(124, 58, 237, 0.08);
}

.content-area pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ── Horizontal Rule ───────────────────────────────────────── */
.content-area hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
  position: relative;
}

.content-area hr::after {
  content: '✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  padding: 0 12px;
  color: var(--accent);
  font-size: 0.8rem;
}

/* ── Images ────────────────────────────────────────────────── */
.content-area img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* ── Index / Campaign Cards ────────────────────────────────── */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 2em;
}

.campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  display: block;
}

.campaign-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-2px);
}

.campaign-card h2 {
  font-family: var(--font-logo);
  font-size: 1.1rem;
  color: var(--accent-light);
  margin: 0 0 8px;
}

.campaign-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* Page header */
.page-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.5em;
}

.page-meta .breadcrumb {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-heading);
  letter-spacing: 0.06em;
}

.page-meta .breadcrumb a {
  color: var(--text-muted);
  border-bottom: none;
}

.page-meta .breadcrumb a:hover { color: var(--accent-light); }
.page-meta .breadcrumb span { color: var(--border); margin: 0 4px; }

/* ── Cover Image ───────────────────────────────────────────── */
.content-area .cover-image {
  margin: 0 0 2em;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
}

.content-area .cover-image img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* ── Highlight.js overrides ────────────────────────────────── */
.hljs { background: transparent; }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body {
    grid-template-columns: 1fr;
  }

  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 150;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 140;
  }

  #sidebar-overlay.active { display: block; }

  #main {
    grid-column: 1;
    padding-top: 60px;
  }

  #hamburger { display: block; }

  .content-area {
    padding: 24px 20px 60px;
  }

  .content-area h1 { font-size: 1.5rem; }
}
