*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f8f8;
    padding: 1rem;
}

header {
    background: #fff;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    border-radius: 8px;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.pen-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #222;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
}

.menu-toggle:hover {
    background-color: #f0f0f0;
}

nav {
    display: flex;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

nav a:hover {
    color: #000;
    background-color: #f0f0f0;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 0 auto;
    max-width: 1600px;
    justify-items: center;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.gallery-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-image.loaded {
    opacity: 1;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    grid-column: 1 / -1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox:not([hidden]) {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.lightbox:not([hidden]) .lightbox-image {
    opacity: 1;
}

.lightbox-close,
.lightbox-control {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
    position: absolute;
    opacity: 0.8;
    border-radius: 50%;
}

.lightbox-close:hover,
.lightbox-control:hover,
.lightbox-close:focus,
.lightbox-control:focus {
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.noscript-warning {
    text-align: center;
    padding: 40px;
    background: #ffebee;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 600px;
}

.no-images-message {
    text-align: center;
    padding: 40px;
    background: #ffebee;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 600px;
    grid-column: 1 / -1;
}

/* Responsive menu untuk smartphone */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 8px 8px;
        z-index: 100;
        gap: 0.5rem;
    }
    
    nav.active {
        display: flex;
    }
    
    nav a {
        padding: 0.8rem 1rem;
        border-bottom: 1px solid #f0f0f0;
    }
    
    nav a:last-child {
        border-bottom: none;
    }
    
    /* Smartphone - FORCED 2 images per row */
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

/* Very small mobile - 1 image per row */
@media (max-width: 480px) {
    .gallery {
        grid-template-columns: 1fr;
    }
    
    body {
        padding: 0.5rem;
    }
    
    header {
        padding: 0.8rem;
    }
    
    .lightbox-close,
    .lightbox-control {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}