/* ============================================
   John Terminal - Liquid Glass Design System
   Matches Desktop App Aesthetic
   ============================================ */

:root {
  /* Core Colors */
  --bg: #050505;
  --bg-elevated: #0a0a0c;
  --text: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Brand Colors */
  --accent: #a855f7;       /* Purple 500 */
  --accent-light: #c084fc; /* Purple 400 */
  --accent-dark: #7e22ce;  /* Purple 700 */
  
  /* Semantic Colors */
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --orange: #f97316;
  --cyan: #06b6d4;

  /* Glass Tokens */
  --glass-bg: rgba(30, 30, 30, 0.4);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.05);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

/* ============================================
   Utility Classes & Components
   ============================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.text-gradient {
  background: linear-gradient(135deg, #fff 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glass Panel Base - Matches Desktop .glass */
.glass {
  background: rgba(20, 20, 22, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Glass Card - Crisper background for content */
.glass-card {
  background: rgba(15, 15, 18, 0.8);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  transition: transform 0.2s, border-color 0.2s;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Glass Border Effect */
.glass-border-gradient {
  position: relative;
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  z-index: 1;
}

.glass-border-gradient::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 13px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: -1;
}

/* Glass Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-primary {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.9) 0%, rgba(126, 34, 206, 0.9) 100%);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: white;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 1) 0%, rgba(126, 34, 206, 1) 100%);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  backdrop-filter: blur(8px);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ============================================
   Background Effects
   ============================================ */

.liquid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: #050505;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: float 20s infinite ease-in-out;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: var(--accent-dark);
  top: -100px;
  left: 20%;
  animation-duration: 25s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: #1e3a8a; /* Dark Blue */
  bottom: -100px;
  right: 10%;
  animation-duration: 30s;
  animation-delay: -5s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: #0f766e; /* Dark Cyan */
  top: 40%;
  left: -100px;
  animation-duration: 35s;
  animation-delay: -10s;
}

/* Grid Overlay */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
  pointer-events: none;
  animation: pulse-grid 8s ease-in-out infinite alternate;
}

/* Data Stream Effect - Vertical lines moving up */
.grid-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 39px,
    rgba(168, 85, 247, 0.1) 40px
  );
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
  animation: scan-vertical 3s linear infinite;
  opacity: 0.3;
}

@keyframes scan-vertical {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 0.5; }
  80% { opacity: 0.5; }
  100% { transform: translateY(-40px); opacity: 0; }
}

@keyframes pulse-grid {
  0% { opacity: 0.5; transform: scale(1); }
  100% { opacity: 0.8; transform: scale(1.02); }
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(30px, -50px); }
  66% { transform: translate(-20px, 20px); }
}

/* ============================================
   Navigation
   ============================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 0;
  transition: padding 0.3s;
  animation: fade-down 0.8s ease-out;
}

.nav.scrolled {
  padding: 12px 0;
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 18px;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
  padding: 180px 0 100px;
  text-align: center;
  position: relative;
  perspective: 2000px;
}

.hero h1 {
  font-size: clamp(48px, 6vw, 80px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 24px;
  opacity: 0;
  animation: fade-up 0.8s ease-out forwards;
  animation-delay: 0.2s;
}

.hero p {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 48px;
  opacity: 0;
  animation: fade-up 0.8s ease-out forwards;
  animation-delay: 0.4s;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 80px;
}

/* Terminal Mockup */
.terminal-window {
  max-width: 1000px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 20px 50px -10px rgba(0, 0, 0, 0.5),
    0 0 100px -20px rgba(168, 85, 247, 0.2);
  
  /* Initial state for animation */
  opacity: 0;
  transform: translateY(40px) scale(0.95);
  
  /* Animation */
  animation: tilt-in 1s ease-out forwards;
  animation-delay: 0.6s;
  
  /* 3D Properties for mouse interaction */
  transform-style: preserve-3d;
  will-change: transform;
  /* Smooth reset transition */
  transition: transform 0.1s cubic-bezier(0.2, 0.4, 0.6, 1);
}

.window-header {
  height: 40px;
  background: rgba(20, 20, 22, 0.9);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--glass-border);
  gap: 8px;
}

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

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

.window-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.window-content {
  background: rgba(10, 10, 12, 0.8);
  padding: 2px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 300px 200px;
  gap: 2px;
}

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

@keyframes fade-down {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tilt-in {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Mockup Panels */
.mock-panel {
  background: #131315;
  border-radius: 6px;
  padding: 16px;
  overflow: hidden;
  position: relative;
}

.mock-panel.chart { grid-row: span 2; }
.mock-panel.orderbook { }
.mock-panel.trades { }

.panel-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Chart Mock Visualization */
.chart-viz {
  width: 100%;
  height: 100%;
  position: relative;
}

.candle {
  width: 8px;
  position: absolute;
  bottom: 20%;
  border-radius: 2px;
}
.candle.up { background: var(--green); }
.candle.down { background: var(--red); }

/* Live Candle Animation */
.candle:last-child {
  animation: live-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

@keyframes live-pulse {
  0%, 100% { height: 55%; bottom: 45%; }
  50% { height: 58%; bottom: 42%; }
}

/* ============================================
   Bento Grid Section
   ============================================ */

.features {
  padding: 120px 0;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 64px;
}

.bento-card {
  padding: 32px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.bento-card.wide {
  grid-column: span 2;
}

.bento-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--accent-light);
}

.bento-card h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
}

.bento-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

/* ============================================
   Markets Strip
   ============================================ */

.markets {
  padding: 60px 0;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.01);
}

.market-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}

.market-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.2s;
}

.market-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15);
}

.market-icon-sm {
  width: 20px;
  height: 20px;
}

/* ============================================
   Footer
   ============================================ */

footer {
  padding: 80px 0 40px;
  border-top: 1px solid var(--glass-border);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text);
}

.copyright {
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
  .window-content {
    grid-template-columns: 1fr;
    grid-template-rows: 250px 200px 200px;
  }
  .mock-panel.chart { grid-row: auto; }
  
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bento-card.wide { grid-column: span 2; }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 40px; }
  .bento-grid { grid-template-columns: 1fr; }
  .bento-card.wide { grid-column: auto; }
  .footer-content {
    flex-direction: column;
    gap: 32px;
  }
  .nav-links { display: none; }
}
