* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

h1 {
    margin-top: 90px;
    text-align: center;
    background: linear-gradient(135deg, #4c0b0b, #ab2424, #310808);
    color: #fff4f4;
    margin-bottom: 60px;
    padding: 25px 0;
    font-size: 2.5rem;
    letter-spacing: 1px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.gallery-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: white;
    transform: translateY(0);
    will-change: transform;
    
    /* Gradient border using pseudo-element */
    border: 1px solid transparent;
    background-clip: padding-box;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    z-index: -1;
    border-radius: 16px;
    background: linear-gradient(135deg, 
        rgba(171, 36, 36, 0.7) 0%, 
        rgba(76, 11, 11, 0.3) 50%, 
        rgba(171, 36, 36, 0.7) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gallery-item:hover::before {
    opacity: 1;
}

/* Inner content styling */
.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(171,36,36,0.1) 0%, rgba(76,11,11,0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
}

.gallery-item:hover::after {
    opacity: 1;
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: all 0.5s ease;
    filter: brightness(0.95);
}

.gallery-item:hover img {
    transform: scale(1.03);
    filter: brightness(1);
}

.caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(76,11,11,0.9), transparent);
    color: white;
    padding: 25px 20px 15px;
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.4s ease;
    transform: translateY(20px);
    z-index: 2;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.gallery-item:hover .caption {
    opacity: 1;
    transform: translateY(0);
}

/* Caption Title Animation */
.caption-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    transform: translateY(15px);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
    position: relative;
    padding-bottom: 0.7rem;
}

.caption-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.7);
    transition: width 0.4s ease;
}

/* Caption Description Animation */
.caption-desc {
    font-size: 0.95rem;
    margin-top: 6px;
    line-height: 1.4;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

/* Hover Effects for Title & Description */
.gallery-item:hover .caption-title {
    transform: translateY(0);
    opacity: 1;
    transition-delay: 0.1s;
}

.gallery-item:hover .caption-title::after {
    width: 100%;
    transition-delay: 0.3s;
}

.gallery-item:hover .caption-desc {
    transform: translateY(0);
    opacity: 1;
    transition-delay: 0.2s;
}

/* Loading animation for images */
.gallery-item img {
    background: #f0f0f0;
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    background-size: 200% 100%;
    animation: 1.5s shine linear infinite;
}

@keyframes shine {
    to {
        background-position-x: -200%;
    }
}

/* Responsive adjustments */
@media (max-width: 1100px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 40px;
        padding: 20px 0;
    }
    
    .gallery-item img {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }
    
    .gallery-item {
        margin-bottom: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-top: 80px;
        padding: 15px 0;
    }
    
    .caption {
        padding: 20px 15px 10px;
        font-size: 1rem;
    }
}

/* Enhanced back button */
button {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    background-color: #600000 !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 7px 14px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Footer adjustments */
.site-footer {
    margin-top: 80px;
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(76,11,11,0.3), transparent);
}
/* Back-to-top button */
.back-to-top {
    position: fixed;
    height: 45px;
    width: 45px;
    bottom: 16px;
    right: 30px;
    font-size: 26px;
    background-color: #780000;
    color: #fdf0d5;
    border-radius: 50%;;
    text-decoration: none;
    display: flex;
    opacity: 0;
    pointer-events: none;
    justify-content: center;
    align-items: center;
    box-shadow: 0px 0px 10px #fdf0d5;
    transition: all .4s;
}

.back-to-top.active {
    bottom: 30px;
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:focus {
    outline:none;
}

.back-to-top:hover {
    background-color: #fdf0d5;
    color: #780000;
    box-shadow: 0px 0px 10px #780000;
    font-size: 28px;
}