/**
 * Algolia Search Highlight Styles
 * Version: 1.0.0
 */

/* ============================================
   Keyword Highlight Base Styles
   ============================================ */

.algolia-highlight {
    background-color: #ffeb3b;
    color: #000000;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Hover effect for better interactivity */
.algolia-highlight:hover {
    background-color: #fdd835;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* ============================================
   First Highlight Special Styling
   ============================================ */

.algolia-highlight.first-highlight {
    background-color: #ff9800;
    color: #ffffff;
    font-weight: 600;
    animation: pulse-highlight 1.5s ease-in-out;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
}

.algolia-highlight.first-highlight:hover {
    background-color: #fb8c00;
}

/* ============================================
   Animations
   ============================================ */

@keyframes pulse-highlight {
    0%, 100% {
        background-color: #ff9800;
        transform: scale(1);
    }
    50% {
        background-color: #f57c00;
        transform: scale(1.05);
    }
}

/* Fade-in animation for highlights */
.algolia-highlight {
    animation: fade-in 0.5s ease-in;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   Smooth Scroll Behavior
   ============================================ */

html {
    scroll-behavior: smooth;
}

/* Scroll margin to account for fixed headers */
.algolia-highlight {
    scroll-margin-top: 120px; /* Adjust based on your header height */
}

/* ============================================
   Focus Outline Effect
   ============================================ */

.algolia-highlight.focus-effect {
    outline: 3px solid #ff9800;
    outline-offset: 5px;
    transition: outline 0.3s ease;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .algolia-highlight {
        background-color: transparent !important;
        color: inherit !important;
        font-weight: bold;
        border-bottom: 2px solid #000000;
        box-shadow: none !important;
        animation: none !important;
    }
    
    .algolia-highlight.first-highlight {
        border-bottom: 3px double #000000;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
    .algolia-highlight {
        background-color: #fbc02d;
        color: #1a1a1a;
    }
    
    .algolia-highlight:hover {
        background-color: #f9a825;
    }
    
    .algolia-highlight.first-highlight {
        background-color: #ff6f00;
        color: #ffffff;
    }
    
    .algolia-highlight.first-highlight:hover {
        background-color: #e65100;
    }
}

/* ============================================
   Accessibility
   ============================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .algolia-highlight {
        background-color: #ffff00;
        color: #000000;
        border: 2px solid #000000;
    }
    
    .algolia-highlight.first-highlight {
        background-color: #ff6600;
        color: #ffffff;
        border: 3px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .algolia-highlight,
    .algolia-highlight.first-highlight {
        animation: none !important;
        transition: none !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media screen and (max-width: 768px) {
    .algolia-highlight {
        padding: 1px 3px;
        font-size: 0.95em;
        scroll-margin-top: 80px; /* Smaller header on mobile */
    }
}

@media screen and (max-width: 480px) {
    .algolia-highlight {
        scroll-margin-top: 60px;
    }
}
