/* ── Color tokens ── */
:root {
  --bg-primary: #0f1923;
  --bg-secondary: #162030;
  --bg-tertiary: #1e2d3d;
  --text-primary: #e0e6ed;
  --text-secondary: #7b8fa3;
  --accent: #00e5ff;
  --accent-hover: #00b8d4;
  --success: #00c853;
  --warning: #ffa726;
  --danger: #ff5252;
  --border: #1e2d3d;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --max-width: 1200px;
  --header-height: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── Typography ── */
h1, h2, h3, h4 { font-family: var(--font-mono); font-weight: 600; line-height: 1.3; }
h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }

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

section {
  padding: 80px 0;
}

/* ── Header / Nav ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 25, 35, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 3px;
}

.logo-icon span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 1px;
}

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

nav { display: flex; align-items: center; gap: 32px; }
nav a { color: var(--text-secondary); font-size: .9rem; font-weight: 500; }
nav a:hover, nav a.active { color: var(--text-primary); }

.nav-cta {
  background: var(--accent);
  color: var(--bg-primary) !important;
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: .85rem;
  transition: background .15s;
}
.nav-cta:hover { background: var(--accent-hover); color: var(--bg-primary) !important; }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  padding: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .95rem;
  border: none;
  transition: all .15s;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--bg-primary); }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-secondary:hover { background: rgba(0, 229, 255, .1); }

.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e04848; }

/* ── Cards ── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

/* ── Code blocks ── */
pre, code {
  font-family: var(--font-mono);
}

code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .85em;
}

pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  font-size: .85rem;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: .95rem;
  transition: border-color .15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input::placeholder { color: var(--text-secondary); opacity: .6; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.badge-free { background: rgba(0, 229, 255, .15); color: var(--accent); }
.badge-pro { background: rgba(255, 167, 38, .15); color: var(--warning); }
.badge-max { background: rgba(0, 200, 83, .15); color: var(--success); }

.badge-qualified { background: rgba(0, 200, 83, .15); color: var(--success); }
.badge-watchlist { background: rgba(255, 167, 38, .15); color: var(--warning); }
.badge-below { background: rgba(255, 82, 82, .15); color: var(--danger); }

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

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

td { font-size: .9rem; }

/* ── Alerts / Messages ── */
.alert {
  padding: 16px 20px;
  border-radius: 8px;
  font-size: .9rem;
  margin-bottom: 20px;
}

.alert-success { background: rgba(0, 200, 83, .1); border: 1px solid var(--success); color: var(--success); }
.alert-error { background: rgba(255, 82, 82, .1); border: 1px solid var(--danger); color: var(--danger); }
.alert-warning { background: rgba(255, 167, 38, .1); border: 1px solid var(--warning); color: var(--warning); }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0;
  color: var(--text-secondary);
  font-size: .85rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-brand p { margin-top: 12px; max-width: 300px; line-height: 1.7; }

.footer-col h4 {
  color: var(--text-primary);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 16px;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--text-secondary); }
.footer-col a:hover { color: var(--text-primary); }

.footer-bottom {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }
  section { padding: 48px 0; }

  .menu-toggle { display: block; }

  nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 24px;
    gap: 16px;
  }

  nav.open { display: flex; }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }

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

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn .5s ease-out forwards;
}

/* ── Copy button ── */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: .75rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all .15s;
}

.copy-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

.code-block-wrap {
  position: relative;
}

/* ── Loading spinner ── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
