/* ===== CPULAB — Design System ===== */

:root {
  --bg:       #050810;
  --bg2:      #080d1a;
  --bg3:      #0d1525;
  --surface:  #111927;
  --border:   #1e2d45;
  --border2:  #2a3f5e;
  --green:    #00ff88;
  --cyan:     #00d4ff;
  --orange:   #ff6b35;
  --purple:   #a855f7;
  --pink:     #f472b6;
  --yellow:   #fbbf24;
  --text:     #e2e8f0;
  --text2:    #8899b0;
  --text3:    #4a5a72;
  --mono:     'JetBrains Mono', monospace;
  --sans:     'Space Grotesk', sans-serif;
  --radius:   12px;
  --radius-lg:20px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
  line-height: 1.6;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ===== HERO ===== */
#hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 2rem;
}

.cpu-logo {
  display: inline-block;
  font-family: var(--mono);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  padding: 0.4em 1.2em;
  border: 1px solid var(--green);
  border-radius: 4px;
  margin-bottom: 2rem;
  background: rgba(0, 255, 136, 0.06);
  animation: fadeSlideDown 0.8s ease both;
}

.cpu-logo-owner {
  text-transform: uppercase;
  font-size: 0.65em;
  letter-spacing: 0.35em;
  color: var(--text3);
  margin-bottom: 0.3em;
  text-align: center;
}

.cpu-logo-cpu { color: var(--green); }
.cpu-logo-lab { color: var(--text2); }

.hero-content h1 {
  font-family: var(--sans);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  animation: fadeSlideDown 0.8s 0.15s ease both;
}

.hero-content h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text2);
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  margin-bottom: 2.5rem;
  animation: fadeSlideDown 0.8s 0.3s ease both;
}

.cta-btn {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.85em 2.2em;
  background: transparent;
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeSlideDown 0.8s 0.45s ease both;
}

.cta-btn:hover {
  background: var(--green);
  color: var(--bg);
  box-shadow: 0 0 30px rgba(0, 255, 136, 0.4);
}

.hero-stats {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4rem;
  z-index: 2;
  animation: fadeSlideUp 1s 0.6s ease both;
}

.stat {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-num {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--cyan);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ===== GALLERY ===== */
#gallery {
  min-height: 100vh;
  padding: 5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.gallery-header {
  margin-bottom: 3rem;
}

.gallery-header h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tab {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.5em 1.2em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
}

.tab:hover { border-color: var(--border2); color: var(--text); }

.tab.active {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--cyan);
  color: var(--cyan);
}

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

/* ===== EXHIBIT CARD ===== */
.exhibit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.exhibit-card:hover {
  transform: translateY(-4px);
  border-color: var(--border2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.card-preview {
  width: 100%;
  height: 200px;
  background: var(--bg3);
  overflow: hidden;
  position: relative;
}

.card-preview canvas {
  width: 100% !important;
  height: 100% !important;
}

.card-preview .preview-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  opacity: 0.2;
}

.card-body {
  padding: 1.25rem 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-cat {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.5;
  flex: 1;
}

.card-launch {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.45em 1.1em;
  border-radius: 6px;
  border: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: all 0.15s;
}

.card-launch:hover { opacity: 0.7; }

/* Category accent colors */
.cat-hardware    { color: var(--green); }
.cat-algorithms  { color: var(--cyan); }
.cat-cryptography{ color: var(--orange); }
.cat-chaos       { color: var(--purple); }
.cat-history     { color: var(--yellow); }
.cat-graphics    { color: var(--pink); }
.cat-gametheory  { color: #60a5fa; }
.cat-networking  { color: #34d399; }

.exhibit-card:hover .card-preview { filter: brightness(1.1); }

/* ===== EXHIBIT OVERLAY ===== */
.exhibit-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 8, 16, 0.95);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  animation: overlayIn 0.3s ease;
}

.exhibit-overlay.hidden { display: none; }

.exhibit-chrome {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.exhibit-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
  gap: 1rem;
}

.exhibit-meta { flex: 1; }

.exhibit-cat-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.4rem;
}

.exhibit-overlay-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.exhibit-overlay-desc {
  font-size: 0.88rem;
  color: var(--text2);
  max-width: 60ch;
}

.close-btn {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.close-btn:hover { background: var(--border); color: var(--text); }

.exhibit-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* ===== EXHIBIT INTERNALS ===== */
.exhibit-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.exhibit-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ctrl-btn {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.4em 1em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.ctrl-btn:hover { border-color: var(--border2); background: var(--bg3); }
.ctrl-btn.active { background: rgba(0,212,255,0.1); border-color: var(--cyan); color: var(--cyan); }

.ctrl-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text3);
  white-space: nowrap;
}

.ctrl-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  min-width: 80px;
}

.ctrl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--cyan);
  border-radius: 50%;
  cursor: pointer;
}

