:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --primary-font: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--primary-font);
}

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background animated gradient */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.08), transparent 45%),
        radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.08), transparent 45%);
    animation: pulse-bg 15s ease-in-out infinite alternate;
}

@keyframes pulse-bg {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    margin-bottom: 3rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 2rem;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.site-title {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(to right, #38bdf8, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.photo-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    background: #000;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.photo-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.8;
}

.photo-card:hover img {
    transform: scale(1.05);
    opacity: 1;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.2) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: var(--transition);
}

.photo-card:hover .card-overlay {
    opacity: 1;
}

.date-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--glass-border);
    color: #e2e8f0;
}

.card-thought-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.95rem;
    color: #cbd5e1;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    transform: translateY(10px);
    transition: var(--transition);
    transition-delay: 0.1s;
}

.photo-card:hover .card-thought-preview {
    transform: translateY(0);
}

.read-more {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.read-more svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
}

.photo-card:hover .read-more svg {
    transform: translateX(4px);
}

/* Lightbox Modal */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1010;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-close svg {
    width: 24px;
    height: 24px;
}

.lightbox-content {
    display: flex;
    width: 100%;
    height: 100%;
    padding: 2rem;
    gap: 2rem;
    align-items: center;
    justify-content: center;
}

.lightbox-image-wrapper {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.nav-btn.prev {
    left: 1.5rem;
}

.nav-btn.next {
    right: 1.5rem;
}

.lightbox-sidebar {
    width: 400px;
    height: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.sidebar-date {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 1rem;
}

.sidebar-thought {
    font-size: 1.1rem;
    line-height: 1.6;
    font-weight: 300;
    margin-bottom: 2rem;
    white-space: pre-line;
    color: var(--text-primary);
}

.metadata-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.metadata-item:last-child {
    margin-bottom: 0;
}

.metadata-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.metadata-value {
    font-size: 0.95rem;
    color: #e2e8f0;
    font-weight: 500;
}

.download-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    transition: var(--transition);
    margin-top: auto;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.download-action:hover {
    box-shadow: 0 10px 20px rgba(56, 189, 248, 0.4);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 1024px) {
    .lightbox-content {
        flex-direction: column;
        padding: 4rem 1rem 1rem;
        gap: 1rem;
    }

    .lightbox-sidebar {
        width: 100%;
        height: auto;
        flex: none;
        max-height: 50vh;
    }

    .lightbox-image-wrapper {
        height: 45vh;
    }

    .nav-btn.prev {
        left: 10px;
    }

    .nav-btn.next {
        right: 10px;
    }

    .lightbox-close {
        top: 1rem;
        right: 1rem;
    }

    header {
        top: 1rem;
        padding: 1rem;
        margin-bottom: 2rem;
    }

    .container {
        padding: 1rem;
    }
}

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .card-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, transparent 100%);
        padding-top: 4rem;
    }

    .card-thought-preview {
        transform: none;
        display: -webkit-box;
    }

    .photo-card img {
        opacity: 1;
    }

    .date-badge {
        top: 0.75rem;
        right: 0.75rem;
        background: rgba(15, 23, 42, 0.8);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Initial loader */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}