/* --- Synaptic Deep Design System --- */

:root {
  --primary-color: #0ea5e9;
  --secondary-color: #38bdf8;
  --accent-color: #2dd4bf;
  --background-color: #ffffff;
  --surface-color: #f8fafc;
  --border-color: #e2e8f0;
  --text-color: #0f172a;
  --text-muted: #475569;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  --primary-color: #38bdf8;
  --background-color: #020617;
  --surface-color: #0a0f1e;
  --border-color: #1e293b;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --glass-bg: rgba(2, 6, 23, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
}

/* --- Base & Typography --- */

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

h1, h2, h3, h4 {
  color: var(--text-color);
  font-weight: 800;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.2;
  text-wrap: balance;
}

h1 { font-size: 3rem; letter-spacing: -0.04em; }
h2 { font-size: 1.85rem; letter-spacing: -0.02em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.75rem; }

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover { opacity: 0.8; }

/* --- Layout Components --- */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
}

.mesh-gradient {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  background: radial-gradient(at 0% 0%, #0ea5e911 0px, transparent 50%), 
              radial-gradient(at 100% 100%, #2dd4bf11 0px, transparent 50%);
  opacity: 0.6;
  pointer-events: none;
}

.layout-root {
  display: flex;
  min-height: 100vh;
}

.layout-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100vh;
  overflow: auto;
}

.layout-content {
  padding: 3rem 2rem;
  flex: 1;
  display: flex;
  justify-content: center;
}

.content-inner {
  width: 100%;
  max-width: 840px;
  animation: enter-stagger 0.6s ease-out both;
}

/* --- Header & Sidebar --- */

.docs-header {
  height: 72px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--glass-border);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background-color: var(--primary-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: white;
  border-radius: 99px;
  animation: synaptic-pulse 2s infinite;
}

.logo-container h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--text-color);
  border: none;
  padding: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.github-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color);
}

.github-btn:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.github-btn:hover img {
  filter: brightness(0) invert(1);
}

.menu-btn {
  display: none;
  background-color: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  margin-right: 0.5rem;
}

.hamburger {
  display: block;
  width: 18px;
  height: 2px;
  background-color: var(--text-color);
  position: relative;
}

.hamburger::before, .hamburger::after {
  content: '';
  display: block;
  width: 18px;
  height: 2px;
  background-color: var(--text-color);
  position: absolute;
  left: 0;
}

.hamburger::before { top: -5px; }
.hamburger::after { top: 5px; }

@media (max-width: 1024px) {
  .menu-btn { display: block; }
}

/* --- Layout & Version Switcher --- */

.sidebar-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 90;
  display: none;
}

@media (max-width: 768px) {
  .sidebar-open .sidebar-overlay { display: block; }
}

.version-switcher {
  position: relative;
  display: flex;
  align-items: center;
}

.active-version {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--primary-color);
  transition: all 0.2s ease;
}

.active-version:hover {
  background-color: var(--background-color);
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
}

.active-version .chevron {
  font-size: 0.6rem;
  opacity: 0.7;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.75rem;
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.5rem 0;
  min-width: 200px;
  list-style: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.version-switcher:hover .dropdown-menu {
  display: block;
}

.dropdown-menu li a {
  display: block;
  padding: 1rem;
  text-decoration: none;
  transition: background-color 0.15s ease;
  border-radius: 8px;
  margin: 0.25rem 0.5rem;
  color: var(--text-color);
}

.dropdown-menu li a:hover {
  background-color: var(--surface-color);
}

.version-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.version-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.version-number {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-color);
}

.current-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 4px;
  width: fit-content;
  margin-top: 0.5rem;
}

.dropdown-menu li a.active .version-label {
  color: var(--primary-color);
}

/* --- Components: Callout --- */

