/* ═══════════════════════════════════════════════════
   SOFI Gallery — Visual Upgrades
   Loaded after style.css — safe additive overrides
   ═══════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
    --shadow-sm: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-md: 0 12px 40px rgba(0,0,0,0.45);
    --shadow-lg: 0 24px 64px rgba(0,0,0,0.55);
    --shadow-xl: 0 32px 80px rgba(0,0,0,0.6);
    --glow-sm: 0 0 20px color-mix(in srgb, var(--accent) 8%, transparent);
    --glow-md: 0 0 40px color-mix(in srgb, var(--accent) 12%, transparent);
    --glow-lg: 0 0 80px color-mix(in srgb, var(--accent) 16%, transparent);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-pill: 100px;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* A. HERO SECTION */

.gallery-hero {
    position: relative;
    width: 100%;
    height: 350px;
    overflow: hidden;
    flex-shrink: 0;
    margin-top: 0;
    isolation: isolate;
}

.gallery-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle 240px at var(--sx, -300%) var(--sy, -300%),
        rgba(255,235,248,0.11) 0%,
        rgba(255,140,200,0.055) 38%,
        transparent 65%
    );
    z-index: 5;
    pointer-events: none;
}

.gallery-hero-bg {
    position: absolute;
    inset: 0;
    background-color: var(--bg-secondary, #0a0a0c);
    background-size: cover;
    background-position: center;
    filter: blur(26px) brightness(0.28) saturate(1.5);
    transform: scale(1.14);
    will-change: opacity;
    z-index: 0;
}

.gallery-hero-aurora {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}
.gallery-hero-aurora::after {
    content: '';
    position: absolute;
    top: -100%;
    left: -60%;
    width: 42%;
    height: 300%;
    background: linear-gradient(
        108deg,
        transparent 35%,
        color-mix(in srgb, var(--accent) 8%, transparent) 46%,
        rgba(190,120,255,0.05)  52%,
        transparent 63%
    );
    animation: auroraBeam 12s ease-in-out infinite;
    animation-delay: -5s;
}
@keyframes auroraBeam {
    0%   { transform: translateX(0)    skewX(-12deg); }
    100% { transform: translateX(580%) skewX(-12deg); }
}

.gallery-hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right,
            var(--bg-primary, #050506) 0%,
            transparent 22%,
            transparent 78%,
            var(--bg-primary, #050506) 100%),
        radial-gradient(ellipse 110% 65% at 50% 120%,
            var(--bg-primary, #050506) 10%,
            transparent 60%),
        linear-gradient(to bottom,
            rgba(5,5,6,0.45) 0%,
            transparent 35%,
            rgba(5,5,6,0.25) 100%);
    pointer-events: none;
    z-index: 2;
}

.gallery-hero-floats {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.hero-float {
    position: absolute;
    width: 72px;
    height: 108px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow: 0 10px 32px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.05);
    opacity: 0;
    transition: opacity 1s ease;
    animation: heroFloat 8s ease-in-out infinite;
    will-change: transform, opacity;
}
.hero-float.visible { opacity: 0.65; }

.hero-float-0 { --rot: -13deg; top: 10%; left:  3%; animation-duration: 7.3s; animation-delay:   0s; }
.hero-float-1 { --rot:   9deg; top: 54%; left:  7%; animation-duration: 9.1s; animation-delay: -3.2s; }
.hero-float-2 { --rot:  12deg; top:  8%; right: 3%; animation-duration: 8.2s; animation-delay: -1.1s; }
.hero-float-3 { --rot:  -9deg; top: 50%; right: 7%; animation-duration: 6.9s; animation-delay: -4.0s; }
.hero-float-4 { --rot:  -4deg; top: 32%; left:  20%; animation-duration: 7.9s; animation-delay: -2.1s; }
.hero-float-5 { --rot:   7deg; top: 27%; right: 20%; animation-duration: 8.6s; animation-delay: -1.5s; }
.hero-float-4.visible,
.hero-float-5.visible { opacity: 0.28; }

@keyframes heroFloat {
    0%,100% { transform: translateY(0)    rotate(var(--rot, 0deg)); }
    50%      { transform: translateY(-13px) rotate(calc(var(--rot, 0deg) + 3deg)); }
}

.gallery-hero-bottom-fade {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 130px;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-primary, #050506) 100%);
    pointer-events: none;
    z-index: 3;
}

.gallery-hero-glass {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 280px;
    width: max-content;
    max-width: min(500px, calc(100vw - 40px));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 30px 60px;
    background: rgba(255,255,255,0.042);
    backdrop-filter: blur(26px) saturate(1.6);
    -webkit-backdrop-filter: blur(26px) saturate(1.6);
    border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
    border-radius: 26px;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.04),
        inset 0 1px 0 rgba(255,255,255,0.10),
        0 24px 64px rgba(0,0,0,0.55),
        0 0 90px color-mix(in srgb, var(--accent) 7%, transparent);
    text-align: center;
    z-index: 4;
    will-change: transform, border-color, box-shadow;
    animation: glassBreath 5s ease-in-out infinite alternate;
}

@keyframes glassBreath {
    0% {
        border-color: color-mix(in srgb, var(--accent) 14%, transparent);
        box-shadow:
            inset 0 0 0 1px rgba(255,255,255,0.03),
            inset 0 1px 0 rgba(255,255,255,0.07),
            0 24px 64px rgba(0,0,0,0.55),
            0 0 28px color-mix(in srgb, var(--accent) 3%, transparent);
    }
    100% {
        border-color: color-mix(in srgb, var(--accent) 56%, transparent);
        box-shadow:
            inset 0 0 0 1px rgba(255,255,255,0.06),
            inset 0 1px 0 rgba(255,255,255,0.12),
            0 24px 64px rgba(0,0,0,0.55),
            0 0 90px color-mix(in srgb, var(--accent) 16%, transparent),
            0 0 160px color-mix(in srgb, var(--accent-secondary) 7%, transparent);
    }
}

.hero-sparkle {
    position: absolute;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 90%, transparent);
    box-shadow: 0 0 4px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent);
    animation: sparklePulse 3s ease-in-out infinite;
}
.hero-sparkle-tl { top: 15px;  left: 15px;  animation-delay:   0s; }
.hero-sparkle-tr { top: 15px;  right: 15px; animation-delay: 0.9s; }
.hero-sparkle-bl { bottom: 15px; left: 15px;  animation-delay: 1.7s; }
.hero-sparkle-br { bottom: 15px; right: 15px; animation-delay: 0.45s; }

