/* =============================================
   Time Space Matter Observer — Main Stylesheet
   Dark Academic Theme
   ============================================= */

:root {
  --bg-primary: #0d0f14;
  --bg-secondary: #131720;
  --bg-card: #1a1f2e;
  --bg-card-hover: #1f2538;
  --bg-elevated: #222840;

  --border: rgba(255,255,255,0.08);
  --border-subtle: rgba(255,255,255,0.04);

  --text-primary: #e8e6e0;
  --text-secondary: #9fa6b8;
  --text-muted: #6b7280;

  /* Dimension colors */
  --time: #60a5fa;
  --time-dark: #1e3a5f;
  --time-glow: rgba(96,165,250,0.15);
  --space: #34d399;
  --space-dark: #0d3326;
  --space-glow: rgba(52,211,153,0.15);
  --matter: #fb923c;
  --matter-dark: #3d1f08;
  --matter-glow: rgba(251,146,60,0.15);
  --observer: #a78bfa;
  --observer-dark: #2d1f4e;
  --observer-glow: rgba(167,139,250,0.15);
  --energy: #f59e0b;
  --energy-dark: #3d2800;
  --energy-glow: rgba(245,158,11,0.15);
  --information: #ec4899;
  --information-dark: #4a1130;
  --information-glow: rgba(236,72,153,0.15);

  --gold: #d4af37;
  --gold-light: #e8c55a;

  --font-serif: 'Palatino Linotype', Palatino, Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-light); }

h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

p { color: var(--text-secondary); margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ---- Layout ---- */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding-bottom: 4rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- Navigation ---- */
.navbar {
  background: rgba(13, 15, 20, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary) !important;
  letter-spacing: 0.02em;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--time), var(--space), var(--matter), var(--observer), var(--energy), var(--information));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  align-items: center;
}

.navbar-nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  white-space: nowrap;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.25rem;
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.5rem 0.5rem;
  min-width: 200px;
  box-shadow: var(--shadow);
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

.nav-dropdown-menu a:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
}

/* ---- Page Header ---- */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.page-header .eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-sans);
}

.page-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.75rem;
}

.page-header .subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 650px;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.25s;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.12);
}

.card-link {
  display: block;
  text-decoration: none;
}

/* ---- Dimension Colors ---- */
.dim-time { color: var(--time); }
.dim-space { color: var(--space); }
.dim-matter { color: var(--matter); }
.dim-observer { color: var(--observer); }
.dim-energy { color: var(--energy); }
.dim-information { color: var(--information); }

.dim-bg-time { background: var(--time-dark); }
.dim-bg-space { background: var(--space-dark); }
.dim-bg-matter { background: var(--matter-dark); }
.dim-bg-observer { background: var(--observer-dark); }
.dim-bg-energy { background: var(--energy-dark); }
.dim-bg-information { background: var(--information-dark); }

.dim-border-time { border-color: var(--time) !important; }
.dim-border-space { border-color: var(--space) !important; }
.dim-border-matter { border-color: var(--matter) !important; }
.dim-border-observer { border-color: var(--observer) !important; }
.dim-border-energy { border-color: var(--energy) !important; }
.dim-border-information { border-color: var(--information) !important; }

.dim-glow-time { box-shadow: 0 0 0 1px var(--time), 0 0 20px var(--time-glow); }
.dim-glow-space { box-shadow: 0 0 0 1px var(--space), 0 0 20px var(--space-glow); }
.dim-glow-matter { box-shadow: 0 0 0 1px var(--matter), 0 0 20px var(--matter-glow); }
.dim-glow-observer { box-shadow: 0 0 0 1px var(--observer), 0 0 20px var(--observer-glow); }
.dim-glow-energy { box-shadow: 0 0 0 1px var(--energy), 0 0 20px var(--energy-glow); }
.dim-glow-information { box-shadow: 0 0 0 1px var(--information), 0 0 20px var(--information-glow); }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

