/* ==========================================================================
   StackRadar Pop & Motion Layer
   Smooth Animations, Auto-Scrolling Marquees, Sticky Headers, GitHub Stars & Micro-interactions
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. STICKY GLASSMORPHIC HEADER
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  background: rgba(247, 250, 249, 0.88) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid rgba(221, 231, 229, 0.85) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="dark"] .site-header {
  background: rgba(13, 28, 32, 0.88) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.site-header.is-scrolled {
  box-shadow: 0 10px 30px -10px rgba(13, 28, 32, 0.12), 0 1px 0 rgba(38, 126, 115, 0.15) !important;
}

[data-theme="dark"] .site-header.is-scrolled {
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(125, 205, 191, 0.15) !important;
}

.site-header .header-inner {
  height: 80px !important;
  transition: height 0.3s ease;
}

.site-header.is-scrolled .header-inner {
  height: 68px !important;
}

/* --------------------------------------------------------------------------
   2. TOP ANNOUNCEMENT TICKER / TEXT SCROLL
   -------------------------------------------------------------------------- */
.announcement {
  background: #091316 !important;
  color: #d1fae5 !important;
  overflow: hidden !important;
  border-bottom: 1px solid rgba(125, 205, 191, 0.15) !important;
}

.announcement .ticker-wrap {
  width: 100%;
  overflow: hidden;
  height: 36px;
  display: flex;
  align-items: center;
}

.announcement .ticker-content {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  white-space: nowrap;
  animation: tickerSlide 40s linear infinite;
  will-change: transform;
}

.announcement:hover .ticker-content {
  animation-play-state: paused;
}

@keyframes tickerSlide {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #ecfdf5;
}

.ticker-item a {
  color: #34d399;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ticker-sep {
  color: #059669;
  font-size: 14px;
  opacity: 0.7;
}

/* Live dot pulsing animation */
.live-dot.pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.7);
  animation: radarDotPulse 1.8s infinite;
}

@keyframes radarDotPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --------------------------------------------------------------------------
   3. DYNAMIC HERO ROTATING TEXT
   -------------------------------------------------------------------------- */
.hero-heading {
  font-size: clamp(48px, 6vw, 76px) !important;
  line-height: 1.05 !important;
  letter-spacing: -0.06em !important;
  font-weight: 800 !important;
  margin: 20px 0 24px !important;
}

.dynamic-rotate-wrap {
  display: inline-block;
  position: relative;
  min-height: 1.1em;
  vertical-align: bottom;
}

.dynamic-rotate-keyword {
  display: inline-block;
  color: #059669;
  background: linear-gradient(135deg, #059669 0%, #10b981 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: italic;
  font-family: Georgia, serif;
  font-weight: 500;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

[data-theme="dark"] .dynamic-rotate-keyword {
  background: linear-gradient(135deg, #34d399 0%, #6ee7b7 50%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dynamic-rotate-keyword.word-exit {
  opacity: 0;
  transform: translateY(-16px) scale(0.96);
}

.dynamic-rotate-keyword.word-enter {
  opacity: 0;
  transform: translateY(16px) scale(0.96);
}

/* --------------------------------------------------------------------------
   4. INFINITE AUTO-SCROLLING MARQUEE RAIL ("LIVE SIGNALS")
   -------------------------------------------------------------------------- */
.auto-marquee-section {
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  position: relative;
}

.auto-marquee-section::before,
.auto-marquee-section::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 2;
  pointer-events: none;
}

.auto-marquee-section::before {
  left: 0;
  background: linear-gradient(to right, var(--surface) 20%, transparent 100%);
}

.auto-marquee-section::after {
  right: 0;
  background: linear-gradient(to left, var(--surface) 20%, transparent 100%);
}

.marquee-header-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-inline: 48px;
}

.marquee-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.auto-marquee-viewport {
  width: 100%;
  overflow: hidden;
  display: flex;
}

.auto-marquee-track {
  display: flex;
  gap: 16px;
  width: max-content;
  animation: marqueeRoll 42s linear infinite;
  will-change: transform;
}

.auto-marquee-track:hover {
  animation-play-state: paused;
}

@keyframes marqueeRoll {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.marquee-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9999px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(13, 28, 32, 0.04);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.marquee-pill:hover {
  transform: translateY(-2px);
  border-color: #10b981;
  background: var(--surface);
  box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.2);
}

.marquee-pill .tool-avatar {
  width: 26px;
  height: 26px;
  font-size: 10px;
  border-radius: 50%;
  margin: 0;
  flex-shrink: 0;
}

.marquee-pill-name {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.marquee-pill-stars {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 9999px;
  color: #d97706;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

[data-theme="dark"] .marquee-pill-stars {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.45);
}

.marquee-pill-alt {
  font-size: 11px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 10px;
}

/* --------------------------------------------------------------------------
   5. PROMINENT GITHUB STARS ON CARDS
   -------------------------------------------------------------------------- */
.card-top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-bottom: 16px !important;
}

.card-top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.badge-stack {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* High-contrast Gold GitHub Star Badge */
.stars-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 4px 10px !important;
  background: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  border-radius: 9999px !important;
  color: #b45309 !important;
  font-family: var(--mono) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.08) !important;
  transition: all 0.2s ease !important;
}

[data-theme="dark"] .stars-badge {
  background: rgba(245, 158, 11, 0.18) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #fbbf24 !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15) !important;
}

