/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a26;
  --bg-code: #1e1e2e;
  --border: #2a2a3a;
  --border-glow: #6366f1;
  --text: #e4e4ef;
  --text-dim: #8888a0;
  --text-bright: #ffffff;
  --accent: #6366f1;
  --accent-2: #f97316;
  --accent-3: #10b981;
  --accent-4: #06b6d4;
  --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-2: linear-gradient(135deg, #f97316, #fb923c);
  --gradient-3: linear-gradient(135deg, #10b981, #34d399);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --max-w: 1200px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

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

a:hover {
  color: var(--accent-2);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ===== Background Grid ===== */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.08), transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.nav.scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-bright);
}

.nav-logo svg {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-1);
  border-radius: 1px;
  transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-bright);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

/* ===== Hero ===== */
.hero {
  padding: 10rem 2rem 5rem;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
}

.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-3);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-bright);
  margin-bottom: 1.25rem;
}

.hero h1 .gradient {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 2.5rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
  color: white;
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--text-bright);
  transform: translateY(-2px);
}

/* ===== Sections ===== */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 5rem 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.section-desc {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0.75rem auto 0;
}

/* ===== Feature Grid ===== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity var(--transition);
}

.feature-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

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

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  font-size: 1.4rem;
}

.feature-icon.purple { background: rgba(99, 102, 241, 0.12); color: #818cf8; }
.feature-icon.orange { background: rgba(249, 115, 22, 0.12); color: #fb923c; }
.feature-icon.green  { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.feature-icon.cyan   { background: rgba(6, 182, 212, 0.12); color: #22d3ee; }
.feature-icon.rose   { background: rgba(244, 63, 94, 0.12); color: #fb7185; }
.feature-icon.amber  { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.feature-icon.blue   { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }

.feature-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* ===== Architecture Diagram ===== */
.arch-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  padding: 2rem 0;
}

.arch-node {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  text-align: center;
  min-width: 160px;
  transition: all var(--transition);
}

.arch-node:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.arch-node-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.arch-node-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-bright);
}

.arch-node-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.arch-arrow {
  color: var(--text-dim);
  font-size: 1.5rem;
  padding: 0 0.5rem;
  flex-shrink: 0;
}

/* ===== Topics Grid ===== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--transition);
}

.topic-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: var(--bg-card-hover);
}

.topic-num {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topic-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 2px;
}

.topic-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ===== Code Block ===== */
.code-section {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}

.code-dots {
  display: flex;
  gap: 6px;
}

.code-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.code-dots .red { background: #ff5f57; }
.code-dots .yellow { background: #febc2e; }
.code-dots .green { background: #28c840; }

.code-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.code-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition);
}

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

.code-body {
  padding: 1.25rem;
  overflow-x: auto;
}

.code-body pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text);
}

.code-body .comment { color: #6a6a8a; }
.code-body .cmd { color: #10b981; }
.code-body .flag { color: #818cf8; }
.code-body .string { color: #f97316; }
.code-body .output { color: #6a6a8a; font-style: italic; }

/* ===== Make Targets Table ===== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table-wrap th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-wrap td {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(42, 42, 58, 0.5);
  vertical-align: top;
}

.table-wrap tr:last-child td {
  border-bottom: none;
}

.table-wrap tr:hover td {
  background: rgba(99, 102, 241, 0.03);
}

.table-wrap code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--bg-code);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--accent);
  white-space: nowrap;
}

.table-wrap .cat-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cat-badge.exec { background: rgba(99, 102, 241, 0.12); color: #818cf8; }
.cat-badge.logs { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.cat-badge.sched { background: rgba(249, 115, 22, 0.12); color: #fb923c; }
.cat-badge.valid { background: rgba(6, 182, 212, 0.12); color: #22d3ee; }
.cat-badge.info { background: rgba(244, 63, 94, 0.12); color: #fb7185; }

/* ===== File Tree ===== */
.file-tree {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 2;
  max-width: 600px;
  margin: 0 auto;
}

.file-tree .dir { color: var(--accent); font-weight: 600; }
.file-tree .file { color: var(--text); }
.file-tree .dim { color: var(--text-dim); }
.file-tree .new-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-3);
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
  margin-left: 8px;
  font-family: var(--font-sans);
}

/* ===== Cost Card ===== */
.cost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.cost-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
}

.cost-card .label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.cost-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-bright);
}

.cost-card .value.accent { color: var(--accent); }
.cost-card .value.green { color: var(--accent-3); }
.cost-card .value.orange { color: var(--accent-2); }

.cost-card .sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer p {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 1rem;
}

.footer-links a {
  color: var(--text-dim);
  font-size: 0.85rem;
}

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

/* ===== Mermaid Diagrams ===== */
.mermaid-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  overflow-x: auto;
  transition: all var(--transition);
}

.mermaid-wrap:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-glow);
}

.mermaid-wrap .mermaid {
  display: flex;
  justify-content: center;
}

.mermaid-wrap .mermaid svg {
  max-width: 100%;
  height: auto;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
  }

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

  .nav-links a::after {
    display: none;
  }

  .nav-hamburger {
    display: block;
  }

  .hero {
    padding: 8rem 1.5rem 3rem;
  }

  .section {
    padding: 3rem 1.5rem;
  }

  .arch-flow {
    flex-direction: column;
  }

  .arch-arrow {
    transform: rotate(90deg);
    padding: 0.25rem 0;
  }

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