@keyframes sparklePulse {
    0%,100% { transform: scale(0.65); opacity: 0.25; }
    50% {
        transform: scale(1.7);
        opacity: 1;
        box-shadow: 0 0 8px var(--accent), 0 0 20px color-mix(in srgb, var(--accent) 55%, transparent);
    }
}

.gallery-hero-title {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    white-space: nowrap;
}
.hero-title-sofi {
    display: block;
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -3px;
    line-height: 0.88;
    background: linear-gradient(118deg, #fff 0%, color-mix(in srgb, var(--accent) 30%, #fff) 20%, var(--accent) 50%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 220% 220%;
    animation: titleShimmer 6s ease-in-out infinite;
}
.hero-title-gallery {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 7px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.52);
    -webkit-text-fill-color: rgba(255,255,255,0.52);
    margin-top: 4px;
    margin-left: 6px;
}

@keyframes titleShimmer {
    0%,100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

.gallery-hero-sub {
    margin: 0;
    font-size: 0.76rem;
    color: rgba(255,255,255,0.56);
    font-weight: 400;
    letter-spacing: 0.025em;
    white-space: normal;
    text-align: center;
    max-width: 340px;
    transition: opacity 0.4s ease;
}

.gallery-hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 16px;
    padding: 8px 22px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent-secondary) 18%, transparent));
    border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
    border-radius: var(--radius-pill, 100px);
    color: rgba(255,255,255,0.88);
    font-size: 0.74rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    letter-spacing: 0.045em;
    cursor: pointer;
    transition: all 0.25s var(--ease-out-expo, ease);
}
.gallery-hero-cta:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 25%, transparent), color-mix(in srgb, var(--accent-secondary) 25%, transparent));
    border-color: color-mix(in srgb, var(--accent) 62%, transparent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}
