@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@300;400;500;600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --bg-primary: #07090e;
  --bg-secondary: #0c1018;
  --bg-card: rgba(16, 22, 34, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(56, 189, 248, 0.35);
  --accent-cyan: #38bdf8;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: #e2e8f0;
  overflow-x: hidden;
  selection-background-color: rgba(56, 189, 248, 0.25);
  selection-color: #ffffff;
}

::selection {
  background: rgba(56, 189, 248, 0.25);
  color: #ffffff;
}

/* Typography Helpers */
.font-serif-title {
  font-family: var(--font-serif);
}

.font-mono-code {
  font-family: var(--font-mono);
}

/* Glassmorphism Components */
.glass-panel {
  background: rgba(14, 20, 31, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.glass-nav {
  background: rgba(7, 9, 14, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.7) 0%, rgba(11, 15, 25, 0.6) 100%);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(56, 189, 248, 0.1);
}

/* Subtle Ambient Glows */
.ambient-glow-cyan {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, rgba(56, 189, 248, 0) 70%);
  pointer-events: none;
  filter: blur(40px);
}

.ambient-glow-emerald {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.06) 0%, rgba(52, 211, 153, 0) 70%);
  pointer-events: none;
  filter: blur(40px);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: #080b11;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Pulsing Status Dot */
@keyframes subtlePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.6;
  }
}

.status-dot {
  animation: subtlePulse 3s ease-in-out infinite;
}

/* Shimmer Effect for Accent Badges */
@keyframes shimmerAnim {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer-badge {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.03) 100%);
  background-size: 200% 100%;
  animation: shimmerAnim 6s linear infinite;
}

/* Custom Checkbox / Pill Active States */
.category-pill.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  box-shadow: 0 0 15px -3px rgba(56, 189, 248, 0.2);
}

/* Coordinate Grid Overlay on Hero */
.telemetry-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Modal Transitions */
#patent-modal {
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#patent-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#patent-modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ─── Scroll-Reveal Animations ──────────────────────────────────────────── */

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

@keyframes revealLeft {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

@keyframes revealScale {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.reveal {
  opacity: 0;
}

.reveal.visible {
  animation: revealUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.reveal-left.visible {
  animation: revealLeft 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.reveal-right.visible {
  animation: revealRight 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.reveal-scale.visible {
  animation: revealScale 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Stagger delays for grid items */
.stagger-1 { animation-delay: 0.05s !important; }
.stagger-2 { animation-delay: 0.12s !important; }
.stagger-3 { animation-delay: 0.19s !important; }
.stagger-4 { animation-delay: 0.26s !important; }

/* ─── Patent Card Appearance / Filter Animation ──────────────────────────── */

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

@keyframes cardOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.96); }
}

.patent-card-entering {
  animation: cardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ─── Telemetry Counter Typewriter Glow ──────────────────────────────────── */

@keyframes counterFlicker {
  0%, 100% { text-shadow: 0 0 14px rgba(56, 189, 248, 0.5); }
  50%       { text-shadow: 0 0 28px rgba(56, 189, 248, 0.9), 0 0 5px rgba(56, 189, 248, 0.4); }
}

.metric-counter.counting {
  animation: counterFlicker 0.2s ease-in-out infinite;
}

/* ─── Pillar Card Magnetic Hover ─────────────────────────────────────────── */

.pillar-card {
  transform-style: preserve-3d;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
}

/* Disable CSS hover transform for pillar cards — JS handles 3D tilt */
.pillar-card:hover {
  transform: none;
}

/* ─── Section Headers — Scan-line effect ────────────────────────────────── */

@keyframes scanReveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0% 0 0);
  }
}

.scan-reveal.visible {
  animation: scanReveal 0.8s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

/* ─── Patent Vault: Live filter tag flash ───────────────────────────────── */

@keyframes pillFlash {
  0%   { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.5); }
  50%  { box-shadow: 0 0 14px 4px rgba(56, 189, 248, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.category-pill.just-activated {
  animation: pillFlash 0.45s ease-out;
}

/* ─── Canvas hint fade in ───────────────────────────────────────────────── */

@keyframes fadeHint {
  0%   { opacity: 0; transform: translateY(5px); }
  30%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

.canvas-hint {
  animation: fadeHint 4.5s ease-in-out 1.5s 1 forwards;
}

/* ─── Prefers-reduced-motion: disable all animations ───────────────────── */

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-left, .reveal-right, .reveal-scale { opacity: 1 !important; animation: none !important; }
  .metric-counter.counting { animation: none !important; }
  .scan-reveal { clip-path: none !important; animation: none !important; }
  .patent-card-entering { animation: none !important; }
}
