/* gallery section — layered over acg.css. Three rolling "floors" (CSS marquee). */

.gallery {
    --c: var(--sky);
    max-width: none;
    padding-inline: 0;
}

.gallery__top {
    max-width: var(--max);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

/* Filter: hide in both copies of every floor. */
.gallery:has(#g-karsa:checked) .gcard:not([data-kategori="karsa"]),
.gallery:has(#g-karya:checked) .gcard:not([data-kategori="karya"]),
.gallery:has(#g-rasa:checked) .gcard:not([data-kategori="rasa"]),
.gallery:has(#g-perkasa:checked) .gcard:not([data-kategori="perkasa"]) {
    display: none;
}

.floors {
    display: grid;
    gap: 6px;
}

.floor {
    --h: 340px;
    overflow: hidden;
    padding-block: 14px;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}

.floor--1 { --dur: 60s; --off: -8s; --h: 340px; }
.floor--2 { --dur: 75s; --off: -34s; --h: 300px; margin-top: -4px; }

.floor__track {
    display: flex;
    width: max-content;
    animation: gallery-roll var(--dur) linear var(--off) infinite;
    will-change: transform;
}

.floor--2 .floor__track { animation-direction: reverse; }

@keyframes gallery-roll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.floor:hover .floor__track,
.floor:focus-within .floor__track {
    animation-play-state: paused;
}

.floor__set {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 18px;
    min-width: 100vw;
    margin: 0;
    padding: 0 18px 0 0;
    list-style: none;
}

/* Staggered sizes: portrait, square, landscape. Offset per floor shifts the rhythm. */
.gcard {
    --c: var(--sky);
    position: relative;
    flex: none;
    height: var(--h);
    aspect-ratio: 4 / 5;
    border-radius: 22px;
    overflow: hidden;
    background: var(--indigo);
    box-shadow: 0 10px 30px rgba(3, 6, 30, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    transition: transform 0.45s var(--ease-out), box-shadow 0.45s, opacity 0.35s, filter 0.35s;
}

.gcard:nth-child(3n + 2) { aspect-ratio: 1 / 1; }
.gcard:nth-child(3n) { aspect-ratio: 16 / 10; }
.floor--2 .gcard:nth-child(3n + 1) { aspect-ratio: 16 / 10; }
.floor--2 .gcard:nth-child(3n) { aspect-ratio: 4 / 5; }

.gcard--karsa { --c: var(--sky); }
.gcard--karya { --c: var(--pink); }
.gcard--rasa { --c: var(--mint); }
.gcard--perkasa { --c: var(--orange); }

.gcard:hover,
.gcard:focus-within {
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 16px 44px rgba(3, 6, 30, 0.6), 0 0 0 2px var(--c), 0 0 38px color-mix(in srgb, var(--c) 60%, transparent);
}

.floors:has(.gcard:hover) .gcard:not(:hover) {
    opacity: 0.55;
    filter: saturate(0.7);
}

.gcard__link {
    position: absolute;
    inset: 0;
    display: block;
    color: var(--text);
    text-decoration: none;
    outline: none;
}

.gcard__link:focus-visible { outline: 3px solid #fff; outline-offset: -3px; border-radius: inherit; }

.gcard__media {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--c) 70%, transparent), transparent 55%),
        radial-gradient(circle at 90% 95%, color-mix(in srgb, var(--c) 35%, var(--royal)), transparent 60%),
        linear-gradient(150deg, var(--indigo), var(--night));
}

/* Brand texture for placeholders. */
.gcard__media:not(:has(img))::before {
    content: "";
    position: absolute;
    inset: -20%;
    background: url("/images/acg/deco/loop-b.svg") center / 90% no-repeat;
    opacity: 0.16;
}

.gcard__media:not(:has(img))::after {
    content: "";
    position: absolute;
    width: 70%;
    aspect-ratio: 1;
    right: -22%;
    top: -18%;
    background: url("/images/acg/deco/blob-violet.webp") center / contain no-repeat;
    opacity: 0.28;
}

.gcard__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out);
}

.gcard:hover .gcard__media img { transform: scale(1.06); }

.gcard__initials {
    position: absolute;
    inset: 12% 0 36% 0;
    display: grid;
    place-items: center;
    z-index: 1;
    font-family: var(--font-script);
    font-size: calc(var(--h) * 0.3);
    line-height: 1;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 0 40px color-mix(in srgb, var(--c) 80%, transparent), 0 6px 24px rgba(3, 6, 30, 0.45);
}

.gcard__note {
    position: absolute;
    z-index: 1;
    left: 14px;
    top: 14px;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

/* Bottom gradient behind text. */
.gcard__link::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(6, 10, 42, 0.92), transparent 60%);
    pointer-events: none;
}

.gcard__level {
    position: absolute;
    z-index: 3;
    top: 12px;
    right: 12px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--navy);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 2px 10px rgba(3, 6, 30, 0.3);
}

.gcard__body {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 16px 14px;
    text-shadow: 0 1px 8px rgba(3, 6, 30, 0.7);
}

.gcard__cat {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c);
}

.gcard__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gcard__who {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-2);
}

.gcard__who strong { color: var(--text); font-weight: 600; }

.gcard__cta {
    display: block;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px);
    font-size: 13px;
    font-weight: 600;
    color: var(--c);
    transition: max-height 0.35s var(--ease-out), margin 0.35s, opacity 0.35s, transform 0.35s var(--ease-out);
}

.gcard:hover .gcard__cta,
.gcard:focus-within .gcard__cta {
    max-height: 24px;
    margin-top: 8px;
    opacity: 1;
    transform: none;
}

@media (hover: none) {
    .gcard__cta { max-height: 24px; margin-top: 8px; opacity: 1; transform: none; }
}

@media (max-width: 640px) {
    .floor--1 { --h: 230px; }
    .floor--2 { --h: 200px; }
    .floor__set { gap: 12px; padding-right: 12px; }
    .gcard { border-radius: 16px; }
    .gcard__body { padding: 12px 12px 10px; }
    .gcard__title { font-size: 14px; }
    .gcard__who { font-size: 11px; }
    .gcard__level { top: 8px; right: 8px; font-size: 10px; padding: 4px 9px; }
}

/* Reduced motion: no marquee; swipeable rows with scroll-snap, duplicate copy hidden. */
@media (prefers-reduced-motion: reduce) {
    .floor {
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
    }

    .floor__track { animation: none; width: auto; }
    .floor__set[aria-hidden="true"] { display: none; }
    .floor__set { min-width: 0; justify-content: flex-start; padding-left: 18px; }
    .gcard { scroll-snap-align: start; }
}
