/* === Core Design System === */
.bg-grid {
    background-image:
        linear-gradient(rgba(30, 41, 59, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 41, 59, 0.3) 1px, transparent 1px);
    background-size: 40px 40px;
}
.glow-accent { box-shadow: 0 0 20px rgba(0, 212, 170, 0.15); }
.data-value {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-variant-numeric: tabular-nums;
}
html { scroll-behavior: smooth; }
[x-cloak] { display: none !important; }

/* === Search pulse === */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0); }
    50% { box-shadow: 0 0 0 4px rgba(0, 212, 170, 0.15); }
}
.search-pulse { animation: pulse-glow 2s ease-in-out infinite; }

/* === Skeleton loading === */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}
.skeleton {
    background: #1E293B;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 0.375rem;
}

/* === Page load staged reveal === */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}
.anim-header { animation: slideDown 300ms ease-out both; }
.anim-hero { animation: fadeUp 400ms ease-out both; animation-delay: 100ms; }
.anim-cred { animation: fadeUp 400ms ease-out both; animation-delay: 250ms; }
.anim-search { animation: scaleIn 500ms ease-out both; animation-delay: 400ms; }
.anim-content { animation: fadeUp 400ms ease-out both; animation-delay: 100ms; }

/* === Results entry stagger === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 400ms ease-out both; }
.stagger-1 { animation: fadeIn 400ms ease-out both; animation-delay: 0ms; }
.stagger-2 { animation: fadeIn 400ms ease-out both; animation-delay: 100ms; }
.stagger-3 { animation: fadeIn 400ms ease-out both; animation-delay: 200ms; }
.stagger-4 { animation: fadeIn 400ms ease-out both; animation-delay: 300ms; }
.stagger-5 { animation: fadeIn 400ms ease-out both; animation-delay: 400ms; }

/* === Gauge animations === */
@keyframes gaugeIndicator {
    from { left: 0%; opacity: 0; }
    to { opacity: 1; }
}
.gauge-animated {
    animation: gaugeIndicator 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 200ms;
    opacity: 0;
}

/* === Search input focus === */
.search-input {
    transition: border-color 200ms, box-shadow 200ms;
}
.search-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}
.search-icon {
    transition: color 200ms;
}

/* === Card hover effects === */
.card-hover {
    transition: border-color 200ms, box-shadow 200ms, transform 200ms;
}
.card-hover:hover {
    border-color: rgba(0, 212, 170, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* === Button effects === */
.btn-press { transition: transform 100ms; }
.btn-press:active { transform: scale(0.97); }

/* === Scroll reveal (used with Alpine x-intersect) === */
.reveal-hidden {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}
.reveal-visible {
    opacity: 1;
    transform: translateY(0);
}


/* === Hero gradient glow === */
.hero-glow {
    background: radial-gradient(ellipse at top center, rgba(0, 212, 170, 0.08) 0%, transparent 60%);
}

/* === Glass card === */
.glass-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 212, 170, 0.12);
}

/* === Gradient border (search section) === */
.gradient-border-top {
    border-top: none;
    position: relative;
}
.gradient-border-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00D4AA, transparent);
}

/* === Search clear button === */
.search-clear {
    transition: opacity 150ms, transform 150ms;
}
.search-clear:hover {
    transform: scale(1.15);
}

/* === Chip hover === */
.chip-hover {
    transition: border-color 200ms, color 200ms, transform 200ms, box-shadow 200ms;
}
.chip-hover:hover {
    transform: scale(1.03);
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.15);
}

/* === Custom scrollbar (dropdown) === */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 2px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #00D4AA;
}

/* === Dropdown hover accent === */
.dropdown-item-hover {
    transition: border-left 150ms, background-color 100ms;
    border-left: 3px solid transparent;
}
.dropdown-item-hover.highlighted {
    border-left-color: #00D4AA;
}

/* === Tooltip === */
.tooltip-trigger {
    position: relative;
    cursor: help;
}
.tooltip-trigger .tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1E293B;
    border: 1px solid rgba(0, 212, 170, 0.2);
    color: #94A3B8;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    width: max-content;
    max-width: 240px;
    z-index: 50;
    transition: opacity 200ms, visibility 200ms;
    pointer-events: none;
}
.tooltip-trigger:hover .tooltip-content,
.tooltip-trigger:focus .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* === Scroll progress bar === */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: #00D4AA;
    z-index: 100;
    width: 0%;
    transition: width 50ms linear;
}

/* === Hero gauge needle animation === */
@keyframes needleOscillate {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}
.gauge-needle {
    transform-origin: 90px 90px;
    animation: needleOscillate 4s ease-in-out infinite;
}

/* === Gauge dot pulse === */
@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0); }
    50% { box-shadow: 0 0 8px 3px rgba(0, 212, 170, 0.3); }
}
.gauge-dot-pulse {
    animation: dotPulse 3s ease-in-out infinite;
}

/* === Risk badge entrance === */
@keyframes badgeBounce {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
.badge-entrance {
    animation: badgeBounce 300ms ease-out both;
    animation-delay: 200ms;
}

/* === Data value glow === */
.data-glow {
    text-shadow: 0 0 12px rgba(0, 212, 170, 0.2);
}

/* === Headline tracking === */
.headline-tight {
    letter-spacing: -0.02em;
}

/* === Gradient accent bar === */
.gradient-accent-bar {
    background: linear-gradient(90deg, transparent 0%, currentColor 20%, currentColor 80%, transparent 100%);
    opacity: 0.8;
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        animation-delay: 0ms !important;
    }
}