.badge-time { background: rgba(96,165,250,0.15); color: var(--time); }
.badge-space { background: rgba(52,211,153,0.15); color: var(--space); }
.badge-matter { background: rgba(251,146,60,0.15); color: var(--matter); }
.badge-observer { background: rgba(167,139,250,0.15); color: var(--observer); }
.badge-energy { background: rgba(245,158,11,0.15); color: var(--energy); }
.badge-information { background: rgba(236,72,153,0.15); color: var(--information); }
.badge-deterministic { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-non-deterministic { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-single { background: rgba(148,163,184,0.1); color: #94a3b8; }
.badge-multiple { background: rgba(251,191,36,0.15); color: #fbbf24; }
.badge-immediate { background: rgba(148,163,184,0.1); color: #94a3b8; }
.badge-total { background: rgba(167,139,250,0.15); color: var(--observer); }

/* ---- Grid Layouts ---- */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

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

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

/* ---- Dimension Cards (Home) ---- */
.dimension-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  text-decoration: none;
  display: block;
}

.dimension-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.dimension-card.time::before { background: var(--time); }
.dimension-card.space::before { background: var(--space); }
.dimension-card.matter::before { background: var(--matter); }
.dimension-card.observer::before { background: var(--observer); }
.dimension-card.energy::before { background: var(--energy); }
.dimension-card.information::before { background: var(--information); }

.dimension-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.dimension-card:hover.time { box-shadow: var(--shadow), 0 0 40px var(--time-glow); }
.dimension-card:hover.space { box-shadow: var(--shadow), 0 0 40px var(--space-glow); }
.dimension-card:hover.matter { box-shadow: var(--shadow), 0 0 40px var(--matter-glow); }
.dimension-card:hover.observer { box-shadow: var(--shadow), 0 0 40px var(--observer-glow); }
.dimension-card:hover.energy { box-shadow: var(--shadow), 0 0 40px var(--energy-glow); }
.dimension-card:hover.information { box-shadow: var(--shadow), 0 0 40px var(--information-glow); }

.dim-numeral {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  opacity: 0.08;
  position: absolute;
  top: 0.6rem; right: 0.8rem;
  line-height: 1;
}

.dim-icon {
  font-size: 1.6rem;
  margin-bottom: 0.6rem;
  display: block;
}

.dimension-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.dimension-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---- Taxonomy Tree ---- */
.taxonomy-tree { list-style: none; }

.taxonomy-dimension {
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.taxonomy-dim-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.taxonomy-dim-header:hover { background: var(--bg-elevated); }

.taxonomy-dim-header .dim-icon { font-size: 1.2rem; margin: 0; }

.taxonomy-dim-header h2 {
  font-size: 1.2rem;
  flex: 1;
}

.taxonomy-chevron {
  transition: transform 0.3s;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.taxonomy-dimension.open .taxonomy-chevron { transform: rotate(180deg); }

.taxonomy-attributes {
  padding: 0 1.25rem 1.25rem;
  display: none;
}

.taxonomy-dimension.open .taxonomy-attributes { display: block; }

.taxonomy-attribute {
  margin-bottom: 0.75rem;
}

.attr-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.attr-values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.attr-value-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.attr-value-pill:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.2);
}

/* ---- Schools List ---- */

/* Filter bar — horizontal row of dimension toggles */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.filter-dim-group {
  position: relative;
}

.filter-dim-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.filter-dim-toggle:hover,
.filter-dim-toggle.active {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.filter-dim-toggle.has-filters {
  border-color: var(--gold);
  color: var(--gold);
}

.filter-dim-icon { font-size: 1rem; }

.filter-dim-count {
  font-size: 0.75rem;
  color: var(--gold);
}

.filter-dim-arrow {
  font-size: 0.65rem;
  opacity: 0.5;
  transition: transform 0.15s;
}

.filter-dim-toggle.active .filter-dim-arrow { transform: rotate(180deg); }

/* Dropdown panel */
.filter-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  min-width: 260px;
  max-width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.filter-dropdown.open { display: block; }

.filter-attr-section { margin-bottom: 0.6rem; }
.filter-attr-section:last-child { margin-bottom: 0; }

.filter-attr-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.filter-chip {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.filter-chip.selected {
  background: var(--gold);
  border-color: var(--gold);
  color: #0d0f14;
  font-weight: 600;
}

/* Active filter tags */
.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(212,175,55,0.15);
  color: var(--gold);
  border: 1px solid rgba(212,175,55,0.3);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tag:hover {
  background: rgba(212,175,55,0.25);
}

.filter-clear {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-clear:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gold);
  color: #0d0f14;
}

.btn-primary:hover { background: var(--gold-light); color: #0d0f14; }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

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

.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.schools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.school-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  display: block;
  transition: all 0.25s;
  position: relative;
}

.school-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.school-number {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.35rem;
}

.school-card h3 {
  font-size: 1rem;
  font-family: var(--font-serif);
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.school-origin {
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

.school-card p {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.school-attr-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* ---- School Detail ---- */
.school-detail-header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.school-detail-header .school-number-large {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.school-detail-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.5rem;
}

.school-detail-header .origin {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.school-detail-header .description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0;
}

.dimension-section {
  margin-bottom: 1.5rem;
}

.dimension-section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.dimension-section-header h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.attr-table td {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9rem;
}

.attr-table td:first-child {
  color: var(--text-muted);
  width: 50%;
  font-size: 0.825rem;
}

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

.observer-text-block {
  background: var(--observer-dark);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ---- Matrix View ---- */
.matrix-container {
  overflow-x: auto;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 900px;
}

.matrix-table th {
  background: var(--bg-elevated);
  padding: 0.6rem 0.5rem;
  text-align: left;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.matrix-table th:first-child {
  min-width: 180px;
  left: 0;
  z-index: 2;
}

.matrix-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  white-space: nowrap;
}

.matrix-table td:first-child {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  background: var(--bg-secondary);
  position: sticky;
  left: 0;
  z-index: 1;
}

.matrix-table tr:hover td { background: rgba(255,255,255,0.03); }
.matrix-table tr:hover td:first-child { background: var(--bg-elevated); }

.matrix-cell {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

/* ---- Compare View ---- */
.compare-table-wrap {
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.compare-table th {
  padding: 1rem;
  text-align: center;
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--border);
}

.compare-table th a {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.compare-table th .th-number {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: block;
  margin-bottom: 0.25rem;
}

.compare-table th:first-child {
  text-align: left;
  min-width: 180px;
}

.compare-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.compare-table td:first-child {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.8rem;
  background: var(--bg-secondary);
}

.compare-table .row-section td {
  background: var(--bg-elevated);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
}

.compare-table tr.differs td:not(:first-child) {
  background: rgba(251, 191, 36, 0.04);
}

.compare-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.compare-school-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.825rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.compare-school-chip:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.compare-school-chip.selected {
  background: rgba(212,175,55,0.15);
  border-color: var(--gold);
  color: var(--gold);
}

/* ---- Perspective Pages (Scientific, Biblical, Reformed) ---- */
.perspective-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  align-items: start;
}

.perspective-toc {
  position: sticky;
  top: 80px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.perspective-toc h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
}

.toc-list a {
  display: block;
  padding: 0.3rem 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.toc-list a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.perspective-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 80px;
}

.perspective-section h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.attribute-block {
  margin-bottom: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.attribute-block-header {
  padding: 0.6rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 500;
}

.attribute-entry {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 1rem;
  align-items: baseline;
}

.attribute-entry:last-child { border-bottom: none; }

.attribute-entry .entry-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.attribute-entry .entry-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ---- Home Hero ---- */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,175,55,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.15;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #e8e6e0 0%, #9fa6b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.stat-item { text-align: center; }

.stat-number {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  display: block;
  line-height: 1;
  margin-bottom: 0.25rem;
  color: var(--gold);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Section nav on home */
.section-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 700px;
  margin: 2.5rem auto;
}

.section-nav-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.25s;
}

.section-nav-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-2px);
}

.section-nav-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.section-nav-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.section-nav-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---- Definitions ---- */
.def-accordion {
  margin-bottom: 1rem;
}

.def-dim-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.def-dim-header:hover { background: var(--bg-elevated); }

.def-dim-header.open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.def-dim-header h2 { flex: 1; font-size: 1.3rem; }

.def-body {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  padding: 0 1.5rem 1.5rem;
}

.def-body.open { display: block; }

.def-attribute {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.def-attribute:last-child { border-bottom: none; }

.def-attr-name {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  margin-top: 0;
}

.def-value {
  margin-bottom: 0.5rem;
  padding-left: 1rem;
}

.def-value-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  display: inline;
}

.def-value-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: inline;
}

/* ---- Footer ---- */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: auto;
  text-align: center;
}

footer p {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.result-summary {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb span { color: var(--text-muted); }

/* ---- Taxonomy Redesign ---- */
.taxonomy-section {
  margin-bottom: 3rem;
}

.dim-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid currentColor;
  transition: all 0.2s;
}
.dim-pill:hover { opacity: 0.8; }
.dim-pill-time { color: var(--time); background: var(--time-dark); }
.dim-pill-space { color: var(--space); background: var(--space-dark); }
.dim-pill-matter { color: var(--matter); background: var(--matter-dark); }
.dim-pill-observer { color: var(--observer); background: var(--observer-dark); }
.dim-pill-energy { color: var(--energy); background: var(--energy-dark); }
.dim-pill-information { color: var(--information); background: var(--information-dark); }

.taxonomy-dim-banner {
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0;
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom: none;
}

.taxonomy-dim-banner-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.taxonomy-dim-numeral {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: rgba(255,255,255,0.2);
  min-width: 2rem;
}

.taxonomy-dim-glyph {
  font-size: 1.75rem;
}

.taxonomy-dim-title {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.15rem;
}

.taxonomy-dim-tagline {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  margin: 0;
}

.taxonomy-attr-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
}

.taxonomy-attr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.taxonomy-attr-card {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.taxonomy-attr-card:last-child {
  border-right: none;
}

.taxonomy-attr-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.taxonomy-attr-letter {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  min-width: 1.25rem;
}

.taxonomy-attr-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.taxonomy-value-count {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.taxonomy-values {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.taxonomy-value-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.taxonomy-value-pill {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid currentColor;
  color: var(--text-muted);
  min-width: 5rem;
  text-align: center;
}

.taxonomy-value-def {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 1200px) {
  .dim-home-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 0.75rem !important; }
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .dim-home-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 0.75rem !important; }
  .filter-dropdown { min-width: 220px; }
  .perspective-layout { grid-template-columns: 1fr; }
  .perspective-toc { position: static; }
}

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .dim-home-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .navbar-nav { display: none; }
  .nav-toggle { display: block; }
  .navbar-nav.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 60px; left: 0; right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.25rem;
  }
  .nav-divider { display: none; }
  .hero-stats { gap: 1.5rem; flex-wrap: wrap; }
  .attribute-entry { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* =============================================
   Individual Dimension Detail Page
   ============================================= */

.dim-detail-header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.dim-detail-numeral {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 400;
  opacity: 0.5;
  line-height: 1;
}

.dim-detail-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.dim-detail-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 0.5rem;
}

.dim-detail-tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-style: italic;
  font-family: var(--font-serif);
  margin: 0;
}

.dim-debates-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.dim-debate-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-serif);
}

.dim-attr-chips {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dim-attr-chip {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.dim-attr-chip-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  min-width: 100px;
  flex-shrink: 0;
}

.dim-attr-chip-values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dim-attr-value {
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
}

.dim-detail-header--time    { border-bottom-color: rgba(96,165,250,0.35); }
.dim-detail-header--space   { border-bottom-color: rgba(52,211,153,0.35); }
.dim-detail-header--matter  { border-bottom-color: rgba(251,146,60,0.35); }
.dim-detail-header--observer{ border-bottom-color: rgba(167,139,250,0.35); }
.dim-detail-header--energy  { border-bottom-color: rgba(245,158,11,0.35); }
.dim-detail-header--information { border-bottom-color: rgba(236,72,153,0.35); }

/* =============================================
   Dimension Pairs — Index Page
   ============================================= */

.pair-dim-legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.pair-legend-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.badge-dim {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.badge-dim.dim-time    { background: var(--time-dark);     color: var(--time);     border: 1px solid rgba(96,165,250,0.25); }
.badge-dim.dim-space   { background: var(--space-dark);    color: var(--space);    border: 1px solid rgba(52,211,153,0.25); }
.badge-dim.dim-matter  { background: var(--matter-dark);   color: var(--matter);   border: 1px solid rgba(251,146,60,0.25); }
.badge-dim.dim-observer{ background: var(--observer-dark); color: var(--observer); border: 1px solid rgba(167,139,250,0.25); }
.badge-dim.dim-energy  { background: var(--energy-dark);   color: var(--energy);   border: 1px solid rgba(245,158,11,0.25); }
.badge-dim.dim-information { background: var(--information-dark); color: var(--information); border: 1px solid rgba(236,72,153,0.25); }

.pairs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.pair-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: all 0.2s;
}

.pair-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.pair-card-dims {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.pair-dim-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 500;
}

.pair-dim-badge.dim-time    { background: var(--time-glow);     color: var(--time); }
.pair-dim-badge.dim-space   { background: var(--space-glow);    color: var(--space); }
.pair-dim-badge.dim-matter  { background: var(--matter-glow);   color: var(--matter); }
.pair-dim-badge.dim-observer{ background: var(--observer-glow); color: var(--observer); }
.pair-dim-badge.dim-energy  { background: var(--energy-glow);   color: var(--energy); }
.pair-dim-badge.dim-information { background: var(--information-glow); color: var(--information); }

.pair-connector {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.pair-card-title {
  font-size: 1.15rem;
  font-family: var(--font-serif);
  color: var(--text-primary);
  margin: 0;
}

.pair-card-tagline {
  font-size: 0.8rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0;
  font-family: var(--font-sans);
}

.pair-card-intro {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

.pair-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.pair-school-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pair-arrow {
  color: var(--gold);
  font-size: 0.9rem;
  transition: transform 0.2s;
}

.pair-card:hover .pair-arrow {
  transform: translateX(4px);
}

/* =============================================
   Dimension Pairs — Detail Page
   ============================================= */

.pair-detail-header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.pair-detail-badges {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pair-dim-badge--lg {
  font-size: 0.9rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-weight: 500;
}

.pair-detail-times {
  font-size: 1.5rem;
  color: var(--text-muted);
  font-weight: 300;
}

.pair-detail-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.5rem;
}

.pair-detail-tagline {
  font-size: 1rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-sans);
  font-weight: 400;
  margin: 0;
}

.pair-detail-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 3rem;
}

.pair-detail-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.pair-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-family: var(--font-sans);
}

.pair-intro-text {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.pair-tension-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.pair-tension-quote {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
  font-family: var(--font-serif);
}

.pair-questions-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pair-questions-list li {
  padding: 0.85rem 1rem 0.85rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text-secondary);
  position: relative;
}

.pair-questions-list li::before {
  content: '?';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.4rem;
  height: 1.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1.4rem;
  text-align: center;
}

.pair-schools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.pair-school-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}

.pair-school-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  font-family: var(--font-serif);
}

.pair-school-stance {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.pair-synthesis-block {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.pair-synthesis-text {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
  margin: 0;
}

/* Sidebar */
.pair-detail-sidebar {
  position: sticky;
  top: 80px;
}

.pair-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pair-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
}

.pair-sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.pair-sidebar-link.active {
  background: rgba(212,175,55,0.1);
  color: var(--gold);
}

.psn-icons {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1px;
  font-size: 0.85rem;
  min-width: 44px;
}

.psn-title {
  font-size: 0.82rem;
}

.pair-sidebar-dim-link {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.15s;
  margin-bottom: 0.15rem;
}

.pair-sidebar-dim-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.pair-sidebar-dim-link.dim-time    { color: var(--time); }
.pair-sidebar-dim-link.dim-space   { color: var(--space); }
.pair-sidebar-dim-link.dim-matter  { color: var(--matter); }
.pair-sidebar-dim-link.dim-observer{ color: var(--observer); }
.pair-sidebar-dim-link.dim-energy  { color: var(--energy); }
.pair-sidebar-dim-link.dim-information { color: var(--information); }

/* Prev/Next */
.pair-prevnext {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.pair-prevnext-btn {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s;
  max-width: 240px;
}

.pair-prevnext-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.14);
}

.pair-prevnext-next { text-align: right; margin-left: auto; }

.prevnext-dir {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.prevnext-title {
  font-size: 0.9rem;
  color: var(--gold);
  font-family: var(--font-serif);
}

/* Responsive */
@media (max-width: 900px) {
  .pair-detail-body {
    grid-template-columns: 1fr;
  }
  .pair-detail-sidebar {
    position: static;
    order: -1;
  }
}

@media (max-width: 600px) {
  .pairs-grid { grid-template-columns: 1fr; }
  .pair-schools-grid { grid-template-columns: 1fr; }
}

/* =============================================
   All Five Dimensions Page
   ============================================= */

.all-five-header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  border-image: linear-gradient(to right, var(--time), var(--space), var(--matter), var(--observer), var(--energy), var(--information)) 1;
}

.all-five-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.all-five-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  margin-bottom: 0.5rem;
}

