/* ── BMC Theory — Design System ── */

:root {
  --bg-root: #0a0a0f;
  --bg-header: #111118;
  --bg-card: #0d0d15;
  --bg-input: #1a1a25;

  --text-primary: #e0e0e0;
  --text-secondary: #888;
  --text-tertiary: #555;

  --accent-cyan: #6af;
  --accent-green: #4f8;
  --accent-orange: #f80;
  --accent-gold: #ffd700;

  --border-dark: #222;
  --border-mid: #333;
  --border-light: #444;

  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --max-width: 1200px;
  --content-width: 820px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

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

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #8cf;
}

img {
  max-width: 100%;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-dark);
  padding: 0 24px;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.header-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo svg {
  flex-shrink: 0;
}

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

.header-nav a {
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--text-primary);
}

.btn-demo {
  padding: 5px 16px !important;
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan) !important;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.btn-demo:hover {
  background: rgba(102, 170, 255, 0.12);
  color: #8cf !important;
}

/* ── Hamburger ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  transition: transform 0.2s, opacity 0.2s;
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── Footer ── */
.site-footer {
  background: var(--bg-header);
  border-top: 1px solid var(--border-dark);
  padding: 32px 24px;
  margin-top: 80px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--text-tertiary);
  font-size: 13px;
}

.footer-links a:hover {
  color: var(--text-secondary);
}

/* ── Hero Section ── */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
  position: relative;
  overflow: hidden;
}

.hero-animation {
  margin: 0 auto 40px;
}

.hero h1 {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero h1 span {
  color: var(--accent-cyan);
}

.hero .subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-block;
  padding: 14px 40px;
  background: linear-gradient(135deg, #2a7a2a, #3a9a3a);
  border: 2px solid #4aba4a;
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: transform 0.1s, filter 0.2s;
  text-decoration: none;
}

.btn-primary:hover {
  transform: scale(1.03);
  filter: brightness(1.1);
  color: #fff;
}

.btn-secondary {
  display: inline-block;
  padding: 14px 40px;
  background: linear-gradient(135deg, #2a4a7a, #3a5a9a);
  border: 2px solid #4a6aba;
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: transform 0.1s, filter 0.2s;
  text-decoration: none;
}

.btn-secondary:hover {
  transform: scale(1.03);
  filter: brightness(1.1);
  color: #fff;
}

/* ── Why Should I Care ── */
.why-care {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 60px;
}

.why-care h2 {
  font-size: 48px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.why-care-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.why-care-item {
  padding: 20px;
  border-left: 2px solid var(--accent-cyan);
}

.why-care-item h3 {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 8px;
}

.why-care-item p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Feature Cards ── */
.features {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  transition: border-color 0.2s;
}

.feature-card:hover {
  border-color: var(--border-mid);
}

.feature-card .icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.feature-card h3 {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 8px;
}

.feature-card h3.accent-gold { color: var(--accent-gold); }
.feature-card h3.accent-cyan { color: var(--accent-cyan); }
.feature-card h3.accent-green { color: var(--accent-green); }
.feature-card h3.accent-orange { color: var(--accent-orange); }

.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Section divider ── */
.section-divider {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 40px;
}

.section-divider.compact { padding-bottom: 20px; }
.section-divider.spaced { padding-top: 40px; padding-bottom: 60px; }

.section-divider h2 {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 8px;
}

.section-divider p {
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
}

/* ── Theory snapshot (landing) ── */
.theory-snapshot {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.snapshot-item {
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
}

.snapshot-item .label {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.snapshot-item .desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.accent-gold { color: var(--accent-gold); }
.accent-cyan { color: var(--accent-cyan); }
.accent-green { color: var(--accent-green); }
.accent-orange { color: var(--accent-orange); }

/* ── Prose (shared typography for page-content and guide-body) ── */
.prose h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}

.prose h2 {
  font-size: 24px;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.prose h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

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

.prose ul, .prose ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

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

.prose blockquote {
  border-left: 3px solid var(--accent-cyan);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--bg-card);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.prose blockquote p {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose blockquote h3 {
  margin-top: 0;
  color: var(--accent-cyan);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border-dark);
  margin: 32px 0;
}

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

.prose em {
  font-style: italic;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.prose th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  color: var(--text-primary);
  font-weight: 600;
}

.prose td {
  padding: 10px 12px;
  border: 1px solid var(--border-dark);
  color: var(--text-secondary);
}

/* ── Anchor links on headings ── */
.prose h2, .prose h3 {
  position: relative;
}

.prose h2:hover .anchor-link,
.prose h3:hover .anchor-link {
  opacity: 1;
}

.anchor-link {
  position: absolute;
  left: -1.2em;
  color: var(--text-tertiary);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s;
  font-weight: 400;
}

.anchor-link:hover {
  color: var(--accent-cyan);
}

/* ── Page content ── */
.page-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px 24px;
}

/* ── Guide layout ── */
.guide-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  gap: 40px;
}

.guide-sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 24px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}

.guide-sidebar::-webkit-scrollbar {
  width: 4px;
}

.guide-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: 2px;
}

.guide-sidebar nav {
  font-size: 13px;
}

.guide-sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.guide-sidebar nav li {
  margin-bottom: 2px;
}

.guide-sidebar nav a {
  display: block;
  padding: 4px 12px;
  color: var(--text-tertiary);
  border-left: 2px solid transparent;
  transition: all 0.2s;
  line-height: 1.4;
}

.guide-sidebar nav a:hover {
  color: var(--text-secondary);
}

.guide-sidebar nav li li {
  padding-left: 12px;
}

.guide-sidebar nav > ul > li > ul {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.guide-sidebar nav > ul > li.toc-open > ul {
  max-height: 500px;
}

.guide-sidebar nav li li a {
  font-size: 12px;
  opacity: 0.6;
}

.guide-sidebar nav li li a:hover,
.guide-sidebar nav li li a.guide-toc-active {
  opacity: 1;
}

.guide-toc-active {
  color: var(--accent-cyan) !important;
  border-left-color: var(--accent-cyan) !important;
}

.lang-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding: 0 12px;
}

.lang-switcher a {
  padding: 4px 12px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.lang-switcher a:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.lang-switcher a.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(102, 170, 255, 0.08);
}

.guide-body {
  padding: 24px 0 80px;
  min-width: 0;
}

.guide-body h2 {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border-dark);
}

