/**
 * Hover Box V2 - Frontend Styles
 * Version: 2.0.0
 */

/* Container Styles */
.hover-box-wrapper {
    width: 100%;
}

.hover-box-grid {
    display: grid;
    width: 100%;
}

/* Individual Box Item */
.hover-box-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #000;
    display: block;
    isolation: isolate;
}

/* Content Position Variations - Not needed anymore since content is absolutely positioned */

/* Link Styles */
.hover-box-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    text-decoration: none;
    color: inherit;
    z-index: 5;
}

.hover-box-item a.hover-box-link {
    text-decoration: none;
}

/* Image Container */
.hover-box-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.hover-box-image img {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.5s ease-out;
    will-change: transform;
}

/* Bottom Overlay with Blur Effect */
.hover-box-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    pointer-events: none;
    transition: all 0.5s ease-out;
}

/* Overlay Position for Top Content */
.hover-box-wrapper[data-content-position="top"] .hover-box-overlay {
    bottom: auto;
    top: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    transform: rotate(180deg);
}

.hover-box-overlay::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
    filter: blur(10px);
}

/* Content Container */
.hover-box-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 120px;
}

/* Content Position for Top */
.hover-box-wrapper[data-content-position="top"] .hover-box-content {
    bottom: auto;
    top: 0;
    justify-content: flex-start;
}

/* Title Styles */
.hover-box-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    color: #ffffff;
    transition: transform 0.5s ease-out;
    position: relative;
}

/* Description (Hidden by Default) */
.hover-box-description {
    margin-top: 15px;
    font-size: 16px;
    line-height: 1.6;
    color: #ffffff;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s ease-out;
    transition-delay: 0.1s;
}

/* Corner Text/Number */
.hover-box-corner {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 4;
    font-weight: 700;
    font-size: 18px;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    border-radius: 4px;
    transition: all 0.5s ease-out;
}

/* Hover States */
.hover-box-item:hover .hover-box-image img {
    transform: scale(1.2);
}

.hover-box-item:hover .hover-box-title {
    transform: translateY(-30px);
}

/* Title shift for top position - moves down instead of up */
.hover-box-wrapper[data-content-position="top"] .hover-box-item:hover .hover-box-title {
    transform: translateY(30px);
}

.hover-box-item:hover .hover-box-description {
    opacity: 1;
    max-height: 200px;
}

.hover-box-item:hover .hover-box-overlay {
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.3));
}

.hover-box-item:hover .hover-box-corner {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.9);
}

/* Animation Classes */
.hover-box-item * {
    transition-property: transform, opacity, max-height, height, background;
    transition-duration: 0.5s;
    transition-timing-function: ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hover-box-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }
    
    .hover-box-content {
        padding: 20px;
        min-height: 100px;
    }
    
    .hover-box-title {
        font-size: 20px;
    }
    
    .hover-box-description {
        font-size: 14px;
    }
    
    .hover-box-corner {
        font-size: 14px;
        padding: 6px 10px;
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .hover-box-item {
        height: 300px !important;
    }
    
    .hover-box-content {
        padding: 15px;
        min-height: 100px;
    }
    
    .hover-box-title {
        font-size: 18px;
    }
}

/* Accessibility */
.hover-box-item:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

/* Smooth Scrolling for the Grid */
.hover-box-grid {
    scroll-behavior: smooth;
}

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

.hover-box-item {
    animation: fadeIn 0.6s ease-out backwards;
}

.hover-box-item:nth-child(1) { animation-delay: 0.1s; }
.hover-box-item:nth-child(2) { animation-delay: 0.2s; }
.hover-box-item:nth-child(3) { animation-delay: 0.3s; }
.hover-box-item:nth-child(4) { animation-delay: 0.4s; }
.hover-box-item:nth-child(5) { animation-delay: 0.5s; }
.hover-box-item:nth-child(6) { animation-delay: 0.6s; }

/* Fix for Safari backdrop-filter */
@supports (-webkit-backdrop-filter: none) {
    .hover-box-overlay {
        -webkit-backdrop-filter: blur(8px);
    }
}

/* Smooth Performance Optimization */
.hover-box-item {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}