.ctrl-select {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.4em 0.8em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  outline: none;
}

.ctrl-select:focus { border-color: var(--cyan); }

.ctrl-input {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.45em 0.9em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  outline: none;
  flex: 1;
  min-width: 0;
  max-width: 400px;
}

.ctrl-input:focus { border-color: var(--cyan); }
.ctrl-input::placeholder { color: var(--text3); }

.exhibit-canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.exhibit-canvas-area canvas {
  position: absolute;
  inset: 0;
}

.full-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== SORTING RACES ===== */
.sorting-arena {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  height: 100%;
  align-items: stretch;
}

.sort-lane {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sort-lane-header {
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sort-lane-name {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.sort-lane-comps {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text3);
}

.sort-lane canvas {
  flex: 1;
  width: 100%;
}

/* ===== PATHFINDING ===== */
.pathfinding-wrap {
  display: flex;
  height: 100%;
  gap: 0;
}

.path-sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
  overflow-y: auto;
}

.path-sidebar h3 {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.path-sidebar .ctrl-btn { width: 100%; justify-content: flex-start; }

.path-legend {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: auto;
}

.path-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text2);
  font-family: var(--mono);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.path-canvas-wrap { flex: 1; position: relative; overflow: hidden; }
.path-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ===== HASH AVALANCHE ===== */
.hash-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 2rem;
  gap: 1.5rem;
  overflow-y: auto;
}

.hash-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.hash-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hash-input-group label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hash-input-group textarea {
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  resize: none;
  height: 80px;
  outline: none;
  transition: border-color 0.15s;
}

.hash-input-group textarea:focus { border-color: var(--cyan); }

.hash-output {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.75rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  word-break: break-all;
  line-height: 1.8;
  min-height: 3rem;
}

.hash-bit-diff {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.hash-bit-diff h3 {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text3);
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.bit-cell {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  transition: background 0.3s;
}

.bit-cell.same { background: rgba(0, 212, 255, 0.15); color: var(--cyan); }
.bit-cell.diff { background: rgba(255, 107, 53, 0.3); color: var(--orange); }

.hash-stats {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.hash-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hash-stat-val {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--orange);
}

.hash-stat-label {
  font-size: 0.75rem;
  color: var(--text3);
  font-family: var(--mono);
}

/* ===== MOORES LAW ===== */
.moores-wrap {
  width: 100%;
  height: 100%;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}

.moores-wrap svg {
  flex: 1;
  width: 100%;
  min-height: 0;
}

/* ===== IK ARM ===== */
.ik-wrap {
  width: 100%;
  height: 100%;
  position: relative;
}

.ik-wrap canvas { width: 100%; height: 100%; display: block; }

.ik-info {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text3);
  pointer-events: none;
}

/* ===== LORENZ ===== */
.lorenz-wrap {
  width: 100%;
  height: 100%;
  position: relative;
}

.lorenz-wrap canvas { width: 100%; height: 100%; display: block; }

.lorenz-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(8, 13, 26, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  backdrop-filter: blur(8px);
}

.lorenz-controls label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text2);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.lorenz-controls span {
  color: var(--cyan);
}

/* ===== CONWAYS LIFE ===== */
.life-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.life-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* ===== BINARY UNIVERSE ===== */
.binary-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.binary-input-bar {
  padding: 0.75rem 1.25rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.binary-canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.binary-canvas-area canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

.exhibit-card { animation: cardIn 0.4s ease both; }

/* stagger cards */
.exhibit-card:nth-child(1)  { animation-delay: 0.05s; }
.exhibit-card:nth-child(2)  { animation-delay: 0.10s; }
.exhibit-card:nth-child(3)  { animation-delay: 0.15s; }
.exhibit-card:nth-child(4)  { animation-delay: 0.20s; }
.exhibit-card:nth-child(5)  { animation-delay: 0.25s; }
.exhibit-card:nth-child(6)  { animation-delay: 0.30s; }
.exhibit-card:nth-child(7)  { animation-delay: 0.35s; }
.exhibit-card:nth-child(8)  { animation-delay: 0.40s; }

/* ===== UTILITY ===== */
.hidden { display: none !important; }

.glow-green { text-shadow: 0 0 20px var(--green); }
.glow-cyan  { text-shadow: 0 0 20px var(--cyan); }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-new { background: rgba(0,255,136,0.15); color: var(--green); border: 1px solid var(--green); }

.tooltip {
  position: absolute;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  pointer-events: none;
  white-space: nowrap;
  z-index: 100;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero-stats { gap: 2rem; }
  .exhibit-grid { grid-template-columns: 1fr; }
  .hash-inputs { grid-template-columns: 1fr; }
  .exhibit-topbar { flex-wrap: wrap; }
  .path-sidebar { display: none; }
}
