.homepage-gallery {
    margin-top: 16px;
    margin-bottom: 24px;
    border: 3px solid #00c8ff;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.2),
        0 5px 15px rgba(0, 200, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 0 0 18px 0;
    position: relative;

    padding: 10px;
}

.homepage-gallery-header {
    display: flex;
    justify-content: flex-end;
    margin: 10px 33px 3px 24px;
    gap: 6px;
}

.homepage-gallery-title {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    background: linear-gradient(45deg, #4d77ff, #00c8ff);
    color: white;
    margin: 0;
    text-decoration: none;
    position: absolute;
    top: -9px;
    left: 40px;
    z-index: 5;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 200, 255, 0.3);
    border: 2px solid #00c8ff;
    padding: 7px 14px 7px 14px;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.icon-container-homepage-gallery {
    position: relative;
    display: flex;
}

.icon-home-gallery-title {
    width: 25px;
    height: 25px;
    margin-right: 4px;
}

.cyber-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 6px 12px;
    min-width: 120px;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
    transition: all 0.25s ease;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    border: none;
    overflow: hidden;
}

.cyber-btn--action {
    background: #00c8ff;
    color: #ffffff;
    border: 1.5px solid rgba(0, 160, 210, 0.85);
}

.cyber-btn--action:hover,
.cyber-btn--action:focus {
    animation: glitch-btn-cyan 0.22s forwards;
    background: linear-gradient(135deg, #0090d0, #00c8ff);
    color: #fff;
    border-color: #00c8ff;
    box-shadow: 0 0 18px rgba(0,200,255,0.45), 0 0 40px rgba(0,200,255,0.15);
    transform: translateY(-3px);
    text-decoration: none;
}

.cyber-btn--action:hover::before {
    content: " ";
    width: 12px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    position: absolute;
    right: 12%;
    bottom: 1px;
    transform: rotate(35deg);
}

.cyber-btn--action:hover::after {
    animation: shrink-line 0.5s forwards;
    content: '';
    width: 65%;
    border: 1px solid rgba(255,255,255,0.9);
    position: absolute;
    left: 3px;
    bottom: 4px;
}

.cyber-btn--action:active {
    background: none;
    color: #00c8ff;
    box-shadow: none;
}

.icon-exh-title-quicknav {
    width: 18px; height: 18px;
    background: rgba(0,150,200,0.15);
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

@keyframes glitch-btn-cyan {
20%  { background: #ff2d78; transform: translateX(-6px); letter-spacing: 6px; border-color: #ff2d78; }
35%  { background: #00ff88; transform: translateX(6px);  border-color: #00ff88; }
55%  { opacity: 0.6; }
65%  { background: #4d77ff; transform: translateX(-5px); filter: blur(3px); border-color: #4d77ff; }
100% { background: #00c8ff;; color: #fff; filter: blur(0); transform: translateY(-3px); border-color: #00c8ff; box-shadow: 0 0 18px rgba(0,200,255,0.5); }
}

@keyframes shrink-line { 100% { width: 55%; } }

.cyber-btn--action:hover span,
.cyber-btn--action:focus span {
    animation: blink-glitch 0.1s infinite;
}

.cyber-btn--action:hover img, .cyber-btn--action:focus img {
    animation: blink-glitch 0.1s infinite;
}

.icon-home-gallery-exposition {
    width: 20px;
    height: 20px;
    margin-right: 3px;
}

.homepage-art-gallery-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: repeat(3, auto);
}

.homepage-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 18px 25px 25px 25px;
}

.homepage-gallery-lobby-header {
    display: flex;
    justify-content: flex-end;
    margin: 10px 33px 3px 24px;
    gap: 6px;
}

.hg-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(45deg, #4d77ff1a, #00c8ff12);
    border: 1px solid rgb(71 192 226 / 45%);
    border-radius: 3px;
    overflow: hidden;
    text-decoration: none;
    color: #2d3748;
    cursor: pointer;
    transition:
        transform 0.22s cubic-bezier(.34, 1.56, .64, 1),
        box-shadow 0.22s ease,
        border-color 0.22s ease;
    animation: hg-card-in 0.35s ease both;
    padding: 6px;
}

.hg-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22), 0 0 0 2px #00c8ff;
    border-color: #00c8ff;
    z-index: 2;
    text-decoration: none !important;
}

.hg-card-thumb-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #e8ecff;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    border-radius: 5px;
}

.hg-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.hg-card:hover .hg-card-thumb {
    transform: scale(1.05);
}

.hg-card-thumb-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: linear-gradient(135deg, #e8ecff, #dde6ff);
}

.hg-card-info {
    padding: 6px 9px 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    background: transparent;
}

.hg-card-word {
    font-size: 0.82rem;
    font-weight: 800;
    color: #474eaf;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.hg-card-author {
    font-size: 0.68rem;
    color: #474eaf;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hg-card-author::before {
    content: '👿 ';
    font-size: 0.6rem;
}

.hg-card-new-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: linear-gradient(135deg, #4d77ff, #00c8ff);
    color: white;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 15px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    z-index: 2;
}

.hg-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 2.5rem 1rem;
    color: #333;
    text-align: center;
    min-height: 160px;
}

.hg-state-icon {
    font-size: 2.2rem;
    opacity: 0.6;
    animation: hg-pulse 2s ease-in-out infinite;
}

.hg-state-text {
    font-size: 1rem;
    color: #333;
}

@keyframes hg-card-in {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@keyframes hg-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%       { opacity: 0.9; transform: scale(1.06); }
}

.hg-card:nth-child(1)  { animation-delay: 0.03s; }
.hg-card:nth-child(2)  { animation-delay: 0.07s; }
.hg-card:nth-child(3)  { animation-delay: 0.11s; }
.hg-card:nth-child(4)  { animation-delay: 0.15s; }
.hg-card:nth-child(5)  { animation-delay: 0.19s; }
.hg-card:nth-child(6)  { animation-delay: 0.23s; }
.hg-card:nth-child(7)  { animation-delay: 0.27s; }
.hg-card:nth-child(8)  { animation-delay: 0.31s; }
.hg-card:nth-child(9)  { animation-delay: 0.35s; }
.hg-card:nth-child(10) { animation-delay: 0.39s; }
.hg-card:nth-child(11) { animation-delay: 0.43s; }
.hg-card:nth-child(12) { animation-delay: 0.47s; }

@media (max-width: 800px) {
    .homepage-art-gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .hag-search-input {
        width: 130px;
    }

    .homepage-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 10px 10px 0;
    }
}

