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

:root {
  --bg:          #05050d;
  --surface:     #0c0c18;
  --surface-2:   #111125;
  --border:      rgba(255, 255, 255, 0.07);
  --border-hover: rgba(0, 200, 248, 0.25);

  --accent:      #00c8f8;
  --accent-dim:  rgba(0, 200, 248, 0.10);
  --accent-glow: 0 0 32px rgba(0, 200, 248, 0.22);
  --purple:      #8b5cf6;

  --text:        #dde2f0;
  --text-muted:  #6b7280;
  --text-subtle: #2e3346;

  --font-sans: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --nav-h:    64px;
  --radius:   8px;
  --ease:     0.2s ease;
  --ease-out: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════
   Canvas background
═══════════════════════════════════════════ */
#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   Navigation
═══════════════════════════════════════════ */
#nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 100;
  height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background var(--ease), border-color var(--ease), backdrop-filter var(--ease);
}

#nav.scrolled {
  background: rgba(5, 5, 13, 0.82);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  border-color: var(--border);
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: opacity var(--ease);
}
.logo:hover { opacity: 0.8; }

.logo-ai { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 400;
  transition: color var(--ease);
}
.nav-links a:hover { color: var(--text); }

.nav-github {
  display: flex !important;
  align-items: center;
  gap: 7px;
  color: var(--accent) !important;
  border: 1px solid rgba(0, 200, 248, 0.3);
  padding: 7px 15px;
  border-radius: 6px;
  font-size: 0.83rem !important;
  transition: background var(--ease), border-color var(--ease), box-shadow var(--ease) !important;
}
.nav-github:hover {
  background: var(--accent-dim) !important;
  border-color: var(--accent) !important;
  box-shadow: var(--accent-glow) !important;
}

/* ═══════════════════════════════════════════
   Container
═══════════════════════════════════════════ */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════
   Hero
═══════════════════════════════════════════ */
#hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: calc(var(--nav-h) + 60px) 28px 80px;
}

/* Subtle radial glow behind hero content */
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(0, 200, 248, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 55%, rgba(139, 92, 246, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 820px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 28px;
  opacity: 0.75;
}

.hero-title {
  font-size: clamp(3.2rem, 11vw, 7.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 28px;
}

.title-ai {
  color: var(--accent);
  text-shadow: 0 0 60px rgba(0, 200, 248, 0.4);
}

.title-rest {
  color: var(--text);
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  color: var(--text-muted);
  margin-bottom: 52px;
  min-height: 1.7em;
}

.cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hero-ctas {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   Buttons
═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--ease);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #04040a;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #33d6ff;
  box-shadow: var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-1px);
}

/* Scroll indicator */
.hero-scroll {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-subtle);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  user-select: none;
}

.scroll-line {
  width: 1px;
  height: 44px;
  background: linear-gradient(to bottom, var(--text-subtle), transparent);
  animation: scrollAnim 2s ease-in-out infinite;
}

@keyframes scrollAnim {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 1; }
  45%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  55%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ═══════════════════════════════════════════
   Section header
═══════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 56px;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.6;
  letter-spacing: 0.05em;
}

.section-header h2 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

/* ═══════════════════════════════════════════
   About
═══════════════════════════════════════════ */
#about {
  padding: 128px 0;
  position: relative;
  z-index: 1;
}

#about::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    transparent 0%,
    var(--surface) 12%,
    var(--surface) 88%,
    transparent 100%
  );
  z-index: -1;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 72px;
  align-items: start;
}

.about-text p {
  font-size: 1.02rem;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 22px;
}
.about-text p:last-child { margin-bottom: 0; }
.about-text strong { color: var(--text); font-weight: 600; }
.about-text em {
  color: var(--accent);
  font-style: normal;
}

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}
.stat:last-child { border-bottom: none; }

.stat-value {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 6px;
}

/* ═══════════════════════════════════════════
   Packages
═══════════════════════════════════════════ */
#packages {
  padding: 128px 0 160px;
  position: relative;
  z-index: 1;
}

.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

/* Loading */
.loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 72px 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* Empty / error state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 72px 0;
  color: var(--text-muted);
}
.empty-state h3 {
  font-family: var(--font-mono);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 12px;
}
.empty-state a {
  color: var(--accent);
}

/* Package card */
.pkg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
  text-decoration: none;
  color: inherit;
}

/* Top edge glow on hover */
.pkg-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--ease);
}

.pkg-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.pkg-card:hover::before {
  opacity: 1;
}

.pkg-header {
  display: flex;
  align-items: center;
  gap: 9px;
}

.pkg-icon {
  color: var(--text-subtle);
  flex-shrink: 0;
}

.pkg-name {
  font-family: var(--font-mono);
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.pkg-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
}

.pkg-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pkg-lang {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.lang-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pkg-stars {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pkg-updated {
  font-size: 0.76rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  margin-left: auto;
}

/* ═══════════════════════════════════════════
   Footer
═══════════════════════════════════════════ */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 48px 0 36px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 36px;
}

.footer-brand .logo {
  display: inline-block;
  margin-bottom: 8px;
}
.footer-brand p {
  font-size: 0.83rem;
  color: var(--text-muted);
}

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

.footer-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color var(--ease);
}
.footer-links a:hover { color: var(--text); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.footer-bottom p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* ═══════════════════════════════════════════
   Scroll reveal
═══════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ═══════════════════════════════════════════
   Responsive
═══════════════════════════════════════════ */
@media (max-width: 800px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .about-stats {
    flex-direction: row;
  }
  .stat {
    flex: 1;
    padding: 20px;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }
  .stat:last-child { border-right: none; }

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

  .footer-inner {
    flex-direction: column;
    gap: 24px;
  }
}

@media (max-width: 540px) {
  .nav-links a:not(.nav-github) {
    display: none;
  }

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

  .about-stats {
    flex-direction: column;
  }
  .stat {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .stat:last-child { border-bottom: none; }
}
