/* ============================================================
   Storage Engine — Dark Terminal Aesthetic
   ============================================================ */

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

:root {
  --bg: #0a0a0f;
  --bg-card: rgba(16, 16, 24, 0.7);
  --bg-card-solid: #10101a;
  --border: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(0, 255, 136, 0.15);
  --text: #e4e4e7;
  --text-dim: #71717a;
  --text-muted: #52525b;
  --green: #00ff88;
  --green-dim: #00cc6a;
  --green-bg: rgba(0, 255, 136, 0.08);
  --red: #ff4d6a;
  --yellow: #ffd93d;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --pink: #f472b6;
  --cyan: #22d3ee;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ---------- Animated Background ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
  animation: glowDrift 20s ease-in-out infinite alternate;
}

.bg-glow--1 {
  width: 600px;
  height: 600px;
  top: -200px;
  left: -100px;
  background: var(--green);
  animation-duration: 25s;
}

.bg-glow--2 {
  width: 500px;
  height: 500px;
  bottom: -150px;
  right: -100px;
  background: var(--purple);
  animation-duration: 30s;
  animation-delay: -5s;
}

.bg-glow--3 {
  width: 400px;
  height: 400px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--blue);
  opacity: 0.08;
  animation-duration: 35s;
  animation-delay: -10s;
}

@keyframes glowDrift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -20px) scale(1.05); }
  66%  { transform: translate(-20px, 30px) scale(0.95); }
  100% { transform: translate(10px, 10px) scale(1.02); }
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
}

.nav__icon { font-size: 1.25rem; }

.nav__title {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav__link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav__link:hover { color: var(--green); }

.nav__link--gh {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.03);
}

.nav__link--gh:hover {
  border-color: var(--green);
  background: var(--green-bg);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 6rem 2rem 4rem;
  text-align: center;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease-out;
}

.hero__title {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.8s ease-out 0.1s both;
}

.hero__icon {
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

.hero__subtitle {
  max-width: 640px;
  font-size: 1.15rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 2.5rem;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero__stats {
  display: flex;
  gap: 3rem;
  margin-bottom: 3rem;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.hero__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.hero__stat-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--green);
}

.hero__stat-value--text {
  font-size: 1.4rem;
}

.hero__stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero__actions {
  display: flex;
  gap: 1rem;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero__scroll-hint {
  position: absolute;
  bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  animation: fadeInUp 0.8s ease-out 0.6s both;
}

.hero__scroll-arrow {
  animation: bounce 2s ease-in-out infinite;
  font-size: 1.2rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--green);
  color: #000;
  border-color: var(--green);
  font-weight: 600;
}

.btn--primary:hover {
  background: #00e67a;
  box-shadow: 0 0 24px rgba(0, 255, 136, 0.3);
}

.btn--ghost {
  border-color: var(--border);
  color: var(--text-dim);
}

.btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.btn--accent {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-bg);
}

.btn--accent:hover {
  background: rgba(0, 255, 136, 0.15);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.15);
}

.btn--danger {
  border-color: var(--red);
  color: var(--red);
  background: rgba(255, 77, 106, 0.08);
}

.btn--danger:hover {
  background: rgba(255, 77, 106, 0.15);
  box-shadow: 0 0 16px rgba(255, 77, 106, 0.15);
}

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn__icon { font-size: 1rem; }

/* ---------- Sections ---------- */
.section {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 2rem;
}

.section__header {
  text-align: center;
  margin-bottom: 3rem;
}

.section__tag {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-glow);
  background: var(--green-bg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--green);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.section__title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section__desc {
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 1rem;
}

.section__desc code {
  font-family: var(--font-mono);
  color: var(--green);
  font-size: 0.9em;
  padding: 0.1em 0.4em;
  background: var(--green-bg);
  border-radius: 4px;
}

/* ---------- Panels (Glassmorphism) ---------- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.panel__dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot--red    { background: #ff5f57; }
.dot--yellow { background: #febc2e; }
.dot--green  { background: #28c840; }

.panel__title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  flex: 1;
}

.panel__actions {
  display: flex;
  gap: 0.5rem;
}

.panel__action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: all var(--transition);
}

.panel__action-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- Demo Grid ---------- */
.demo-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---------- Terminal ---------- */
.terminal-panel {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.terminal {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  max-height: 350px;
  scroll-behavior: smooth;
}

.terminal::-webkit-scrollbar {
  width: 6px;
}

.terminal::-webkit-scrollbar-track {
  background: transparent;
}

.terminal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
}

