/* ═══════════════════════════════════════════════
   Knowledge Base — Premium Dark Design
   Matching mockup: vibrant gradients, icon stats,
   accent borders, glowing elements
   ═══════════════════════════════════════════════ */

:root {
  --bg-deep: #080c18;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --green: #10b981;
}

body {
  background: var(--bg-deep);
  color: rgba(255, 255, 255, 0.55);
  overflow-x: hidden;
}

/* Noise texture overlay for premium depth */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── Aurora Background ────────────────────────── */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.aurora-bg::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -15%;
  width: 70%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.04) 40%, transparent 70%);
  animation: auroraA 14s ease-in-out infinite alternate;
}

.aurora-bg::after {
  content: '';
  position: absolute;
  bottom: -25%;
  right: -15%;
  width: 65%;
  height: 65%;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.1) 0%, rgba(168, 85, 247, 0.03) 40%, transparent 70%);
  animation: auroraA 11s ease-in-out infinite alternate-reverse;
}

@keyframes auroraA {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(25px, -15px) scale(1.04);
  }

  100% {
    transform: translate(-15px, 10px) scale(0.97);
  }
}

/* ─── Glass Surfaces ───────────────────────────── */
.glass-sidebar {
  background: rgba(10, 14, 28, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.glass-surface {
  background: rgba(10, 14, 28, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glass-modal {
  background: rgba(12, 17, 32, 0.96);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

/* ─── Scrollbar ────────────────────────────────── */
.scrollbar-thin::-webkit-scrollbar {
  width: 3px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
}

/* ─── Animations ───────────────────────────────── */
#content {
  animation: fadeSlideIn 0.4s ease-out;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  .aurora-bg::before,
  .aurora-bg::after {
    animation-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════ */

.sidebar-logo-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #a855f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
}

/* Search button in sidebar */
.sidebar-search-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-search-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-hover);
}

.sidebar-kbd {
  margin-left: auto;
  font-size: 0.55rem;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
}

/* ★ Ask AI gradient button — matches mockup */
.ask-ai-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
  border: none;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #a855f7 100%);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.ask-ai-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.ask-ai-btn:hover::before {
  transform: translateX(100%);
}

.ask-ai-btn:hover {
  box-shadow: 0 6px 32px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}

/* Nav items */
.nav-date-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.nav-date-btn:hover {
  background: var(--surface-hover);
  color: rgba(255, 255, 255, 0.85);
}

.nav-date-btn.active {
  background: rgba(59, 130, 246, 0.08);
  color: #60a5fa;
}

.nav-date-btn .chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
  opacity: 0.4;
}

.nav-date-btn.expanded .chevron {
  transform: rotate(90deg);
}

.nav-date-btn .count-badge {
  margin-left: auto;
  background: rgba(139, 92, 246, 0.12);
  color: rgba(139, 92, 246, 0.7);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
}

.nav-sections {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease-out;
}

.nav-sections.open {
  max-height: 1200px;
}

.nav-section-link {
  display: block;
  padding: 0.3rem 0.65rem 0.3rem 1.75rem;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.78rem;
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.15s;
  cursor: pointer;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-section-link:hover {
  color: rgba(255, 255, 255, 0.75);
  background: var(--surface-hover);
}

.nav-time {
  color: rgba(255, 255, 255, 0.12);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  margin-right: 0.25rem;
}

/* ═══════════════════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════════════════ */

.home-hero {
  text-align: center;
  padding: 2.5rem 0 1rem;
  position: relative;
  z-index: 1;
}

.home-hero .hero-icon {
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1.5rem;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #a855f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 50px rgba(59, 130, 246, 0.25),
    0 0 100px rgba(139, 92, 246, 0.15),
    0 0 150px rgba(168, 85, 247, 0.08);
  animation: heroIconPulse 4s ease-in-out infinite;
}

@keyframes heroIconPulse {

  0%,
  100% {
    box-shadow: 0 0 50px rgba(59, 130, 246, 0.25), 0 0 100px rgba(139, 92, 246, 0.15), 0 0 150px rgba(168, 85, 247, 0.08);
  }

  50% {
    box-shadow: 0 0 60px rgba(59, 130, 246, 0.3), 0 0 120px rgba(139, 92, 246, 0.2), 0 0 180px rgba(168, 85, 247, 0.12);
  }
}

.home-hero h1 {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.05;
  background: linear-gradient(135deg, #e0d5ff 0%, #c4b5fd 15%, #818cf8 35%, #6366f1 55%, #8b5cf6 75%, #a78bfa 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.6rem;
  animation: heroGradientShift 8s ease-in-out infinite;
}

@keyframes heroGradientShift {

  0%,
  100% {
    background-position: 0% center;
  }

  50% {
    background-position: 100% center;
  }
}

.prose-kb .home-hero p,
.home-hero p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.95rem;
  max-width: 40rem;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 300;
  text-align: center !important;
}

/* ★ Stat Cards with icons & colored borders — matches mockup */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin: 2rem 0 2rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 1rem;
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Subtle shimmer on stat cards */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
  transition: left 0.6s ease;
}

.stat-card:hover::before {
  left: 150%;
}

.stat-card:hover {
  transform: translateY(-3px);
}

/* Blue stat */
.stat-card.stat-blue {
  border: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow:
    0 0 30px rgba(59, 130, 246, 0.04),
    inset 0 1px 0 rgba(59, 130, 246, 0.06);
}

.stat-card.stat-blue:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow:
    0 0 40px rgba(59, 130, 246, 0.1),
    0 8px 32px rgba(59, 130, 246, 0.06),
    inset 0 1px 0 rgba(59, 130, 246, 0.1);
}

