/* ==========================================
   RESET
========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Inter, Arial, sans-serif;
    background: #f5f7fb;
    color: #111827;
    min-height: 100vh;
}


/* ==========================================
   HEADER
========================================== */

.header {
    text-align: center;
    padding: 55px 20px 45px;
    background:
        radial-gradient(
            circle at top left,
            rgba(99, 102, 241, 0.35),
            transparent 35%
        ),
        linear-gradient(
            135deg,
            #111827,
            #1e293b
        );
    color: white;
}

.header h1 {
    font-size: clamp(34px, 5vw, 52px);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.header p {
    color: #cbd5e1;
    font-size: 17px;
}


/* ==========================================
   MAIN
========================================== */

main {
    width: min(94%, 1500px);
    margin: 35px auto 70px;
}


/* ==========================================
   SEARCH BOX
========================================== */

.search-box {
    width: min(700px, 100%);
    margin: 0 auto 28px;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 8px;

    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;

    box-shadow:
        0 10px 35px rgba(15, 23, 42, 0.08);

    transition: 0.3s ease;
}

.search-box:focus-within {
    border-color: #6366f1;

    box-shadow:
        0 10px 35px rgba(99, 102, 241, 0.18);
}

.search-box input {
    flex: 1;

    min-width: 0;

    padding: 14px 17px;

    border: none;
    outline: none;

    background: transparent;

    font-size: 16px;
    color: #111827;
}

.search-box input::placeholder {
    color: #9ca3af;
}

.search-box button {
    border: none;

    padding: 13px 24px;

    border-radius: 12px;

    background: #4f46e5;
    color: white;

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;

    transition:
        transform 0.25s ease,
        background 0.25s ease,
        box-shadow 0.25s ease;
}

.search-box button:hover {
    background: #4338ca;

    transform: translateY(-2px);

    box-shadow:
        0 8px 20px rgba(79, 70, 229, 0.25);
}

.search-box button:active {
    transform: scale(0.97);
}


/* ==========================================
   FILTERS
========================================== */

.filters {
    display: flex;

    justify-content: center;
    align-items: center;

    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 30px;
}

.filter-btn {
    padding: 10px 18px;

    border: 1px solid #e5e7eb;

    border-radius: 999px;

    background: white;
    color: #475569;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.05);

    transition:
        0.25s ease;
}

.filter-btn:hover {
    color: #4f46e5;

    border-color: #c7d2fe;

    transform: translateY(-2px);
}

.filter-btn.active {
    background: #4f46e5;
    color: white;

    border-color: #4f46e5;

    box-shadow:
        0 7px 18px rgba(79, 70, 229, 0.25);
}


/* ==========================================
   GALLERY STATUS
========================================== */

.gallery-status {
    display: flex;
    justify-content: flex-end;

    margin-bottom: 18px;

    color: #64748b;

    font-size: 14px;
    font-weight: 600;
}

#imageCount {
    padding: 7px 12px;

    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 999px;
}


/* ==========================================
   GALLERY
========================================== */

.gallery {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 20px;
}


/* ==========================================
   GALLERY CARD
========================================== */

.gallery-item {
    position: relative;

    height: 300px;

    overflow: hidden;

    border-radius: 18px;

    background: #e2e8f0;

    cursor: pointer;

    box-shadow:
        0 8px 25px rgba(15, 23, 42, 0.10);

    isolation: isolate;

    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease;
}

.gallery-item:hover {
    transform: translateY(-7px);

    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.18);
}


/* ==========================================
   GALLERY IMAGE
========================================== */

.gallery-item img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;

    transition:
        transform 0.6s cubic-bezier(
            0.2,
            0.8,
            0.2,
            1
        );
}

.gallery-item:hover img {
    transform: scale(1.08);
}


/* ==========================================
   IMAGE OVERLAY
========================================== */

.photo-overlay {
    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    padding: 55px 20px 20px;

    color: white;

    background:
        linear-gradient(
            to top,
            rgba(0, 0, 0, 0.82),
            rgba(0, 0, 0, 0.35),
            transparent
        );

    transform: translateY(5px);

    opacity: 0.95;

    transition:
        0.35s ease;

    z-index: 2;
}

.gallery-item:hover .photo-overlay {
    transform: translateY(0);
}

.photo-overlay h3 {
    font-size: 17px;

    line-height: 1.3;

    margin-bottom: 6px;

    text-transform: capitalize;
}

.photo-overlay p {
    font-size: 13px;

    color: #e2e8f0;
}


/* ==========================================
   LOADING
========================================== */

.loading {
    text-align: center;

    margin: 40px 0;

    color: #64748b;

    font-size: 16px;

    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.45;
    }

    50% {
        opacity: 1;
    }
}


/* ==========================================
   ERROR
========================================== */

.error {
    max-width: 600px;

    margin: 25px auto;

    padding: 14px 18px;

    text-align: center;

    color: #b91c1c;

    background: #fef2f2;

    border: 1px solid #fecaca;

    border-radius: 12px;

    font-size: 14px;
}


/* ==========================================
   SKELETON LOADING
========================================== */

.skeleton-card {
    height: 300px;

    border-radius: 18px;

    background:
        linear-gradient(
            90deg,
            #e5e7eb 25%,
            #f3f4f6 50%,
            #e5e7eb 75%
        );

    background-size: 200% 100%;

    animation:
        skeletonLoading 1.5s infinite;
}

