/* ==========================================================================
   theme.css — dark operator theme: grid background, surfaces, terminal, reveals
   Memetics · memetics.pro
   ========================================================================== */

/* --------------------------------------------------------------------------
   Grid background — terminal overlay, subtle, non-distracting
   -------------------------------------------------------------------------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(30, 41, 59, 0.55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30, 41, 59, 0.55) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 25%, transparent 78%);
  opacity: 0.7;
}

body > * { position: relative; z-index: 1; }

/* Section-scoped grid — used on hero and CTA bands */
.grid-bg {
  position: relative;
  overflow: hidden;
}

.grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(59, 130, 246, 0.09) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59, 130, 246, 0.09) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 90% 70% at 30% 40%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 30% 40%, #000 0%, transparent 70%);
}

.grid-bg > * { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */

.surface {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.surface-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.band {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.rule {
  height: 1px;
  background: var(--border-subtle);
  border: 0;
  margin: var(--space-md) 0;
}

.rule-accent {
  width: 48px;
  height: 3px;
  background: var(--brand-primary);
  border: 0;
  margin: 1.25rem 0 1.5rem;
}

/* --------------------------------------------------------------------------
   Monospace section labels — // 01 — THE PROBLEM
   -------------------------------------------------------------------------- */

.label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.label-primary { color: var(--brand-primary); }
.label-accent { color: var(--brand-accent); }
.label-success { color: var(--status-success); }

/* Inline monospace chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.4375rem 0.875rem;
  background: var(--bg-surface);
}

.chip-primary { color: var(--brand-primary); border-color: rgba(59, 130, 246, 0.35); }
.chip-accent { color: var(--brand-accent); border-color: rgba(245, 158, 11, 0.35); }
.chip-success { color: var(--status-success); border-color: rgba(34, 197, 94, 0.35); }
.chip-danger { color: var(--status-danger); border-color: rgba(239, 68, 68, 0.35); }

.chip-live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* --------------------------------------------------------------------------
   Terminal blocks
   -------------------------------------------------------------------------- */

.terminal {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.9;
  color: var(--status-success);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.terminal-bar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-default);
}

.terminal-bar .title {
  margin-left: 0.5rem;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.terminal-body {
  padding: 1.25rem 1.25rem 1.375rem;
  overflow-x: auto;
}

.terminal-body .line { white-space: pre; }
.terminal-body .prompt { color: var(--brand-primary); }
.terminal-body .comment { color: var(--text-tertiary); }
.terminal-body .out { color: var(--text-secondary); }
.terminal-body .ok { color: var(--status-success); }
.terminal-body .bad { color: var(--status-danger); }
.terminal-body .warn { color: var(--brand-accent); }

/* --------------------------------------------------------------------------
   Metrics
   -------------------------------------------------------------------------- */

.metric {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.metric-success { color: var(--status-success); }
.metric-primary { color: var(--brand-primary); }
.metric-accent { color: var(--brand-accent); }
.metric-danger { color: var(--status-danger); }

.metric-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Reveal on scroll — progressive enhancement only
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  html.js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 620ms var(--ease), transform 620ms var(--ease);
  }
  html.js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Scrollbar
   -------------------------------------------------------------------------- */

* { scrollbar-color: var(--border-default) var(--bg-base); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