.all-five-roles {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.all-five-role-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.all-five-role-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 2.25rem;
  text-align: center;
  margin-top: 0.1rem;
}

.all-five-role-name {
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font-serif);
  margin-bottom: 0.3rem;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Selection */
::selection { background: rgba(212,175,55,0.3); color: var(--text-primary); }

/* ============ Constellation Graph Page ============ */
.graph-page {
  padding-bottom: 3rem;
}

/* --- Filter Bar (above graph) --- */
.graph-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

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

.graph-match-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- Active filter chips --- */
.graph-active-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.graph-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--chip-color, var(--gold));
  color: var(--chip-color, var(--gold));
  white-space: nowrap;
}

.graph-chip .chip-dim {
  opacity: 0.6;
  font-size: 0.7rem;
}

.graph-chip .chip-remove {
  background: none;
  border: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.graph-chip .chip-remove:hover {
  opacity: 1;
}

/* --- Side-by-side layout --- */
.graph-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

/* --- Filter Sidebar --- */
.graph-sidebar {
  width: 280px;
  min-width: 280px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  position: sticky;
  top: 80px;
}

.graph-sidebar.collapsed {
  width: 44px;
  min-width: 44px;
  overflow: hidden;
}

.graph-sidebar.collapsed .graph-dim-section,
.graph-sidebar.collapsed .graph-legend {
  display: none;
}

.graph-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.graph-sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.graph-sidebar-toggle:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.graph-sidebar.collapsed .graph-sidebar-header span {
  display: none;
}

/* --- Sidebar Legend --- */
.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* --- Dimension Sections (accordion) --- */
.graph-dim-section {
  border-bottom: 1px solid var(--border);
}

.graph-dim-section:last-child {
  border-bottom: none;
}

.graph-dim-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dim-color, var(--text-primary));
  text-align: left;
  transition: background 0.15s;
}

