/* ============================================
   APHIDS Documentation - Custom Theme
   ============================================ */

/* -- Root variables -- */
:root {
  --aphids-purple: #8b5cf6;
  --aphids-purple-dark: #6d28d9;
  --aphids-cyan: #06b6d4;
  --aphids-green: #10b981;
  --aphids-red: #ef4444;
  --aphids-amber: #f59e0b;
  --aphids-pink: #ec4899;
  --aphids-glow: 0 0 20px rgba(139, 92, 246, 0.3);
  --aphids-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.3);
}

/* -- Dark mode slate overrides -- */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0f0e17;
  --md-default-bg-color--light: #1a1a2e;
  --md-default-bg-color--lighter: #16213e;
  --md-primary-fg-color: #8b5cf6;
  --md-accent-fg-color: #06b6d4;
  --md-typeset-a-color: #a78bfa;
  --md-code-bg-color: #1e1e2e;
  --md-code-fg-color: #cdd6f4;
}

/* -- Hero section on index -- */
.aphids-hero {
  text-align: center;
  padding: 2rem 1rem 3rem;
  margin: -0.8rem -0.8rem 2rem;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  border-radius: 0 0 1.5rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.aphids-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
  animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-5%, 5%); }
}

.aphids-hero h1,
.aphids-hero .aphids-hero-title {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #a78bfa, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  position: relative;
  letter-spacing: -0.02em;
}

.aphids-hero-title .mdi {
  -webkit-text-fill-color: #a78bfa;
  font-size: 3rem;
}

.aphids-hero .hero-subtitle {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.6);
  max-width: 700px;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
  position: relative;
}

.aphids-hero .hero-badges {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  margin-bottom: 1.5rem;
}

.aphids-hero .hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid;
}

.hero-badge--purple {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4) !important;
  color: #c4b5fd;
}

.hero-badge--cyan {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4) !important;
  color: #67e8f9;
}

.hero-badge--green {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #6ee7b7;
}

.hero-badge--amber {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fcd34d;
}

.hero-badge--pink {
  background: rgba(236, 72, 153, 0.15);
  border-color: rgba(236, 72, 153, 0.4) !important;
  color: #f9a8d4;
}

.hero-badge--red {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #fca5a5;
}

/* -- Hero logo -- */
.hero-logo-container {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
}

.hero-logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 180px;
  height: 180px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, rgba(6, 182, 212, 0.15) 50%, transparent 70%);
  border-radius: 50%;
  filter: blur(25px);
  animation: logoGlowPulse 4s ease-in-out infinite alternate;
}

@keyframes logoGlowPulse {
  0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

.hero-logo {
  width: 120px;
  height: auto;
  position: relative;
  filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.4));
  animation: logoFloat 6s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* -- Hero tagline -- */
.hero-tagline {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
  position: relative;
}

/* -- Hero CTA buttons -- */
.hero-cta {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: all 0.3s ease;
  letter-spacing: 0.02em;
}

.cta-primary {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
}

.cta-primary:hover {
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.55);
  transform: translateY(-2px);
}

.cta-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85) !important;
}

.cta-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.cta-button .mdi {
  font-size: 1.1rem;
}

/* -- Highlighted feature card -- */
.feature-card--highlight {
  border-color: rgba(239, 68, 68, 0.3) !important;
  background: rgba(239, 68, 68, 0.06);
}

