/* ============================================
   NEXUS MARKET BLOG - Main Stylesheet
   Light theme, scarlet accent, Tor-safe (no-JS fallback)
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --bg-sidebar: #F5F5F5;
  --text: #1A1A1A;
  --text-muted: #555555;
  --text-light: #777777;
  --scarlet: #DC143C;
  --scarlet-dark: #B01030;
  --scarlet-light: #FFE8EC;
  --border: #E0E0E0;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 6px 24px rgba(220,20,60,0.12);
  --radius: 10px;
  --sidebar-width: 260px;
  --header-height: 64px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Rajdhani', 'Inter', sans-serif;
  --max-content: 860px;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #111111;
  --bg-card: #1A1A1A;
  --bg-sidebar: #161616;
  --text: #E8E8E8;
  --text-muted: #AAAAAA;
  --text-light: #888888;
  --scarlet: #FF1744;
  --scarlet-dark: #DC143C;
  --scarlet-light: #2A1520;
  --border: #333333;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-hover: 0 6px 24px rgba(255,23,68,0.15);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--scarlet); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--scarlet-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.logo svg { width: 32px; height: 32px; }
.logo span { color: var(--scarlet); }

.header-nav { display: flex; align-items: center; gap: 24px; }
.header-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.header-nav a:hover { color: var(--scarlet); text-decoration: none; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--scarlet); color: var(--scarlet); }

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* --- Layout --- */
.site-layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-section { padding: 0 20px; margin-bottom: 28px; }
.sidebar-title {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--scarlet-light);
  color: var(--scarlet);
  text-decoration: none;
}
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.sidebar-nav a:hover svg,
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 3px 3px 3px 0;
  transition: all 0.15s;
}
.sidebar-tag:hover {
  border-color: var(--scarlet);
  color: var(--scarlet);
  text-decoration: none;
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px 40px 60px;
  max-width: calc(var(--max-content) + var(--sidebar-width) + 80px);
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 24px;
}
.breadcrumbs a { color: var(--text-light); }
.breadcrumbs a:hover { color: var(--scarlet); }
.breadcrumbs .sep { opacity: 0.5; }

/* --- Hero --- */
.hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.hero h1 {
  font-family: var(--font-heading);
  font-size: 42px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 16px;
}
.hero h1 span { color: var(--scarlet); }
.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 640px;
  line-height: 1.7;
}

/* --- Cards Grid --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--scarlet);
  transform: translateY(-2px);
}

.card-icon {
  width: 44px;
  height: 44px;
  background: var(--scarlet-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.card-icon svg { width: 22px; height: 22px; color: var(--scarlet); }

.card h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
}
.card .card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-light);
}

/* --- Article Styles --- */
.article-header { margin-bottom: 32px; }
.article-header h1 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-light);
}
.article-meta .tag {
  background: var(--scarlet-light);
  color: var(--scarlet);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.article-body { max-width: var(--max-content); }
.article-body h2 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 600;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--scarlet-light);
  color: var(--text);
}
.article-body h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--text);
}
.article-body p {
  margin-bottom: 16px;
  color: var(--text);
}
.article-body ul, .article-body ol {
  margin: 16px 0;
  padding-left: 24px;
}
.article-body li { margin-bottom: 8px; }

/* Info blocks */
.info-block {
  background: var(--scarlet-light);
  border-left: 4px solid var(--scarlet);
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
}
.info-block p { margin: 0; font-size: 15px; }
.info-block strong { color: var(--scarlet); }

.warning-block {
  background: #FFF8E1;
  border-left: 4px solid #FFA000;
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
}
[data-theme="dark"] .warning-block { background: #2A2210; }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--bg-sidebar);
  font-weight: 600;
  color: var(--text);
}
.data-table tr:hover td { background: var(--scarlet-light); }

/* FAQ Accordion (CSS-only, works without JS) */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  background: var(--bg-card);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 20px;
  color: var(--scarlet);
  font-weight: 300;
}
.faq-item[open] summary::after { content: '\2212'; }
.faq-item .faq-answer {
  padding: 0 20px 16px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* --- CTA Button --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--scarlet);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn:hover {
  background: var(--scarlet-dark);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--scarlet);
  color: var(--scarlet);
}
.btn-outline:hover {
  background: var(--scarlet);
  color: #fff;
}

/* --- Footer --- */
.site-footer {
  margin-left: var(--sidebar-width);
  border-top: 1px solid var(--border);
  padding: 32px 40px;
  background: var(--bg-sidebar);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 13px; color: var(--text-light); }
.footer-copy { font-size: 13px; color: var(--text-light); }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }
  .header-nav { display: none; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 24px 20px 40px; }
  .site-footer { margin-left: 0; }
  .hero h1 { font-size: 32px; }
  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
}

/* --- Print --- */
@media print {
  .sidebar, .site-header, .site-footer, .theme-toggle { display: none; }
  .main-content { margin-left: 0; }
}
