/* ─── Premium Visual Enhancement Layer ─── */

/* Font stack: Geist → Inter → Manrope → system */
/* Geist loaded via <link> in Layout.astro for performance */
:root {
  --font-sans: 'Geist', 'Inter', 'Manrope', system-ui, -apple-system, sans-serif;
  
  /* Premium color tokens */
  --premium-glow-1: rgba(245, 158, 11, 0.12);
  --premium-glow-2: rgba(139, 92, 246, 0.12);
  --premium-glow-3: rgba(6, 182, 212, 0.10);
  --premium-glass-blur: 24px;
  --premium-transition-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --premium-transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Selection: purple tint */
::selection {
  background: rgba(121, 40, 202, 0.25);
  color: var(--text-primary);
}
html.dark ::selection {
  background: rgba(167, 139, 250, 0.3);
}

/* Focus-visible outline */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Scroll margin for anchor targets */
[id] {
  scroll-margin-top: 72px;
}

/* ─── Card Hover Glow ─── */
.card-glow {
  position: relative;
  transition: transform 0.4s var(--premium-transition-smooth), box-shadow 0.4s var(--premium-transition-smooth);
}
.card-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 112, 243, 0.08), transparent 40%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--premium-transition-smooth);
}
.card-glow:hover::after {
  opacity: 1;
}
.card-glow:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
html.dark .card-glow::after {
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.05), transparent 40%);
}
html.dark .card-glow:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ─── Theme Transition Smoothing ─── */
.theme-transitioning,
.theme-transitioning * {
  transition: background 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease !important;
}

/* ─── Premium Ambience ─── */
.premium-ambience {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.premium-ambience-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.08;
  will-change: transform;
}
.premium-ambience-blob.b1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.5), transparent);
  top: -200px; left: -200px;
  animation: blob-float 20s ease-in-out infinite;
}
.premium-ambience-blob.b2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.4), transparent);
  bottom: -150px; right: -150px;
  animation: blob-float 25s ease-in-out infinite reverse;
}
.premium-ambience-blob.b3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.3), transparent);
  top: 40%; left: 60%;
  animation: blob-float 18s ease-in-out infinite 5s;
}
.premium-ambience-blob.b4 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.3), transparent);
  top: 60%; left: -100px;
  animation: blob-float 22s ease-in-out infinite 3s;
}
html.dark .premium-ambience-blob {
  opacity: 0.12;
}

@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(40px, -50px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(30px, 40px) scale(1.02); }
}

/* ─── Fade-in Animations ─── */
.fade-enter {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.fade-enter.fade-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Trust Cards ─── */
.trust-section {
  padding: 0 0 var(--space-4xl);
}
.trust-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  max-width: 900px;
  margin: 0 auto;
}
@media (max-width: 800px) {
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .trust-grid { grid-template-columns: 1fr; }
}
.trust-card {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glass);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s;
}
.trust-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-level-4);
}
.trust-card-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto var(--space-sm);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 112, 243, 0.1), rgba(121, 40, 202, 0.1));
  color: var(--link);
  transition: transform 0.3s, box-shadow 0.3s;
}
.trust-card:hover .trust-card-icon {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 112, 243, 0.15);
}
.trust-card-icon svg {
  width: 20px;
  height: 20px;
}
.trust-card h3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 2px;
  color: var(--text-primary);
}
.trust-card p {
  font-size: 12px;
  color: var(--text-mute);
  margin: 0;
  line-height: 1.5;
}

/* ─── Button Ripple ─── */
.ripple-btn {
  position: relative;
  overflow: hidden;
}
.ripple-btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple-anim 0.6s ease-out;
  pointer-events: none;
}
@keyframes ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ─── Hero Stat Counter ─── */
.hero-stat-value {
  display: inline-block;
}

