/* Innerspace Wiki — Dark neutral palette */

:root {
  --bg: #0f1114;
  --bg-raised: #1a1d23;
  --bg-hover: #22262e;
  --border: #2a2e37;
  --text: #c8ccd4;
  --text-muted: #6b7280;
  --text-bright: #e5e7eb;
  --accent: #7c8af6;
  --accent-dim: #5c6ac4;
  --tag-bg: #1e2330;
  --tag-text: #8b95a8;
  --success: #4ade80;
  --warning: #fbbf24;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
header {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.logo:hover {
  text-decoration: none;
  color: var(--accent);
}

nav {
  display: flex;
  gap: 1.25rem;
}

.nav-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text-bright);
  border-bottom-color: var(--accent);
}

/* Main */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.loading {
  color: var(--text-muted);
  text-align: center;
  padding: 4rem 0;
}

.error {
  color: #ef4444;
  text-align: center;
  padding: 2rem;
}

/* Article List (Home) */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.article-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.article-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
}

.article-card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}

.article-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 0.75rem;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

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

.article-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.article-summary {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.7;
  font-style: italic;
  margin-bottom: 1rem;
}

.article-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Markdown Content */
.article-body {
  font-size: 0.95rem;
  line-height: 1.8;
}

.article-body h1 {
  display: none; /* Title is in header */
}

.article-body h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 2rem 0 0.75rem;
}

.article-body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 1.5rem 0 0.5rem;
}

.article-body p {
  margin-bottom: 1rem;
}

.article-body ul, .article-body ol {
  margin: 0.5rem 0 1rem 1.5rem;
}

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

.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: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  background: var(--bg-raised);
  border-radius: 0 4px 4px 0;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.article-body code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.85em;
  background: var(--tag-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

/* Sidebar Sections */
.sidebar-section {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 2rem;
}

.sidebar-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.sidebar-section ul {
  list-style: none;
  padding: 0;
}

.sidebar-section li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.sidebar-section li:last-child {
  border-bottom: none;
}

.source-link {
  color: var(--accent);
  font-weight: 600;
}

.source-link:hover {
  text-decoration: underline;
}

.source-type {
  font-size: 0.7rem;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.5rem;
}

.source-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cross-ref-link {
  display: block;
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0;
  background: var(--bg-hover);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.875rem;
  transition: background 0.15s;
}

.cross-ref-link:hover {
  background: var(--border);
  text-decoration: none;
}

/* Scripture tags */
.scripture-ref {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--tag-bg);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin: 0.15rem;
}

/* Search */
.search-container {
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-bright);
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.search-result:hover {
  border-color: var(--accent-dim);
}

.search-result h3 {
  font-size: 1rem;
  color: var(--text-bright);
  margin-bottom: 0.35rem;
}

.search-result p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

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

/* Responsive */
@media (max-width: 640px) {
  .header-inner {
    padding: 0.6rem 1rem;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .article-header h1 {
    font-size: 1.4rem;
  }

  .article-body {
    font-size: 0.9rem;
  }
}