.stat-card.stat-blue .stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.08);
}

.stat-card.stat-blue .stat-icon svg {
  color: #60a5fa;
}

.stat-card.stat-blue .stat-value {
  color: #60a5fa;
  text-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

/* Violet stat */
.stat-card.stat-violet {
  border: 1px solid rgba(139, 92, 246, 0.2);
  box-shadow:
    0 0 30px rgba(139, 92, 246, 0.04),
    inset 0 1px 0 rgba(139, 92, 246, 0.06);
}

.stat-card.stat-violet:hover {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow:
    0 0 40px rgba(139, 92, 246, 0.1),
    0 8px 32px rgba(139, 92, 246, 0.06),
    inset 0 1px 0 rgba(139, 92, 246, 0.1);
}

.stat-card.stat-violet .stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.08);
}

.stat-card.stat-violet .stat-icon svg {
  color: #a78bfa;
}

.stat-card.stat-violet .stat-value {
  color: #a78bfa;
  text-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

/* Green stat */
.stat-card.stat-green {
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow:
    0 0 30px rgba(16, 185, 129, 0.04),
    inset 0 1px 0 rgba(16, 185, 129, 0.06);
}

.stat-card.stat-green:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow:
    0 0 40px rgba(16, 185, 129, 0.1),
    0 8px 32px rgba(16, 185, 129, 0.06),
    inset 0 1px 0 rgba(16, 185, 129, 0.1);
}

.stat-card.stat-green .stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.08);
}

.stat-card.stat-green .stat-icon svg {
  color: #34d399;
}

.stat-card.stat-green .stat-value {
  color: #34d399;
  text-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 0.25rem;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

/* ─── Inline Search ────────────────────────────── */
.inline-search-container {
  position: relative;
  margin: 0 0 2rem;
  z-index: 10;
}

.inline-search-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.7rem 1rem;
  transition: all 0.2s;
}

.inline-search-box:focus-within {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.06);
}

.inline-search-input {
  flex: 1;
  background: transparent;
  outline: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
  font-weight: 400;
  font-family: 'IBM Plex Sans', sans-serif;
}

.inline-search-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.search-kbd {
  font-size: 0.55rem;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.18);
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
}

.inline-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(12, 17, 32, 0.97);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-hover);
  border-radius: 0.85rem;
  max-height: 360px;
  overflow-y: auto;
  padding: 0.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Search results */
.search-empty {
  padding: 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.82rem;
}

.search-hit {
  padding: 0.6rem 0.85rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
}

.search-hit:hover {
  background: rgba(255, 255, 255, 0.04);
}

.search-hit-title {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  font-size: 0.85rem;
}

