/* ==========================================================================
   Photo Gallery Dual-Taxonomy Filter Modal
   Ghost Search UI (SodoSearch) Matching Aesthetics & Snappy Animations
   Strict Light Theme (Zero Dark Mode Overrides)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Header Filter Button (Matches Ghost .gh-search icon button)
   -------------------------------------------------------------------------- */
.gh-filter-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    width: 30px;
    height: 30px;
    box-sizing: border-box;
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    transition: opacity 0.2s ease;
}

.gh-filter-btn:hover {
    opacity: 0.9;
}

.gh-filter-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Active Filter Notification Dot on Header Icon */
.gh-filter-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #000000;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.gh-filter-dot.is-active {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 2px #ffffff;
}

/* --------------------------------------------------------------------------
   Desktop Header: Align Filter and Search side-by-side with 12px gap
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    .gh-head-actions {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        margin-right: 0 !important;
    }

    .gh-head-actions .gh-search {
        margin: 0 !important;
    }

    .gh-head-brand .gh-filter-btn {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   Mobile Header (<=767px):
   4-column grid keeps burger on far right, padded 16px matching chatbot trigger:
   Col 1: Logo (1fr)
   Col 2: Filter (auto)
   Col 3: Search (auto)
   Col 4: Burger (auto)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    #gh-head {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    #gh-head .gh-head-brand {
        display: grid !important;
        grid-template-columns: 1fr auto auto auto !important;
        align-items: center !important;
        column-gap: 8px !important;
        height: 64px !important;
    }

    .gh-head-brand .gh-head-brand-wrapper {
        grid-column: 1 !important;
    }

    .gh-head-brand #photoFilterToggleMobile {
        grid-column: 2 !important;
        display: inline-flex !important;
        margin: 0 !important;
    }

    .gh-head-brand .gh-search {
        grid-column: 3 !important;
        display: inline-flex !important;
        margin: 0 !important;
    }

    .gh-head-brand .gh-burger {
        grid-column: 4 !important;
        display: block !important;
        margin: 0 !important;
    }

    /* Never show filter button inside the opened mobile drawer */
    .gh-head-actions #photoFilterToggle,
    .is-head-open #gh-head .gh-head-actions .gh-filter-btn,
    .is-head-open #gh-head .gh-head-actions #photoFilterToggle {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   Modal Backdrop & Overlay (Exact SodoSearch Matching Blur, Fade & Padding)
   -------------------------------------------------------------------------- */
@keyframes searchFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes searchFadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* SodoSearch Exact Keyframe: translateY(20px) -> translateY(0) at 0.15s ease */
@keyframes searchPopup {
    0% {
        -webkit-transform: translateY(16px);
        transform: translateY(16px);
        opacity: 0;
    }
    100% {
        -webkit-transform: translateY(0);
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes searchPopout {
    0% {
        -webkit-transform: translateY(0);
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        -webkit-transform: translateY(16px);
        transform: translateY(16px);
        opacity: 0;
    }
}

.photo-filter-backdrop {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: clamp(3.5rem, 10vh, 8rem);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.photo-filter-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    animation: searchFadeIn 0.15s ease forwards;
}

.photo-filter-backdrop.is-closing {
    opacity: 0;
    pointer-events: none;
    animation: searchFadeOut 0.12s ease forwards;
}

/* --------------------------------------------------------------------------
   Modal Window Card (SodoSearch Exact Animate-Popup Matching)
   Pure Light Theme Only
   -------------------------------------------------------------------------- */
.photo-filter-modal {
    position: relative;
    width: 90%;
    max-width: 512px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 24px 28px;
    color: #18181b;
    font-family: inherit;
    transform-origin: center top;
    isolation: isolate;
}

.photo-filter-backdrop.is-open .photo-filter-modal {
    animation: searchPopup 0.15s ease forwards;
}

.photo-filter-backdrop.is-closing .photo-filter-modal {
    animation: searchPopout 0.12s ease forwards;
}

/* Modal Header */
.photo-filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.photo-filter-modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.photo-filter-modal-icon {
    display: flex;
    align-items: center;
    color: #71717a;
}

.photo-filter-modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
    color: #18181b;
}

.photo-filter-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: #71717a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.photo-filter-modal-close:hover {
    color: #18181b;
    background: rgba(0, 0, 0, 0.05);
}

/* Modal Body */
.photo-filter-modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.photo-filter-modal-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.photo-filter-modal-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #71717a;
    margin: 0;
}

.photo-filter-select-wrapper {
    position: relative;
    width: 100%;
}

/* Matching Ghost Search Box Input Sizing (18px) */
.photo-filter-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 13px 40px 13px 16px;
    font-size: 18px;
    font-weight: 500;
    color: #18181b;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
    line-height: 1.4;
}

.photo-filter-select:hover {
    border-color: rgba(0, 0, 0, 0.28);
}

.photo-filter-select:focus {
    border-color: #000000;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.photo-filter-select option {
    background-color: #ffffff;
    color: #18181b;
    font-size: 16px;
    font-weight: 400;
    padding: 8px 12px;
}

.photo-filter-chevron {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 14px;
    color: #71717a;
}

/* Status Indicator */
.photo-filter-modal-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #71717a;
    padding-top: 4px;
}

.photo-filter-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
}

/* Modal Footer */
.photo-filter-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 18px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.photo-filter-modal-reset {
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #71717a;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.15s ease;
    font-family: inherit;
}

.photo-filter-modal-reset:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

.photo-filter-modal-apply {
    margin-left: auto;
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 11px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.photo-filter-modal-apply:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.photo-filter-modal-apply:active {
    transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   Empty State Notification
   -------------------------------------------------------------------------- */
.photo-filter-empty {
    text-align: center;
    padding: 60px 24px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px dashed rgba(0, 0, 0, 0.12);
    border-radius: 16px;
    margin: 32px auto;
    max-width: 500px;
    animation: filterFadeIn 0.3s ease-out;
}

.photo-filter-empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.photo-filter-empty-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #18181b;
}

.photo-filter-empty-text {
    font-size: 15px;
    color: #71717a;
    margin: 0 0 20px;
    line-height: 1.5;
}

.photo-filter-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    background: #18181b;
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.photo-filter-empty-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes filterFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   Grid Transitions
   -------------------------------------------------------------------------- */
.post-feed .grid-item {
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-feed .grid-item.is-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

.post-feed .grid-item.is-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* --------------------------------------------------------------------------
   Strict Photography Page Lock
   Guarantee filter UI NEVER displays outside the home photography gallery
   -------------------------------------------------------------------------- */
body:not(.page-photos) .gh-filter-btn,
body:not(.page-photos) .photo-filter-backdrop,
body:not(.page-photos) .photo-filter-empty {
    display: none !important;
}
