/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --accent-primary: #ff6a00;
  --accent-secondary: #ffd400;
  --bg: #0a0a0a;
  --bg-elevated: #161616;
  --bg-card: #1a1a1a;
  --border: rgba(255,255,255,0.08);
  --text: #f5f5f5;
  --text-muted: rgba(245,245,245,0.6);
  --text-dim: rgba(245,245,245,0.35);
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --nav-h: 60px;
  --transition: 0.15s ease;
}

[data-theme="light"] {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-card: #f0f0f0;
  --border: rgba(0,0,0,0.08);
  --text: #0a0a0a;
  --text-muted: rgba(10,10,10,0.6);
  --text-dim: rgba(10,10,10,0.35);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; }
a { color: var(--accent-primary); text-decoration: none; }
a:hover { opacity: 0.85; }
button { cursor: pointer; font-family: inherit; }

/* ── Typography ────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }

p { color: var(--text-muted); line-height: 1.7; }

.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent-primary); }

/* ── Layout ────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

main { flex: 1; padding-top: var(--nav-h); }

footer {
  margin-top: auto;
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

/* ── Navigation ────────────────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.nav-brand:hover { opacity: 1; color: var(--accent-primary); }

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--border); opacity: 1; }
.nav-link.active { color: var(--text); background: color-mix(in srgb, var(--accent-primary) 12%, transparent); }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.nav-theme-btn:hover { color: var(--text); border-color: var(--text-muted); background: var(--bg-card); }

.nav-burger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
}
.nav-burger span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all var(--transition);
}

/* Mobile nav */
@media (max-width: 768px) {
  .nav-menu {
    display: none;
    position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: var(--space-sm);
    gap: 2px;
  }
  .nav-menu.open { display: flex; }
  .nav-link { padding: 0.6rem var(--space-md); }
  .nav-burger { display: flex; }
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 0.55rem 1rem;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
  background: var(--bg-card);
}

.btn-danger {
  background: transparent;
  color: #ff6b6b;
  border-color: var(--border);
}
.btn-danger:hover:not(:disabled) { border-color: #ff6b6b; background: color-mix(in srgb, #ff6b6b 10%, transparent); }

.btn-sm { font-size: 0.8rem; padding: 0.4rem 0.75rem; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
}
.badge-live {
  background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
  color: var(--accent-primary);
  border-color: color-mix(in srgb, var(--accent-primary) 30%, transparent);
}
.badge-soon {
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  color: var(--text-dim);
  border-color: var(--border);
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.page-hero {
  padding: var(--space-xl) 0 var(--space-lg);
}
.page-hero h1 { margin-bottom: 0.5rem; }
.page-hero p { font-size: 1.05rem; max-width: 560px; }

/* ── Breadcrumb ────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-primary); }
.breadcrumb span { color: var(--text-dim); }

/* ── Skeleton loader ───────────────────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
}
.skeleton-line { height: 16px; margin-bottom: var(--space-sm); }
.skeleton-line.wide { width: 100%; }
.skeleton-line.short { width: 40%; }
.skeleton-card { height: 240px; border-radius: var(--radius-lg); }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.875rem;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 999;
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.toast.toast-show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── Error state ───────────────────────────────────────────────────────── */
.error-state {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
}
.error-state .error-icon { font-size: 2.5rem; margin-bottom: var(--space-md); }
.error-state h2 { margin-bottom: var(--space-sm); }
.error-state p { color: var(--text-muted); margin-bottom: var(--space-lg); font-family: var(--font-mono); font-size: 0.82rem; }

/* ── Coming soon page ──────────────────────────────────────────────────── */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  min-height: 50vh;
  gap: var(--space-md);
}
.coming-soon .cs-icon { font-size: 3rem; }
.coming-soon h1 { margin-bottom: var(--space-sm); }
.coming-soon p { max-width: 480px; font-size: 1rem; }
.coming-soon .btn { margin-top: var(--space-sm); }

/* ── Hub cards ─────────────────────────────────────────────────────────── */
.hub-hero {
  padding: var(--space-xl) 0 var(--space-lg);
}
.hub-hero h1 { margin-bottom: var(--space-sm); }
.hub-hero p { font-size: 1.05rem; }

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-lg);
  padding: var(--space-lg) 0 var(--space-xl);
}

.section-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  text-decoration: none;
}
.section-card:hover { opacity: 1; }

.section-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.section-card h3 { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.section-card p { font-size: 0.875rem; color: var(--text-muted); flex: 1; }

.section-card-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

/* Responsive */
@media (max-width: 480px) {
  .container { padding: 0 var(--space-md); }
  .section-grid { grid-template-columns: 1fr; }
}