.gallery-hero-cta svg { flex-shrink: 0; }

/* B. ENHANCED CARDS */

.card {
    background: linear-gradient(145deg, rgba(18,18,24,0.96), rgba(10,10,14,0.99));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.4s ease, border-color 0.4s ease;
    position: relative;
}
.card:hover {
    transform: translateY(-10px) scale(1.01);
    box-shadow:
        var(--shadow-lg),
        var(--glow-md),
        var(--glow-lg),
        inset 0 1px 0 rgba(255,255,255,0.06);
    border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}
.card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent, #ff69b4), var(--accent-secondary, #8b5cf6));
    opacity: 0;
    border-radius: 16px 16px 0 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 3;
}
.card:hover::after { opacity: 1; }

.card-image-wrapper img {
    transition: transform 0.5s ease, opacity 0.5s ease, filter 0.5s ease;
}
.card:hover .card-image-wrapper img {
    transform: scale(1.06);
    filter: saturate(1.12) brightness(1.04);
}

/* C. DISCORD FOOTER CARD */

.dc-card {
    background: var(--dc-base);
    border: 1px solid color-mix(in srgb, var(--dc-accent) 28%, transparent);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 60px color-mix(in srgb, var(--dc-accent) 16%, transparent);
}
.dc-card:hover {
    border-color: color-mix(in srgb, var(--dc-accent) 52%, transparent);
}
.dc-banner {
    background: linear-gradient(135deg, var(--dc-accent) 0%, var(--dc-base) 100%) !important;
}
.dc-body {
    background: linear-gradient(to bottom, var(--dc-accent) 0%, var(--dc-base) 97%) !important;
}
/* Avatar decoration — must overlay centered on avatar ring at all sizes */
.dc-avatar-decoration {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    width: 128% !important;
    height: 128% !important;
    pointer-events: none;
    z-index: 3;
}
.dc-status-dot {
    z-index: 4 !important;
    border-color: #ff8fa8 !important;
}
.dc-clan {
    background: rgba(255,255,255,0.12) !important;
    padding: 3px 8px 3px 5px !important;
    gap: 4px !important;
}
.dc-clan-tag {
    color: #fff !important;
    opacity: 0.9;
}
.dc-clan-icon {
    width: 11px !important;
    height: 11px !important;
}
.dc-status-online {
    animation: statusPulse 2.2s ease-in-out infinite;
}
@keyframes statusPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(35,165,90,0.55); }
    50%      { box-shadow: 0 0 0 5px rgba(35,165,90,0); }
}
.dc-act {
    background: rgba(0,0,0,0.25) !important;
    border: 1px solid rgba(0,0,0,0.15);
    transition: background 0.2s ease, border-color 0.2s ease;
}
.dc-act:hover {
    background: rgba(0,0,0,0.32) !important;
    border-color: rgba(0,0,0,0.2);
}
.dc-username {
    color: rgba(255,255,255,0.75) !important;
}
.dc-section-label {
    color: rgba(255,255,255,0.8) !important;
}
.dc-divider {
    background: rgba(0,0,0,0.15) !important;
}
.dc-act-label {
    color: rgba(255,255,255,0.85) !important;
}
.dc-act-detail {
    color: rgba(255,255,255,0.7) !important;
}
.dc-member-since {
    color: #fff !important;
}

/* D. LOADER */

