/* =================================================================
   Research Library — Sacred Chemistry Deep Dive
   The most comprehensive psychedelics research database, accessible.
   ================================================================= */

/* ── Layout ── */
.rl-container {
  display: flex;
  height: 100vh;
  background: #020410;
  color: #e0e0e0;
  font-family: var(--font-body, 'Inter', sans-serif);
  overflow: hidden;
}

/* ── Sidebar ── */
.rl-sidebar {
  width: 320px;
  min-width: 280px;
  background: #0a0c1a;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.rl-sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.rl-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  text-decoration: none;
}

.rl-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rl-logo-text {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.5px;
}

.rl-logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-body, 'Inter', sans-serif);
  letter-spacing: 0.3px;
  display: block;
  margin-top: 2px;
}

.rl-stats-bar {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 12px;
}

.rl-stat-val {
  color: #00e5cc;
  font-weight: 600;
}

/* Search */
.rl-search-wrap {
  padding: 12px 20px;
  flex-shrink: 0;
}

.rl-search {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 14px 10px 36px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.rl-search:focus {
  border-color: rgba(0,229,204,0.4);
}

.rl-search-icon {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.25);
  font-size: 14px;
  pointer-events: none;
}

.rl-search-wrap {
  position: relative;
}

/* Navigation */
.rl-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rl-nav::-webkit-scrollbar {
  display: none;
}

.rl-nav-section {
  margin-bottom: 4px;
}

.rl-nav-section-title {
  padding: 12px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
}

.rl-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.rl-nav-item:hover {
  background: rgba(255,255,255,0.03);
}

.rl-nav-item.active {
  background: rgba(0,229,204,0.06);
  border-left-color: #00e5cc;
}

.rl-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rl-nav-label {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rl-nav-item.active .rl-nav-label {
  color: #fff;
}

.rl-nav-count {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  flex-shrink: 0;
}

/* Sub-files under compound */
.rl-nav-subitem {
  padding: 5px 20px 5px 48px;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  transition: color 0.15s;
}

.rl-nav-subitem:hover {
  color: rgba(255,255,255,0.7);
}

.rl-nav-subitem.active {
  color: #00e5cc;
}

/* ── Content Area ── */
.rl-content {
  flex: 1;
  overflow-y: auto;
  background: #060818;
}

.rl-content {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.rl-content::-webkit-scrollbar {
  display: none;
}

/* Welcome state */
.rl-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

.rl-welcome-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.6;
}

.rl-welcome h2 {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 28px;
  color: #fff;
  margin: 0 0 12px;
  letter-spacing: 1px;
}

.rl-welcome p {
  color: rgba(255,255,255,0.45);
  font-size: 15px;
  line-height: 1.6;
  max-width: 480px;
}

.rl-welcome-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
  max-width: 600px;
  width: 100%;
}

.rl-welcome-stat {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 20px;
}

.rl-welcome-stat-val {
  font-size: 28px;
  font-weight: 700;
  color: #00e5cc;
  display: block;
}

.rl-welcome-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
  display: block;
}

/* Article content */
.rl-article {
  max-width: 840px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}

.rl-article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.rl-article-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  background: rgba(0,229,204,0.1);
  color: #00e5cc;
  border: 1px solid rgba(0,229,204,0.15);
}

.rl-article-title {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 32px;
  color: #fff;
  margin: 0 0 8px;
  line-height: 1.25;
  letter-spacing: 0.5px;
}

.rl-article-meta {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

.rl-article-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Sacred Chemistry link */
.rl-sacred-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0,229,204,0.08);
  border: 1px solid rgba(0,229,204,0.15);
  border-radius: 8px;
  color: #00e5cc;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.2s;
  margin-top: 16px;
}

.rl-sacred-link:hover {
  background: rgba(0,229,204,0.15);
}