/* ─── Premium Empty State ─── */
.ss-empty-enhanced .ss-empty-icon {
  position: relative;
}
.ss-empty-enhanced .ss-empty-icon::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 112, 243, 0.08), transparent);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ss-empty-enhanced .ss-empty-suggestions .ss-quick-chip {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(0, 112, 243, 0.06), rgba(121, 40, 202, 0.06));
  font-weight: 500;
}
.ss-empty-enhanced .ss-empty-suggestions .ss-quick-chip:hover {
  background: linear-gradient(135deg, rgba(0, 112, 243, 0.12), rgba(121, 40, 202, 0.12));
  border-color: rgba(0, 112, 243, 0.15);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 112, 243, 0.1);
}

/* ─── Sub-page card enhancements ─── */
.calc-card {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s;
}
.calc-card:hover .calc-icon {
  transform: scale(1.08);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── Hero stat number counter ─── */
.hero-stat-num {
  transition: opacity 0.3s;
}

/* ─── Bottom spacing for pages ─── */
.premium-spacer {
  height: var(--space-4xl);
}

/* ─── Premium Micro-Interactions ─── */

/* Button press effect */
.btn:active,
.premium-btn:active {
  transform: scale(0.97) !important;
  transition-duration: 0.1s !important;
}

/* Focus ring animation */
.premium-focus-ring {
  position: relative;
}
.premium-focus-ring::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
  pointer-events: none;
  opacity: 0;
}
.premium-focus-ring:focus-visible::before {
  border-color: var(--link);
  opacity: 1;
  box-shadow: 0 0 0 4px rgba(0, 112, 243, 0.15);
}

/* ─── Premium Section Headers ─── */
.section-header-premium {
  position: relative;
  display: inline-block;
}
.section-header-premium::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--finance), var(--health));
  opacity: 0.6;
  transition: width 0.3s var(--premium-transition-smooth);
}
.section-header-premium:hover::after {
  width: 60px;
  opacity: 1;
}

/* ─── Premium Card Hover States ─── */
.premium-card-hover {
  transition: transform 0.4s var(--premium-transition-smooth), 
              box-shadow 0.4s var(--premium-transition-smooth),
              border-color 0.3s;
}
.premium-card-hover:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.1);
}
.premium-card-hover::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(139, 92, 246, 0.05));
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.premium-card-hover:hover::before {
  opacity: 1;
}

/* ─── Premium Gradient Text ─── */
.premium-gradient-text {
  background: linear-gradient(135deg, var(--finance), var(--health-end), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ─── Premium Noise Texture Overlay ─── */
.premium-noise {
  position: relative;
}
.premium-noise::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.02;
  pointer-events: none;
  border-radius: inherit;
  mix-blend-mode: overlay;
}

/* ─── Premium Border Gradient ─── */
.premium-border-gradient {
  position: relative;
  border: none !important;
}
.premium-border-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.3));
  -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;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.premium-border-gradient:hover::before {
  opacity: 1;
}

/* ─── Premium Scroll Progress ─── */
.premium-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--finance), var(--health), var(--violet));
  transform-origin: left;
  transform: scaleX(0);
  z-index: 9999;
  transition: transform 0.1s linear;
}

/* ─── Premium Loading States ─── */
@keyframes premium-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.premium-loading {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: premium-shimmer 1.5s ease-in-out infinite;
}

/* ─── Premium Tooltip ─── */
.premium-tooltip {
  position: relative;
}
.premium-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 12px;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s var(--premium-transition-smooth);
  pointer-events: none;
  z-index: 1000;
}
.premium-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text-primary);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s var(--premium-transition-smooth);
  pointer-events: none;
  z-index: 1000;
}
.premium-tooltip:hover::after,
.premium-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ─── Premium Icon Animation ─── */
@keyframes icon-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(3deg); }
  75% { transform: translateY(4px) rotate(-2deg); }
}
.premium-icon-float {
  animation: icon-float 4s ease-in-out infinite;
}

/* ─── Premium Pulse Effect ─── */
@keyframes premium-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 112, 243, 0.3); }
  50% { box-shadow: 0 0 0 12px rgba(0, 112, 243, 0); }
}
.premium-pulse {
  animation: premium-pulse 2s ease-in-out infinite;
}