@keyframes skeletonLoading {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}


/* ==========================================
   LIGHTBOX
========================================== */

.lightbox {
    position: fixed;

    inset: 0;

    display: none;

    align-items: center;
    justify-content: center;

    background:
        rgba(2, 6, 23, 0.94);

    backdrop-filter: blur(10px);

    z-index: 9999;

    padding: 70px 80px;
}

.lightbox.active {
    display: flex;

    animation:
        lightboxFade 0.25s ease;
}

@keyframes lightboxFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* ==========================================
   LIGHTBOX IMAGE
========================================== */

.lightbox img {
    max-width: min(1100px, 82vw);

    max-height: 78vh;

    width: auto;
    height: auto;

    object-fit: contain;

    border-radius: 14px;

    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.55);

    animation:
        imageZoom 0.3s ease;
}

@keyframes imageZoom {
    from {
        transform: scale(0.94);
        opacity: 0.5;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}


/* ==========================================
   LIGHTBOX BUTTONS
========================================== */

.close-btn,
.prev-btn,
.next-btn {
    position: absolute;

    width: 52px;
    height: 52px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 1px solid
        rgba(255, 255, 255, 0.18);

    border-radius: 50%;

    background:
        rgba(255, 255, 255, 0.10);

    color: white;

    font-size: 27px;

    cursor: pointer;

    backdrop-filter: blur(8px);

    transition:
        0.25s ease;

    z-index: 5;
}

.close-btn:hover,
.prev-btn:hover,
.next-btn:hover {
    background:
        rgba(255, 255, 255, 0.22);

    transform: scale(1.08);
}

.close-btn:active,
.prev-btn:active,
.next-btn:active {
    transform: scale(0.94);
}

/* ==========================================
   LIGHTBOX IMAGE LOADING
========================================== */

.lightbox img {
    opacity: 1;
    transition:
        opacity 0.2s ease,
        transform 0.25s ease;
}

.lightbox img.loading-image {
    opacity: 0.25;
    filter: blur(4px);
}



/* ==========================================
   CLOSE
========================================== */

.close-btn {
    top: 25px;
    right: 30px;
}


/* ==========================================
   PREVIOUS
========================================== */

.prev-btn {
    left: 30px;
}


/* ==========================================
   NEXT
========================================== */

.next-btn {
    right: 30px;
}


/* ==========================================
   PHOTO INFORMATION
========================================== */

.photo-info {
    position: absolute;

    left: 50%;

    bottom: 25px;

    transform: translateX(-50%);

    width: min(700px, 80%);

    padding: 12px 20px;

    text-align: center;

    color: white;

    background:
        rgba(15, 23, 42, 0.65);

    border:
        1px solid rgba(255, 255, 255, 0.12);

    border-radius: 14px;

    backdrop-filter: blur(10px);
}

.photo-info h3 {
    font-size: 16px;

    margin-bottom: 4px;
}

.photo-info p {
    color: #cbd5e1;

    font-size: 13px;
}


/* ==========================================
   TABLET
========================================== */

@media (max-width: 1100px) {

    .gallery {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

}


/* ==========================================
   SMALL TABLET
========================================== */

@media (max-width: 800px) {

    .gallery {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 15px;
    }

    .gallery-item {
        height: 260px;
    }

    .lightbox {
        padding: 60px 20px;
    }

    .lightbox img {
        max-width: 88vw;
        max-height: 72vh;
    }

}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 600px) {

    .header {
        padding: 40px 18px 35px;
    }

    .header h1 {
        font-size: 34px;
    }

    .header p {
        font-size: 15px;
    }

    main {
        width: 94%;
        margin-top: 25px;
    }

    .search-box {
        padding: 6px;

        border-radius: 14px;
    }

    .search-box input {
        padding: 12px;
        font-size: 15px;
    }

    .search-box button {
        padding: 12px 16px;
    }

    .filters {
        justify-content: flex-start;

        overflow-x: auto;

        flex-wrap: nowrap;

        padding-bottom: 8px;

        scrollbar-width: none;
    }

    .filters::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex-shrink: 0;
    }

    .gallery-status {
        justify-content: flex-start;
    }

    .gallery {
        grid-template-columns: 1fr 1fr;

        gap: 10px;
    }

    .gallery-item {
        height: 210px;

        border-radius: 13px;
    }

    .photo-overlay {
        padding: 35px 12px 12px;
    }

    .photo-overlay h3 {
        font-size: 14px;
    }

    .photo-overlay p {
        font-size: 11px;
    }

    .lightbox {
        padding: 70px 10px 100px;
    }

    .lightbox img {
        max-width: 94vw;
        max-height: 68vh;
    }

    .close-btn {
        top: 18px;
        right: 18px;
    }

    .prev-btn {
        left: 12px;
    }

    .next-btn {
        right: 12px;
    }

    .close-btn,
    .prev-btn,
    .next-btn {
        width: 46px;
        height: 46px;

        font-size: 23px;
    }

    .photo-info {
        bottom: 15px;

        width: 85%;

        padding: 10px 12px;
    }

}


/* ==========================================
   VERY SMALL MOBILE
========================================== */

@media (max-width: 400px) {

    .gallery {
        grid-template-columns: 1fr;
    }

    .gallery-item {
        height: 270px;
    }

    .search-box button {
        padding: 12px;
    }

}