/**
 * Project Card Widget Styles
 * Hover effects for image/video transition and text animation
 */

/* Base Project Card Styles */
.project-card-widget {
    position: relative;
    display: block;
    overflow: visible; /* Changed from hidden to visible */
    margin-top: 5px; /* Add top margin to prevent border clipping */
    margin-bottom: 5px; /* Add bottom margin for shadow */
    padding: 10px; /* Ensure enough space for scale effects */
}

.project-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-radius 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid transparent; /* Default transparent border */
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: inherit; /* Keep any custom borders visible */
    /* Allow for custom hover background */
    /* Allow for custom hover border radius */
    /* Allow for custom hover scale */
}

/* Inner Content Box */
.project-card-inner {
    position: relative;
    z-index: 3;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem 0;
}

@media (min-width: 768px) {
    .project-card-inner {
        padding: 1.75rem 1.5rem 0;
    }
}

@media (min-width: 1200px) {
    .project-card-inner {
        padding: 2rem 1.75rem 0;
    }
}

/* Typography Styles */
.project-category {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666666;
    margin-bottom: 0.75rem;
    transition: color 0.3s ease;
}

.project-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 1rem;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.project-location {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #888888;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

.project-location .locationPin {
    width: 12px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
    transition: fill 0.3s ease;
}

.project-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555555;
    margin-bottom: 1.25rem;
    transition: color 0.3s ease;
}

.project-link {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #007cba;
    margin-top: auto;
    margin-bottom: 1.75rem;
    margin-left: 1rem;
    margin-right: 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    position: relative;
    z-index: 4;
}

@media (min-width: 768px) {
    .project-link {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
    }
}

@media (min-width: 1200px) {
    .project-link {
        margin-left: 1.75rem;
        margin-right: 1.75rem;
        margin-bottom: 2rem;
    }
}

/* Show link text on hover */
.project-card:hover .project-link {
    opacity: 1;
    transform: translateY(0);
    /* Custom link hover color will override the default */
}

/* Image Container */
.img-container {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-radius: 0 0 8px 8px;
    margin-top: auto;
}

.project-image,
.project-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.project-image {
    z-index: 2;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.project-video {
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Video appears on hover - Multiple selectors for better compatibility */
.project-card:hover .project-image,
.project-card.is-video-hovering .project-image {
    opacity: 0;
}

.project-card:hover .project-video,
.project-card.is-video-hovering .project-video {
    opacity: 1;
}

/* Force video visibility on hover state */
.project-card:hover .project-video {
    display: block !important;
    visibility: visible !important;
}

/* CSS-Only Video Hover Fallback */
/* This provides video hover functionality even if JavaScript fails */
.project-card:hover .project-video {
    opacity: 1 !important;
    z-index: 3;
}

.project-card:hover .project-image {
    opacity: 0 !important;
}

/* Ensure video is ready for hover */
.project-video {
    pointer-events: none; /* Prevent video from interfering with hover */
}

/* Additional hover state for debugging */
.project-card:hover {
    outline: 2px solid rgba(0, 124, 186, 0.3);
    outline-offset: -2px;
}

/* Force video to show on hover - ultimate fallback */
.project-card:hover .img-container .project-video,
.project-card.force-video-visible .img-container .project-video {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 10 !important;
}

.project-card:hover .img-container .project-image,
.project-card.force-video-visible .img-container .project-image {
    opacity: 0 !important;
    z-index: 1 !important;
}

/* Entrance Animations */
.project-card-widget.animated {
    opacity: 0;
    animation-duration: 0.6s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-out;
}

.project-card-widget.entrance-fadeIn {
    animation-name: fadeInUp;
}

.project-card-widget.entrance-slideUp {
    animation-name: slideUpIn;
}

.project-card-widget.entrance-slideLeft {
    animation-name: slideLeftIn;
}

.project-card-widget.entrance-scaleUp {
    animation-name: scaleUpIn;
}

/* Keyframes for entrance animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUpIn {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideLeftIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleUpIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design - Internal Card Layout */
@media (max-width: 1199px) {
    .project-description {
        display: none !important;
    }
    
    .project-link {
        display: none !important;
    }
    
    .project-card-inner {
        padding-bottom: 1rem;
    }
}

@media (max-width: 991px) {
    .project-title {
        font-size: 1.3rem;
    }
    
    .img-container {
        height: 200px;
    }
    
    .project-card-inner {
        padding: 1.5rem 1.25rem 0;
    }
}

@media (max-width: 767px) {
    .project-title {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }
    
    .project-location {
        margin-bottom: 1rem;
    }
    
    .img-container {
        height: 180px;
    }
    
    .project-card-inner {
        padding: 1.25rem 1rem 0;
    }
    
    .project-card {
        margin-bottom: 1.5rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .project-card {
        background: #1a1a1a;
        box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
    }
    
    .project-card:hover {
        box-shadow: 0 10px 30px rgba(255, 255, 255, 0.15);
    }
    
    .project-title {
        color: #ffffff;
    }
    
    .project-category {
        color: #cccccc;
    }
    
    .project-location {
        color: #aaaaaa;
    }
    
    .project-description {
        color: #bbbbbb;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .project-card {
        border: 2px solid currentColor;
    }
    
    .project-link {
        text-decoration: underline;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .project-card,
    .project-link,
    .project-image,
    .project-video,
    .project-card-widget.animated {
        transition: none;
        animation: none;
    }
    
    .project-card-widget.animated {
        opacity: 1;
        transform: none;
    }
    
    .project-card:hover {
        transform: none;
    }
    
    .project-card:hover .project-link {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .project-video {
        display: none;
    }
    
    .project-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .project-card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Focus Styles for Accessibility */
.project-card-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.project-card-link:focus .project-card {
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3);
}

/* Loading State for Images and Videos */
.project-image[data-loading="true"],
.project-video[data-loading="true"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Elementor Native Layout Support */
.project-card-widget {
    width: 100%;
    max-width: 100%;
}

/* When used in Elementor, the widget will automatically inherit the column width
   set by Elementor's responsive controls (e.g., 100% width on mobile, 50% on tablet, 33% on desktop).
   No Bootstrap grid classes needed - Elementor handles all layout and responsive behavior. */

/* Enhanced Hover Styles Support */
/* These styles provide base support for the new hover controls */

/* Typography hover transitions */
.project-category,
.project-title, 
.project-location,
.project-description,
.project-link {
    transition: color 0.3s ease;
}

/* Card hover state enhancements */
.project-card {
    transition: all 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-radius 0.3s ease;
}

/* Hover effects are defined in the existing .project-card:hover rule above */

/* Enhanced link hover visibility - uses existing hover effect */
/* The project-link hover styles are already defined earlier in the file */

/* Support for hover scale effect */
.project-card-widget {
    /* Ensure enough space for scale effects */
    padding: 10px;
}

/* Icon hover effects */
.project-location .locationPin {
    transition: fill 0.3s ease;
}

.project-card:hover .project-location .locationPin {
    fill: currentColor; /* Will inherit the location hover color */
}
