/* ==========================================================================
   Premia Editorial Gallery - FLIP Smooth Continuous Expansion Style
   ========================================================================== */

html {
    scroll-behavior: smooth;
}

/* Main Container */
.premia-editorial-wrapper {
    position: relative;
    width: 100%;
    max-width: 1700px;
    margin: 0 auto;
    padding: 30px 40px 160px 40px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Neue Haas Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #111111;
    -webkit-font-smoothing: antialiased;
}

/* Demo Notice Banner */
.premia-demo-notice {
    text-align: center;
    padding: 14px 24px;
    margin-bottom: 50px;
    background: #f6f5f2;
    border: 1px dashed #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
    letter-spacing: 0.02em;
    color: #555555;
}

/* Placeholder spacer to prevent layout jump when nav becomes fixed */
.premia-nav-placeholder {
    display: block;
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    transition: height 0.15s ease;
}

/* Bottom-Centered Floating Navigation Bar (Single Line 65% Transparent Capsule) */
.premia-editorial-nav {
    position: fixed !important;
    bottom: 35px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: auto !important;
    z-index: 99999 !important;
    width: max-content !important;
    max-width: calc(100% - 40px) !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.65) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 24px !important;
    border-radius: 28px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.09);
    border: 1px solid rgba(220, 220, 220, 0.65);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, box-shadow 0.4s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.premia-editorial-nav:hover {
    background: rgba(255, 255, 255, 0.92) !important;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.14) !important;
}

/* Smooth fade out when scrolling outside gallery area */
.premia-editorial-nav.is-hidden-bottom {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translate(-50%, 25px) !important;
}

/* Single Line Filter Categories (No Wrap) */
.premia-editorial-cats {
    list-style: none;
    margin: 0;
    padding: 0 2px;
    display: flex;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
    white-space: nowrap !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.premia-editorial-cats::-webkit-scrollbar {
    display: none;
}

.premia-cat-item {
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.premia-cat-btn {
    background: none;
    border: none;
    outline: none;
    font-size: 10.5px !important;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #777777;
    cursor: pointer;
    padding: 4px 6px;
    position: relative;
    white-space: nowrap !important;
    transition: color 0.3s ease;
}

.premia-cat-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 6px;
    right: 6px;
    height: 1px;
    background-color: #111111;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.premia-cat-btn:hover {
    color: #111111;
}

.premia-cat-btn:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.premia-cat-item.is-active .premia-cat-btn {
    color: #111111;
    font-weight: 700;
}

.premia-cat-item.is-active .premia-cat-btn::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* 4-Column Dynamic Feed Layout */
.premia-editorial-feed {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-flow: dense;
    align-items: start;
    gap: 40px 24px;
    width: 100%;
    margin-top: 20px;
}

/* Gallery Item */
.premia-gallery-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
    z-index: 1;
}

/* Dynamic Grid Spans based on Image Orientation */
.premia-gallery-item[data-orientation="landscape"] {
    grid-column: span 2;
}

/* Scroll Reveal Active State */
.premia-gallery-item.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

.premia-gallery-item.is-hidden {
    display: none !important;
}

/* Dim & Shift State for non-expanded items when one item is focused */
.premia-editorial-feed.has-expanded-item .premia-gallery-item:not(.is-expanded) {
    opacity: 0.40;
    filter: grayscale(15%);
    transition: opacity 0.7s ease, filter 0.7s ease;
}

.premia-editorial-feed.has-expanded-item .premia-gallery-item:not(.is-expanded):hover {
    opacity: 0.85;
    filter: none;
}

/* EXPANDED ITEM LAYOUT (Preserves Natural Proportions) */
.premia-gallery-item.is-expanded {
    grid-column: span 2;
    z-index: 10;
    opacity: 1 !important;
    filter: none !important;
}

.premia-gallery-item.is-expanded[data-orientation="landscape"] {
    grid-column: span 3;
}

/* Image Card Container for FLIP animation */
.premia-image-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    width: 100%;
    position: relative;
    will-change: transform;
}

.premia-img-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
    background-color: #f4f3f0;
    border-radius: 3px;
    transition: box-shadow 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.premia-gallery-item.is-expanded .premia-img-wrapper {
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
}

/* Curtain Reveal Overlay Mask */
.premia-img-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #faf9f6;
    transform: scaleY(1);
    transform-origin: bottom;
    transition: transform 0.9s cubic-bezier(0.77, 0, 0.175, 1);
    pointer-events: none;
    z-index: 2;
}

.premia-gallery-item.is-revealed .premia-img-wrapper::after {
    transform: scaleY(0);
}

.premia-gallery-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.premia-image-card:hover .premia-gallery-img {
    transform: scale(1.03);
}

/* Close Focus Badge on Expanded Item */
.premia-close-focus {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    background: rgba(17, 17, 17, 0.85);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.4s ease 0.3s, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.3s, background 0.2s ease;
}