.loader-logo {
    font-size: 4rem;
    letter-spacing: -2px;
    filter: drop-shadow(0 0 40px color-mix(in srgb, var(--accent) 40%, transparent));
}
.loader-bar-wrapper { height: 4px; width: 240px; }
.loader-content { position: relative; }
.loader-content::before {
    content: '';
    position: absolute;
    width: 320px; height: 320px;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--accent) 7%, transparent) 0%, transparent 70%);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%) scale(0.8);
    animation: loaderAura 3s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: -1;
}
@keyframes loaderAura {
    0%   { transform: translate(-50%,-50%) scale(0.8); opacity: 0.5; }
    100% { transform: translate(-50%,-50%) scale(1.3); opacity: 1; }
}

/* E. BANNER SECTION */

.banner-window {
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 5%, transparent), 0 30px 80px rgba(0,0,0,0.5);
}
.dot.active {
    width: 24px;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
}

/* F. CONTROLS POLISH */

.controls {
    background: rgba(255,255,255,0.012);
    border-top: 1px solid rgba(255,255,255,0.04);
}
.controls input:focus {
    border-color: color-mix(in srgb, var(--accent) 50%, transparent) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent), 0 2px 8px rgba(0,0,0,0.2) !important;
    outline: none;
}
.sort-btn:hover { box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 15%, transparent); }

/* G. FLOATING HEADER TOGGLE BUTTON */

.floating-btn {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--accent) 22%, transparent);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px color-mix(in srgb, var(--accent) 8%, transparent);
}
.floating-btn:hover {
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 30px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* H. CUSTOM FILTER DROPDOWNS */

#controlsContainer #categorySelect,
#controlsContainer #subCategorySelect {
    display: none !important;
}

.fdd-outer { display: contents; }

.fdd-wrap {
    position: relative;
    flex-shrink: 0;
}

.fdd-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    min-width: 144px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.fdd-btn:hover {
    background: rgba(255,255,255,0.07);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.fdd-btn.open {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 7%, transparent);
    color: #fff;
}

.fdd-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 148px;
}

.fdd-chevron {
    flex-shrink: 0;
    color: rgba(255,255,255,0.35);
    transition: transform 0.22s ease, color 0.2s ease;
}
.fdd-btn.open .fdd-chevron {
    transform: rotate(180deg);
    color: color-mix(in srgb, var(--accent) 90%, transparent);
}

.fdd-panel {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    min-width: 210px;
    max-height: 0;
    overflow: hidden;
    background: rgba(9,9,13,0.98);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 13px;
    box-shadow:
        0 24px 64px rgba(0,0,0,0.78),
        0 0 0 1px color-mix(in srgb, var(--accent) 6%, transparent),
        inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    z-index: 1100;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    transition:
        max-height 0.28s cubic-bezier(0.4,0,0.2,1),
        opacity 0.2s ease,
        transform 0.22s cubic-bezier(0.34,1.2,0.64,1);
    pointer-events: none;
}
.fdd-panel.open {
    max-height: 360px;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--accent) 20%, transparent) transparent;
}
.fdd-panel.open::-webkit-scrollbar { width: 4px; }
.fdd-panel.open::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 4px;
}

