/* ===================================
   CRESTVIEW CAPITAL - MAIN STYLES
   =================================== */

/* CSS Variables */
:root {
  /* Light Mode Colors */
  --color-bg: #ffffff;
  --color-surface: #f9fafb;
  --color-border: #e5e7eb;
  --color-text: #111827;
  --color-text-muted: #6b7280;

  /* Brand Colors */
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-accent-purple: #667eea;
  --color-accent-indigo: #764ba2;
}

.dark {
  /* Dark Mode Colors */
  --color-bg: #0f1117;
  --color-surface: #1a1d29;
  --color-elevated: #242834;
  --color-border: #2d3142;
  --color-text: #ffffff;
  --color-text-muted: #9ca3af;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Sora", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Dark Mode Scrollbar */
.dark ::-webkit-scrollbar-track {
  background: var(--color-elevated);
}

.dark ::-webkit-scrollbar-thumb {
  background: var(--color-border);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #3d4356;
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-accent-purple)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Gradient Background */
.gradient-bg {
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-accent-purple)
  );
}

/* Glass Effect */
.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass-effect {
  background: rgba(26, 29, 41, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Card Hover Effect */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.dark .card-hover:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Button Animations */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

/* Pulse Animation */
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.pulse-ring {
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* Shimmer Effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Float Animation */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.float {
  animation: float 6s ease-in-out infinite;
}

.float-delayed {
  animation: float 6s ease-in-out 2s infinite;
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* Slide In Animations */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

/* Ticker Animation */
@keyframes ticker {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.ticker-wrapper {
  overflow: hidden;
  white-space: nowrap;
}

.ticker-animate {
  display: inline-flex;
  animation: ticker 30s linear infinite;
  will-change: transform;
}

.ticker-animate:hover {
  animation-play-state: paused;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  padding: 0 1rem;
  white-space: nowrap;
}

/* Image Loading Placeholder */
[data-src] {
  transition: opacity 0.3s ease;
}

[data-src].loaded {
  opacity: 1 !important;
}

/* Loading Spinner */
.spinner {
  border: 3px solid rgba(59, 130, 246, 0.1);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Selection Color */
::selection {
  background-color: var(--color-primary);
  color: white;
}

::-moz-selection {
  background-color: var(--color-primary);
  color: white;
}

/* Focus Styles */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
}

/* Utility Classes */
.text-balance {
  text-wrap: balance;
}

.text-pretty {
  text-wrap: pretty;
}

/* Responsive Typography */
@media (max-width: 640px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 1280px) {
  html {
    font-size: 16px;
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===================================
   HERO AMBIENT ORBS
   =================================== */
@keyframes orb-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(40px, -30px) scale(1.08); }
  66%       { transform: translate(-25px, 22px) scale(0.94); }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
  pointer-events: none;
  z-index: 0;
}
.orb-1 { width: 480px; height: 480px; background: rgba(59,130,246,0.13); top: -120px; left: -80px; animation: orb-drift 12s ease-in-out infinite; }
.orb-2 { width: 560px; height: 560px; background: rgba(102,126,234,0.10); bottom: -140px; right: -100px; animation: orb-drift 16s ease-in-out infinite reverse; }
.orb-3 { width: 320px; height: 320px; background: rgba(139,92,246,0.08); top: 40%; left: 55%; animation: orb-drift 22s ease-in-out infinite 4s; }
.orb-4 { width: 220px; height: 220px; background: rgba(56,189,248,0.07); top: 8%; right: 22%; animation: orb-drift 14s ease-in-out infinite 2s reverse; }

/* ===================================
   HERO 3D FLOATING ASSETS
   =================================== */
.hero-3d {
  position: absolute;
  pointer-events: none;
  will-change: transform;
  mix-blend-mode: screen;
  z-index: 1;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}
.hero-3d-right {
  width: clamp(260px, 32vw, 500px);
  right: -50px;
  top: 50%;
  opacity: 0.88;
}
.hero-3d-left {
  width: clamp(180px, 22vw, 340px);
  left: -30px;
  bottom: 0;
  opacity: 0.65;
}
/* Light mode: near invisible — images designed for dark bg */
html:not(.dark) .hero-3d {
  mix-blend-mode: multiply;
  opacity: 0.07;
}

/* ===================================
   HERO CONTENT STAGGER
   =================================== */
.hero-stagger > * {
  opacity: 0;
  animation: fadeIn 0.75s ease forwards;
}
.hero-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.hero-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.hero-stagger > *:nth-child(3) { animation-delay: 0.35s; }
.hero-stagger > *:nth-child(4) { animation-delay: 0.5s; }
.hero-stagger > *:nth-child(5) { animation-delay: 0.65s; }

/* ===================================
   HOW IT WORKS — CONNECTOR LINE DRAW
   =================================== */
.connector-line {
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.connector-line.drawn {
  transform: scaleX(1);
}

/* ===================================
   SECTION HEADER ANIMATED UNDERLINE
   =================================== */
.animated-underline {
  position: relative;
  display: inline;
}
.animated-underline::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(to right, #3b82f6, #667eea);
  border-radius: 2px;
  transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}
.fade-in .animated-underline::after {
  width: 100%;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
