/* ============================================
   REPUBLIC PULSE — DESIGN SYSTEM
   Signal Room direction
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600&display=swap');

:root {
  /* Color tokens — from brand style guide */
  --bg-primary: #000000;
  --bg-panel: #0A0B0D;
  --bg-card: #111214;
  --bg-card-hover: #16181B;
  --border-default: #2A2A2A;
  --border-subtle: #1A1A1A;
  --text-primary: #FFFFFF;
  --text-secondary: #D8D8D8;
  --text-muted: #8A8A8A;
  --text-muted-dim: #6A6A6A;
  --signal-red: #E1373B;
  --signal-red-dim: rgba(225, 55, 59, 0.15);
  --signal-red-glow: rgba(225, 55, 59, 0.4);
  --status-green: #5FBF7A;
  --status-green-dim: rgba(95, 191, 122, 0.15);

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Motion */
  --ease-pulse: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-base: 300ms;
  --duration-slow: 600ms;
}

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

html {
  scroll-behavior: smooth;
}

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

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img { max-width: 100%; display: block; }

/* Focus states — always visible */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--signal-red);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--signal-red);
  color: var(--text-primary);
}

/* ============================================
   PULSE MOTIF — the signature animated element
   ============================================ */

.pulse-line {
  display: block;
  width: 100%;
  height: auto;
}

.pulse-line path {
  stroke: var(--signal-red);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Traveling pulse animation — the "live" heartbeat sweep */
.pulse-line.animated path {
  stroke-dasharray: 12 340;
  stroke-dashoffset: 0;
  animation: pulse-sweep 3.2s linear infinite;
  filter: drop-shadow(0 0 4px var(--signal-red-glow));
}

@keyframes pulse-sweep {
  0% { stroke-dashoffset: 352; }
  100% { stroke-dashoffset: 0; }
}

/* Small live-dot indicator, used next to "live" labels */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal-red);
  box-shadow: 0 0 0 0 var(--signal-red-glow);
  animation: live-ping 2s var(--ease-pulse) infinite;
}

@keyframes live-ping {
  0% { box-shadow: 0 0 0 0 var(--signal-red-glow); }
  70% { box-shadow: 0 0 0 8px rgba(225, 55, 59, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 55, 59, 0); }
}

/* ============================================
   NAV — persistent shell, consistent across pages
   ============================================ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: rgba(10, 11, 13, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.nav-logo .r-mark {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-link {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-pulse);
  position: relative;
  padding: var(--space-2) 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--signal-red);
}

.nav-link.disabled {
  color: var(--text-muted-dim);
  pointer-events: none;
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  background: var(--border-default);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: var(--space-1);
}

/* Mobile bottom tab bar */
.tab-bar {
  display: none;
}

@media (max-width: 768px) {
  .nav-links.desktop-links { display: none; }

  .tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 11, 13, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-2) var(--space-3);
    padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
  }

  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-2);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: color var(--duration-fast) var(--ease-pulse);
  }

  .tab-item.active {
    color: var(--signal-red);
  }

  .tab-item svg {
    width: 22px;
    height: 22px;
  }

  body {
    padding-bottom: 72px;
  }
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  border-radius: 6px;
  transition: all var(--duration-fast) var(--ease-pulse);
  white-space: nowrap;
}

.btn-primary {
  background: var(--signal-red);
  color: var(--text-primary);
}

.btn-primary:hover {
  background: #F04448;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--signal-red-glow);
}

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

.btn-secondary:hover {
  border-color: var(--text-muted);
  background: var(--bg-card);
}

.btn-ghost {
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn:active {
  transform: scale(0.98);
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: var(--space-5);
  transition: border-color var(--duration-base) var(--ease-pulse),
              transform var(--duration-base) var(--ease-pulse);
}

.card:hover {
  border-color: var(--text-muted-dim);
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 640px) {
  .container { padding: 0 var(--space-4); }
}

.section {
  padding: var(--space-9) 0;
}

@media (max-width: 640px) {
  .section { padding: var(--space-7) 0; }
}

/* Fade-up scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-pulse),
              transform var(--duration-slow) var(--ease-pulse);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}
