/* shared/base.css — global tokens, reset, layout, header/footer, and the
 * component library every page reuses (buttons, cards, form fields, choices,
 * sliders, callouts). Page-specific styles live in pages/<page>.css and only
 * cover what's unique to that page.
 */

*,*::before,*::after { box-sizing: border-box; }

:root {
  --bg: #0a0a0b;
  --bg-elevated: #131316;
  --surface: #18181d;
  --surface-hover: #1f1f25;
  --border: #2a2a32;
  --border-hover: #3a3a44;
  --text: #f4f4f5;
  --text-dim: #a1a1aa;
  --text-faint: #71717a;
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-dim: #4c1d95;
  --accent-glow: rgba(167, 139, 250, 0.15);
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.5);
  --transition-fast: 0.15s ease;
}

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: ''; position: fixed; inset: 0;
  background:
    radial-gradient(at 20% 0%, rgba(167,139,250,0.12) 0%, transparent 50%),
    radial-gradient(at 80% 100%, rgba(52,211,153,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- header + nav ---------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  background: rgba(10,10,11,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}
.logo-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #0a0a0b;
}
.logo-text .dim { color: var(--text-dim); font-weight: 400; }

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.active { color: var(--text); background: var(--surface); }

.header-aside {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 13px;
}
.header-aside a {
  color: var(--text-dim);
  text-decoration: none;
  transition: var(--transition-fast);
}
.header-aside a:hover { color: var(--text); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.badge-link {
  text-decoration: none;
  transition: all 120ms ease;
}
.badge-link:hover {
  color: var(--text);
  border-color: var(--accent);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

@media (max-width: 720px) {
  .nav { display: none; }
  .nav-mobile { display: flex; }
}
.nav-mobile { display: none; }

/* Mobile nav: a horizontal pill bar shown only on small screens, placed below
 * the main header for one-thumb reach. */
.nav-mobile {
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,11,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 8px 0;
  gap: 4px;
  justify-content: center;
  overflow-x: auto;
}
.nav-mobile a {
  flex-shrink: 0;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}
.nav-mobile a.active { color: var(--text); background: var(--surface); }

/* ---------------- typography ---------------- */

h1, h2, h3 { letter-spacing: -0.02em; margin: 0; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.15; }
h3 { font-size: 18px; line-height: 1.3; }

.accent {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 14px;
  background: var(--accent-glow);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: 100px;
}

.lede {
  color: var(--text-dim);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
}

/* ---------------- cards + surfaces ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card.padded { padding: 32px; }
@media (max-width: 640px) {
  .card.padded { padding: 20px; }
}

.surface { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ---------------- form fields ---------------- */

.field { display: flex; flex-direction: column; gap: 10px; }
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.field label .hint {
  color: var(--text-faint);
  font-weight: 400;
  font-family: var(--font-mono);
}

.input, .field input[type=text], .field input[type=number], .field input[type=search] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: var(--transition-fast);
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  user-select: none;
}
.choice:hover { border-color: var(--border-hover); background: var(--surface-hover); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice input:checked + span { color: var(--accent); }
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 100px;
  background: var(--border);
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--accent-glow);
  transition: transform var(--transition-fast);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.slider-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  min-width: 56px;
  text-align: right;
}

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0b;
  box-shadow: 0 4px 16px rgba(167,139,250,0.3);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(167,139,250,0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  background: var(--surface);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-primary .arrow { transition: transform var(--transition-fast); }
.btn-primary:hover .arrow { transform: translateX(2px); }

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

.btn.full { width: 100%; }
.btn.lg { padding: 14px 24px; font-size: 15px; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(10,10,11,0.3);
  border-top-color: #0a0a0b;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-secondary .spinner { border-color: rgba(244,244,245,0.2); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- callouts (warning / error / info) ---------------- */

.callout {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
}
.callout strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.callout ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-dim); }
.callout-warning {
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.25);
}
.callout-warning strong { color: var(--warning); }
.callout-error {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.25);
  color: var(--error);
}
.callout-error span { color: var(--text-dim); font-size: 13px; font-family: var(--font-mono); }
.callout.hidden { display: none; }

/* ---------------- footer ---------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 48px;
  color: var(--text-faint);
  font-size: 13px;
  margin-top: 80px;
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-row a { color: var(--text-dim); text-decoration: none; }
.footer-row a:hover { color: var(--text); }
.footer-stack {
  font-family: var(--font-mono);
  font-size: 11px;
}
.footer-legal {
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  gap: 8px;
  align-items: center;
}
.footer-legal a { color: var(--text-dim); text-decoration: none; }
.footer-legal a:hover { color: var(--text); }
.footer-sep { color: var(--border); }

/* ---------------- utilities ---------------- */

.meta-pill {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-faint);
}
.empty .icon { font-size: 36px; opacity: 0.5; margin-bottom: 12px; }
.empty h3 { color: var(--text-dim); margin-bottom: 8px; }
.empty p { margin: 0; font-size: 14px; }

.fade-in { animation: fadeIn 0.3s ease-out backwards; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
