/* ─────────────────────────────────────────────────────────────────────────────
   gallery.css — Styles for gallery pages (Japan, Sydney, Melbourne, Adelaide)
   Jonathan Brine Photography
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Gallery page header (3-column grid for true center title) ──────────────── */

.gallery-page-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.gallery-header-title {
    text-align: center;
}

.gallery-header-title h1 {
    font-family: 'Playfair Display', serif;
    margin: 0;
    font-size: 1.6rem;
    font-weight: 400;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.gallery-header-title small {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 400;
    margin-top: 3px;
}

/* Photo count — right side of header */
.photo-count {
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Masonry gallery grid ───────────────────────────────────────────────────── */

.gallery {
    column-count: 3;
    column-gap: 14px;
    padding: 28px 4%;
    max-width: 1600px;
    margin: 0 auto;
}

.gallery-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 14px;
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(0,0,0,0.10);
    transition: transform 0.4s ease, box-shadow 0.3s ease, opacity 0.5s ease, filter 0.5s ease;
    opacity: 0;
    filter: blur(6px);
}

.gallery-item img.loaded {
    opacity: 1;
    filter: blur(0);
}

.gallery-item:hover img {
    transform: scale(1.025);
    box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}

@media (max-width: 900px)  { .gallery { column-count: 2; } }
@media (max-width: 560px)  { .gallery { column-count: 1; } }

/* ── Lightbox modal ─────────────────────────────────────────────────────────── */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(12,12,10,0.93);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.modal.open { display: flex; }

.modal-content {
    background: var(--bg);
    max-width: 88vw;
    max-height: 94vh;
    padding: 20px 24px 22px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    position: relative;
    overflow: auto;
    animation: modalIn 0.22s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.97) translateY(6px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.modal-content img {
    width: 100%;
    height: auto;
    max-height: calc(94vh - 120px);
    object-fit: contain;
    border-radius: 5px;
    display: block;
}

.modal-meta {
    margin-top: 14px;
    text-align: center;
}
.modal-meta h3 { display: none; }
.modal-meta p {
    margin: 0;
    font-size: 1rem;
    color: #555;
    line-height: 1.75;
    max-width: 52ch;
    word-wrap: break-word;
    margin: 0 auto;
}

.close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 1.6rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    transition: color 0.2s;
    padding: 4px 6px;
}
.close:hover { color: var(--fg); }

.modal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    gap: 1rem;
}
.modal-nav button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    color: #555;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.modal-nav button:hover  { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.modal-nav button:disabled { opacity: 0.2; pointer-events: none; }

.modal-counter {
    font-size: 0.75rem;
    color: #aaa;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Keyboard hint — fades out after a few seconds */
.modal-hint {
    text-align: center;
    margin-top: 10px;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #bbb;
    animation: hintFade 4s ease forwards;
    pointer-events: none;
}
@keyframes hintFade {
    0%   { opacity: 0.9; }
    60%  { opacity: 0.9; }
    100% { opacity: 0; }
}

/* ── Scroll to top ──────────────────────────────────────────────────────────── */

.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: rgba(249,248,246,0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #555;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s, background 0.2s, color 0.2s, border-color 0.2s;
    pointer-events: none;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.scroll-top-btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ── Mobile gallery header adjustments ──────────────────────────────────────── */

@media (max-width: 620px) {
    .gallery-page-header {
        grid-template-columns: auto 1fr auto;
    }
    .gallery-header-title h1 { font-size: 1.2rem; }
    .gallery-header-title small { display: none; }
    .photo-count { display: none; }
}