.stars-badge:hover {
  transform: scale(1.05);
  background: rgba(245, 158, 11, 0.2) !important;
}

.stars-badge .star-icon {
  width: 13px !important;
  height: 13px !important;
  color: #f59e0b !important;
  flex-shrink: 0 !important;
  filter: drop-shadow(0 1px 2px rgba(245, 158, 11, 0.3));
}

/* Card bottom prominent star link */
.stars-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #b45309 !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  font-family: var(--mono) !important;
  transition: color 0.2s ease !important;
}

[data-theme="dark"] .stars-link {
  color: #fbbf24 !important;
}

.stars-link:hover {
  color: #f59e0b !important;
  text-decoration: underline !important;
}

.stars-link svg {
  color: #f59e0b !important;
}

/* Spotlight Big Stars Pill */
.spotlight-stars-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 9999px;
  color: #fbbf24;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}

/* --------------------------------------------------------------------------
   6. CARD MOTION, HOVER ELEVATION & BENTO MICRO-INTERACTIONS
   -------------------------------------------------------------------------- */
.tool-card {
  position: relative !important;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.28s ease !important;
  will-change: transform, box-shadow !important;
}

.tool-card:hover {
  transform: translateY(-6px) !important;
  border-color: rgba(38, 126, 115, 0.5) !important;
  box-shadow: 0 20px 40px -15px rgba(13, 28, 32, 0.12), 0 0 0 1px rgba(125, 205, 191, 0.35) !important;
}

[data-theme="dark"] .tool-card:hover {
  border-color: rgba(125, 205, 191, 0.45) !important;
  box-shadow: 0 24px 50px -15px rgba(0, 0, 0, 0.6), 0 0 25px -5px rgba(125, 205, 191, 0.25) !important;
}

.tool-card h3 a {
  transition: color 0.2s ease;
}

.tool-card:hover h3 a {
  color: var(--green);
}

[data-theme="dark"] .tool-card:hover h3 a {
  color: #34d399;
}

/* Project preview zoom effect */
.project-preview {
  overflow: hidden;
}

.project-preview img {
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.tool-card:hover .project-preview img {
  transform: scale(1.04) !important;
}

/* --------------------------------------------------------------------------
   7. RADAR SWEEP & ROTATION ANIMATION (HERO SPOTLIGHT)
   -------------------------------------------------------------------------- */
.radar-art {
  position: relative;
  overflow: hidden;
}

.radar-ray {
  animation: radarRaySweep 4.5s linear infinite !important;
  transform-origin: center center !important;
  will-change: transform;
}

@keyframes radarRaySweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.r1 {
  animation: radarRingPulse 3.5s ease-in-out infinite !important;
}

.r2 {
  animation: radarRingPulse 3.5s ease-in-out 1.2s infinite !important;
}

.r3 {
  animation: radarRingPulse 3.5s ease-in-out 2.4s infinite !important;
}

@keyframes radarRingPulse {
  0% { transform: scale(0.97); opacity: 0.35; }
  50% { transform: scale(1.03); opacity: 0.75; }
  100% { transform: scale(0.97); opacity: 0.35; }
}

.radar-ping {
  animation: radarPingPulse 2.2s infinite !important;
}

.radar-ping.p2 {
  animation-delay: 1.1s !important;
}

@keyframes radarPingPulse {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(125, 205, 191, 0.8); }
  70% { transform: scale(1.5); opacity: 0.7; box-shadow: 0 0 0 14px rgba(125, 205, 191, 0); }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(125, 205, 191, 0); }
}

/* --------------------------------------------------------------------------
   8. PREVIEW RAILS AUTO-DRIFT & ENHANCED TILES
   -------------------------------------------------------------------------- */
.preview-tile {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease, border-color 0.28s ease !important;
  position: relative;
}

.preview-tile:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 18px 36px -10px rgba(13, 28, 32, 0.12), 0 0 0 1px rgba(16, 185, 129, 0.3) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

.preview-tile-stars {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: rgba(13, 28, 32, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 9999px;
  color: #fbbf24;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.preview-tile-stars svg {
  width: 12px;
  height: 12px;
  color: #f59e0b;
}

/* --------------------------------------------------------------------------
   9. CATEGORY TABS & FILTER MICRO-INTERACTIONS
   -------------------------------------------------------------------------- */
.category-tabs > a {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.category-tabs > a:hover {
  transform: translateY(-2px);
  background: var(--soft) !important;
  color: var(--green) !important;
}

.category-tabs > a.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3) !important;
}

/* Search bar pulse on focus */
.hero-search, .discovery-controls .directory-search {
  transition: all 0.25s ease !important;
}

.hero-search:focus-within, .discovery-controls .directory-search:focus-within {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 8px 24px -4px rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
}

/* --------------------------------------------------------------------------
   10. AMBIENT BACKGROUND GLOW
   -------------------------------------------------------------------------- */
body {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.04) 0%, transparent 40%) !important;
  background-attachment: fixed !important;
}

[data-theme="dark"] body {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.09) 0%, transparent 60%),
    radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.06) 0%, transparent 50%) !important;
  background-attachment: fixed !important;
}

/* --------------------------------------------------------------------------
   11. STAGGERED REVEAL ON SCROLL
   -------------------------------------------------------------------------- */
.tool-card, .collection-card, .pricing-card {
  opacity: 1;
}

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

.reveal-card {
  animation: cardEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
