/* Moduvex Landing — Redesigned */

/* ── CSS Custom Properties ── */
:root {
  --bg: #FAFBFC;
  --bg-alt: #F1F5F9;
  --surface: #FFFFFF;
  --text: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --accent-soft: rgba(59, 130, 246, 0.08);
  --border: #E2E8F0;
  --border-hover: #CBD5E1;
  --code-bg: #0F172A;
  --code-text: #E2E8F0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --nav-bg: rgba(250, 251, 252, 0.85);
  --max-w: 1080px;
  --nav-h: 64px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
}

[data-theme="dark"] {
  --bg: #0B1120;
  --bg-alt: #131C31;
  --surface: #1A2437;
  --text: #E8EDF5;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent: #60A5FA;
  --accent-hover: #93C5FD;
  --accent-soft: rgba(96, 165, 250, 0.1);
  --border: #1E293B;
  --border-hover: #334155;
  --code-bg: #0D1525;
  --code-text: #E2E8F0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
  --nav-bg: rgba(11, 17, 32, 0.85);
}

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

/* ── Base ── */
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

code, pre { font-family: var(--font-mono); }

h1, h2, h3, .hero-badge, .btn, .nav-brand, .stat-value {
  font-family: var(--font-sans);
  font-weight: 700;
}

/* ── Container ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Nav ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand img { width: 28px; height: 28px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.lang-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 24px 6px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-sans);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
}

.lang-select:hover { border-color: var(--border-hover); }
.lang-select option { background: var(--surface); color: var(--text); }

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color 0.2s, color 0.2s;
}

.theme-btn:hover { border-color: var(--border-hover); color: var(--text); }

/* Theme icons */
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun, :root .icon-sun { display: none; }
[data-theme="light"] .icon-moon, :root .icon-moon { display: block; }

.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  padding: 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s, color 0.2s;
}

.github-link:hover { border-color: var(--border-hover); color: var(--text); text-decoration: none; }
.github-link svg { width: 18px; height: 18px; fill: currentColor; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}

/* ── Sections ── */
section { padding: 100px 0; }
.section-alt { background: var(--bg-alt); }

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.03em;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 48px;
  max-width: 560px;
  line-height: 1.7;
}

/* ── Hero ── */
.hero {
  position: relative;
  padding-top: calc(var(--nav-h) + 80px);
  padding-bottom: 80px;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59,130,246,0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(59,130,246,0.06), transparent);
  pointer-events: none;
}

[data-theme="dark"] .hero-bg {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59,130,246,0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(96,165,250,0.08), transparent);
}

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

.hero-badge {
  display: inline-block;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 18px;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 28px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(2.5rem, 5.5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -0.04em;
  color: var(--text);
}

.hero h1 .accent {
  background: linear-gradient(135deg, var(--accent), #818CF8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 36px;
  line-height: 1.75;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
  text-decoration: none;
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ── Stats ── */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat { text-align: center; }

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* ── Cards ── */
.card-grid {
  display: grid;
  gap: 16px;
}

.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  cursor: default;
}

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

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  margin-bottom: 16px;
  background: var(--bg-alt);
  color: var(--text-secondary);
}

.card-icon-blue {
  background: var(--accent-soft);
  color: var(--accent);
}

.card-icon svg { width: 20px; height: 20px; }

.card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ── Code Blocks ── */
.code-window {
  background: var(--code-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.06);
}

.code-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

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

.code-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
}

.code-dots span:nth-child(1) { background: #FF5F57; }
.code-dots span:nth-child(2) { background: #FEBC2E; }
.code-dots span:nth-child(3) { background: #28C840; }

.code-filename {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  flex: 1;
}

.code-copy {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  transition: color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
}

.code-copy:hover { color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.2); }
.code-copy.copied { color: #4ADE80; border-color: #4ADE80; }

.code-body {
  padding: 20px 24px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--code-text);
  overflow-x: auto;
}

/* Syntax highlight */
.kw  { color: #7DD3FC; }
.fn  { color: #60A5FA; }
.str { color: #4ADE80; }
.cm  { color: #475569; }
.attr { color: #C084FC; }
.ty  { color: #F9A8D4; }
.mac { color: #FCD34D; }

/* ── Architecture Diagram ── */
.arch-diagram {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 48px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.arch-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.arch-node {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

.arch-node:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.arch-umbrella {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.arch-starter {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.arch-layer {
  background: var(--bg-alt);
  color: var(--text);
}

.arch-core {
  background: var(--surface);
  color: var(--text-secondary);
}

.arch-runtime {
  background: var(--code-bg);
  color: var(--code-text);
  border-color: rgba(255,255,255,0.1);
}

/* ── Crate Table ── */
.table-wrap { overflow-x: auto; }

.crate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.crate-table thead { text-align: left; }

.crate-table th {
  padding: 14px 20px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-alt);
}

.crate-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.crate-table code {
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--accent);
  white-space: nowrap;
  font-weight: 500;
}

.crate-table tr:last-child td { border-bottom: none; }
.crate-table tbody tr { transition: background 0.15s; }
.crate-table tbody tr:hover { background: var(--bg-alt); }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

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

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--text); text-decoration: none; }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Fade-in ── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  section { padding: 72px 0; }
  .hero { padding-top: calc(var(--nav-h) + 48px); padding-bottom: 56px; }
  .section-title { font-size: 1.6rem; }
  .card-grid-3 { grid-template-columns: 1fr; }
  .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { gap: 20px; }
  .stat-divider { display: none; }
  .arch-node { font-size: 0.72rem; padding: 8px 14px; }
  .footer-top { flex-direction: column; gap: 20px; text-align: center; }
  .footer-links { justify-content: center; }
}

@media (max-width: 560px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    flex-direction: column;
    padding: 12px 24px 20px;
    border-bottom: 1px solid var(--border);
    gap: 4px;
  }

  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: center; }
  .btn { width: 100%; max-width: 300px; justify-content: center; }
  .hero-stats { flex-direction: column; gap: 16px; }
  .arch-row { flex-direction: column; align-items: center; }
}