/* ── Mermaid ── */
.mermaid {
  margin: 24px 0;
  text-align: center;
}

.mermaid svg {
  max-width: 100%;
}

/* ── About page ── */
.about-header {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 32px;
}

.about-photo {
  width: 160px;
  border-radius: var(--radius-md);
}

.about-info h1 {
  margin-bottom: 4px;
}

.about-info .role {
  color: var(--text-secondary);
  font-size: 15px;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.contact-list li {
  padding: 6px 0;
  font-size: 14px;
}

.contact-list li span {
  color: var(--text-tertiary);
  display: inline-block;
  width: 70px;
}

/* ── Publications ── */
.pub-item {
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 16px;
}

.pub-item h3 {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 16px;
}

.pub-item .pub-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.pub-item p {
  font-size: 14px;
  color: var(--text-secondary);
}

.pub-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.pub-status.upcoming {
  background: rgba(255, 136, 0, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(255, 136, 0, 0.3);
}

.pub-status.available {
  background: rgba(68, 255, 136, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(68, 255, 136, 0.2);
}

.pub-links {
  margin-top: 12px;
}

/* ── Back to top ── */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 40px;
  height: 40px;
  background: var(--bg-header);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ── Progress bar ── */
.reading-progress {
  position: fixed;
  top: 56px;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent-cyan);
  z-index: 99;
  transition: width 0.1s;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .header-nav {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-dark);
    flex-direction: column;
    padding: 16px 24px;
    gap: 12px;
  }

  .header-nav.open {
    display: flex;
  }

  .header-nav a {
    font-size: 16px;
    padding: 8px 0;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero .subtitle {
    font-size: 16px;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }

  .why-care-grid {
    grid-template-columns: 1fr;
  }

  .features {
    grid-template-columns: 1fr;
  }

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

  .guide-layout {
    grid-template-columns: 1fr;
  }

  .guide-sidebar {
    position: static;
    height: auto;
    border-bottom: 1px solid var(--border-dark);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  .about-header {
    flex-direction: column;
  }

  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .back-to-top {
    bottom: 16px;
    right: 16px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0;
  }

  .header-logo {
    font-size: 15px;
  }

  .snapshot-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}
