:root {
    --bg-color: #fdfbf7; /* Warm off-white */
    --text-color: #4a4a4a;
    --accent-color: #8c7b75;
    --title-color: #2c2c2c;
    --lightbox-bg: rgba(0, 0, 0, 0.9);
    --lightbox-btn-bg: rgba(255, 255, 255, 0.8);
    --lightbox-btn-hover: rgba(255, 255, 255, 0.95);
    --lightbox-btn-shadow: rgba(0,0,0,0.15);
    --gap: 20px;
    --border-radius: 3px;
    --card-bg: white;
    --button-bg: rgba(255, 255, 255, 0.9);
    --shadow: rgba(0,0,0,0.08);
    --shadow-hover: rgba(0,0,0,0.25);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-color: #b8a8a2;
    --title-color: #f5f5f5;
    --lightbox-bg: rgba(0, 0, 0, 0.95);
    --lightbox-btn-bg: rgba(42, 42, 42, 0.9);
    --lightbox-btn-hover: rgba(58, 58, 58, 0.95);
    --lightbox-btn-shadow: rgba(255,255,255,0.1);
    --card-bg: #2a2a2a;
    --button-bg: rgba(42, 42, 42, 0.9);
    --shadow: rgba(0,0,0,0.3);
    --shadow-hover: rgba(0,0,0,0.5);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 40px 20px;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

body::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 60px;
    font-family: 'Lora', serif;
    max-width: 1400px;
    margin: 0 auto 60px auto;
    padding: 0 20px;
}

.header-content {
    flex: 1;
}

.dark-mode-toggle {
    background: var(--button-bg);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 2px 12px var(--shadow);
    transition: all 0.3s ease;
    margin-top: 10px;
}

.dark-mode-toggle:hover {
    background: var(--card-bg);
    box-shadow: 0 4px 20px var(--shadow-hover);
    transform: scale(1.05);
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

header h1 a:hover {
    color: var(--accent-color);
}

.colophon-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    font-family: 'Nunito', sans-serif;
}

.colophon-content h2 {
    font-family: 'Lora', serif;
    font-size: 2rem;
    color: var(--title-color);
    margin-bottom: 20px;
}

.colophon-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
}

/* Archive Page */
.archive-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    font-family: 'Nunito', sans-serif;
}

.archive-content h2 {
    font-family: 'Lora', serif;
    font-size: 2rem;
    color: var(--title-color);
    margin-bottom: 40px;
    text-align: center;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 60px;
}

.archive-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
}

.archive-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-hover);
}

.archive-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.archive-item:hover img {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .archive-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .archive-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
}

header h1 {
    font-weight: 400;
    font-size: 2.5rem;
    color: var(--title-color);
    margin-bottom: 4px;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 8px;
}

header p {
    font-style: italic;
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* Gallery Container with Navigation */
.gallery-container {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 100vw;
}

.gallery-nav {
    position: fixed;
    bottom: 30px;
    background: var(--button-bg);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-color);
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 12px var(--shadow);
    transition: all 0.3s ease;
    user-select: none;
}

.gallery-nav:hover {
    background: var(--card-bg);
    box-shadow: 0 4px 20px var(--shadow-hover);
    transform: scale(1.05);
}

.gallery-prev {
    left: 30px;
}

.gallery-next {
    left: 90px;
}

.colophon-link {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--button-bg);
    color: var(--text-color);
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 400;
    box-shadow: 0 2px 12px var(--shadow);
    transition: all 0.3s ease;
    z-index: 10;
}

.colophon-link:hover {
    background: var(--card-bg);
    box-shadow: 0 4px 20px var(--shadow-hover);
    transform: translateY(-2px);
    color: var(--accent-color);
}

.archive-link {
    position: fixed;
    bottom: 80px;
    right: 30px;
    background: var(--button-bg);
    color: var(--text-color);
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 400;
    box-shadow: 0 2px 12px var(--shadow);
    transition: all 0.3s ease;
    z-index: 10;
}

.archive-link:hover {
    background: var(--card-bg);
    box-shadow: 0 4px 20px var(--shadow-hover);
    transform: translateY(-2px);
    color: var(--accent-color);
}

/* Horizontal Carousel */
.gallery {
    display: flex;
    gap: var(--gap);
    max-width: none;
    margin: 0;
    padding: 0 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    user-select: none;
}

.gallery::-webkit-scrollbar {
    display: none;
}

@media (max-width: 768px) {
    .gallery {
        gap: 15px;
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .gallery {
        gap: 12px;
        padding: 0 12px;
    }
}

.gallery-item {
    flex-shrink: 0;
    width: 300px;
    height: 400px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
    cursor: pointer;
    background: var(--card-bg);
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--lightbox-bg);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox.show {
    opacity: 1;
}

.lightbox-content {
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: lightboxZoom 0.4s ease-out;
    object-fit: contain;
    flex-shrink: 0;
    margin: 0 15vw; /* Add horizontal margins to prevent control overlap */
}

@keyframes lightboxZoom {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--text-color);
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1001;
    background: var(--lightbox-btn-bg);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px var(--lightbox-btn-shadow);
}
.close:hover {
    color: var(--accent-color);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--lightbox-btn-bg);
    color: var(--text-color);
    border: none;
    font-size: 24px;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 1001;
    border-radius: 5px;
    box-shadow: 0 2px 10px var(--lightbox-btn-shadow);
}

.nav-btn:hover {
    background: var(--lightbox-btn-hover);
    color: var(--accent-color);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

/* Mobile responsiveness for lightbox */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95%;
        max-height: 80%;
    }
    
    .close {
        top: 10px;
        right: 15px;
        font-size: 28px;
        width: 40px;
        height: 40px;
    }
    
    .nav-btn {
        font-size: 20px;
        padding: 12px 15px;
    }
    
    .prev {
        left: 10px;
    }
    
    .next {
        right: 10px;
    }
}