﻿/* ========== Base Styles & Reset ========== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    opacity: 0.85;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========== Skeleton Loader Animation ========== */
.image-placeholder {
    animation: skeleton-pulse 1.2s ease-in-out infinite;
    background: linear-gradient(135deg, var(--color-skeleton-start) 0%, var(--color-skeleton-end) 100%);
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

@keyframes skeleton-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Стили для загруженных изображений */
.lazy-image {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Состояние ошибки */
.image-placeholder.image-error {
    animation: none;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
}

.image-placeholder.image-error span {
    display: block;
    text-align: center;
    color: var(--color-muted);
    font-size: var(--text-base);
    font-weight: 500;
    padding: var(--spacing-4);
}

/* ========== Плейсхолдеры для изображений (универсальные) ========== */
.image-placeholder--hero {
    aspect-ratio: 1241 / 506;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.image-placeholder--estimate {
    aspect-ratio: 490 / 470;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.image-placeholder--card {
    aspect-ratio: 359 / 362;
}

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

/* ========== Социальные иконки ========== */
.social-placeholder {
    width: 3.25rem;
    height: 3.25rem;
    background: var(--color-border);
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 500;
}