/* ── Rendered Content Styling ── */
.rl-body h1 {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 28px;
  color: #fff;
  margin: 40px 0 16px;
  letter-spacing: 0.5px;
  display: none; /* Title already shown in header */
}

.rl-body h2 {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 22px;
  color: #fff;
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  letter-spacing: 0.3px;
}

.rl-body h3 {
  font-size: 17px;
  color: #e0e0e0;
  margin: 28px 0 10px;
  font-weight: 600;
}

.rl-body h4 {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  margin: 20px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.rl-body p {
  font-size: 15px;
  line-height: 1.75;
  color: rgba(255,255,255,0.7);
  margin: 0 0 16px;
}

.rl-body strong {
  color: #fff;
  font-weight: 600;
}

.rl-body em {
  color: rgba(255,255,255,0.8);
  font-style: italic;
}

.rl-body a {
  color: #00e5cc;
  text-decoration: none;
  border-bottom: 1px solid rgba(0,229,204,0.2);
  transition: border-color 0.2s;
}

.rl-body a:hover {
  border-bottom-color: #00e5cc;
}

.rl-body blockquote {
  border-left: 3px solid #00e5cc;
  margin: 20px 0;
  padding: 12px 20px;
  background: rgba(0,229,204,0.04);
  border-radius: 0 8px 8px 0;
  color: rgba(255,255,255,0.65);
  font-style: italic;
  font-size: 15px;
  line-height: 1.65;
}

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

.rl-body li {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,0.65);
  margin-bottom: 6px;
}

.rl-body li strong {
  color: #e0e0e0;
}

.rl-body ul ul {
  margin: 4px 0;
}

.rl-body code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: #ff9cac;
  font-family: 'JetBrains Mono', monospace;
}

.rl-body pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
}

.rl-body pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}

.rl-body hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 32px 0;
}

/* Tables */
.rl-body .rl-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}

.rl-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rl-body thead {
  background: rgba(255,255,255,0.04);
}

.rl-body th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.rl-body td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
}

.rl-body tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

/* ── Mobile Menu Toggle ── */
.rl-menu-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00e5cc, #b366ff);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,229,204,0.3);
  align-items: center;
  justify-content: center;
}

.rl-sidebar-close {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 11;
  align-items: center;
  justify-content: center;
}

/* ── Back to Sacred Chemistry ── */
.rl-back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  transition: color 0.2s;
  flex-shrink: 0;
}

.rl-back-link:hover {
  color: #00e5cc;
}

/* ── Search results ── */
.rl-search-results {
  padding: 0 20px 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}

.rl-highlight {
  background: rgba(0,229,204,0.2);
  color: #fff;
  padding: 1px 2px;
  border-radius: 2px;
}

/* ── Loading ── */
.rl-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
}

.rl-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #00e5cc;
  border-radius: 50%;
  animation: rl-spin 0.8s linear infinite;
}

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

.rl-loading-text {
  color: rgba(255,255,255,0.4);
  font-size: 14px;
}

/* ── Table of contents (in-article) ── */
.rl-toc {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 32px;
}

.rl-toc-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 12px;
  font-weight: 600;
}

.rl-toc a {
  display: block;
  padding: 4px 0;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}

.rl-toc a:hover {
  color: #00e5cc;
}

.rl-toc a.rl-toc-h3 {
  padding-left: 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .rl-article {
    padding: 32px 32px 60px;
  }
}

@media (max-width: 768px) {
  .rl-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

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

  .rl-menu-toggle {
    display: flex;
  }

  .rl-sidebar-close {
    display: flex;
  }

  .rl-article {
    padding: 24px 20px 80px;
  }

  .rl-article-title {
    font-size: 24px;
  }

  .rl-body h2 {
    font-size: 19px;
  }

  .rl-welcome h2 {
    font-size: 22px;
  }

  .rl-welcome-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .rl-article {
    padding: 20px 16px 80px;
  }

  .rl-welcome-grid {
    grid-template-columns: 1fr;
  }
}
