/* ==============================================================================
   TORWIKI PORTAL — MASTER DESIGN SYSTEM (2026 EDITION)
   High-Authority Darknet Directory & Hidden Wiki Reference Architecture
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=IBM+Plex+Serif:wght@500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg-primary: #0E0E12;
  --bg-surface: #15151B;
  --bg-elevated: #1B1B24;
  --bg-card: #15151C;
  --bg-card-hover: #1E1E28;
  --bg-inset: #0A0A0D;
  
  --text-primary: #EAE8E4;
  --text-secondary: #9E9D99;
  --text-tertiary: #6E6D69;
  --text-inverse: #0E0E12;
  
  --accent-primary: #7C3AED;
  --accent-hover: #9333EA;
  --accent-muted: rgba(124, 58, 237, 0.14);
  --accent-subtle: rgba(124, 58, 237, 0.06);
  --accent-glow: rgba(124, 58, 237, 0.25);
  
  --color-green: #10B981;
  --color-green-glow: rgba(16, 185, 129, 0.2);
  --color-orange: #F59E0B;
  --color-red: #EF4444;
  --color-blue: #3B82F6;
  
  --cat-market: #7C3AED;
  --cat-guide: #0D9488;
  --cat-learn: #6366F1;
  --cat-service: #EC4899;
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-default: rgba(255, 255, 255, 0.12);
  --border-hover: rgba(124, 58, 237, 0.4);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
  
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, serif;
  --font-mono: 'Space Mono', monospace;
  
  --container-max: 1160px;
  --container-narrow: 840px;
  --header-height: 64px;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse 900px 500px at 50% 0%, rgba(124, 58, 237, 0.08) 0%, transparent 70%),
    linear-gradient(to bottom, #0E0E12 0%, #0A0A0D 100%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  padding-top: var(--header-height);
  overflow-x: hidden;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style: none;
}

/* ==============================================================================
   LAYOUT CONTAINERS
   ============================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 20px;
}

/* ==============================================================================
   STICKY SITE HEADER
   ============================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: rgba(14, 14, 18, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.nav-brand-logo {
  height: 32px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.footer-brand-logo {
  height: 36px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  margin-bottom: 12px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: var(--accent-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}

.brand-logo:hover {
  color: #FFFFFF;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: #FFFFFF;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--color-green-glow);
  color: var(--color-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-green);
  box-shadow: 0 0 6px var(--color-green);
}

/* ==============================================================================
   HERO / BANNER SECTION
   ============================================================================== */
.hero-section {
  padding: 45px 0 35px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.04) 0%, transparent 100%);
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--accent-primary);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  display: block;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.25;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.hero-desc {
  font-size: 15.5px;
  color: var(--text-secondary);
  max-width: 820px;
  line-height: 1.65;
  margin-bottom: 22px;
}

.hero-meta-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-tertiary);
}

.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==============================================================================
   CATEGORIES PILLS & TAB NAVIGATION
   ============================================================================== */
.category-nav {
  display: flex;
  gap: 12px;
  margin: 30px 0 24px;
  flex-wrap: wrap;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.category-pill:hover, .category-pill.active {
  background: var(--accent-muted);
  border-color: var(--accent-primary);
  color: #FFFFFF;
}

/* ==============================================================================
   MARKETS DIRECTORY GRID & CARDS
   ============================================================================== */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin: 25px 0 45px;
}

.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.market-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

.market-card-banner {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.market-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.market-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.market-card-logo {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  object-fit: contain;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 2px;
}

.market-hero-banner {
  width: 100%;
  max-height: 220px;
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0 25px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.market-hero-banner img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.article-figure {
  margin: 28px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-surface);
}

.article-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.article-figure figcaption {
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
}

.market-card-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: #FFFFFF;
}

.market-card-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.badge-active {
  background: var(--color-green-glow);
  color: var(--color-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-multisig {
  background: var(--accent-muted);
  color: var(--accent-primary);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.badge-xmr {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-orange);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.market-card-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 16px;
  flex: 1;
}

.market-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  font-size: 12.5px;
}

.metric-label {
  color: var(--text-tertiary);
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-val {
  color: #FFFFFF;
  font-weight: 600;
}

.market-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-card-action {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 4px;
  background: var(--accent-primary);
  color: #FFFFFF !important;
  transition: background 0.15s ease;
}

.btn-card-action:hover {
  background: var(--accent-hover);
}

.btn-card-secondary {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.btn-card-secondary:hover {
  color: #FFFFFF;
}

/* ==============================================================================
   DATA TABLES (MARKET COMPARISONS & REVIEWS)
   ============================================================================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  margin: 25px 0 35px;
  box-shadow: var(--shadow-sm);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

table.data-table th, table.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

table.data-table th {
  background: var(--bg-elevated);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
}

table.data-table td {
  color: var(--text-primary);
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ==============================================================================
   PROSE & ARTICLE TYPOGRAPHY
   ============================================================================== */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 40px;
  margin: 35px 0 60px;
}

.prose {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.75;
}

.prose h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.25;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

.prose h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: #FFFFFF;
  margin: 36px 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: #FFFFFF;
  margin: 24px 0 10px;
}

.prose p {
  margin-bottom: 16px;
  color: #CBC9C5;
}

.prose ul, .prose ol {
  margin: 14px 0 20px 24px;
  color: #CBC9C5;
}

.prose li {
  margin-bottom: 8px;
}

.prose strong {
  color: #FFFFFF;
  font-weight: 600;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 3px;
  color: #E2E8F0;
  border: 1px solid var(--border-subtle);
}

.prose pre {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #E2E8F0;
  line-height: 1.5;
  margin: 20px 0;
}

/* Callout Box */
.callout-box {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 6px 6px 0;
  padding: 18px 22px;
  margin: 25px 0;
}

.callout-box.warning {
  border-left-color: var(--color-orange);
}

.callout-title {
  font-weight: 700;
  color: #FFFFFF;
  font-size: 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0 !important;
}

/* Onions List / Quick Copy */
.onion-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 16px;
  margin: 20px 0;
}

.onion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
}

.onion-row:last-child {
  border-bottom: none;
}

.onion-addr {
  word-break: break-all;
  color: #FFFFFF;
}

.btn-copy {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-copy:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #FFFFFF;
}

/* ==============================================================================
   SIDEBAR & TOC
   ============================================================================== */
.sidebar-sticky {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 18px;
}

.sidebar-widget-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.sidebar-link {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.sidebar-link:hover {
  color: var(--accent-primary);
}

/* ==============================================================================
   FOOTER
   ============================================================================== */
.site-footer {
  background: #09090C;
  border-top: 1px solid var(--border-subtle);
  padding: 50px 0 30px;
  margin-top: 60px;
  font-size: 13px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 35px;
  margin-bottom: 40px;
}

.footer-brand p {
  color: var(--text-tertiary);
  margin-top: 12px;
  line-height: 1.6;
  max-width: 320px;
}

.footer-col-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #FFFFFF;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.footer-links-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.footer-links-list a {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.footer-links-list a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 25px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 15px;
}

/* ==============================================================================
   RESPONSIVE DESIGN
   ============================================================================== */
@media (max-width: 992px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-sticky {
    position: static;
  }
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .market-grid {
    grid-template-columns: 1fr;
  }
  .hero-title {
    font-size: 26px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
