/* =============================================
   GALLERY PAGE — white background, blue sidebar
   ============================================= */

body.gallery-page {
    background: #f0f1f3;
    color: #333;
    overflow-x: hidden;
    position: relative;
}
body.gallery-page::before {
    content: '';
    position: fixed;
    inset: -30px;
    z-index: -1;
    background-image: url('../../site images/gallery-background.jpg');
    background-size: cover;
    background-position: center;
    filter: blur(12px);
    opacity: 0; /* disabled — set to 0.85 to re-enable background image */
}


/* ── LAYOUT ──────────────────────────────────── */
body.gallery-page main.container {
    padding-top: calc(54px + 1.5rem);
}

/* ── FILTER SIDEBAR ──────────────────────────── */
body.gallery-page .filters-panel {
    background: #d8dade;
    border: 1px solid #888;
    border-radius: 0;
    box-shadow: none;
    padding: 1.2rem;
}
body.gallery-page .filters-panel h3 {
    color: rgba(0,0,0,0.35);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
}
body.gallery-page .filter-category-header {
    color: rgba(0,0,0,0.55);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding: 0.45rem 0;
}
body.gallery-page .filter-category-header:hover { color: #111; }

body.gallery-page .filter-option label {
    color: rgba(0,0,0,0.5);
    font-size: 0.72rem;
}
body.gallery-page .filter-option label:hover { color: #111; }

body.gallery-page .filter-option-undef { border-top: 1px solid rgba(0,0,0,0.08); margin-top: 0.3rem; padding-top: 0.3rem; }
body.gallery-page .filter-option-undef label { color: rgba(0,0,0,0.32); font-style: italic; }
body.gallery-page .filter-option-undef label:hover { color: rgba(0,0,0,0.6); }

/* ── SEARCH ──────────────────────────────────── */
body.gallery-page .search-box input {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.13);
    color: #333;
    border-radius: 2px;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    padding: 0.6rem 1rem;
}
body.gallery-page .search-box input::placeholder { color: rgba(0,0,0,0.3); }
body.gallery-page .search-box input:focus {
    outline: none;
    border-color: rgba(0,0,0,0.3);
}

/* ── GALLERY CARDS ───────────────────────────── */
body.gallery-page .gallery-item {
    background: #d8dade;
    border-radius: 0;
    border: 1px solid #888;
    box-shadow: none;
    transition: background 0.25s;
    position: relative;
}
body.gallery-page .gallery-item:hover {
    transform: none;
    box-shadow: none;
    background: #cdd0d6;
}
body.gallery-page .gallery-item:hover img {
    background: #cdd0d6;
}
body.gallery-page .gallery-item:hover .gallery-item-info {
    background: #cdd0d6;
}
body.gallery-page .gallery-item img {
    display: block;
    height: 200px;
    width: 100%;
    object-fit: contain;
    background: #d8dade;
    cursor: pointer;
    transition: opacity 0.2s;
}
body.gallery-page .gallery-item img:hover { opacity: 1; }

body.gallery-page .gallery-item-info {
    padding: 0.75rem 0.9rem 0.9rem;
    background: #d8dade;
}
body.gallery-page .gallery-item-title {
    color: #111;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
}
body.gallery-page .gallery-item-meta {
    color: rgba(0,0,0,0.42);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    margin-bottom: 0.2rem;
}
body.gallery-page .gallery-item-attrs {
    margin: 0.25rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}
body.gallery-page .gallery-item-attrs .attr-row {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}
body.gallery-page .gallery-item-attrs dt {
    font-size: 0.6rem;
    color: rgba(0,0,0,0.35);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    min-width: 3.2rem;
    flex-shrink: 0;
}
body.gallery-page .gallery-item-attrs dd {
    font-size: 0.7rem;
    color: rgba(0,0,0,0.62);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── BUTTONS ─────────────────────────────────── */
body.gallery-page .btn-primary {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.3);
    color: rgba(0,0,0,0.7);
    border-radius: 2px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
body.gallery-page .btn-primary:hover {
    background: rgba(0,0,0,0.06);
    border-color: #111;
    color: #111;
}
body.gallery-page .btn-secondary {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.16);
    color: rgba(0,0,0,0.45);
    border-radius: 2px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    transition: border-color 0.2s, color 0.2s;
}
body.gallery-page .btn-secondary:hover {
    border-color: rgba(0,0,0,0.4);
    color: rgba(0,0,0,0.8);
}
body.gallery-page .clear-filters {
    border: 1px solid rgba(0,0,0,0.15);
    color: rgba(0,0,0,0.38);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 2px;
    padding: 0.4rem 0.8rem;
    background: transparent;
    transition: border-color 0.2s, color 0.2s;
}
body.gallery-page .clear-filters:hover {
    border-color: rgba(0,0,0,0.4);
    color: rgba(0,0,0,0.75);
}

/* ── FEATURED SLOT PILL ─────────────────────── */
body.gallery-page .featured-slot-pill {
    display: none; /* hidden until session confirms login */
    position: absolute;
    bottom: 0;
    left: 0;
    background: rgba(26, 58, 96, 0.82);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.18rem 0.55rem 0.18rem 0.45rem;
    border-top-right-radius: 3px;
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
}
body.is-logged-in.gallery-page .featured-slot-pill {
    display: block;
}

/* ── ADMIN CARD ACTIONS ──────────────────────── */
body.gallery-page .gallery-item-admin {
    display: none;
    position: absolute;
    top: 0; right: 0;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.35rem;
    background: rgba(255,255,255,0.92);
    z-index: 10;
    border-bottom-left-radius: 2px;
}
body.is-admin .gallery-item-admin { display: flex; }

body.gallery-page .admin-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0.18rem 0.22rem;
    border-radius: 2px;
    transition: background 0.15s;
    color: #444;
    flex-shrink: 0;
}
body.gallery-page .admin-action:hover { background: rgba(30,58,96,0.1); color: #1e3a60; }
body.gallery-page .admin-delete:hover { background: rgba(180,30,30,0.1); color: #b41e1e; }

body.gallery-page .admin-star-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
body.gallery-page .admin-star-menu {
    display: none;
    position: absolute;
    top: 100%; right: 0;
    background: #fff;
    border: 1px solid rgba(30,58,96,0.25);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 100;
    min-width: 90px;
}
body.gallery-page .admin-star-menu.open { display: block; }
body.gallery-page .admin-star-row {
    display: block;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 0.38rem 0.7rem;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
}
body.gallery-page .admin-star-row:hover { background: rgba(30,58,96,0.07); color: #1e3a60; }

/* Add Image button */
body.gallery-page .btn-add-image {
    display: none;
    width: 100%;
    margin-top: 1rem;
    background: transparent;
    border: 1px solid rgba(30,58,96,0.35);
    color: #1e3a60;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}
body.is-admin .btn-add-image { display: block; }
body.gallery-page .btn-add-image:hover { background: rgba(30,58,96,0.07); }

/* ── ADMIN MODALS ─────────────────────────────── */
body.gallery-page .admin-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(220,228,236,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    justify-content: center;
    align-items: center;
    padding: 1rem;
}
body.gallery-page .admin-modal.active { display: flex; }
body.gallery-page .admin-modal-card {
    background: #fff;
    border: 3px solid rgba(30,58,96,0.45);
    box-shadow: 0 12px 48px rgba(0,0,0,0.14);
    padding: 1.8rem 2rem 2rem;
    width: 100%;
    max-width: 560px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
body.gallery-page .admin-modal-close {
    position: absolute;
    top: 0.7rem; right: 1rem;
    background: none; border: none;
    font-size: 1.4rem;
    color: rgba(0,0,0,0.35);
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}
body.gallery-page .admin-modal-close:hover { color: #111; }
body.gallery-page .admin-modal-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #111;
    margin: 0 0 1.2rem;
}
body.gallery-page .admin-modal-form .admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}
body.gallery-page .admin-form-group {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
body.gallery-page .admin-form-group label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(0,0,0,0.4);
}
body.gallery-page .admin-form-group input {
    background: #fff;
    border: 1px solid rgba(30,58,96,0.22);
    color: #222;
    font-size: 0.83rem;
    font-family: inherit;
    padding: 0.45rem 0.65rem;
    outline: none;
    border-radius: 0;
    transition: border-color 0.2s;
}
body.gallery-page .admin-form-group input:focus { border-color: rgba(30,58,96,0.65); }
body.gallery-page .admin-form-group input[type="file"] { padding: 0.3rem; }
body.gallery-page .admin-modal-error {
    font-size: 0.75rem;
    color: #c0392b;
    min-height: 1em;
    margin-bottom: 0.5rem;
}
body.gallery-page .admin-upload-progress {
    font-size: 0.75rem;
    color: rgba(0,0,0,0.45);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
body.gallery-page .admin-modal-submit {
    background: transparent;
    border: 1px solid rgba(30,58,96,0.5);
    color: #1e3a60;
    font-size: 0.72rem;
    font-family: inherit;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.5rem 1.4rem;
    cursor: pointer;
    transition: background 0.2s;
}
body.gallery-page .admin-modal-submit:hover { background: rgba(30,58,96,0.07); }
body.gallery-page .admin-modal-submit:disabled { opacity: 0.5; cursor: default; }

/* ── LOADING SPINNER ─────────────────────────── */
body.gallery-page .loading p {
    color: rgba(0,0,0,0.35);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    margin-top: 0.6rem;
}
body.gallery-page .spinner {
    border-color: rgba(0,0,0,0.1);
    border-top-color: rgba(0,0,0,0.45);
}

/* ── LIGHTBOX ────────────────────────────────── */
body.gallery-page .lightbox {
    background: rgba(240,241,243,0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
body.gallery-page .lightbox-content {
    max-width: 820px;
    width: 90%;
    background: #fff;
    border: 3px solid rgba(30,58,96,0.45);
    box-shadow: 0 12px 48px rgba(0,0,0,0.14);
    overflow: hidden;
}
body.gallery-page .lightbox-content > img {
    display: block;
    width: 100%;
    max-height: 62vh;
    object-fit: contain;
    background: #f5f5f5;
}
body.gallery-page .lightbox-info {
    background: #f0f1f3;
    border: none;
    border-top: 1px solid rgba(30,58,96,0.12);
    margin-top: 0;
    padding: 0.9rem 1.1rem 1.1rem;
}
body.gallery-page .lb-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.65rem;
}
body.gallery-page .lightbox-info h2 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #111;
    margin: 0;
}
body.gallery-page .lb-counter {
    font-size: 0.68rem;
    color: rgba(0,0,0,0.35);
    letter-spacing: 0.06em;
    white-space: nowrap;
    margin-left: 1rem;
}

/* attribute grid */
body.gallery-page .lb-attrs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem 1.2rem;
}
body.gallery-page .lb-attr {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
body.gallery-page .lb-attr-label {
    font-size: 0.6rem;
    color: rgba(0,0,0,0.35);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
body.gallery-page .lb-attr-value {
    font-size: 0.78rem;
    color: #222;
}

/* lightbox action buttons */
body.gallery-page .lb-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.9rem;
    flex-wrap: wrap;
}
body.gallery-page .btn-lb {
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 0.38rem 0.9rem;
    border-radius: 2px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
body.gallery-page .btn-lb-download {
    background: transparent;
    border: 1px solid rgba(30,58,96,0.4);
    color: #1e3a60;
}
body.gallery-page .btn-lb-download:hover {
    background: rgba(30,58,96,0.07);
    border-color: #1e3a60;
}
body.gallery-page .btn-lb-original {
    background: #1e3a60;
    border: 1px solid #1e3a60;
    color: #fff;
}
body.gallery-page .btn-lb-original:hover {
    background: #2a4e80;
    border-color: #2a4e80;
}
body.gallery-page .btn-lb-contact {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.18);
    color: rgba(0,0,0,0.55);
}
body.gallery-page .btn-lb-contact:hover {
    border-color: rgba(0,0,0,0.4);
    color: #111;
}

/* navigation arrows */
body.gallery-page .lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(30,58,96,0.22);
    color: #1e3a60;
    font-size: 2.2rem;
    line-height: 1;
    width: 46px;
    height: 64px;
    cursor: pointer;
    z-index: 2002;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
}
body.gallery-page .lightbox-nav:hover {
    background: #fff;
}
body.gallery-page .lightbox-prev { left: 16px; }
body.gallery-page .lightbox-next { right: 16px; }
body.gallery-page .lb-nav-disabled {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
}

body.gallery-page .lightbox-close {
    font-size: 28px;
    color: rgba(0,0,0,0.4);
    top: 16px; right: 20px;
    transition: color 0.2s;
}
body.gallery-page .lightbox-close:hover { color: #111; }

/* ── FOOTER ──────────────────────────────────── */
body.gallery-page footer {
    background: #0f1e30 !important;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 1.8rem 0 !important;
    margin-top: 3rem;
}
body.gallery-page footer p {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.28) !important;
    letter-spacing: 0.04em;
    opacity: 1 !important;
}

/* ── GALLERY HEADER — search row + stats bar ─ */
body.gallery-page .gallery-search-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.6rem;
}
body.gallery-page .gallery-search-row .search-box {
    flex: 1;
}

/* sort dropdown */
body.gallery-page .gallery-sort select {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.13);
    color: rgba(0,0,0,0.6);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    padding: 0.6rem 0.8rem;
    border-radius: 2px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(0,0,0,0.35)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 2rem;
    transition: border-color 0.2s;
}
body.gallery-page .gallery-sort select:hover {
    border-color: rgba(0,0,0,0.28);
    color: #111;
}

/* stats bar */
body.gallery-page .gallery-stats-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.45rem 0 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    margin-bottom: 1rem;
}
body.gallery-page .gallery-count {
    font-size: 0.72rem;
    color: rgba(0,0,0,0.38);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* active filter tags */
body.gallery-page .filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(30,58,96,0.08);
    border: 1px solid rgba(30,58,96,0.2);
    color: rgba(0,0,0,0.65);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    padding: 0.18rem 0.5rem;
    border-radius: 2px;
}
body.gallery-page .filter-tag-remove {
    background: none;
    border: none;
    color: rgba(0,0,0,0.4);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
    transition: color 0.15s;
}
body.gallery-page .filter-tag-remove:hover { color: #111; }

/* ── BACK TO TOP ─────────────────────────────── */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 42px;
    height: 42px;
    background: #1e3a60;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s, background 0.15s;
    z-index: 900;
}
#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#back-to-top:hover { background: #2a4e80; }
