/* ===== TopInv Custom Styles ===== */

/* --- CSS Variables --- */
:root {
  --bull: #00e676;
  --bear: #ff5252;
  --neutral: #9e9e9e;
  --ai-gradient-1: #6366f1;
  --ai-gradient-2: #a855f7;
  --ai-gradient-3: #ec4899;
  --surface-dark: #0f0f0f;
  --card-dark: #16213e;
  --card-alt-dark: #1a1a2e;
}

/* --- Smooth Scroll --- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* --- AI Card Gradient Border --- */
.ai-card {
  position: relative;
  background-clip: padding-box;
}

.ai-card::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    var(--ai-gradient-1),
    var(--ai-gradient-2),
    var(--ai-gradient-3),
    var(--ai-gradient-1)
  );
  background-size: 300% 300%;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradient-shift 6s ease infinite;
  pointer-events: none;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- AI Label --- */
.ai-label {
  background: linear-gradient(135deg, var(--ai-gradient-1), var(--ai-gradient-2));
  color: #fff;
}

/* --- Stock Card Hover --- */
.stock-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stock-card:hover {
  transform: translateY(-1px);
}

.stock-card:active {
  transform: translateY(0);
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Light mode scrollbar */
html:not(.dark) ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

html:not(.dark) ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* --- Hide Scrollbar Utility --- */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* --- Line Clamp --- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Smooth Transitions --- */
* {
  -webkit-tap-highlight-color: transparent;
}

a, button {
  touch-action: manipulation;
}

/* Ensure minimum tap targets */
a, button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Exception for inline elements that should not have min-height */
.stock-card,
p a,
span a,
.ai-label,
[class*="source_tag"],
[class*="signal_badge"] span,
.flex a {
  min-height: unset;
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 8px;
}

html:not(.dark) .skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 25%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.04) 75%
  );
  background-size: 200% 100%;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Fade-in Animation --- */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section {
  animation: fade-in-up 0.4s ease-out;
}

section:nth-child(2) { animation-delay: 0.05s; }
section:nth-child(3) { animation-delay: 0.1s; }
section:nth-child(4) { animation-delay: 0.15s; }
section:nth-child(5) { animation-delay: 0.2s; }

/* --- Snap Scroll for Event Cards --- */
.snap-x {
  scroll-snap-type: x mandatory;
}

.snap-start {
  scroll-snap-align: start;
}

/* --- Progress Bar Animations --- */
[class*="bg-gradient-to-r"] {
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Pulse for Signal Dots --- */
@keyframes signal-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Override Tailwind animate-pulse for signal dots to be subtler */
.animate-pulse {
  animation: signal-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --- No Underline for Links --- */
a.no-underline,
a.no-underline:hover {
  text-decoration: none;
}

/* --- Focus Styles for Accessibility --- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ai-gradient-2);
  outline-offset: 2px;
  border-radius: 8px;
}
