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

:root {
  --bg-primary: #111827;
  --bg-secondary: #1a2235;
  --bg-sidebar: #151d2e;
  --bg-hover: #1e2a3f;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --border: #1e293b;
  --border-light: #2d3a4f;
  --sidebar-width: 280px;
  --toc-width: 240px;
  --header-height: 56px;
  --content-max: 780px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
}
.menu-toggle:hover { background: var(--bg-hover); }

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
}
.logo-link:hover { text-decoration: none; }

.logo-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.logo-icon { flex-shrink: 0; }
.logo-img { height: 32px; width: auto; display: block; }

.search-container {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  min-width: 200px;
}
.search-container:hover { border-color: var(--text-muted); }
.search-icon { flex-shrink: 0; opacity: 0.5; }
.search-text { flex: 1; }
.search-shortcut { display: flex; gap: 4px; }
.search-shortcut kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-muted);
}

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

.sidebar-header {
  padding: 20px 20px 12px;
  display: none;
}

.sidebar-nav {
  padding: 12px 0;
}

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

.nav-section-title {
  padding: 6px 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-top: 16px;
}

.nav-section:first-child .nav-section-title { margin-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  padding: 6px 20px 6px 24px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  color: var(--accent-light);
  background: transparent;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item-sub {
  padding-left: 40px;
  font-size: 13.5px;
}

.nav-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  margin-left: auto;
  display: flex;
  align-items: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.nav-toggle svg {
  width: 16px;
  height: 16px;
}
.nav-toggle.open { transform: rotate(90deg); }

.nav-children {
  display: none;
  overflow: hidden;
}
.nav-children.open { display: block; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 85;
}

/* Main Content */
.content {
  margin-left: var(--sidebar-width);
  margin-right: var(--toc-width);
  padding: calc(var(--header-height) + 32px) 48px 80px;
  min-height: 100vh;
  max-width: calc(100% - var(--sidebar-width) - var(--toc-width));
}

.content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-light);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--accent-light); }
.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 10px;
}

/* Typography */
.page-title {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 16px;
  padding-bottom: 4px;
  letter-spacing: -0.01em;
}

.content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.content p {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.content strong { font-weight: 600; }

.content ul, .content ol {
  padding-left: 24px;
  margin-bottom: 16px;
}
.content li {
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* Content images */
.content-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
  display: block;
}

/* Anchor links for headings */
.heading-anchor {
  color: var(--text-muted);
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 0.85em;
}
h2:hover .heading-anchor,
h3:hover .heading-anchor { opacity: 1; }

/* Hero text (used on about page) */
.hero-text {
  font-size: 1.35rem;
  line-height: 1.65;
  color: var(--text-primary);
  margin-bottom: 24px;
}

/* Links list (for key docs page) */
.doc-links {
  list-style: none;
  padding: 0;
}
.doc-link {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 8px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  font-size: 15px;
}
.doc-link:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  text-decoration: none;
}
.doc-link-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 18px;
}

/* Embedded doc container */
.embed-container {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  margin: 20px 0;
  background: #fff;
}
.embed-container iframe {
  width: 100%;
  height: 600px;
  border: none;
}

/* Token Allocation Chart */
.chart-container {
  background: #0a0e17;
  border-radius: 12px;
  padding: 32px;
  margin: 24px 0;
  text-align: center;
}
.chart-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
}

/* Token table */
.token-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
}
.token-table th,
.token-table td {
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  text-align: left;
}
.token-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}
.token-table td { color: var(--text-secondary); }
.token-table tr:last-child td { font-weight: 600; color: var(--text-primary); }

/* Phase sections */
.phase-note {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin: 16px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Social links */
.social-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: var(--accent-light);
  font-size: 16px;
}
.social-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Prev/Next navigation */
.page-nav {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-nav-link {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  flex: 1;
  transition: background 0.15s, border-color 0.15s;
  min-width: 0;
}
.page-nav-link:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  text-decoration: none;
}
.page-nav-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.page-nav-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-nav-link.next { text-align: right; margin-left: auto; }

.page-updated {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Table of Contents sidebar */
.toc-sidebar {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: var(--toc-width);
  padding: 32px 20px;
  overflow-y: auto;
  font-size: 13px;
}

.toc-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.toc-link {
  display: block;
  padding: 4px 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  transition: color 0.15s;
}
.toc-link:hover { color: var(--text-primary); text-decoration: none; }
.toc-link.active { color: var(--accent-light); }
.toc-link-sub { padding-left: 12px; }

/* Contract address */
.contract-address {
  font-family: 'Courier New', monospace;
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  word-break: break-all;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* Roadmap phases */
.roadmap-phase {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.roadmap-phase:last-child { border-bottom: none; }
.roadmap-phase strong {
  color: var(--accent-light);
}

/* Responsive */
@media (max-width: 1200px) {
  .toc-sidebar { display: none; }
  .content { margin-right: 0; max-width: calc(100% - var(--sidebar-width)); }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .top-bar .logo-link { display: none; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-header { display: block; }
  .sidebar-overlay.open { display: block; }
  .content {
    margin-left: 0;
    max-width: 100%;
    padding: calc(var(--header-height) + 24px) 20px 80px;
  }
  .search-container { min-width: auto; }
  .search-text { display: none; }
  .search-shortcut { display: none; }
  .page-nav { flex-direction: column; }
}

/* Pie chart via CSS conic gradient */
.pie-chart {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  margin: 0 auto 24px;
  background: conic-gradient(
    #60a5fa 0deg 126deg,
    #3b82f6 126deg 162deg,
    #818cf8 162deg 198deg,
    #1e3a5f 198deg 338.4deg,
    #2563eb 338.4deg 345.6deg,
    #1e40af 345.6deg 360deg
  );
  box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
  position: relative;
}

.pie-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  margin-top: 16px;
}
.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.pie-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