.search-hit-time {
  color: rgba(255, 255, 255, 0.12);
  font-family: 'JetBrains Mono';
  font-size: 0.65rem;
  margin-right: 0.3rem;
}

.search-hit-date {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
}

.search-hit-snippet {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.78rem;
  margin-top: 0.2rem;
  line-height: 1.5;
}

.search-hit-snippet mark {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  padding: 0 0.1rem;
  border-radius: 0.15rem;
}

/* Section labels */
.section-block {
  margin-bottom: 2rem;
}

.section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.2);
  margin-bottom: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ★ Recent entries with left accent border — matches mockup */
.recent-entry {
  display: block;
  padding: 0.9rem 1.2rem;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(139, 92, 246, 0.35);
  border-radius: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Hover glow line on left border */
.recent-entry::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.6), rgba(59, 130, 246, 0.4));
  opacity: 0;
  transition: opacity 0.3s;
}

.recent-entry:hover::after {
  opacity: 1;
}

.recent-entry:hover {
  border-color: rgba(139, 92, 246, 0.3);
  border-left-color: transparent;
  background: rgba(139, 92, 246, 0.03);
  transform: translateX(3px);
  box-shadow:
    0 4px 24px rgba(139, 92, 246, 0.08),
    inset 0 0 30px rgba(139, 92, 246, 0.02);
}

.entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.entry-date {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
}

.entry-meta {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.22);
  font-family: 'JetBrains Mono', monospace;
}

.entry-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
}

.entry-section-name {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
}

.entry-more {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.18);
}

/* Tags */
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--border);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.tag:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  transform: translateY(-1px);
}

.tag-aws {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.18);
  color: #fb923c;
}

.tag-aws:hover {
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.12);
}

.tag-security {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.18);
  color: #c084fc;
}

.tag-security:hover {
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.12);
}

.tag-devops {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.tag-devops:hover {
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.12);
}

.tag-cloud {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
}

.tag-cloud:hover {
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.12);
}

/* ═══════════════════════════════════════════════
   PAGE VIEW
   ═══════════════════════════════════════════════ */

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-meta {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.82rem;
  margin-top: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
}

.breadcrumb-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  transition: color 0.15s;
  cursor: pointer;
}

.breadcrumb-link:hover {
  color: rgba(255, 255, 255, 0.6);
}

/* Section cards */
.section-card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.25s;
}

.section-card:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.025);
}

.section-card .section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-card .section-time {
  flex-shrink: 0;
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0.4rem;
  margin-top: 0.1rem;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.section-card .section-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.35;
  margin: 0;
  border: none;
  padding: 0;
}

/* ToC */
#toc-nav a {
  display: block;
  padding: 0.25rem 0;
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.72rem;
  text-decoration: none;
  transition: color 0.15s;
  line-height: 1.45;
}

#toc-nav a:hover {
  color: rgba(255, 255, 255, 0.6);
}

#toc-nav a.active {
  color: #60a5fa;
}

/* ═══════════════════════════════════════════════
   PROSE (Markdown content)
   ═══════════════════════════════════════════════ */

.prose-kb {
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.55);
}

.prose-kb h1 {
  font-size: 2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}

.prose-kb h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.prose-kb h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin: 1.5rem 0 0.6rem;
}

.prose-kb h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  margin: 1.25rem 0 0.5rem;
}

.prose-kb p {
  margin: 0 0 0.85rem;
}

.prose-kb a {
  color: #60a5fa;
  text-decoration: none;
  transition: color 0.2s;
}

.prose-kb a:hover {
  color: #93bbfd;
  text-decoration: underline;
}

