* { box-sizing: border-box; }
:root {
  --bg: #0f172a;
  --surface: #111827;
  --surface-2: #0b1022;
  --text: #e5e7eb;
  --text-weak: #94a3b8;
  --primary: #3b82f6;
  --shadow-light: rgba(255,255,255,0.06);
  --shadow-dark: rgba(0,0,0,0.65);
  --elev: 12px;
}
.theme-light {
  --bg: #e9eef8;
  --surface: #f3f6fd;
  --surface-2: #eef3fe;
  --text: #1f2937;
  --text-weak: #6b7280;
  --primary: #2563eb;
  --shadow-light: rgba(255,255,255,0.9);
  --shadow-dark: rgba(0,0,0,0.18);
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  scroll-behavior: smooth;
}
/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin: 18px auto 12px auto;
  width: min(1200px, 94vw);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
}
.navbar .brand {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.navbar .logo {
  font-weight: 700;
  letter-spacing: 0.4px;
}
.navbar .slogan {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-weak);
}
.navbar .links a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: transparent;
}
.navbar .links a:hover, .navbar .links a:focus {
  background: rgba(255,255,255,0.06);
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
  transition: transform 160ms ease, filter 160ms ease, background-color 160ms ease;
}
.theme-toggle:focus, .theme-toggle:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  background-color: rgba(255,255,255,0.06);
}

/* Responsive layout: stack on small screens */
@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    grid-template-areas:
      'nav'
      'main'
      'sidebar';
    justify-items: center;
  }
  .navbar {
    margin: 12px 12px 16px 12px;
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html, body { scroll-behavior: auto; }
}

/* Widgets */
.tradingview-widget-container {
  width: min(1200px, 94vw);
  margin: 0 auto 12px auto;
}
.heatmap-wrap {
  width: 100%;
  height: min(2000px, 70vh);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;

  background: var(--surface);
}
.heatmap-wrap .tradingview-widget-container { height: 100%; width: 100%; }
.heatmap-wrap .tradingview-widget-container__widget { height: 100%; }

.sidebar.max { max-width: 360px; }

/* Components and layout (unified) */
.links {
  display: flex;
  gap: 8px;
  align-items: center;
}
.links a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  transition: background-color 160ms ease, transform 160ms ease;
}
.links a:hover, .links a:focus { background: rgba(255,255,255,0.06); transform: translateY(-1px); }

.hero {
  width: min(1200px, 94vw);
  margin: 24px auto 12px auto;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: none;
}
.hero h1 { margin: 0 0 8px 0; font-size: 1.8rem; }
.hero p { margin: 8px 0 14px 0; }
.actions { display: inline-flex; gap: 10px; }
.cta {
  display: inline-block;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
}
.cta.outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.18);
}

.section { width: min(1200px, 94vw); margin: 22px auto; }
.section h2 { margin: 0 0 10px 0; font-size: 1.2rem; color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px 14px;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}
.grid a.card { color: inherit; text-decoration: none; display: block; }
.card:hover, .card:focus-within { transform: translateY(-2px); background: var(--surface-2); border-color: rgba(255,255,255,0.12); }
.card h3 { margin: 0 0 6px 0; font-size: 1rem; }
.small { font-size: 0.95rem; color: var(--text-weak); }

/* Article layout (migrated from template) */
.article-page { display: grid; grid-template-columns: min(760px, 100%) min(360px, 100%); gap: 24px; width: min(1200px, 94vw); margin: 0 auto 40px auto; }
.article {
  background: var(--surface);
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
}
.article-header { margin-bottom: 16px; }
.article-title { margin: 0 0 8px 0; font-size: 2rem; letter-spacing: 0.2px; }
.article-meta { color: var(--text-weak); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.article-tags { list-style: none; padding: 0; margin: 10px 0 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.article-tags a { text-decoration: none; color: var(--text); background: var(--surface-2); padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(0,0,0,0.06); }
.article-content p { color: var(--text-weak); line-height: 1.7; }
.article-content h2 { margin-top: 22px; margin-bottom: 8px; }
.article-content h3 { margin-top: 18px; margin-bottom: 6px; color: var(--text); }
.article-content blockquote { margin: 14px 0; padding: 10px 14px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 8px; }
.article-content pre { background: #0b1220; color: #e5e7eb; padding: 14px; border-radius: 10px; overflow: auto; border: 1px solid rgba(0,0,0,0.2); }
.article-footer { margin-top: 22px; }
.article-nav { display: flex; justify-content: space-between; gap: 12px; }
.article-nav a { color: var(--text); text-decoration: none; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.06); }
.article-nav a:hover { filter: brightness(1.05); }

.sidebar { background: var(--surface-2); border: 1px solid rgba(0,0,0,0.04); border-radius: 12px; padding: 18px 16px; box-shadow: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light); height: fit-content; }
.sidebar h2 { margin: 0 0 8px 0; font-size: 1.1rem; }
.toc, .categories { margin: 8px 0 16px 18px; }
.toc a, .categories a { color: var(--text); text-decoration: none; }
.toc a:hover, .categories a:hover { text-decoration: underline; }

/* Footer */
.site-footer { width: min(1200px, 94vw); margin: 24px auto 32px auto; color: var(--text-weak); text-align: center; }

/* Responsive additions */
@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .navbar { flex-direction: column; align-items: stretch; gap: 10px; }
}

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