.callout {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border-radius: 8px;
  background-color: var(--surface-color);
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.callout-icon {
  font-size: 1.25rem;
}

.callout-title {
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.callout-content p {
  margin: 0;
  color: color-mix(in srgb, var(--text-color) 80%, transparent);
  line-height: 1.6;
}

.callout-info .callout-title { color: #38bdf8; }
.callout-tip .callout-title { color: #10b981; }
.callout-warning .callout-title { color: #f59e0b; }
.callout-danger .callout-title { color: #ef4444; }

/* --- Components: Code Block --- */

.code-block-container {
  margin: 1.5rem 0;
  border-radius: 12px;
  overflow: hidden;
  background-color: #1e293b;
  border: 1px solid var(--border-color);
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: rgba(2, 6, 23, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.code-block-lang {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.copy-btn {
  background-color: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.copy-btn:hover {
  color: var(--text-color);
}

.code-block-container pre {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  background-color: transparent !important;
  box-shadow: none;
  border: none;
}

.code-block-container code {
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
}

/* --- Components: Counter --- */

.counter {
  display: flex;
  padding: 10px 0;
  border-top: 2px solid var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  align-items: center;
}

.counter button {
  display: flex;
  width: 2em;
  height: 2em;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  background-color: transparent;
}

.counter button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.counter span {
  min-width: 2.5em;
  padding: 0 2rem;
  box-sizing: border-box;
  color: var(--primary-color);
  text-align: center;
  font-size: 4rem;
}

/* --- Pages: About / Support --- */

.support-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 3rem;
}

.support-card {
  padding: 1.5rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.support-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.support-card .card-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 1rem;
}

.support-card h3 {
  font-size: 1.125rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.support-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .support-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Landing Page & Hero --- */

.landing-page {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

.mesh-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 10%, var(--primary-color) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, var(--accent-color) 0%, transparent 40%);
  opacity: 0.05;
  filter: blur(80px);
}

.hero {
  padding: 8rem 2rem 4rem;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  animation: fade-up 0.8s ease-out;
}

.badge-neural {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary-color) 20%, transparent);
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0.05em;
}

.pulse-ring {
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
  border-radius: 50%;
  position: relative;
}

.pulse-ring::after {
  content: '';
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border: 1px solid var(--primary-color);
  border-radius: 50%;
  animation: synaptic-pulse 2s infinite;
}

.badge-version {
  padding: 0.4rem 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hero h1 {
  font-size: clamp(3rem, 8vw, 4.5rem);
  margin-top: 0;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  animation: fade-up 0.8s ease-out 0.1s both;
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-lead {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 3rem;
  animation: fade-up 0.8s ease-out 0.2s both;
}

.hero-btns {
  display: flex;
  gap: 1.5rem;
  animation: fade-up 0.8s ease-out 0.3s both;
}

.btn-elite {
  padding: 1rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 10px 20px rgba(14, 165, 233, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(14, 165, 233, 0.3);
  opacity: 1;
}

.btn-secondary {
  background-color: var(--surface-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--background-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  opacity: 1;
}

/* --- Features Bento --- */

.features-bento {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.custom-card.clickable {
  cursor: pointer;
}

.card-glint {
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.custom-card:hover .card-glint {
  opacity: 1;
}

/* --- Search Modal --- */

.search-trigger kbd {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-family: inherit;
  color: var(--text-muted);
}

.search-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  padding-top: 10vh;
}

.search-modal {
  background-color: var(--surface-color);
  width: 100%;
  max-width: 600px;
  max-height: 70vh;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  animation: fade-up 0.3s ease-out;
}

.search-input-container {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-color);
  outline: none;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.search-item {
  display: block;
  padding: 1rem;
  border-radius: 12px;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.search-item:hover, .search-item.active {
  background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
  opacity: 1;
}

.item-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.item-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.no-results {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* --- Animations --- */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Tools List --- */

.tools-container {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  min-height: 400px;
  transition: opacity 0.3s ease;
}

.tool-category h2 {
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
  border-bottom: none;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s ease;
}

.tool-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.tool-header {
  margin-bottom: 1rem;
}

.tool-header code {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1rem;
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.tool-params {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.param-badge {
  background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
  color: var(--primary-color);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-weight: 500;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sidebar {
  width: 280px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: auto;
  padding: 2rem 1.25rem;
  border-right: 1px solid var(--glass-border);
  z-index: 900;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
  }
  .sidebar-toggle-input:checked ~ .sidebar {
    transform: translateX(0);
  }
}

.nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.nav-link:hover {
  background-color: var(--surface-color);
  color: var(--primary-color);
}

.nav-link.active {
  background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
  color: var(--primary-color);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

/* --- Cards & Bento --- */

.custom-card {
  position: relative;
  padding: 2rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
}

.custom-card:hover {
  background-color: var(--background-color);
  border-color: color-mix(in srgb, var(--primary-color) 30%, transparent);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(-4px);
}

.card-icon {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

/* --- Code & Technical --- */

pre {
  background-color: #0a0f1e !important;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #1e293b;
  margin: 2rem 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  overflow: auto;
}

p code, li code {
  background-color: var(--surface-color);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: #e11d48;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

/* --- Search --- */

.search-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  min-width: 260px;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.search-trigger:hover {
  border-color: var(--primary-color);
  background-color: var(--background-color);
}

/* --- Animations --- */

@keyframes synaptic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(14, 165, 233, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

@keyframes enter-stagger {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
