/* card.css - стили для карточек галереи */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: clamp(20px, 3vw, 25px);
    padding: 20px 0;
}

/* Планшеты и мобильные */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        gap: 15px;
        padding: 15px 0;
    }
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 10px 0;
    }
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: var(--transition-normal);
    animation: fadeIn 0.5s ease;
    will-change: transform;
    height: 100%;
    display: flex;
    flex-direction: column;
}

@media (hover: hover) {
    .gallery-item:hover {
        transform: translateY(-8px);
        border-color: var(--accent-color);
        box-shadow: var(--shadow-accent);
    }
}

.gallery-item.featured {
    border: 2px solid var(--accent-color);
    box-shadow: var(--shadow-accent);
}

.gallery-item-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ===== IMAGE ===== */
.gallery-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    /* 4:3 */
    overflow: hidden;
    background: var(--secondary-bg);
    flex-shrink: 0;
}

.gallery-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

@media (hover: hover) {
    .gallery-item:hover .gallery-image-wrapper img {
        transform: scale(1.05);
    }
}

/* ===== FEATURED BADGE ===== */
.featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--accent-color);
    color: white;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: clamp(11px, 2vw, 12px);
    font-weight: 600;
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-md);
    animation: pulse 2s infinite;
    white-space: nowrap;
}

@media (max-width: 576px) {
    .featured-badge {
        top: 8px;
        right: 8px;
        padding: 4px 10px;
        font-size: 10px;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 51, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0);
    }
}

/* ===== INFO ===== */
.gallery-item-info {
    padding: clamp(15px, 3vw, 20px);
    flex: 1;
}

.gallery-item-title {
    font-size: clamp(1.1rem, 2.5vw, 1.2rem);
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 576px) {
    .gallery-item-title {
        font-size: 1rem;
    }
}

.gallery-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

@media (max-width: 576px) {
    .gallery-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: clamp(11px, 2vw, 12px);
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    background: var(--accent-color);
    white-space: nowrap;
}

@media (max-width: 576px) {
    .category-badge {
        font-size: 10px;
        padding: 3px 10px;
    }
}

.item-date {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: clamp(11px, 2vw, 12px);
}

.item-date i {
    font-size: 14px;
    color: var(--accent-color);
}

/* ===== APPOINTMENT LINK ===== */
.appointment-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--secondary-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: clamp(12px, 2.2vw, 13px);
    margin-top: 10px;
    text-decoration: none;
    transition: var(--transition-normal);
}

@media (hover: hover) {
    .appointment-link:hover {
        border-color: var(--accent-color);
        color: var(--accent-color);
        background: rgba(255, 51, 102, 0.05);
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reduced motion & touch */
@media (prefers-reduced-motion: reduce) {

    .gallery-item,
    .gallery-image-wrapper img,
    .featured-badge {
        animation: none;
        transition: none;
        transform: none !important;
    }
}

@media (hover: none) and (pointer: coarse) {
    .gallery-item:hover {
        transform: none;
    }

    .gallery-item:hover .gallery-image-wrapper img {
        transform: none;
    }
}