/* styles.css — ZeroSpecialist Educational Website */
/* Matches the Hybrid-Swarm-Local app dark theme */

:root {
  --bg: hsl(240, 10%, 3.9%);
  --bg-card: hsl(240, 8%, 8%);
  --bg-card-hover: hsl(240, 8%, 10%);
  --fg: hsl(210, 40%, 98%);
  --fg-muted: hsl(215, 20%, 65%);
  --primary: hsl(263, 70%, 60%);
  --primary-dim: hsl(263, 70%, 60%, 0.15);
  --primary-hover: hsl(263, 70%, 55%);
  --accent: hsl(280, 65%, 55%);
  --accent-dim: hsl(280, 65%, 55%, 0.15);
  --swarm-blue: hsl(220, 90%, 56%);
  --swarm-blue-dim: hsl(220, 90%, 56%, 0.15);
  --secondary: hsl(217, 33%, 17%);
  --border: hsl(217, 33%, 17%);
  --border-hover: hsl(263, 70%, 60%, 0.5);
  --destructive: hsl(0, 72%, 51%);
  --success: hsl(142, 71%, 45%);
  --warning: hsl(38, 92%, 50%);
  --radius: 0.5rem;
  --shadow-glow: 0 0 30px hsl(263, 70%, 60%, 0.2);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
  --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

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

/* --- Header --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: hsla(240, 10%, 3.9%, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--fg);
}

.site-header .logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
}

.site-header .logo-text {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.site-header .logo-text span {
  color: var(--fg-muted);
  font-weight: 400;
}

.site-header .header-badge {
  margin-left: 0.75rem;
  padding: 0.125rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 999px;
  background: var(--primary-dim);
  color: var(--primary);
  letter-spacing: 0.03em;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-right a {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.header-right a:hover {
  color: var(--fg);
}

/* --- Tab Navigation --- */

.tab-nav {
  display: flex;
  gap: 2px;
  padding: 0.75rem 1.5rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.tab-btn {
  position: relative;
  padding: 0.625rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all 0.15s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--fg);
  background: var(--secondary);
}

.tab-btn.active {
  color: var(--fg);
  background: var(--bg-card);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.tab-icon {
  margin-right: 0.5rem;
  font-size: 0.875rem;
}

/* --- Main Content --- */

.tab-content {
  display: none;
  padding: 2rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn 0.2s ease-out;
}

.tab-content.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Cards --- */

.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--border-hover); }

.card-header {
  padding: 1.25rem 1.5rem 0.75rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  margin-top: 0.25rem;
}

.card-body {
  padding: 0 1.5rem 1.5rem;
}

.card-body-flush {
  padding: 0;
}

/* --- Section Headings --- */

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
  max-width: 720px;
  line-height: 1.7;
}

/* --- Grid Layouts --- */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.gap-sm { gap: 0.5rem; }
.gap-lg { gap: 1.5rem; }

/* --- Form Controls --- */

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.control-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.control-value {
  font-size: 1.125rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--fg);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--secondary);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--primary);
  cursor: pointer;
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--primary);
  cursor: pointer;
}

input[type="number"], input[type="text"] {
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  color: var(--fg);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

input[type="number"]:focus, input[type="text"]:focus {
  border-color: var(--primary);
}

/* --- Progress Bars --- */

.bar-track {
  width: 100%;
  height: 8px;
  background: var(--secondary);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease-out, background 0.3s;
}

.bar-fill.verbosity     { background: hsl(263, 70%, 60%); }
.bar-fill.assertiveness { background: hsl(280, 65%, 55%); }
.bar-fill.formality     { background: hsl(220, 90%, 56%); }
.bar-fill.domainFocus   { background: hsl(142, 71%, 45%); }
.bar-fill.reasoningDepth{ background: hsl(38, 92%, 50%); }

/* --- Badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-primary   { background: var(--primary-dim); color: var(--primary); }
.badge-accent    { background: var(--accent-dim); color: var(--accent); }
.badge-blue      { background: var(--swarm-blue-dim); color: var(--swarm-blue); }
.badge-success   { background: hsl(142, 71%, 45%, 0.15); color: var(--success); }
.badge-warning   { background: hsl(38, 92%, 50%, 0.15); color: var(--warning); }
.badge-muted     { background: var(--secondary); color: var(--fg-muted); }

/* --- Tables --- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: hsl(240, 8%, 10%); }

td.mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

td .win { color: var(--success); font-weight: 600; }
td .lose { color: var(--fg-muted); }

/* --- Code Blocks --- */

.code-block {
  background: var(--secondary);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--fg);
  border: 1px solid var(--border);
}

code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}

/* --- Prompt Display --- */

.prompt-display {
  background: hsl(240, 10%, 5%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: hsl(210, 40%, 88%);
  max-height: 320px;
  overflow-y: auto;
}

.prompt-display .prompt-highlight {
  color: var(--primary);
  font-weight: 600;
}

/* --- Stat Cards --- */

.stat-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.stat-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: 0.375rem;
}

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

.stat-sub {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.25rem;
}

/* --- Diagram / Canvas --- */

.canvas-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: hsl(240, 10%, 2.5%);
  overflow: hidden;
  position: relative;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* --- Dimension Bars (Explorer) --- */

.dim-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.dim-label {
  width: 130px;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}

.dim-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dim-value {
  width: 50px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* --- Flow Diagrams --- */

.flow-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  position: relative;
}

.flow-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 2.75rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.flow-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  z-index: 1;
}

.flow-icon.purple { background: var(--primary-dim); color: var(--primary); }
.flow-icon.blue   { background: var(--swarm-blue-dim); color: var(--swarm-blue); }
.flow-icon.green  { background: hsl(142, 71%, 45%, 0.15); color: var(--success); }
.flow-icon.amber  { background: hsl(38, 92%, 50%, 0.15); color: var(--warning); }

.flow-body h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.flow-body p {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font-sans);
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
}
.btn-ghost:hover { background: var(--secondary); color: var(--fg); }

/* --- Signal Visualization --- */

.signal-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 2px;
}

.signal-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  transition: background 0.3s;
}

/* --- Decay Chart --- */

.decay-chart {
  width: 100%;
  height: 200px;
  position: relative;
}

/* --- Misc --- */

.separator {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

.text-muted { color: var(--fg-muted); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-blue { color: var(--swarm-blue); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.font-mono { font-family: var(--font-mono); }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.px-1 { padding-left: 0.5rem; padding-right: 0.5rem; }

/* --- Scrollbar --- */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: hsl(217, 33%, 25%); }

/* --- Hero Section (optional) --- */

.hero {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--fg), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--fg-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* --- Two-Column Layout --- */

.split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

/* --- Approach Nodes --- */

.node {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid;
}

.node-specialist {
  background: hsl(142, 71%, 45%, 0.1);
  border-color: hsl(142, 71%, 45%, 0.3);
  color: var(--success);
}

.node-approach {
  background: hsl(220, 90%, 56%, 0.1);
  border-color: hsl(220, 90%, 56%, 0.3);
  color: var(--swarm-blue);
}

.node-signal {
  background: hsl(38, 92%, 50%, 0.1);
  border-color: hsl(38, 92%, 50%, 0.3);
  color: var(--warning);
}

/* --- Heatmap Legend --- */

.legend {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  color: var(--fg-muted);
}

.legend-bar {
  width: 100px;
  height: 8px;
  border-radius: 4px;
}

/* --- Tab descriptions under headings --- */

.tab-hero {
  margin-bottom: 2rem;
}

.tab-hero h2 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
}

.tab-hero p {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  max-width: 680px;
  line-height: 1.7;
}
