/* Fix navbar shift caused by scrollbar */
html {
    overflow-y: scroll;
}

/* Center cover images */
.post-cover {
    text-align: center;
    margin-left: auto !important;
    margin-right: auto !important;
}

.post-cover img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Post Title and Info */
.post-info {
    margin-bottom: 2rem;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.post-title a {
    text-decoration: none;
    color: inherit;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.95rem;
    opacity: 0.8;
}

.post-date,
.post-location,
.post-camera {
    display: inline-block;
}

/* Collage Cover Layouts */
.post-cover-collage {
    margin: 2rem 0;
}

.collage {
    display: grid;
    gap: 4px;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.collage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 2 photos - side by side */
.collage-2 {
    grid-template-columns: 1fr 1fr;
    max-height: 500px;
}

.collage-2 img {
    height: 500px;
}

/* 3 photos - 1 large on left, 2 stacked on right */
.collage-3 {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    max-height: 600px;
}

.collage-3 img:first-child {
    grid-row: 1 / 3;
    height: 600px;
}

.collage-3 img:nth-child(2),
.collage-3 img:nth-child(3) {
    height: 298px;
}

/* 4 photos - 2x2 grid */
.collage-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    max-height: 600px;
}

.collage-4 img {
    height: 298px;
}

/* Responsive collages */
@media (max-width: 768px) {

    .collage-2,
    .collage-3,
    .collage-4 {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .collage-2 img {
        height: 250px;
    }

    .collage-3 img:first-child {
        grid-row: auto;
        height: 300px;
    }

    .collage-3 img:nth-child(2),
    .collage-3 img:nth-child(3) {
        height: 250px;
    }

    .collage-4 img {
        height: 250px;
    }
}

/* Photography Grid Layout - New Masonry Style */
.photo-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
    margin-bottom: 4rem;
}

.photo-card {
    margin: 0;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--background);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    break-inside: avoid;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.photo-card-image {
    position: relative;
    width: 100%;
    height: 300px;
    /* Fixed height for consistent grid, or use aspect-ratio if preferred */
    overflow: hidden;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.photo-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.view-icon {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.photo-card-caption {
    padding: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    border-top: 1px solid var(--border);
    /* Assuming var exists, otherwise rgba(0,0,0,0.05) */
    background: var(--background);
}

/* Enhanced Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    /* Deep black for immersion */
}

.lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.lightbox-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: zoom-out;
    /* Hint that clicking might do something (or default pointer) */
}

.lightbox-details {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 6rem 2rem 3rem 2rem;
    color: #fff;
    text-align: center;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.7), transparent);
    transition: opacity 0.5s ease;
    opacity: 1;
    /* Visible by default */
    pointer-events: auto;
}

/* Hidden state for details */
.lightbox-details.hidden {
    opacity: 0;
    pointer-events: none;
}

.lightbox-details h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.lightbox-details p {
    margin: 0 auto 1rem auto;
    font-size: 1rem;
    max-width: 800px;
    opacity: 0.9;
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.lightbox-meta {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.9rem;
    opacity: 0.8;
    font-family: monospace;
}

.lightbox-meta span {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 10001;
    opacity: 0.6;
    transition: opacity 0.2s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    padding: 2rem;
    z-index: 10000;
    opacity: 0.5;
    transition: opacity 0.2s, background 0.2s;
    user-select: none;
}

.lightbox-nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

.lightbox-prev {
    left: 0;
}

.lightbox-next {
    right: 0;
}

/* Responsive Design Overrides */
@media (max-width: 768px) {
    .photo-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 1.5rem;
    }

    .photo-card-image {
        height: auto;
        aspect-ratio: 3/2;
    }

    .lightbox-nav {
        padding: 1rem;
        font-size: 2rem;
    }

    .lightbox-details h3 {
        font-size: 1.1rem;
    }

    .lightbox-details p {
        font-size: 0.9rem;
    }
}