/* ==========================================================================
   Afluex showcase pages (Gallery, Portfolio) — page-specific layouts.
   Loaded after assets/css/afluex.css by those pages only. The filters and
   the photo viewer are driven by assets/js/afluex.js; everything here is
   CSS, so the motion stops for visitors who prefer reduced motion.
   ========================================================================== */

/* centred page hero used by both pages */
.show-hero {
    padding: calc(var(--header-h) + clamp(40px, 6vw, 80px)) 0 0;
    text-align: center;
}

.show-hero .crumbs,
.show-hero .actions {
    justify-content: center;
}

.show-hero .page-hero__lead {
    margin-inline: auto;
}

/* ======================================================================
   Gallery: a slowly turning 3D ring of the team photos
   ====================================================================== */

.ring {
    --w: clamp(150px, 19vw, 260px);
    --r: calc(var(--w) * 1.02);
    position: relative;
    height: calc(var(--w) * 1.25);
    margin-top: clamp(36px, 5vw, 64px);
    perspective: 1500px;
    perspective-origin: 50% 30%;
    overflow: hidden;
    /* fade the sides so the ring reads as depth, not a hard crop */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}

.ring__track {
    position: absolute;
    left: 50%;
    top: 8%;
    width: var(--w);
    aspect-ratio: 870 / 630;
    margin-left: calc(var(--w) / -2);
    transform-style: preserve-3d;
    transform: rotateX(-6deg) rotateY(0deg);
    animation: ring-spin 48s linear infinite;
}

.ring:hover .ring__track {
    animation-play-state: paused;
}

@keyframes ring-spin {
    to {
        transform: rotateX(-6deg) rotateY(-360deg);
    }
}

.ring__item {
    position: absolute;
    inset: 0;
    margin: 0;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--line-2);
    background: #050b10;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9), 0 0 40px -20px rgba(107, 199, 209, 0.5);
    transform: rotateY(calc(var(--i) * 60deg)) translateZ(var(--r));
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.ring__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* reflection floor */
.ring::after {
    content: "";
    position: absolute;
    left: 15%;
    right: 15%;
    bottom: 4%;
    height: 30%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(107, 199, 209, 0.22), transparent);
    filter: blur(20px);
    pointer-events: none;
}

/* filters + grid */
.gallery-filters {
    justify-content: center;
}

html:not(.enhanced) .gallery-filters {
    display: none;
}

.gallery--bento {
    grid-auto-flow: dense;
}

.gallery--bento .shot:nth-child(1),
.gallery--bento .shot:nth-child(6) {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery--bento .shot img {
    height: 100%;
}

.gallery--bento .shot:nth-child(1) img,
.gallery--bento .shot:nth-child(6) img {
    aspect-ratio: auto;
}

.shot {
    transition: transform 0.5s var(--ease), border-color 0.3s, box-shadow 0.4s;
}

.shot:hover,
.shot:focus-visible {
    border-color: var(--line-2);
    box-shadow: 0 30px 60px -30px rgba(107, 199, 209, 0.45);
}

.shot figcaption {
    transform: translateY(6px);
    transition: transform 0.4s var(--ease);
}

.shot:hover figcaption,
.shot:focus-visible figcaption {
    transform: none;
}

.shot__zoom {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    background: rgba(4, 8, 12, 0.7);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s, transform 0.3s var(--ease);
}

.shot__zoom svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--text);
    stroke-width: 2;
    stroke-linecap: round;
}

.shot:hover .shot__zoom,
.shot:focus-visible .shot__zoom {
    opacity: 1;
    transform: none;
}

/* viewer */
.lightbox figure {
    animation: lb-in 0.35s var(--ease);
}

@keyframes lb-in {
    from {
        opacity: 0;
        transform: scale(0.97);
    }
}

.lightbox__btn:hover {
    border-color: var(--aqua);
}

/* ======================================================================
   Portfolio
   ====================================================================== */

/* hero: a tilted wall of browser windows drifting past */
.wall {
    position: relative;
    height: clamp(260px, 30vw, 400px);
    margin-top: clamp(36px, 5vw, 64px);
    overflow: hidden;
    perspective: 1400px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent), linear-gradient(transparent, #000 15%, #000 80%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.wall__plane {
    position: absolute;
    inset: -10% -20%;
    display: grid;
    align-content: center;
    gap: 18px;
    transform: rotateX(28deg) rotateZ(-7deg);
    transform-style: preserve-3d;
}

.wall__row {
    display: flex;
    gap: 18px;
    width: max-content;
    animation: wall-a 60s linear infinite;
}

.wall__row:nth-child(2) {
    animation-name: wall-b;
    margin-left: -140px;
}

@keyframes wall-a {
    to {
        transform: translateX(-50%);
    }
}

@keyframes wall-b {
    from {
        transform: translateX(-50%);
    }

    to {
        transform: translateX(0);
    }
}

.wall:hover .wall__row {
    animation-play-state: paused;
}

.bw {
    flex-shrink: 0;
    width: clamp(200px, 22vw, 300px);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line-2);
    background: #050b10;
    box-shadow: 0 30px 50px -30px rgba(0, 0, 0, 0.9);
}

.bw__bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(16, 30, 42, 0.95);
}

.bw__bar i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
}

.bw__bar b {
    flex: 1;
    height: 8px;
    margin-left: 8px;
    border-radius: 4px;
    background: rgba(148, 214, 224, 0.08);
}

.bw img {
    width: 100%;
    aspect-ratio: 669 / 540;
    object-fit: cover;
}

/* project cards */
.projects {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.project {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project__shot {
    position: relative;
    margin: 12px 12px 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: radial-gradient(circle at 50% 45%, rgba(107, 199, 209, 0.14), #050b10 70%);
}

.project__shot img {
    width: 100%;
    aspect-ratio: 669 / 540;
    object-fit: cover;
    transition: transform 0.7s var(--ease);
}

.project:hover .project__shot img {
    transform: scale(1.05);
}

.project__shot img.is-mark {
    object-fit: contain;
    padding: 22% 30%;
}

.project__body {
    padding: 20px 22px 24px;
    display: grid;
    gap: 8px;
    flex: 1;
    align-content: start;
}

.project__no {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    color: var(--aqua);
}

.project h3 {
    font-size: 1.15rem;
}

.project p {
    font-size: 14.5px;
}

.note {
    margin-top: 22px;
    font-size: 13.5px;
    color: var(--text-3);
    text-align: center;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 960px) {

    .projects {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery--bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery--bento .shot:nth-child(6) {
        grid-row: span 1;
    }
}

@media (max-width: 640px) {

    .projects {
        grid-template-columns: minmax(0, 1fr);
    }

    .gallery--bento {
        grid-template-columns: minmax(0, 1fr);
    }

    .gallery--bento .shot:nth-child(n) {
        grid-column: auto;
        grid-row: auto;
    }

    .gallery--bento .shot img {
        aspect-ratio: 870 / 630;
    }

    .ring {
        --w: 150px;
    }

    .lightbox__prev,
    .lightbox__next {
        top: auto;
        bottom: 20px;
    }
}

/* ---------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {

    .ring__track,
    .wall__row,
    .wall__row:nth-child(2),
    .lightbox figure {
        animation: none;
    }

    .shot,
    .shot figcaption,
    .project__shot img {
        transition: none;
    }
}

.show-hero .actions {
    margin-top: 30px;
}
