:root{
    --header-dark: rgba(0,0,0,0.8);
    --header-light: rgba(255, 255, 255, 0.8);
    --header-shadow-dark: rgba(0,0,0,0.3);
    --header-shadow-light: rgba(255,255,255,0.3);
    --main-dark: #111;
    --main-light: #eee;
    --gallery-dark: #222;
    --gallery-light: #ddd;
    --text-white: #fff;
    --text-dark: #000;
    --preview-dark: rgba(0, 0, 0, 0.95);
    --preview-light: rgba(255,255,255, 0.95);
}

/* ================= BASE ================= */
body {
    margin: 0;
    font-family: Arial;
    background: var(--main-dark);
}

body.light-mode{
    background: var(--main-light);
}

/* Disable scroll when preview open */
body.no-scroll .header {
    display: none;
}

.no-scroll {
    overflow: hidden;
}

/* ================= GALLERY ================= */
.gallery {
    column-count: 5;
    column-gap: 10px;
    padding: 10px;
    margin: 40px;
    background: var(--gallery-dark);
    border-radius: 8px;
}

.light-mode .gallery{
    background: var(--gallery-light);
}

/* Responsive columns */
@media (max-width: 1200px) {
    .gallery { column-count: 4; }
}
@media (max-width: 900px) {
    .gallery {
        column-count: 3;
        margin: 20px;
    }
}
@media (max-width: 700px) {
    .gallery {
        column-count: 2;
        margin: 10px;
        padding: 8px;
    }
}
@media (max-width: 400px) {
    .gallery {
        column-count: 1;
        margin: 5px;
        padding: 5px;
    }
}

/* Images */
.gallery img {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    break-inside: avoid;
    transition: transform 0.3s ease;
}

.gallery img:hover {
    transform: scale(1.03);
}

/* ================= PREVIEW ================= */
#preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--preview-dark);
    display: none;
    justify-content: center;
    align-items: center;
}

.light-mode #preview{
    background: var(--preview-light);
}

/* Image container */
.image-container {
    width: 90%;
    height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Preview image */
#preview img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    transform-origin: center;
    transition: transform 0.25s ease, opacity 0.25s ease;
    cursor: grab;
}

#preview img:active {
    cursor: grabbing;
}

/* ================= CONTROLS ================= */

/* Close */
.close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 32px;
    color: var(--text-white);
    cursor: pointer;
}

/* Nav arrows */
.nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
    color: var(--text-white);
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    backdrop-filter: blur(5px);
    transition: 0.2s ease;
    z-index: 100;
}

.light-mode .nav {
    color: var(--text-dark);
    background: none;
}

.nav.left { left: 15px; }
.nav.right { right: 15px; }

.nav:active {
    transform: translateY(-50%) scale(0.9);
}

/* Zoom button */
.zoom-btn {
    position: absolute;
    bottom: 25px;
    right: 25px;
    font-size: 22px;
    color: var(--text-white);
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

/* Light mode control colors */
.light-mode .close,
.light-mode .nav,
.light-mode .zoom-btn{
    color: var(--text-dark);
    background: none;
}

/* ================= MOBILE ================= */
@media (max-width: 600px) {

    /* 🔥 SHOW arrows (important fix) */
    .nav {
        font-size: 22px;
        padding: 10px;
        background: rgba(0,0,0,0.6);
    }

    .nav.left { left: 10px; }
    .nav.right { right: 10px; }

    .zoom-btn {
        bottom: 20px;
        right: 20px;
        font-size: 20px;
        padding: 10px;
    }

    .close {
        font-size: 28px;
        top: 15px;
        right: 15px;
    }
}