.fdd-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    gap: 10px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.65);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
    border-radius: 0;
}
.fdd-item:first-child { border-radius: 12px 12px 0 0; }
.fdd-item:last-child  { border-radius: 0 0 12px 12px; }
.fdd-item:only-child  { border-radius: 12px; }
.fdd-item:hover {
    background: rgba(255,255,255,0.055);
    color: #fff;
}
.fdd-item.active {
    background: color-mix(in srgb, var(--accent) 7%, transparent);
    color: #fff;
}
.fdd-item-reset {
    color: rgba(255,255,255,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 2px;
}
.fdd-item-reset:hover   { color: rgba(255,255,255,0.75); background: rgba(255,255,255,0.03); }
.fdd-item-reset.active  { color: rgba(255,255,255,0.6);  background: transparent; }

.fdd-check {
    width: 16px; height: 16px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.12);
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.fdd-check svg { opacity: 0; transition: opacity 0.15s ease; color: #fff; }
.fdd-item.active .fdd-check {
    background: var(--accent, #ff69b4);
    border-color: var(--accent, #ff69b4);
    box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent);
}
.fdd-item.active .fdd-check svg { opacity: 1; }
.fdd-item-text { flex: 1; }

.fdd-btn-sub { min-width: 156px; }
.fdd-btn-sub.open {
    background: color-mix(in srgb, var(--accent-secondary) 9%, transparent);
    border-color: color-mix(in srgb, var(--accent-secondary) 45%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-secondary) 7%, transparent);
}
.fdd-btn-sub.open .fdd-chevron { color: color-mix(in srgb, var(--accent-secondary) 90%, transparent); }
.fdd-panel-sub .fdd-item.active { background: color-mix(in srgb, var(--accent-secondary) 8%, transparent); }
.fdd-panel-sub .fdd-item.active .fdd-check {
    background: var(--accent-secondary, #8b5cf6);
    border-color: var(--accent-secondary, #8b5cf6);
    box-shadow: 0 0 6px color-mix(in srgb, var(--accent-secondary) 45%, transparent);
}

/* I. RESPONSIVE BREAKPOINTS */

/* ── Large screens: 1440px and above ── */
@media (min-width: 1440px) {
    .gallery-hero {
        height: 400px;
    }
    .hero-title-sofi {
        font-size: 5rem;
        letter-spacing: -4px;
    }
    .gallery-hero-glass {
        padding: 38px 80px;
    }
    .hero-float {
        width: 84px;
        height: 126px;
    }
    .hero-float-4.visible,
    .hero-float-5.visible {
        opacity: 0.35;
    }
    .gallery-hero::before {
        background: radial-gradient(
            circle 300px at var(--sx, -300%) var(--sy, -300%),
            rgba(255,235,248,0.13) 0%,
            rgba(255,140,200,0.065) 38%,
            transparent 65%
        );
    }
    .card:hover {
        box-shadow:
            0 28px 70px rgba(0,0,0,0.6),
            0 0 55px color-mix(in srgb, var(--accent) 16%, transparent),
            0 0 100px color-mix(in srgb, var(--accent) 8%, transparent),
            inset 0 1px 0 rgba(255,255,255,0.06);
    }
}

/* ── Desktop: 1024px to 1439px ── */
@media (min-width: 1024px) and (max-width: 1439px) {
    .gallery-hero {
        height: 380px;
    }
    .hero-float-4.visible,
    .hero-float-5.visible {
        opacity: 0.32;
    }
    .gallery-hero::before {
        background: radial-gradient(
            circle 300px at var(--sx, -300%) var(--sy, -300%),
            rgba(255,235,248,0.13) 0%,
            rgba(255,140,200,0.065) 38%,
            transparent 65%
        );
    }
    .card:hover {
        box-shadow:
            0 26px 65px rgba(0,0,0,0.58),
            0 0 48px color-mix(in srgb, var(--accent) 14%, transparent),
            0 0 90px color-mix(in srgb, var(--accent) 7%, transparent),
            inset 0 1px 0 rgba(255,255,255,0.06);
    }
}

/* ── Intermediate tablet: 769px to 1023px ── */
@media (min-width: 769px) and (max-width: 1023px) {
    .gallery-hero {
        height: 260px;
    }
    .gallery-hero-glass {
        padding: 26px 50px;
    }
    .hero-title-sofi {
        font-size: 3.6rem;
        letter-spacing: -2.5px;
    }
    .hero-float {
        width: 64px;
        height: 96px;
    }
    .hero-float-4,
    .hero-float-5 {
        display: none;
    }
    .gallery-hero-bottom-fade {
        height: 110px;
    }
}

/* ── Mobile landscape / large mobile: 641px to 768px ── */
@media (min-width: 641px) and (max-width: 768px) {
    .gallery-hero {
        height: 240px;
    }
    .gallery-hero-glass {
        padding: 22px 40px;
        min-width: 240px;
    }
    .hero-title-sofi {
        font-size: 3.2rem;
        letter-spacing: -2px;
    }
    .hero-title-gallery {
        font-size: 0.62rem;
        letter-spacing: 5px;
    }
    .gallery-hero-cta {
        font-size: 0.72rem;
        padding: 7px 20px;
        margin-top: 12px;
    }
    .gallery-hero-bottom-fade {
        height: 100px;
    }
    .hero-float {
        width: 60px;
        height: 90px;
    }
    .hero-float-4,
    .hero-float-5 {
        display: none;
    }
}

/* ── Mobile: 481px to 640px ── */
@media (max-width: 640px) {
    .gallery-hero {
        height: 210px;
    }
    .gallery-hero-glass {
        padding: 20px 30px;
        min-width: 210px;
    }
    .hero-title-sofi {
        font-size: 2.8rem;
        letter-spacing: -2px;
    }
    .hero-title-gallery {
        font-size: 0.58rem;
        letter-spacing: 5px;
    }
    .gallery-hero-bottom-fade {
        height: 90px;
    }
    .hero-float {
        width: 58px;
        height: 87px;
    }
    .hero-float-4,
    .hero-float-5 {
        display: none;
    }
    .fdd-wrap {
        width: 100%;
        display: inline-flex;
        flex-shrink: 1;
    }
    .fdd-btn {
        width: 100%;
        justify-content: space-between;
    }
    .fdd-label {
        max-width: none;
    }
    .fdd-panel {
        left: 0;
        right: 0;
        min-width: 0;
    }
}

/* ── Small mobile: up to 480px ── */
@media (max-width: 480px) {
    .gallery-hero {
        height: 185px;
    }
    .gallery-hero-glass {
        padding: 16px 24px;
        min-width: 0;
        border-radius: 18px;
    }
    .hero-title-sofi {
        font-size: 2.6rem;
        letter-spacing: -1.5px;
    }
    .hero-title-gallery {
        font-size: 0.56rem;
        letter-spacing: 4px;
    }
    .gallery-hero-sub {
        font-size: 0.68rem;
        white-space: normal;
        text-align: center;
    }
    .gallery-hero-cta {
        margin-top: 10px;
        font-size: 0.68rem;
        padding: 6px 16px;
    }
    .gallery-hero-floats {
        display: none;
    }
    .hero-sparkle {
        width: 4px;
        height: 4px;
    }
    .hero-sparkle-tl, .hero-sparkle-tr { top: 11px; }
    .hero-sparkle-tl, .hero-sparkle-bl { left: 11px; }
    .hero-sparkle-tr, .hero-sparkle-br { right: 11px; }
    .hero-sparkle-bl, .hero-sparkle-br { bottom: 11px; }
    .fdd-wrap {
        width: 100%;
        display: inline-flex;
        flex-shrink: 1;
    }
    .fdd-btn {
        width: 100%;
        justify-content: space-between;
    }
    .fdd-label {
        max-width: none;
    }
    .fdd-panel {
        left: 0;
        right: 0;
        min-width: 0;
    }
}

/* ── Tiny mobile: up to 360px ── */
@media (max-width: 360px) {
    .gallery-hero {
        height: 160px;
    }
    .gallery-hero-glass {
        padding: 12px 18px;
        border-radius: 14px;
        min-width: 0;
    }
    .hero-title-sofi {
        font-size: 2.2rem;
        letter-spacing: -1px;
    }
    .hero-title-gallery {
        display: none;
    }
    .gallery-hero-sub {
        display: none;
    }
    .gallery-hero-cta {
        margin-top: 8px;
        font-size: 0.64rem;
        padding: 5px 14px;
    }
    .gallery-hero-floats {
        display: none;
    }
    .hero-sparkle {
        display: none;
    }
    .fdd-wrap {
        width: 100%;
        display: inline-flex;
        flex-shrink: 1;
    }
    .fdd-btn {
        width: 100%;
        justify-content: space-between;
    }
    .fdd-label {
        max-width: none;
    }
    .fdd-panel {
        left: 0;
        right: 0;
        min-width: 0;
    }
}

/* ═══════════════════════════════════════════════════
   ADDITIONAL POLISH & IMPROVEMENTS
   ═══════════════════════════════════════════════════ */

/* J. GALLERY STATS BAR */

.gallery-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 14px 24px;
    margin: 0 auto 8px;
    max-width: max-content;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-pill, 100px);
    font-size: 0.76rem;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateY(8px);
    animation: statsReveal 0.5s ease 0.8s forwards;
}
.gallery-stats-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
}
.gallery-stats strong {
    color: rgba(255,255,255,0.8);
    font-weight: 600;
}
@keyframes statsReveal {
    to { opacity: 1; transform: translateY(0); }
}

/* K. IMPROVED EMPTY STATE */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 24px;
    text-align: center;
    grid-column: 1 / -1;
}
.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
    color: rgba(255,255,255,0.3);
    margin-bottom: 4px;
}
.empty-state h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
}
.empty-state p {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.4);
    max-width: 280px;
}

