/* ==========================================================================
   PRISM — SSS-Tier Product Design System & Stylesheet
   Deterministic Web Layout & Repository Intelligence MCP Infrastructure
   ========================================================================== */

/* --------------------------------------------------------------------------
   01. Design Tokens & CSS Variables
   -------------------------------------------------------------------------- */
:root {
  /* Neutral Color Palette (Obsidian & Deep Zinc Base) */
  --bg-canvas: #09090b;
  --bg-surface: #0f0f12;
  --bg-surface-elevated: #16161a;
  --bg-surface-subtle: #1c1c22;
  --bg-overlay: rgba(9, 9, 11, 0.85);

  /* Hairline Borders & Dividers */
  --border-subtle: #1f1f24;
  --border-medium: #27272a;
  --border-prominent: #3f3f46;
  --border-focus: rgba(59, 130, 246, 0.6);

  /* Typography / Text Colors */
  --text-primary: #f4f4f6;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-muted: #52525b;
  --text-inverse: #09090b;

  /* Optical Brand Accents (Restrained Optical Blue & Spectrum Dispersion) */
  --prism-blue: #3b82f6;
  --prism-blue-hover: #2563eb;
  --prism-blue-light: #60a5fa;
  --prism-blue-dim: rgba(59, 130, 246, 0.12);
  --prism-blue-border: rgba(59, 130, 246, 0.35);

  --prism-violet: #8b5cf6;
  --prism-violet-dim: rgba(139, 92, 246, 0.12);
  
  --prism-emerald: #10b981;
  --prism-emerald-dim: rgba(16, 185, 129, 0.12);

  --prism-amber: #f59e0b;
  --prism-amber-dim: rgba(245, 158, 11, 0.12);

  --prism-rose: #f43f5e;
  --prism-rose-dim: rgba(244, 63, 94, 0.12);

  /* Subtle Optical Refraction Gradient (Restrained, not saturated neon) */
  --prism-refraction-line: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #10b981 100%);
  --prism-gradient-subtle: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.04) 50%, transparent 100%);

  /* Spacing Scale (8pt Grid with 4pt half-step) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* Typography Scale */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;

  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.84375rem;  /* 13.5px */
  --text-base: 0.9375rem; /* 15px */
  --text-lg: 1.0625rem;   /* 17px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 2rem;       /* 32px */
  --text-4xl: 2.5rem;     /* 40px */
  --text-5xl: 3.25rem;    /* 52px */
  --text-6xl: 4rem;       /* 64px */

  --tracking-tight: -0.025em;
  --tracking-tighter: -0.04em;
  --tracking-normal: 0em;
  --tracking-wide: 0.04em;
  --tracking-mono: -0.01em;

  /* Radius */
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* Elevation & Shadows (Flat / Minimal hairline shadows) */
  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 16px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-subtle);
  --shadow-overlay: 0 20px 40px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-medium);

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 880px;
  --header-height: 64px;
}

/* --------------------------------------------------------------------------
   02. Reset & Base Setup
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-canvas);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-secondary);
  background-color: var(--bg-canvas);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

::selection {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-mono);
}

/* Tabular figures for metrics & tables */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   03. Typography Hierarchy
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
}

h1 {
  font-size: clamp(var(--text-3xl), 5vw, var(--text-6xl));
  letter-spacing: var(--tracking-tighter);
  font-weight: 700;
}

h2 {
  font-size: clamp(var(--text-2xl), 3.5vw, var(--text-4xl));
  letter-spacing: var(--tracking-tight);
}

h3 {
  font-size: var(--text-xl);
  font-weight: 600;
}

h4 {
  font-size: var(--text-base);
  font-weight: 600;
}

p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--prism-blue-light);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--prism-blue);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
}

/* --------------------------------------------------------------------------
   04. Layout & Grid Architecture
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
}

.section-hero {
  padding-top: calc(var(--header-height) + var(--space-16));
  padding-bottom: var(--space-20);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

/* Refraction hairline at top of hero/sections */
.hairline-border-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--prism-refraction-line);
  opacity: 0.8;
}

.section-header {
  margin-bottom: var(--space-12);
}

.section-header.text-center {
  text-align: center;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* Sub-grid Systems */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-split-60-40 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-8);
  align-items: start;
}

.grid-split-50-50 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: center;
}

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-split-60-40, .grid-split-50-50 {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

/* --------------------------------------------------------------------------
   05. Navigation Header
   -------------------------------------------------------------------------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.brand-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
}

.nav-link {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-cta-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   06. Interactive Components & Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  height: 38px;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background-color: var(--prism-blue);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background-color: var(--prism-blue-hover);
  color: #ffffff;
}

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

.btn-secondary:hover {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-prominent);
}

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

.btn-ghost:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface);
}

.btn-sm {
  height: 30px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  height: 46px;
  padding: 0 var(--space-6);
  font-size: var(--text-base);
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  border-radius: var(--radius-xs);
  background-color: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-blue {
  background-color: var(--prism-blue-dim);
  color: var(--prism-blue-light);
  border-color: var(--prism-blue-border);
}

.badge-emerald {
  background-color: var(--prism-emerald-dim);
  color: var(--prism-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-amber {
  background-color: var(--prism-amber-dim);
  color: var(--prism-amber);
  border-color: rgba(245, 158, 11, 0.3);
}

/* --------------------------------------------------------------------------
   07. Terminal & Code Command Snippets
   -------------------------------------------------------------------------- */
.cli-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-subtle);
}

