/* ============================================================================
   IMAGE COMPONENT STYLES
   Template Factory — 75-image-component.css
   ========================================================================= */

/**
 * Base Image Wrapper
 * - Contains image with aspect ratio control
 * - Prevents layout shift (CLS)
 */
.image-wrapper {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
}

.image-wrapper img,
.image-wrapper picture {
    display: block;
    width: 100%;
    height: auto;
}

/**
 * Aspect Ratios
 * - Maintains proportions regardless of container width
 */
.image-wrapper--16-9 {
    aspect-ratio: 16 / 9;
}

.image-wrapper--4-3 {
    aspect-ratio: 4 / 3;
}

.image-wrapper--3-2 {
    aspect-ratio: 3 / 2;
}

.image-wrapper--1-1,
.image-wrapper--square {
    aspect-ratio: 1 / 1;
}

.image-wrapper--2-3,
.image-wrapper--portrait {
    aspect-ratio: 2 / 3;
}

.image-wrapper--3-4 {
    aspect-ratio: 3 / 4;
}

.image-wrapper--9-16 {
    aspect-ratio: 9 / 16;
}

.image-wrapper--21-9,
.image-wrapper--ultrawide {
    aspect-ratio: 21 / 9;
}

.image-wrapper--landscape {
    aspect-ratio: 16 / 9;
}

/**
 * Rounded Variants
 */
.image-wrapper--rounded {
    border-radius: var(--radius-lg);
}

.image-wrapper--rounded img {
    border-radius: inherit;
}

.image-wrapper--circle {
    border-radius: 50%;
    aspect-ratio: 1 / 1;
}

.image-wrapper--circle img {
    border-radius: 50%;
}

/* Circle with white border ring (for use on coloured backgrounds) */
.image-wrapper--circle-bordered {
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.9);
}

.image-wrapper--circle-bordered img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/**
 * Object Fit Options
 */
.image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image--contain {
    object-fit: contain;
}

.image--fill {
    object-fit: fill;
}

.image--none {
    object-fit: none;
}

.image--scale-down {
    object-fit: scale-down;
}

/**
 * Image Figure (with caption)
 */
.image-figure {
    margin: 0;
}

.image-caption {
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-align: center;
}

/**
 * Responsive Image Helpers
 */
.image-responsive {
    max-width: 100%;
    height: auto;
}

/**
 * Image Overlay (for cards, heroes)
 */
.image-wrapper--overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.6) 100%
    );
    pointer-events: none;
}

/**
 * Loading State (skeleton)
 */
.image-wrapper--loading {
    background: linear-gradient(
        90deg,
        var(--bg-surface-alt) 0%,
        var(--bg-elevated) 50%,
        var(--bg-surface-alt) 100%
    );
    background-size: 200% 100%;
    animation: image-loading 1.5s ease-in-out infinite;
}

@keyframes image-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/**
 * Error State
 */
.image-wrapper--error {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-alt);
    color: var(--text-muted);
    min-height: 200px;
}

.image-wrapper--error::before {
    content: '🖼️';
    font-size: 3rem;
    opacity: 0.5;
}

/**
 * vid-bg: Background Video
 * Используется в slot--background для видео-фона секции.
 * Абсолютное позиционирование задаётся через slot--background в 50-layouts.css.
 */
.vid-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