.prose-kb strong {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.prose-kb ul {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
  list-style: none;
}

.prose-kb ul li {
  position: relative;
  margin-bottom: 0.3rem;
}

.prose-kb ul li::before {
  content: '';
  position: absolute;
  left: -1.1rem;
  top: 0.65rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0.6;
}

.prose-kb ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

.prose-kb ol li {
  margin-bottom: 0.3rem;
}

.prose-kb ol li::marker {
  color: var(--blue);
  font-weight: 600;
}

.prose-kb code:not(pre code) {
  background: rgba(255, 255, 255, 0.06);
  color: #93c5fd;
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
  font-size: 0.82em;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.prose-kb pre {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  margin: 0.75rem 0 1.25rem;
  overflow: hidden;
}

.prose-kb pre code {
  display: block;
  padding: 1rem 1.25rem;
  font-size: 0.78rem;
  line-height: 1.65;
  font-family: 'JetBrains Mono', monospace;
  overflow-x: auto;
  color: #c9d1d9;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  padding: 0.3rem 0.55rem;
  border-radius: 0.375rem;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
}

.prose-kb pre:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

.copy-btn.copied {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.code-lang-label {
  position: absolute;
  top: 0.5rem;
  left: 1rem;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.15);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}

.prose-kb table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.82rem;
}

.prose-kb thead th {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-hover);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prose-kb tbody td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.prose-kb tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.prose-kb blockquote {
  border-left: 2px solid var(--blue);
  margin: 0.75rem 0;
  padding: 0.65rem 1rem;
  background: rgba(59, 130, 246, 0.04);
  border-radius: 0 0.5rem 0.5rem 0;
}

.prose-kb blockquote p {
  margin: 0;
}

.prose-kb hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ═══════════════════════════════════════════════
   AI CHAT
   ═══════════════════════════════════════════════ */

/* ★ Floating AI chat button — matches mockup with label + green dot */
.ai-float-btn {
  position: fixed;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem 0.65rem 0.85rem;
  border-radius: 99px;
  border: none;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3);
}

.ai-float-btn:hover {
  box-shadow: 0 6px 32px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

.ai-float-label {
  font-size: 0.82rem;
}

.ai-float-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg-deep);
}

/* Chat panel */
.chat-panel-inner {
  width: 420px;
  max-width: 92vw;
  height: 520px;
  background: rgba(12, 17, 32, 0.97);
  backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-bubble-ai {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 0 0.75rem 0.75rem 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.65);
}

.chat-bubble-ai p {
  margin: 0 0 0.5rem;
}

.chat-bubble-ai p:last-child {
  margin: 0;
}

.chat-bubble-ai code {
  background: rgba(255, 255, 255, 0.06);
  color: #93c5fd;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.78em;
  font-family: 'JetBrains Mono', monospace;
}

.chat-bubble-ai pre {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.5rem;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
  overflow-x: auto;
}

.chat-bubble-ai pre code {
  background: transparent;
  padding: 0;
  border: none;
  font-size: 0.75rem;
  color: #c9d1d9;
}

.chat-bubble-user {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 0.75rem 0 0.75rem 0.75rem;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  max-width: 85%;
}

.chat-textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.6rem 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-family: 'IBM Plex Sans', sans-serif;
  outline: none;
  resize: none;
  max-height: 100px;
  transition: border-color 0.2s;
}

.chat-textarea:focus {
  border-color: rgba(99, 102, 241, 0.4);
}

.chat-textarea::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.chat-send-btn {
  padding: 0.6rem;
  border-radius: 0.75rem;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chat-send-btn:not(:disabled):hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.5rem 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.3;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ─── Z-index ──────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

main,
header {
  position: relative;
  z-index: 1;
}

/* ─── Responsive stat cards ───────────────────── */
@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .home-hero h1 {
    font-size: 2.4rem;
  }

  .stat-card {
    padding: 1rem;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .home-hero h1 {
    font-size: 2.8rem;
  }
}

/* ─── Selection highlight ─────────────────────── */
::selection {
  background: rgba(139, 92, 246, 0.3);
  color: white;
}

/* ─── Focus visible ───────────────────────────── */
:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.5);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* ─── Staggered entry animation ───────────────── */
.recent-entry {
  animation: fadeSlideIn 0.4s ease-out backwards;
}

.recent-entry:nth-child(1) {
  animation-delay: 0.05s;
}

.recent-entry:nth-child(2) {
  animation-delay: 0.1s;
}

.recent-entry:nth-child(3) {
  animation-delay: 0.15s;
}

.recent-entry:nth-child(4) {
  animation-delay: 0.2s;
}

.recent-entry:nth-child(5) {
  animation-delay: 0.25s;
}