.feature-card--highlight:hover {
  border-color: rgba(239, 68, 68, 0.5) !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.feature-card--highlight::before {
  background: linear-gradient(90deg, var(--aphids-red), var(--aphids-amber));
}

/* -- Terminal-style install block -- */
.aphids-terminal {
  background: #1a1a2e;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem auto;
  max-width: 600px;
  font-family: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  position: relative;
  box-shadow: var(--aphids-glow);
}

.aphids-terminal::before {
  content: '$ ';
  color: var(--aphids-green);
  font-weight: 700;
}

.aphids-terminal code {
  color: #e2e8f0;
  background: none !important;
  padding: 0 !important;
  font-size: inherit;
}

.aphids-terminal .terminal-dots {
  position: absolute;
  top: 0.6rem;
  left: 0.75rem;
  display: flex;
  gap: 0.35rem;
}

.aphids-terminal .terminal-dots span {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
}

.aphids-terminal .terminal-dots span:nth-child(1) { background: #ef4444; }
.aphids-terminal .terminal-dots span:nth-child(2) { background: #f59e0b; }
.aphids-terminal .terminal-dots span:nth-child(3) { background: #10b981; }

/* -- Feature cards grid -- */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.feature-card {
  background: rgba(30, 30, 46, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: var(--aphids-glow);
  transform: translateY(-2px);
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--aphids-purple), var(--aphids-cyan));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-card .card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  display: block;
}

.feature-card .card-icon .mdi {
  font-size: 2rem;
  color: var(--aphids-purple);
}

.feature-card a {
  color: var(--aphids-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.feature-card a:hover {
  color: #67e8f9;
}

.feature-card code {
  font-size: 0.75rem;
  background: rgba(139, 92, 246, 0.1) !important;
  border: 1px solid rgba(139, 92, 246, 0.2) !important;
  color: #c4b5fd !important;
  padding: 0.15em 0.4em !important;
  border-radius: 0.25rem;
  display: inline-block;
  margin: 0.3rem 0;
}

.hero-badge .mdi {
  font-size: 0.9rem;
  vertical-align: middle;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: #e2e8f0;
}

.feature-card p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  line-height: 1.6;
}

/* -- Mode cards (wider) -- */
.mode-card {
  background: rgba(30, 30, 46, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.mode-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: var(--aphids-glow-cyan);
}

.mode-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.mode-card .mode-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

/* -- Stats bar -- */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  padding: 1.5rem 0;
  margin: 1rem 0;
  border-top: 1px solid rgba(139, 92, 246, 0.15);
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

.stat-item {
  text-align: center;
}

.stat-item .stat-value {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #a78bfa, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  line-height: 1.2;
}

.stat-item .stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* -- Glowing code blocks -- */
[data-md-color-scheme="slate"] .md-typeset pre {
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: 0.5rem;
}

[data-md-color-scheme="slate"] .md-typeset pre:hover {
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.08);
}

/* -- Admonition overrides -- */
[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Custom admonition: terminal */
:root {
  --md-admonition-icon--terminal: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 14H4V8h16m-7 4h5v2h-5m-1.3-.5l-1.4 1.4L7.5 12l2.8-2.9 1.4 1.4L10.3 12"/></svg>');
}

.md-typeset .admonition.terminal,
.md-typeset details.terminal {
  border-color: rgba(16, 185, 129, 0.4);
}

.md-typeset .terminal > .admonition-title,
.md-typeset .terminal > summary {
  background-color: rgba(16, 185, 129, 0.1);
}

.md-typeset .terminal > .admonition-title::before,
.md-typeset .terminal > summary::before {
  background-color: #10b981;
  -webkit-mask-image: var(--md-admonition-icon--terminal);
  mask-image: var(--md-admonition-icon--terminal);
}

/* -- Table styling (slate) -- */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 0.5rem;
  overflow: hidden;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) td {
  border-color: rgba(255, 255, 255, 0.04);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) tr:hover td {
  background: rgba(139, 92, 246, 0.04);
}

/* -- Tabs styling -- */
[data-md-color-scheme="slate"] .md-typeset .tabbed-labels > label {
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

[data-md-color-scheme="slate"] .md-typeset .tabbed-set > input:checked + label {
  border-color: var(--aphids-purple);
  color: var(--aphids-purple);
}

/* -- Inline code -- */
[data-md-color-scheme="slate"] .md-typeset code {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border-radius: 0.25rem;
  padding: 0.05em 0.3em;
}

[data-md-color-scheme="slate"] .md-typeset pre code {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}

/* -- Navigation -- */
[data-md-color-scheme="slate"] .md-nav__link--active {
  color: var(--aphids-purple) !important;
  font-weight: 600;
}

[data-md-color-scheme="slate"] .md-tabs__link--active {
  color: var(--aphids-purple) !important;
}

/* -- Scrollbar -- */
[data-md-color-scheme="slate"] ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-md-color-scheme="slate"] ::-webkit-scrollbar-track {
  background: transparent;
}

[data-md-color-scheme="slate"] ::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

[data-md-color-scheme="slate"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.5);
}

/* -- Footer override -- */
[data-md-color-scheme="slate"] .md-footer {
  background: #0a0a14;
}

/* -- Flow diagram styling -- */
.flow-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.75rem 1rem;
  background: rgba(30, 30, 46, 0.8);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 0.5rem;
  min-width: 120px;
  transition: all 0.3s ease;
}

.flow-step:hover {
  border-color: var(--aphids-purple);
  box-shadow: var(--aphids-glow);
}

.flow-step .step-num {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--aphids-purple);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.flow-step .step-icon {
  font-size: 1.5rem;
}

.flow-step .step-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #e2e8f0;
}

.flow-arrow {
  font-size: 1.2rem;
  color: rgba(139, 92, 246, 0.4);
}

/* -- Responsive -- */
@media (max-width: 768px) {
  .aphids-hero h1,
  .aphids-hero .aphids-hero-title {
    font-size: 2rem;
  }
  .hero-logo {
    width: 80px;
  }
  .hero-logo-glow {
    width: 120px;
    height: 120px;
  }
  .hero-tagline {
    font-size: 0.9rem;
  }
  .grid-cards {
    grid-template-columns: 1fr;
  }
  .stats-bar {
    gap: 1.5rem;
  }
  .flow-steps {
    flex-direction: column;
  }
  .flow-arrow {
    transform: rotate(90deg);
  }
}
