/* Animation delay classes */
.anim-delay-75 { animation-delay: 75ms; }
.anim-delay-100 { animation-delay: 100ms; }
.anim-delay-150 { animation-delay: 150ms; }
.anim-delay-200 { animation-delay: 200ms; }
.anim-delay-225 { animation-delay: 225ms; }
.anim-delay-300 { animation-delay: 300ms; }

/* Swiper overrides from project_detail.html */
.swiper {
    width: 100%;
    border-radius: 1rem;
    overflow: hidden;
}
.mainSwiper {
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.popularSwiper .swiper-slide {
    height: auto;
    align-self: flex-start;
}
.swiper-slide {
    cursor: pointer;
}
.swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.swiper-button-next,
.swiper-button-prev {
    color: #C9A84B !important;
    background: rgba(34, 33, 48, 0.4);
    backdrop-filter: blur(4px);
    width: 36px !important;
    height: 36px !important;
    border-radius: 50%;
    transition: background 0.3s;
}
.swiper-button-next:hover,
.swiper-button-prev:hover {
    background: rgba(34, 33, 48, 0.85);
}
.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 14px !important;
    font-weight: bold;
}
.swiper-pagination-bullet {
    background: #C9A84B !important;
    opacity: 0.5;
}
.swiper-pagination-bullet-active {
    opacity: 1;
}
.swiper-thumbs {
    height: 80px;
    box-sizing: border-box;
    padding: 8px 0;
    margin-top: 8px;
}
.thumbSwiper .swiper-slide {
    height: 100%;
    opacity: 0.5;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.2s;
    aspect-ratio: auto;
}
.thumbSwiper .swiper-slide-thumb-active,
.thumbSwiper .active-thumb {
    opacity: 1;
    outline: 2px solid #C9A84B;
    outline-offset: 2px;
}

/* Custom Gallery & Lightbox */
#unifiedLightbox {
    transition: opacity 0.3s ease;
    outline: none;
}
#unifiedLightbox.hidden {
    display: none;
}
#unifiedLightbox:not(.hidden) {
    display: flex;
}
#unifiedLightboxImg {
    transition: opacity 0.15s ease, transform 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
}
.thumbSwiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Plan Swiper */
.planSwiper {
    aspect-ratio: 4 / 3;
    border-radius: 1rem;
    overflow: hidden;
}
.planSwiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f9f9f9;
    border-radius: 1rem;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    align-items: center;
    justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
}
.lightbox .close {
    position: absolute;
    top: 20px; right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 10;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 40px;
    padding: 10px 18px;
    cursor: pointer;
    border-radius: 8px;
    z-index: 10;
    transition: background 0.2s;
    user-select: none;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.4); }
.lightbox-nav.left { left: 20px; }
.lightbox-nav.right { right: 20px; }

/* Lightbox Arrow Fix (ensure they stay at the edges) */
#unifiedLightboxPrev {
    left: 20px;
    z-index: 110;
}
#unifiedLightboxNext {
    right: 20px;
    z-index: 110;
}
@media (max-width: 640px) {
    #unifiedLightboxPrev { left: 10px; }
    #unifiedLightboxNext { right: 10px; }
}

/* Swiper slide tooltip */
.swiper-slide::after {
    content: "Нажмите, чтобы увеличить";
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(34,33,48,0.8);
    color: #FCFCFC;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.swiper-slide:hover::after {
    opacity: 1;
}

/* Custom classes from catalog.html */
.project-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.project-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Золотой кант для десктопного фильтра */
.desktop-filter {
    border: 1px solid rgba(201,168,75,0.3);
}

/* Мобильный фильтр – выезжает сверху */
.mobile-filter-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 70;
    background: #FCFCFC;
    border: 1px solid rgba(201,168,75,0.3);
    border-radius: 0 0 20px 20px;
    padding: 24px 20px 32px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
}
.mobile-filter-sheet.open {
    transform: translateY(0);
}
.filter-backdrop {
    position: fixed;
    inset: 0;
    z-index: 69;
    background: rgba(0,0,0,0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.filter-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.sort-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.sort-pills::-webkit-scrollbar { display: none; }
.sort-pill {
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
    color: #222130;
    background: #fff;
}
.sort-pill.active {
    background: #222130;
    color: #FCFCFC;
    border-color: #222130;
}

/* Markdown content styles from base.html and news_detail.html */
.content-body h1, .content-body h2, .content-body h3 {
    font-weight: 700;
    color: #222130;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.content-body h1 { font-size: 2em; }
.content-body h2 { font-size: 1.5em; }
.content-body h3 { font-size: 1.25em; }
.content-body p { margin-bottom: 1em; }
.content-body ul, .content-body ol {
    margin-left: 1.5em;
    margin-bottom: 1em;
}
.content-body li { margin-bottom: 0.25em; }
.content-body a {
    color: #C9A84B;
    text-decoration: underline;
}
.content-body blockquote {
    border-left: 4px solid #C9A84B;
    padding-left: 1em;
    color: #555;
    font-style: italic;
}
.content-body pre {
    background: #222130;
    color: #FCFCFC;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
}
.content-body code {
    background: #f0f0f0;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}
.content-body img {
    max-width: 100%;
    border-radius: 8px;
}

/* Animations and common styles from base.html */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out forwards; }
.animate-fade-in { animation: fadeIn 0.8s ease-out forwards; }
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
html { scroll-behavior: smooth; }

.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #FCFCFC; }
::-webkit-scrollbar-thumb { background: #C9A84B; border-radius: 4px; }

.card-hover { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(0,0,0,0.1); }

.btn-gold {
    background: linear-gradient(135deg, #C9A84B 0%, #D4B86A 100%);
    color: #222130;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201,168,75,0.4);
}

#backToTopBtn {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
#backToTopBtn.visible {
    opacity: 1;
    visibility: visible;
}

/* Mobile tab bar */
.mobile-tab-bar {
    display: flex;
}
@media (min-width: 768px) {
    .mobile-tab-bar {
        display: none;
    }
}
.mobile-tab-item {
    color: #222130;
    transition: color 0.2s;
}
.mobile-tab-item.active {
    color: #C9A84B;
}
.mobile-tab-item svg {
    width: 1.5rem;
    height: 1.5rem;
    transition: stroke 0.2s, fill 0.2s;
}

/* Lazy loading */
.lazy-img {
    opacity: 0;
    filter: blur(15px);
    transition: opacity 0.6s ease, filter 0.6s ease;
}
.lazy-img.loaded {
    opacity: 1;
    filter: blur(0);
}

@media (max-width: 640px) {
    .mainSwiper { aspect-ratio: 1 / 1; }
    .planSwiper { aspect-ratio: 1 / 1; }
    .swiper-slide::after {
        bottom: 8px;
        font-size: 0.65rem;
        padding: 3px 8px;
    }
}
.metrika-noscript { position: absolute; left: -9999px; }
