/* Shared terminal design primitives for pages opting in with .terminal-page. */
.terminal-page {
  --bg-void: var(--color-bg);
  --bg-panel: var(--terminal-bg-card, #16161a);
  --bg-elevated: var(--terminal-bg-elevated, #111114);
  --bg-hover: var(--terminal-bg-hover, #1c1c21);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text-muted);
  --text-dim: var(--color-text-dim);
  --accent-gold: var(--color-terracotta, #d4af37);
  --accent-bright: var(--gold-bright, #ffd700);
  --accent-dim: var(--gold-dim, #9a7b2c);
  --accent-glow: var(--gold-glow, rgba(212, 175, 55, 0.4));
  --positive: var(--color-positive, #00d084);
  --negative: var(--color-negative, #ff4757);
  --border: var(--color-border);
  --border-bright: rgba(212, 175, 55, 0.25);
  --font-terminal: "JetBrains Mono", var(--font-mono);
}

.terminal-page body,
body.terminal-page {
  font-family: var(--font-terminal);
  font-size: 14px;
}

.terminal-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

.terminal-page .site-nav {
  z-index: 1000;
}

.terminal-page ::selection {
  background: var(--accent-gold);
  color: var(--bg-void);
}

/* :where() scopes the primitives without inflating their old specificity. */
:where(.terminal-page) .hero {
  min-height: 100vh;
  padding: 100px 24px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

:where(.terminal-page) .hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 500px;
  background: radial-gradient(ellipse at 50% 0, rgba(212, 175, 55, 0.08) 0, transparent 70%);
  pointer-events: none;
}

:where(.terminal-page) .hero-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 60px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  align-items: center;
}

:where(.terminal-page) .hero-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

:where(.terminal-page) .terminal-prompt {
  font-size: 0.85rem;
  color: var(--accent-gold);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-terminal);
}

:where(.terminal-page) .terminal-prompt::before {
  content: ">";
  color: var(--accent-bright);
}

:where(.terminal-page) .cursor {
  display: inline-block;
  width: 8px;
  height: 18px;
  background: var(--accent-gold);
  animation: blink 1s step-end infinite;
  margin-left: 4px;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

:where(.terminal-page) .hero-title {
  font-family: var(--font-terminal);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  color: var(--text-primary);
}

:where(.terminal-page) .hero-title .accent {
  color: var(--accent-gold);
}

:where(.terminal-page) .hero-title .secondary {
  color: var(--text-secondary);
  font-weight: 400;
}

:where(.terminal-page) .hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin-bottom: 32px;
  line-height: 1.8;
}

:where(.terminal-page) .hero-ctas {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

:where(.terminal-page) .btn-primary,
:where(.terminal-page) .cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-gold);
  color: var(--bg-void);
  font-family: var(--font-terminal);
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

:where(.terminal-page) .btn-primary {
  padding: 14px 28px;
  font-size: 0.85rem;
}

:where(.terminal-page) .btn-primary:hover {
  background: var(--accent-bright);
  color: var(--bg-void);
  box-shadow: 0 0 20px var(--accent-glow);
}

:where(.terminal-page) .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-primary);
  padding: 14px 28px;
  font-family: var(--font-terminal);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border-bright);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

:where(.terminal-page) .btn-secondary:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

:where(.terminal-page) .live-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

:where(.terminal-page) .live-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

:where(.terminal-page) .live-indicator {
  width: 8px;
  height: 8px;
  background: var(--positive);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(0, 208, 132, 0.4);
  }

  50% {
    opacity: 0.6;
    box-shadow: 0 0 0 6px rgba(0, 208, 132, 0);
  }
}

:where(.terminal-page) .live-panel-header span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

:where(.terminal-page) .live-stats {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

:where(.terminal-page) a.live-stat {
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

:where(.terminal-page) a.live-stat:hover {
  background: rgba(255, 255, 255, 0.03);
}

:where(.terminal-page) a.live-stat:hover .live-stat-label {
  color: var(--accent-gold);
}

:where(.terminal-page) .live-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}

:where(.terminal-page) .live-stat:last-child {
  border-bottom: none;
}

:where(.terminal-page) .live-stat-label {
  color: var(--text-dim);
  font-size: 0.8rem;
}

:where(.terminal-page) .live-stat-value {
  font-weight: 600;
  color: var(--accent-bright);
}

:where(.terminal-page) .live-stat-value.gold {
  color: var(--accent-gold);
}

:where(.terminal-page) .section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px;
}

:where(.terminal-page) .section-header {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

:where(.terminal-page) .section-title {
  font-family: var(--font-terminal);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

:where(.terminal-page) .section-subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
}

@media (max-width: 1024px) {
  :where(.terminal-page) .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  :where(.terminal-page) .live-panel {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .terminal-page {
    font-size: 13px;
  }

  :where(.terminal-page) .hero {
    padding: 80px 16px 40px;
  }
}

@media (max-width: 480px) {
  :where(.terminal-page) .hero-ctas {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(.terminal-page) .cursor,
  :where(.terminal-page) .live-indicator {
    animation: none;
    opacity: 1;
  }
}

:where(.terminal-page) :focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

:where(.terminal-page) :focus:not(:focus-visible) {
  outline: 0;
}
