@import url("https://fonts.googleapis.com/css2?family=Fredoka+One&family=Roboto:wght@400;700&display=swap");

body {
    margin: 0;
    background: #0a0a0a;
    color: white;
    font-family: "Fredoka One", sans-serif;
    overflow-x: hidden;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    background: rgba(20, 20, 20, 0.85);
    padding: 15px 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    z-index: 1000;
    flex-wrap: wrap;
}

.header h1 {
    font-size: 1.6rem;
    background: linear-gradient(90deg, #ff5f6d, #ffc371);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo {
    font-size: 1.8rem;
}

.upload-btn {
    background: linear-gradient(90deg, #ff5f6d, #ffc371);
    padding: 8px 15px;
    border-radius: 10px;
    color: black;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}
.upload-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* ===== Gallery ===== */
main.masonry {
    max-width: 1200px;
    margin: 40px auto;
    column-count: 4;
    column-gap: 1rem;
    padding: 1rem;
}

.media-container {
    break-inside: avoid;
    margin-bottom: 1rem;
}

.image-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: zoom-in;
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    background: #1a1a1a;
}
.image-card:hover {
    transform: scale(1.04);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

.image-card img,
.image-card video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    object-fit: cover;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: white;
    opacity: 0.9;
    pointer-events: none;
    filter: drop-shadow(0 0 5px black);
}

/* ===== Skeletons ===== */
#skeletons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.skeleton {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background: linear-gradient(90deg, #202020 25%, #2a2a2a 50%, #202020 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===== Captions ===== */
.caption {
    text-align: center;
    font-family: "Roboto", sans-serif;
    font-size: 0.9rem;
    color: #ccc;
    margin-top: 0.4rem;
    word-break: break-word;
}

/* ===== Lightbox ===== */
#viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}
#viewer.hidden {
    display: none;
}

#viewer-content {
    position: relative;
    width: 90vw;
    height: 80vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* “Pop” animation */
#viewer-content img,
#viewer-content video {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    animation: popIn 0.15s ease-out;
}
@keyframes popIn {
    from {
        transform: scale(0.93);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#viewer-caption {
    margin-top: 15px;
    text-align: center;
    color: #ccc;
    font-family: "Roboto", sans-serif;
    font-size: 1rem;
    max-width: 80%;
}

/* Buttons */
#close {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 3rem;
    color: white;
    cursor: pointer;
    transition:
        transform 0.2s,
        color 0.2s;
    z-index: 3000;
}
#close:hover {
    transform: scale(1.2);
    color: #ff5f6d;
}

#controls {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
    z-index: 3000;
}
#controls button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    border-radius: 10px;
    padding: 5px 15px;
    transition:
        background 0.2s,
        transform 0.2s;
}
#controls button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Footer */
footer {
    text-align: center;
    padding: 25px;
    background: #111;
    color: #aaa;
    font-size: 0.9rem;
    border-top: 2px solid #222;
}

/* Disable scroll when lightbox open */
body.viewer-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 1000px) {
    main.masonry {
        column-count: 3;
    }
}
@media (max-width: 700px) {
    main.masonry {
        column-count: 2;
        max-width: 90%;
    }
    .header {
        flex-direction: column;
        gap: 10px;
    }
}
@media (max-width: 500px) {
    main.masonry {
        column-count: 1;
        max-width: 95%;
    }
    .upload-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    #controls button {
        font-size: 1.5rem;
    }
}