/* ─── Premium Glassmorphism Enhanced ─── */
.premium-glass {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(var(--premium-glass-blur));
  -webkit-backdrop-filter: blur(var(--premium-glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
html.dark .premium-glass {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ─── Premium Hover Scale ─── */
.premium-hover-scale {
  transition: transform 0.3s var(--premium-transition-bounce);
}
.premium-hover-scale:hover {
  transform: scale(1.05);
}

/* ─── Premium Text Shadow ─── */
.premium-text-shadow {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
html.dark .premium-text-shadow {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ─── Premium Section Reveal ─── */
.section-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--premium-transition-smooth), transform 0.8s var(--premium-transition-smooth);
}
.section-reveal.section-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Premium Card Tilt ─── */
.browse-calc-card,
.split-card,
.feature-card,
.trust-card {
  transition: transform 0.4s var(--premium-transition-smooth), box-shadow 0.4s var(--premium-transition-smooth);
  transform-style: preserve-3d;
  will-change: transform;
}

/* ─── Premium Gradient Border Animation ─── */
@keyframes gradient-border-rotate {
  0% { --angle: 0deg; }
  100% { --angle: 360deg; }
}

/* ─── Premium Hover Glow Effect ─── */
.hover-glow {
  position: relative;
}
.hover-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--finance), var(--health), var(--violet), var(--finance));
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
  filter: blur(8px);
}
.hover-glow:hover::before {
  opacity: 0.6;
}

/* ─── Premium Button Shine ─── */
.btn-shine {
  position: relative;
  overflow: hidden;
}
.btn-shine::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}
.btn-shine:hover::before {
  left: 100%;
}

/* ─── Premium Focus Ring Enhanced ─── */
.premium-focus-ring:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 4px;
  box-shadow: 0 0 0 8px rgba(0, 112, 243, 0.15);
}

/* ─── Premium Loading Spinner ─── */
@keyframes premium-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.premium-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: premium-spin 0.8s linear infinite;
}

/* ─── Premium Pulse Dot ─── */
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--finance);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ─── Premium Gradient Text Animated ─── */
@keyframes gradient-text-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.premium-gradient-text-animated {
  background: linear-gradient(135deg, var(--finance), var(--health), var(--violet), var(--finance));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-text-flow 4s ease infinite;
}

/* ─── Premium Glassmorphism Hover ─── */
.premium-glass-hover {
  transition: background 0.3s, backdrop-filter 0.3s, border-color 0.3s;
}
.premium-glass-hover:hover {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ─── Premium Image Zoom ─── */
.premium-img-zoom {
  overflow: hidden;
}
.premium-img-zoom img {
  transition: transform 0.5s var(--premium-transition-smooth);
}
.premium-img-zoom:hover img {
  transform: scale(1.1);
}

/* ─── FAQ SECTION ─── */
.faq-section {
  padding: var(--space-4xl) 0;
}
.faq-inner {
  max-width: 800px;
  margin: 0 auto;
}
.faq-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.faq-item {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  overflow: hidden;
  transition: all 0.3s;
}
.faq-item.open {
  box-shadow: var(--shadow-level-3);
}
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  transition: background 0.2s;
}
.faq-question:hover {
  background: var(--bg-card-hover);
}
.faq-icon-emoji {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}
.faq-q-text {
  flex: 1;
  min-width: 0;
}
.faq-chevron {
  flex-shrink: 0;
  color: var(--text-mute);
  transition: transform 0.3s var(--premium-transition-smooth);
}
.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--finance);
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--premium-transition-smooth), padding 0.3s;
}
.faq-item.open .faq-answer {
  max-height: 300px;
}
.faq-answer p {
  margin: 0;
  padding: 0 var(--space-lg) var(--space-lg) calc(var(--space-lg) + 20px + var(--space-sm));
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}
@media (max-width: 600px) {
  .faq-question {
    padding: var(--space-sm) var(--space-md);
    font-size: 14px;
  }
  .faq-answer p {
    padding: 0 var(--space-md) var(--space-md) var(--space-md);
  }
}
