/* ==========================================================================
   Moonedge CDN — main stylesheet
   Plain CSS, no build tools. Organized by section for readability.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand */
  --accent: #5b5cf6;
  --accent-2: #7c3aed;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-contrast: #ffffff;

  /* Surfaces & text */
  --bg: #ffffff;
  --bg-elevated: #f7f7fb;
  --surface: #ffffff;
  --border: #e6e8f0;
  --text: #171923;
  --text-muted: #5a6072;
  --text-inverse: #f5f6ff;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(23, 25, 35, 0.05);
  --shadow-md: 0 10px 30px -12px rgba(23, 25, 35, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(23, 25, 35, 0.25);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  /* Layout */
  --container-max: 1140px;
  --header-h: 68px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", Menlo,
    Consolas, monospace;
}

/* Dark theme (automatic) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c11;
    --bg-elevated: #10121a;
    --surface: #14161f;
    --border: #262a38;
    --text: #e9eaf1;
    --text-muted: #9aa0b4;
    --text-inverse: #f5f6ff;

    --accent-soft: rgba(129, 132, 245, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  }
}

/* --------------------------------------------------------------------------
   2. Base / reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

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

ul,
ol {
  list-style: none;
}

h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   3. Layout helpers
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 4.5rem 0;
}

.section-head {
  max-width: 620px;
  margin: 0 auto 3rem;
  text-align: center;
}

.section-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin-bottom: 0.9rem;
}

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

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  padding: 0.78rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-on-accent {
  background: var(--accent-contrast);
  color: var(--accent);
}

.btn-on-accent:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-ghost-on-accent {
  background: transparent;
  color: var(--text-inverse);
  border-color: rgba(255, 255, 255, 0.45);
}

.btn-ghost-on-accent:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-sm {
  padding: 0.5rem 1.05rem;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   5. Header & navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

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

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 0.25rem 0;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
}

/* Active link (set by JS on scroll) */
.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.nav-cta-item {
  display: inline-flex;
}

/* Hamburger toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu */
@media (max-width: 860px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 0.5rem 1.25rem 1.25rem;
    display: none;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-link {
    display: block;
    padding: 0.85rem 0;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-link:last-of-type {
    border-bottom: none;
  }

  .nav-link.active::after {
    display: none;
  }

  .nav-cta-item {
    display: block;
    margin-top: 1rem;
  }

  .nav-cta-item .btn {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   6. Skip link
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
  color: var(--accent-contrast);
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5.5rem 0 6rem;
  text-align: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}

.hero-glow-1 {
  width: 480px;
  height: 480px;
  top: -160px;
  left: 50%;
  transform: translateX(-60%);
  background: radial-gradient(circle, var(--accent), transparent 70%);
}

.hero-glow-2 {
  width: 380px;
  height: 380px;
  bottom: -120px;
  right: -80px;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  opacity: 0.35;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hostname-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.55rem 0.45rem 0.95rem;
  margin-bottom: 1.8rem;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  flex-shrink: 0;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.copy-btn svg {
  width: 16px;
  height: 16px;
}

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

.copy-feedback {
  display: none;
}

.copy-btn.copied .copy-feedback {
  display: inline;
  color: #22c55e;
}

.copy-btn.copy-failed .copy-feedback {
  display: inline;
  color: #ef4444;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 3.9rem);
  max-width: 15ch;
  margin: 0 auto 1.2rem;
  background: linear-gradient(120deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text);
}

.hero-subtitle {
  max-width: 560px;
  margin: 0 auto 2.2rem;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2.4vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin-bottom: 2.8rem;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.6rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hero-pills li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.hero-pills svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   8. Features
   -------------------------------------------------------------------------- */
.features {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.7rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 1.2rem;
}

.feature-icon svg {
  width: 24px;
  height: 24px;
}

.feature-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   9. How it works
   -------------------------------------------------------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 1.6rem 1.7rem;
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 1.1rem;
}

.step h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.step p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   10. Network / stats
   -------------------------------------------------------------------------- */
.network {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  text-align: center;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
}

.stat-value {
  display: block;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.4rem;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   11. CTA
   -------------------------------------------------------------------------- */
.cta-card {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  color: var(--text-inverse);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.cta-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.cta-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 0.9rem;
  position: relative;
}

.cta-desc {
  max-width: 520px;
  margin: 0 auto 2rem;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  position: relative;
}

/* --------------------------------------------------------------------------
   12. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3.5rem 0 2rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand .brand-mark {
  width: 34px;
  height: 34px;
  margin-bottom: 1rem;
}

.footer-tagline {
  color: var(--text-muted);
  max-width: 34ch;
  font-size: 0.95rem;
}

.footer-nav {
  display: flex;
  gap: 3rem;
  justify-content: flex-end;
}

.footer-col h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
  margin-bottom: 1rem;
}

.footer-col li {
  margin-bottom: 0.6rem;
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.93rem;
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-hostname {
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   13. Responsive refinements
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .section {
    padding: 3.5rem 0;
  }

  .hero {
    padding: 4rem 0 4.5rem;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-nav {
    justify-content: flex-start;
    gap: 3rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
