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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: #fafafa;
    color: #262626;
    min-height: 100vh;
    text-rendering: optimizeSpeed;
}

header {
    text-align: center;
    padding: 32px 20px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 250, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(219, 219, 219, 0.8);
    contain: layout style;
}

header h1 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 36px;
    font-weight: 400;
    color: #262626;
}

header p {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    font-weight: 400;
    color: #8e8e8e;
    margin-top: 2px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    max-width: 935px;
    margin: 0 auto;
    padding: 0 0 60px;
}

.grid-item {
    position: relative;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    cursor: pointer;
    background: #efefef;
    content-visibility: auto;
    contain-intrinsic-size: auto 622px;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.grid-item:hover img {
    transform: scale(1.05);
}

.grid-item .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.05) 0%,
            rgba(0, 0, 0, 0.1) 40%,
            rgba(0, 0, 0, 0.55) 100%);
    opacity: 0;
    will-change: opacity;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 12px;
}

.grid-item:hover .overlay {
    opacity: 1;
}

.overlay .date {
    font-family: 'Ma Shan Zheng', cursive;
    color: #fff;
    font-size: 22px;
    font-weight: 400;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    will-change: transform;
    transform: translateY(6px);
    transition: transform 0.3s ease;
}

.overlay .location {
    font-family: 'Caveat', cursive;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin-top: 0;
    font-weight: 400;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    will-change: transform;
    transform: translateY(6px);
    transition: transform 0.3s ease 0.04s;
}

.grid-item:hover .overlay .date,
.grid-item:hover .overlay .location {
    transform: translateY(0);
}

/* ---------- Detail Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #fff;
    border-radius: 12px;
    max-width: 680px;
    width: 100%;
    margin: 40px 0 60px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-close {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 1001;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.modal-header {
    padding: 24px 24px 0;
}

.modal-header .modal-date {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 26px;
    font-weight: 400;
    color: #262626;
}

.modal-header .modal-location {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    color: #8e8e8e;
    margin-top: 0;
}

.modal-header .modal-count {
    font-family: 'Caveat', cursive;
    font-size: 14px;
    color: #8e8e8e;
    margin-top: 2px;
}

.modal-cover {
    padding: 20px 24px 0;
}

.modal-cover img {
    width: 100%;
    border-radius: 4px;
    display: block;
    object-fit: contain;
    max-height: 60vh;
    cursor: zoom-in;
    transition: opacity 0.2s ease;
}

.modal-cover img:hover {
    opacity: 0.85;
}

.modal-thumbnails {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 20px 24px 24px;
}

.modal-thumbnails .thumb {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: pointer;
    border-radius: 2px;
    background: #efefef;
    transform: translateZ(0);
}

.modal-thumbnails .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: transform 0.3s ease;
}

.modal-thumbnails .thumb:hover img {
    transform: scale(1.06);
}

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #8e8e8e;
}

/* ---------- Scrollbar ---------- */
.modal-overlay::-webkit-scrollbar {
    width: 4px;
}

.modal-overlay::-webkit-scrollbar-track {
    background: transparent;
}

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

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
    transition: opacity 0.25s ease;
    cursor: pointer;
    contain: layout style paint;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    cursor: default;
    will-change: transform;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 2001;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 640px) {
    .modal {
        margin: 30px 0 50px;
        border-radius: 8px;
    }

    .modal-header {
        padding: 18px 16px 0;
    }

    .modal-cover {
        padding: 14px 16px 0;
    }

    .modal-thumbnails {
        padding: 14px 16px 18px;
        grid-template-columns: repeat(3, 1fr);
    }
}