.terminal-prompt {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green);
  margin-right: 0.75rem;
  white-space: nowrap;
  user-select: none;
}

.terminal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  caret-color: var(--green);
}

.terminal-input::placeholder {
  color: var(--text-muted);
}

/* Terminal output lines */
.term-line {
  animation: termLineIn 0.3s ease-out;
}

.term-line--cmd {
  color: var(--text);
}

.term-line--cmd .cmd-prompt {
  color: var(--green);
}

.term-line--cmd .cmd-text {
  color: var(--text);
}

.term-line--ok {
  color: var(--green);
}

.term-line--err {
  color: var(--red);
}

.term-line--info {
  color: var(--blue);
}

.term-line--warn {
  color: var(--yellow);
}

.term-line--system {
  color: var(--purple);
}

.term-line--dim {
  color: var(--text-muted);
}

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

/* ---------- Action Bar ---------- */
.action-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ---------- KV Table ---------- */
.kv-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.kv-count, .log-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.kv-table-wrap {
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
}

.kv-table-wrap::-webkit-scrollbar {
  width: 6px;
}

.kv-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.kv-table th {
  text-align: left;
  padding: 0.6rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card-solid);
  z-index: 1;
}

.kv-table td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: all var(--transition);
}

.kv-table tr {
  transition: background var(--transition);
}

.kv-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.kv-table .key-cell {
  color: var(--cyan);
  font-weight: 500;
}

.kv-table .value-cell {
  color: var(--text);
}

.kv-table .offset-cell {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.kv-table .size-cell {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.kv-row-enter {
  animation: kvRowIn 0.4s ease-out;
}

.kv-row-update {
  animation: kvRowPulse 0.6s ease-out;
}

.kv-row-delete {
  animation: kvRowOut 0.3s ease-out forwards;
}

@keyframes kvRowIn {
  from { opacity: 0; transform: translateX(-10px); background: var(--green-bg); }
  to   { opacity: 1; transform: translateX(0); background: transparent; }
}

@keyframes kvRowPulse {
  0%  { background: rgba(0, 255, 136, 0.15); }
  100% { background: transparent; }
}

@keyframes kvRowOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(10px); }
}

.kv-empty, .log-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.kv-empty__icon, .log-empty__icon {
  font-size: 2rem;
  opacity: 0.5;
}

/* ---------- Log Viewer ---------- */
.log-panel {
  margin-top: 0;
}

.log-viewer {
  padding: 1rem;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-content: flex-start;
}

.log-viewer::-webkit-scrollbar {
  width: 6px;
}

.log-viewer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.log-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  animation: logEntryIn 0.4s ease-out;
  transition: all var(--transition);
  background: rgba(255, 255, 255, 0.02);
}

.log-entry:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.log-entry--put { border-left: 3px solid var(--green); }
.log-entry--del { border-left: 3px solid var(--red); }

.log-entry__seq {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.log-entry__op {
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.log-entry--put .log-entry__op {
  color: var(--green);
  background: var(--green-bg);
}

.log-entry--del .log-entry__op {
  color: var(--red);
  background: rgba(255, 77, 106, 0.1);
}

.log-entry__key { color: var(--cyan); }

.log-entry__value {
  color: var(--text-dim);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-entry--compacted {
  opacity: 0.3;
  text-decoration: line-through;
  border-color: rgba(255, 255, 255, 0.03);
}

.log-entry--removing {
  animation: logEntryOut 0.5s ease-out forwards;
}

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

@keyframes logEntryOut {
  to { opacity: 0; transform: scale(0.8); }
}

/* ---------- Benchmark Cards ---------- */
.bench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.bench-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.bench-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.bench-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.bench-card:hover::before { opacity: 1; }

.bench-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.bench-card__label {
  font-weight: 700;
  font-size: 1rem;
}

.bench-card__badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

.bench-card__value {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.bench-card__number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--green);
}

.bench-card__unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bench-card__bar-wrap {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 1rem;
  overflow: hidden;
}

.bench-card__bar {
  height: 100%;
  border-radius: 3px;
  background: var(--bar-color, var(--green));
  width: 0%;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--bar-color, var(--green));
}

.bench-card__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- Chart Panel ---------- */
.chart-panel {
  margin-top: 0;
}

.chart-container {
  padding: 1.5rem;
  display: flex;
  justify-content: center;
}

#bench-chart {
  width: 100%;
  max-width: 800px;
  height: auto;
}