.cli-box .cli-cmd {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-x: auto;
  white-space: nowrap;
}

.cli-box .cli-prompt {
  color: var(--prism-blue);
  user-select: none;
}

.cli-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  transition: all 0.15s ease;
}

.cli-copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* --------------------------------------------------------------------------
   08. Card & Container Architecture (Strict Anti-Card-Soup)
   -------------------------------------------------------------------------- */
.surface-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  position: relative;
  transition: border-color 0.15s ease;
}

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

.surface-card-interactive {
  cursor: pointer;
}

.surface-card-interactive:hover {
  border-color: var(--border-prominent);
  background-color: var(--bg-surface-elevated);
}

/* Card Header & Content */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  color: var(--text-primary);
  font-weight: 600;
}

.card-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   09. Prism Interactive Demonstrators (The Two Pillars)
   -------------------------------------------------------------------------- */
/* Demonstrated Container Shell */
.demo-workbench {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.workbench-bar {
  background-color: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workbench-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.workbench-tab {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.workbench-tab.active {
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border-color: var(--border-medium);
}

.workbench-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
}

@media (max-width: 820px) {
  .workbench-body {
    grid-template-columns: 1fr;
  }
}

.workbench-pane-preview {
  padding: var(--space-6);
  border-right: 1px solid var(--border-subtle);
  background-color: #0b0b0e;
  position: relative;
  display: flex;
  flex-direction: column;
}

.workbench-pane-inspect {
  padding: var(--space-6);
  background-color: var(--bg-surface);
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* Box Model Visualizer Component */
.box-model-diagram {
  margin: auto;
  width: 100%;
  max-width: 380px;
  border: 1px dashed var(--prism-amber);
  background-color: rgba(245, 158, 11, 0.05);
  padding: 18px;
  position: relative;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
}

.box-model-margin-label {
  position: absolute;
  top: 3px;
  left: 6px;
  color: var(--prism-amber);
  text-transform: uppercase;
  font-weight: 600;
}

.box-model-border {
  border: 1px solid var(--prism-blue);
  background-color: rgba(59, 130, 246, 0.08);
  padding: 18px;
  position: relative;
}

.box-model-border-label {
  position: absolute;
  top: 3px;
  left: 6px;
  color: var(--prism-blue-light);
  text-transform: uppercase;
  font-weight: 600;
}

.box-model-padding {
  border: 1px dashed var(--prism-violet);
  background-color: rgba(139, 92, 246, 0.08);
  padding: 22px;
  position: relative;
}

.box-model-padding-label {
  position: absolute;
  top: 3px;
  left: 6px;
  color: var(--prism-violet);
  text-transform: uppercase;
  font-weight: 600;
}

.box-model-content {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  padding: 16px;
  color: var(--text-primary);
  font-weight: 600;
}

/* Metric / Telemetry Rows */
.telemetry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.telemetry-row:last-child {
  border-bottom: none;
}

.telemetry-key {
  color: var(--text-tertiary);
}

.telemetry-val {
  color: var(--text-primary);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   10. AST Intelligence & Blast Radius Visualization
   -------------------------------------------------------------------------- */
.tree-node-list {
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.8;
}

.tree-node-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
}

.tree-node-item.highlighted {
  color: var(--prism-blue-light);
  background-color: var(--prism-blue-dim);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border-left: 2px solid var(--prism-blue);
}

.tree-node-item .node-badge {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 2px;
  text-transform: uppercase;
  font-weight: 600;
}

.node-route {
  background-color: var(--prism-emerald-dim);
  color: var(--prism-emerald);
}

.node-fn {
  background-color: var(--prism-violet-dim);
  color: var(--prism-violet);
}

.node-schema {
  background-color: var(--prism-amber-dim);
  color: var(--prism-amber);
}

/* --------------------------------------------------------------------------
   11. Structured Comparative Matrix Table
   -------------------------------------------------------------------------- */
.comparison-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--text-sm);
}

.comparison-table th, 
.comparison-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.comparison-table th {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.comparison-table .col-prism {
  background-color: rgba(59, 130, 246, 0.03);
  border-left: 1px solid var(--border-medium);
  border-right: 1px solid var(--border-medium);
}

.comparison-table th.col-prism {
  background-color: var(--prism-blue-dim);
  color: var(--prism-blue-light);
  border-top: 2px solid var(--prism-blue);
}

/* --------------------------------------------------------------------------
   12. Agent Grid & Ecosystem Pill Matrix
   -------------------------------------------------------------------------- */
.agent-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.agent-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.agent-pill:hover {
  border-color: var(--border-prominent);
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

.agent-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--prism-blue);
}

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
  background-color: var(--bg-canvas);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

/* --------------------------------------------------------------------------
   14. Utility Classes
   -------------------------------------------------------------------------- */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-blue      { color: var(--prism-blue-light); }
.text-emerald   { color: var(--prism-emerald); }
.text-amber     { color: var(--prism-amber); }

.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