.premia-gallery-item.is-expanded .premia-close-focus {
    opacity: 1;
    transform: scale(1);
}

.premia-close-focus:hover {
    background: #000000;
}

/* Below-Image Labels (Title & Category) */
.premia-item-info {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease 0.3s, 
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

.premia-gallery-item.is-revealed .premia-item-info {
    opacity: 1;
    transform: translateY(0);
}

/* Below-Image Labels (Title & Category) - High Specificity Theme Overrides */
.premia-editorial-wrapper h3.premia-item-title,
.premia-editorial-wrapper .premia-item-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    letter-spacing: -0.01em !important;
    color: #111111 !important;
    line-height: 1.35 !important;
    text-transform: none !important;
}

.premia-editorial-wrapper .premia-gallery-item.is-expanded h3.premia-item-title,
.premia-editorial-wrapper .premia-gallery-item.is-expanded .premia-item-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    margin-top: 2px !important;
}

.premia-editorial-wrapper span.premia-item-cat,
.premia-editorial-wrapper .premia-item-cat {
    font-size: 11px !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: #777777 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.premia-gallery-item.is-expanded .premia-item-cat {
    font-size: 12px;
    color: #333333;
}

/* Responsive Grid Breakpoints */
@media screen and (max-width: 1280px) {
    .premia-editorial-feed {
        grid-template-columns: repeat(3, 1fr);
        gap: 36px 20px;
    }
    .premia-gallery-item.is-expanded[data-orientation="landscape"] {
        grid-column: span 3;
    }
}

@media screen and (max-width: 860px) {
    .premia-editorial-feed {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px 18px;
    }

    .premia-gallery-item[data-orientation="landscape"] {
        grid-column: span 2;
    }

    .premia-gallery-item.is-expanded,
    .premia-gallery-item.is-expanded[data-orientation="landscape"] {
        grid-column: span 2 !important;
    }

    .premia-editorial-wrapper {
        padding: 20px 20px 120px 20px;
    }

    .premia-editorial-nav {
        bottom: 22px !important;
        width: max-content !important;
        max-width: calc(100% - 24px) !important;
        padding: 8px 16px !important;
    }

    .premia-editorial-cats {
        gap: 12px;
    }

    .premia-cat-btn {
        font-size: 10px !important;
    }
}

@media screen and (max-width: 540px) {
    .premia-editorial-feed {
        grid-template-columns: repeat(1, 1fr);
        gap: 36px;
    }

    .premia-gallery-item,
    .premia-gallery-item[data-orientation="landscape"],
    .premia-gallery-item.is-expanded,
    .premia-gallery-item.is-expanded[data-orientation="landscape"] {
        grid-column: span 1 !important;
    }
}

/* ==========================================================================
   iOS 18 Liquid Glass Capsule Variation (.premia-ios-glass)
   ========================================================================== */
.premia-editorial-nav.premia-ios-glass {
    position: fixed !important;
    bottom: 35px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 99999 !important;
    width: max-content !important;
    max-width: calc(100% - 32px) !important;
    margin: 0 !important;
    background: rgba(245, 245, 248, 0.48) !important;
    backdrop-filter: blur(35px) saturate(190%) contrast(105%) !important;
    -webkit-backdrop-filter: blur(35px) saturate(190%) contrast(105%) !important;
    padding: 6px 8px !important;
    border-radius: 30px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 
                inset 0 1px 1.5px rgba(255, 255, 255, 0.85), 
                inset 0 -1px 1px rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
    display: flex;
    align-items: center;
}

.premia-editorial-nav.premia-ios-glass .premia-editorial-cats {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin: 0;
}

/* Sliding iOS Liquid Glass Active Indicator (Centered alignment fix) */
.premia-glass-active-pill {
    position: absolute;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.05), inset 0 1px 0.5px rgba(255, 255, 255, 1);
    border: 0.5px solid rgba(255, 255, 255, 0.9);
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), width 0.38s cubic-bezier(0.16, 1, 0.3, 1), height 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 1;
    box-sizing: border-box;
}

/* iOS Category Items & Buttons */
.premia-editorial-nav.premia-ios-glass .premia-cat-item {
    z-index: 3;
    position: relative;
}

.premia-editorial-nav.premia-ios-glass .premia-cat-btn {
    font-size: 11px !important;
    font-weight: 500 !important;
    letter-spacing: 0.03em !important;
    text-transform: capitalize !important;
    color: rgba(0, 0, 0, 0.55) !important;
    padding: 7px 14px !important;
    border-radius: 20px !important;
    z-index: 3;
    position: relative;
    transition: color 0.25s ease;
}

.premia-editorial-nav.premia-ios-glass .premia-cat-btn::after {
    display: none !important;
}

.premia-editorial-nav.premia-ios-glass .premia-cat-item.is-active .premia-cat-btn {
    color: #000000 !important;
    font-weight: 600 !important;
}
