/* Animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Phosphor icon font-display override for better text rendering during load */
@font-face {
    font-family: "Phosphor";
    font-display: swap;
    src: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.2/src/regular/Phosphor.woff2") format("woff2");
}

/* Alpine.js - Prevent FOUC (Flash of Unstyled Content) */
[x-cloak] {
    display: none !important;
}

/* Stats animations */
.stat {
    animation: fadeInUp 0.6s ease-out forwards;
}

.stat:nth-child(2) {
    animation-delay: 0.2s;
}

.stat:nth-child(3) {
    animation-delay: 0.4s;
}

.stat-value {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s, transform 0.3s;
}

.stat-value.visible {
    opacity: 1;
    transform: scale(1);
}

/* HTMX Loading States */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: flex;
}

.htmx-request.htmx-indicator {
    display: flex;
}

/* HTMX Transitions */
.htmx-swapping {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.htmx-settling {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* Button Transitions */
.btn {
    transition: all 0.3s ease;
}

.btn.active {
    transform: scale(1.05);
}

/* Trust Signal Components */
.badge {
    transition: all 0.2s ease;
}

.badge:hover {
    transform: translateY(-2px);
}

/* Description Toggle */
.description-text {
    transition: all 0.3s ease;
}

.description-text.expanded {
    line-clamp: unset;
    -webkit-line-clamp: unset;
    display: block;
}

.expand-btn {
    transition: all 0.2s ease;
    cursor: pointer;
}

.expand-btn:hover {
    opacity: 0.8;
    transform: translateX(2px);
}

/* Modal Enhancements */
.modal-box {
    animation: slideUp 0.3s ease-out;
}

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

/* Card Enhancements */
.card {
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-4px);
}

/* Verified Badge Pulse */
.badge-success {
    animation: verifiedPulse 2s ease-in-out infinite;
}

@keyframes verifiedPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* price and warranty info box */
.trust-info-box {
    background: linear-gradient(135deg, rgba(var(--pc), 0.05) 0%, rgba(var(--sc), 0.05) 100%);
    border-left: 3px solid hsl(var(--p));
    transition: all 0.2s ease;
}

.trust-info-box:hover {
    border-left-width: 4px;
}

/* Attribute tags with icons */
.attribute-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.attribute-tag:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Accessibility: ensure stats are always visible for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .stat {
        animation: none;
        opacity: 1;
    }

    .stat-value {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .card:hover {
        transform: none;
    }

    .badge:hover {
        transform: none;
    }

    .attribute-tag:hover {
        transform: none;
    }

    .modal-box {
        animation: none;
    }
}
/* -----------------------------------------------------------------------
 * Accessibility: Color contrast fixes
 * DaisyUI dark theme stat-title/stat-desc use base-content at ~60% opacity
 * which fails WCAG AA (4.5:1) contrast ratio on dark backgrounds.
 * Override to use ~85% opacity for sufficient contrast.
 * ----------------------------------------------------------------------- */
.stat-title {
    color: oklch(var(--bc) / 0.85) !important;
}

.stat-desc {
    color: oklch(var(--bc) / 0.82) !important;
}

/* btn-secondary: default DaisyUI dark theme gives ~4.37:1 contrast (needs 4.5:1).
 * Slightly darken the background to pass WCAG AA. */
.btn-secondary {
    --tw-bg-opacity: 1;
    background-color: oklch(42% 0.24 330) !important;
    border-color: oklch(42% 0.24 330) !important;
}