@media only screen and (orientation: portrait), (max-aspect-ratio: 4/3) {

    .cyber-btn--action:hover,
    .cyber-btn--action:focus {
        animation: none !important;
        background: #00c8ff !important;
        color: #ffffff !important;
        border-color: rgba(0, 160, 210, 0.85) !important;
        box-shadow: none !important;
        transform: none !important;
        letter-spacing: normal !important;
        filter: none !important;
        opacity: 1 !important;
    }

    .cyber-btn--action:hover::before,
    .cyber-btn--action:hover::after,
    .cyber-btn--action:focus::before,
    .cyber-btn--action:focus::after {
        content: none !important;
        animation: none !important;
    }

    .cyber-btn--action:hover span,
    .cyber-btn--action:focus span,
    .cyber-btn--action:hover img,
    .cyber-btn--action:focus img {
        animation: none !important;
    }

    .homepage-art-gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .homepage-art-gallery-grid > *:nth-child(odd):first-child {
        grid-column: 1 / -1;
        justify-self: center;
        width: 100%;
    }
    
    .hag-search-input {
        width: 100px;
        font-size: 0.65rem;
    }

    .homepage-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 8px 8px 0;
    }

    .homepage-gallery-title { 
        font-size: 0.88rem;
        font-size: 16px;
        padding: 9px 6px 8px 8px;
        left: 50%;
        transform: translateX(-50%);
        min-width: 90%;
        max-width: 95%;
        justify-content: center;
    }

    .view-in-exh-button {
        margin-top: 8px;
        width: 100%;
    }

    .homepage-gallery-header {
        margin: 40px 15px 3px 15px !important;
    }

    .homepage-gallery-lobby-header {
        margin: 40px 15px 3px 15px !important;
    }

    .homepage-gallery:last-child {
        margin-bottom: initial;
    }
}

@media only screen and (max-width: 1024px) and (orientation: landscape) {

    .cyber-btn--action:hover,
    .cyber-btn--action:focus {
        animation: none !important;
        background: #00c8ff !important;
        color: #ffffff !important;
        border-color: rgba(0, 160, 210, 0.85) !important;
        box-shadow: none !important;
        transform: none !important;
        letter-spacing: normal !important;
        filter: none !important;
        opacity: 1 !important;
    }

    .cyber-btn--action:hover::before,
    .cyber-btn--action:hover::after,
    .cyber-btn--action:focus::before,
    .cyber-btn--action:focus::after {
        content: none !important;
        animation: none !important;
    }

    .cyber-btn--action:hover span,
    .cyber-btn--action:focus span,
    .cyber-btn--action:hover img,
    .cyber-btn--action:focus img {
        animation: none !important;
    }
}