/* L. TOAST NOTIFICATIONS */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(12,12,16,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
    font-size: 0.82rem;
    font-family: inherit;
    color: rgba(255,255,255,0.85);
    transform: translateX(120%);
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.toast.toast-out {
    animation: toastOut 0.25s ease forwards;
}
.toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
}
.toast-success .toast-icon { color: #22c55e; }
.toast-error .toast-icon { color: #ef4444; }
.toast-info .toast-icon { color: #3b82f6; }

@keyframes toastIn {
    to { transform: translateX(0); }
}
@keyframes toastOut {
    to { transform: translateX(120%); opacity: 0; }
}

/* M. REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .hero-float { display: none; }
    .hero-sparkle { display: none; }
    .gallery-hero-aurora::after { animation: none; }
}

/* N. FOCUS VISIBLE STYLES */

:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
    outline-offset: 2px;
}
.card:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
    outline-offset: 3px;
    transform: translateY(-6px);
}
.fdd-item:focus-visible {
    background: rgba(255,255,255,0.055);
    color: #fff;
    outline: none;
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* O. SKELETON LOADING IMPROVEMENT */

.skeleton-card {
    border-radius: 16px;
}
.skeleton-image {
    border-radius: 16px 16px 0 0;
}

/* P. LINK ACCESSIBILITY */

.footer-bottom-link {
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.2);
    text-underline-offset: 3px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.footer-bottom-link:hover {
    text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

/* Q. MOBILE BACKDROP-FILTER OPTIMIZATION */

@media (max-width: 768px) {
    .gallery-hero-glass {
        backdrop-filter: blur(16px) saturate(1.3);
        -webkit-backdrop-filter: blur(16px) saturate(1.3);
    }
    .fdd-panel {
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
    .gallery-stats {
        padding: 10px 18px;
        gap: 14px;
        font-size: 0.72rem;
    }
}

/* R. CARD HOVER GLOW ACCENT */

.card {
    --card-glow: color-mix(in srgb, var(--accent) 15%, transparent);
}
.card:hover {
    --card-glow: color-mix(in srgb, var(--accent) 25%, transparent);
}

/* S. POPUP FOCUS TRAP STYLE */

#popup:not(.hidden) {
    animation: popupBgIn 0.2s ease forwards;
}
@keyframes popupBgIn {
    from { backdrop-filter: blur(0); }
    to { backdrop-filter: blur(4px); }
}

/* T. BANNERS LINK BUTTON POLISH */

.banners-link {
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}
.banners-link:hover {
    opacity: 1;
}