/* ---------- Architecture ---------- */
.arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.arch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--transition);
  position: relative;
}

.arch-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.arch-card__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.arch-card__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.arch-card__desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.arch-card__desc code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--cyan);
  padding: 0.1em 0.35em;
  background: rgba(34, 211, 238, 0.08);
  border-radius: 3px;
}

.arch-card__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-glow);
  color: var(--green-dim);
  background: var(--green-bg);
}

/* ---------- Flow Diagram ---------- */
.flow-panel { margin-top: 0; }

.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 2.5rem 1rem;
  flex-wrap: wrap;
}

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  min-width: 120px;
  transition: all var(--transition);
}

.flow-node:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.flow-node__icon { font-size: 1.5rem; }
.flow-node__label { font-weight: 600; font-size: 0.9rem; }
.flow-node__sub { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }

.flow-node--client { border-color: rgba(96, 165, 250, 0.3); }
.flow-node--engine { border-color: rgba(0, 255, 136, 0.3); }
.flow-node--index  { border-color: rgba(167, 139, 250, 0.3); }
.flow-node--log    { border-color: rgba(255, 217, 61, 0.3); }

.flow-arrow {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
}

.flow-arrow__line {
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, var(--border), rgba(255, 255, 255, 0.15));
}

.flow-arrow__head {
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-left: -4px;
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
}

.footer__content {
  max-width: 600px;
  margin: 0 auto;
}

.footer__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.footer__icon { font-size: 1.25rem; }

.footer__text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.footer__links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color var(--transition);
}

.footer__link:hover { color: var(--green); }

.footer__divider {
  width: 60px;
  height: 1px;
  background: var(--border);
  margin: 1.5rem auto;
}

.footer__credit {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer__credit strong {
  color: var(--text-dim);
  font-weight: 600;
}

/* ---------- Crash Overlay ---------- */
.crash-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(255, 0, 0, 0.05);
  pointer-events: none;
  animation: crashFlash 0.6s ease-out forwards;
}

@keyframes crashFlash {
  0%   { background: rgba(255, 77, 106, 0.2); }
  20%  { background: rgba(255, 77, 106, 0); }
  40%  { background: rgba(255, 77, 106, 0.12); }
  60%  { background: rgba(255, 77, 106, 0); }
  80%  { background: rgba(255, 77, 106, 0.05); }
  100% { background: rgba(255, 77, 106, 0); opacity: 0; }
}

/* Compaction glow effect */
.compact-glow {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  animation: compactGlow 0.8s ease-out forwards;
}

@keyframes compactGlow {
  0%   { background: rgba(0, 255, 136, 0.08); }
  50%  { background: rgba(0, 255, 136, 0.03); }
  100% { background: transparent; opacity: 0; }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40%  { transform: translateY(6px); }
  60%  { transform: translateY(3px); }
}

/* Reveal animation for sections */
.section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .demo-grid {
    grid-template-columns: 1fr;
  }

  .hero__stats {
    gap: 1.5rem;
  }

  .flow-diagram {
    flex-direction: column;
    gap: 0.5rem;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }

  .nav__links {
    gap: 0.75rem;
  }

  .nav__link:not(.nav__link--gh) {
    display: none;
  }
}

@media (max-width: 600px) {
  .hero__title {
    font-size: 2.5rem;
  }

  .hero__stats {
    flex-direction: column;
    gap: 1rem;
  }

  .hero__actions {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
  }

  .btn {
    justify-content: center;
  }

  .action-bar {
    flex-direction: column;
  }

  .section {
    padding: 3rem 1rem;
  }

  .bench-grid {
    grid-template-columns: 1fr;
  }

  .arch-grid {
    grid-template-columns: 1fr;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Selection color */
::selection {
  background: rgba(0, 255, 136, 0.25);
  color: var(--text);
}
