/* =============================================
   The Bloodvault — Public / Reader Styles
   ============================================= */

body.public-body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.8;
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar Nav ─── */
.public-nav {
  width: var(--nav-width);
  min-width: var(--nav-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
}

.nav-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--bg-border);
}

.site-title {
  font-family: var(--font-fraktur);
  font-size: 1.6rem;
  color: var(--accent-glow);
  text-decoration: none;
  letter-spacing: 0.02em;
  display: block;
  text-shadow: 0 0 12px rgba(139,26,26,0.4);
}
.site-title:hover { color: var(--accent-hover); }

.nav-list {
  list-style: none;
  padding: 1rem 0;
  flex: 1;
}

.nav-list li a {
  display: block;
  padding: 0.55rem 1.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nav-list li a:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
  border-left-color: var(--accent);
}

.nav-list li.active a {
  color: var(--accent-hover);
  border-left-color: var(--accent-glow);
  background: var(--bg-raised);
  font-weight: 600;
}

.nav-empty {
  padding: 0.75rem 1.25rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* Section headers — collapsible buttons */
.nav-section-item {
  list-style: none;
}

.nav-section-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--bg-border);
  margin-top: 0.4rem;
  padding: 0.55rem 1.1rem 0.3rem;
  color: var(--accent-light);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
}

.nav-section-btn:hover { color: var(--accent-hover); }

.nav-section-item:first-child > .nav-section-btn {
  border-top: none;
  margin-top: 0;
}

/* Nested sections inside a sub-list get no top border, smaller label */
.nav-sub .nav-section-btn {
  border-top: none;
  margin-top: 0;
  font-size: 0.68rem;
  padding-top: 0.4rem;
  padding-bottom: 0.2rem;
  color: var(--text-muted);
}

.nav-section-btn:hover { color: var(--accent-hover); }

/* Collapse arrow */
.nav-arrow {
  display: inline-block;
  font-size: 0.6rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-section-btn[aria-expanded="false"] .nav-arrow {
  transform: rotate(-90deg);
}

/* Nested sub-list */
.nav-sub {
  list-style: none;
  padding: 0;
  overflow: hidden;
}

.nav-sub.nav-collapsed {
  display: none;
}

/* Page links inside any depth */
.nav-page-item a {
  display: block;
  padding: 0.45rem 1.1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nav-page-item a:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
  border-left-color: var(--accent);
}

.nav-page-item.active a {
  color: var(--accent-hover);
  border-left-color: var(--accent-glow);
  background: var(--bg-raised);
  font-weight: 600;
}

.nav-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--bg-border);
}

.admin-link {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.admin-link:hover { color: var(--text-secondary); }

/* ─── Main Content ─── */
.public-main {
  margin-left: var(--nav-width);
  flex: 1;
  min-height: 100vh;
  padding: 3rem 4rem;
  max-width: 820px;
}

/* ─── Story Article ─── */
.story-page { }

.story-title {
  font-family: var(--font-fraktur);
  font-size: 2.8rem;
  color: var(--accent-glow);
  margin-bottom: 2rem;
  text-shadow: 0 0 20px rgba(139,26,26,0.3);
  letter-spacing: 0.02em;
}

.story-content h1,
.story-content h2,
.story-content h3,
.story-content h4 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}

.story-content h1 { font-size: 2rem; }
.story-content h2 { font-size: 1.6rem; color: var(--accent-light); }
.story-content h3 { font-size: 1.25rem; }

.story-content p { margin: 0 0 1.25rem; }

.story-content a {
  color: var(--text-link);
  text-decoration: underline;
}
.story-content a:hover { color: var(--text-link-hover); }

/* WikiLinks get a subtle crimson tint to distinguish them */
.story-content a[href^="/story/"] {
  color: var(--accent-hover);
  text-decoration-color: var(--accent);
}
.story-content a[href^="/story/"]:hover {
  color: #ff9090;
}

.story-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-style: italic;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.story-content code {
  background: var(--bg-surface);
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--accent-hover);
}

.story-content pre {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.story-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.story-content hr {
  border: none;
  border-top: 1px solid var(--bg-border);
  margin: 2.5rem 0;
}

.story-content ul, .story-content ol {
  padding-left: 1.5rem;
  margin: 0 0 1.25rem;
}

.story-content li { margin: 0.25rem 0; }

.story-content img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-border);
}

.story-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.story-content th, .story-content td {
  border: 1px solid var(--bg-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.story-content th {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
}

/* ─── 404 ─── */
.story-404 {
  text-align: center;
  padding-top: 4rem;
}
.story-404 a {
  color: var(--text-link);
}

/* ─── Mobile hamburger ─── */
.nav-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  color: var(--text-primary);
  font-size: 1.2rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

@media (max-width: 720px) {
  .public-nav {
    transform: translateX(-100%);
  }
  .public-nav.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }
  .nav-toggle { display: block; }
  .nav-overlay.open { display: block; }
  .public-main {
    margin-left: 0;
    padding: 4rem 1.5rem 2rem;
  }
  .story-title { font-size: 2rem; }
}
