/**
 * Image Protection & Optimization Styles
 * شركة ركن امجاد - Rukn Amjad Company
 */

/* ================================================
   UNIFORM IMAGE SIZING - ALL IMAGES SAME SIZE
   ================================================ */

/* General image container styling */
.image-container {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Service images - 16:9 aspect ratio */
.service-item img,
.service-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    display: block;
}

/* Project images - 4:3 aspect ratio */
.project-item img,
.project-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    display: block;
}

/* Blog post images - 16:9 aspect ratio */
.blog-item img,
.blog-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    display: block;
}

/* Team member images - Square 1:1 */
.team-item img,
.team-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    display: block;
}

/* Testimonial images - Square */
.testimonial-item img,
.testimonial-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
}

/* Carousel/Slider images - Full width 16:9 */
.carousel-item img,
.carousel-image,
.header-carousel img {
    width: 100%;
    height: 600px;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Gallery images - uniform grid */
.gallery-item img,
.lightbox-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    transition: transform 0.3s ease;
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Detail page featured images */
.featured-image,
.detail-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    display: block;
}

/* Responsive image wrapper */
.responsive-image {
    display: block;
    width: 100%;
    height: auto;
}

.responsive-image img {
    display: block;
    width: 100%;
    height: auto;
}

/* ================================================
   IMAGE PROTECTION - Prevent Copy/Download
   ================================================ */

/* Disable user selection on all images */
img,
.protected-image,
.service-item img,
.project-item img,
.blog-item img,
.team-item img,
.gallery-item img,
.carousel-item img {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto; /* Keep pointer events for clicks */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Prevent text selection on image captions */
.image-caption,
.gallery-caption,
figcaption {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Add watermark overlay (optional) */
.image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(0,0,0,0.05) 100%);
    pointer-events: none;
}

/* Blur effect on hover (optional - for extra protection) */
.protected-image.blur-on-hover:hover {
    filter: blur(2px);
    transition: filter 0.2s ease;
}

/* ================================================
   LAZY LOADING & PERFORMANCE
   ================================================ */

/* Lazy loading placeholder */
img[loading="lazy"] {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Image loading skeleton */
.image-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Blur-up loading effect */
.blur-up {
    filter: blur(10px);
    transition: filter 0.3s ease;
}

.blur-up.loaded {
    filter: blur(0);
}

/* ================================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ================================================ */

@media (max-width: 768px) {
    /* Reduce image heights on mobile */
    .service-item img,
    .service-image {
        height: 200px;
    }
    
    .project-item img,
    .project-image {
        height: 180px;
    }
    
    .blog-item img,
    .blog-image {
        height: 180px;
    }
    
    .carousel-item img,
    .carousel-image,
    .header-carousel img {
        height: 300px;
    }
    
    .gallery-item img {
        height: 150px;
    }
    
    .team-item img,
    .team-image {
        height: 250px;
    }
}

@media (max-width: 576px) {
    /* Further reduce on very small screens */
    .service-item img,
    .service-image {
        height: 180px;
    }
    
    .project-item img,
    .project-image,
    .blog-item img,
    .blog-image {
        height: 160px;
    }
    
    .carousel-item img,
    .carousel-image,
    .header-carousel img {
        height: 250px;
    }
    
    .gallery-item img {
        height: 120px;
    }
}

/* ================================================
   HIGH DPI / RETINA DISPLAY SUPPORT
   ================================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure images stay sharp on retina displays */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ================================================
   WEBP SUPPORT & FALLBACK
   ================================================ */

/* Modern browsers will use WebP format automatically via <picture> */
picture {
    display: block;
    width: 100%;
}

/* ================================================
   PRINT STYLES - Prevent printing images
   ================================================ */

@media print {
    img,
    .protected-image,
    .image-container {
        display: none !important;
    }
}

/* ================================================
   ACCESSIBILITY - Screen readers only
   ================================================ */

.sr-only-image-description {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ================================================
   LOADING STATES
   ================================================ */

.image-loading {
    position: relative;
    background: #f0f0f0;
}

.image-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #ddd;
    border-top-color: #D4AF37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================
   ZOOM EFFECT ON HOVER (OPTIONAL)
   ================================================ */

.zoom-on-hover {
    overflow: hidden;
    position: relative;
}

.zoom-on-hover img {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-on-hover:hover img {
    transform: scale(1.1);
}

/* ================================================
   OVERLAY PROTECTION (INVISIBLE LAYER)
   ================================================ */

.protected-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    cursor: default;
}