.graph-dim-toggle:hover {
  background: rgba(255,255,255,0.03);
}

.graph-dim-icon {
  font-size: 1rem;
}

.graph-dim-name {
  flex: 1;
}

.graph-dim-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--dim-color, var(--gold));
  color: #0d0f14;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
}

.graph-dim-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.graph-dim-body {
  padding: 0 1rem 0.6rem;
}

/* --- Attribute Groups --- */
.graph-attr-group {
  margin-bottom: 0.5rem;
}

.graph-attr-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.graph-attr-pills {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

/* --- Filter Pills --- */
.graph-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.graph-pill .pill-count {
  font-size: 0.6rem;
  opacity: 0.45;
  font-weight: 500;
}

.graph-pill:hover {
  border-color: var(--pill-color, var(--gold));
  color: var(--pill-color, var(--gold));
  background: rgba(255,255,255,0.03);
}

.graph-pill:hover .pill-count {
  opacity: 0.7;
}

.graph-pill.active {
  background: var(--pill-color, var(--gold));
  color: #0d0f14;
  border-color: var(--pill-color, var(--gold));
  font-weight: 600;
}

.graph-pill.active .pill-count {
  opacity: 0.7;
}

/* --- Graph Main Area --- */
.graph-main {
  flex: 1;
  min-width: 0;
}

.graph-wrapper {
  position: relative;
}

.graph-container {
  width: 100%;
  height: 70vh;
  min-height: 500px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  background: #0d0f14;
}

.graph-container canvas {
  border-radius: var(--radius-lg);
}

.graph-info-card {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  pointer-events: none;
  min-width: 160px;
  max-width: 280px;
  z-index: 10;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
}

.graph-info-card .info-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.graph-info-card .info-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.graph-info-card .info-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.graph-info-card .info-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-style: italic;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .graph-layout {
    flex-direction: column-reverse;
  }

  .graph-sidebar {
    width: 100%;
    min-width: 100%;
    max-height: 300px;
    position: static;
  }

  .graph-sidebar.collapsed {
    width: 100%;
    min-width: 100%;
    max-height: 44px;
  }

  .graph-container {
    height: 55vh;
    min-height: 350px;
  }
}

@media (max-width: 480px) {
  .graph-filter-bar {
    gap: 0.5rem;
  }

  .graph-active-chips {
    display: none;
  }
}
