/*------------------------------------------------------------------*\
    Services Grid
\*------------------------------------------------------------------*/

.services-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.16vw;
    background-color: var(--color-black);
}

.services-grid__item {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 32vw; /* equivalent to 57vh at 16:9 — scales with width */
    padding: 5.375rem 3.625rem 3.688rem 4.875rem;
    background-size: cover;
    background-position: center;
    text-decoration: none;
    overflow: hidden;
}

/* Cover video sits behind the overlay (image stays as poster/fallback) */
.services-grid__cover-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

.services-grid__overlay {
    position: absolute;
    inset: 0;
    background-color: var(--service-overlay, rgba(0, 0, 0, 0.55));
    transition: opacity 0.3s ease;
    z-index: 0;
}

/* Lighten on hover via opacity so any overlay colour is preserved */
.services-grid__item:hover .services-grid__overlay {
    opacity: 0.7;
}

.services-grid__content,
.services-grid__footer {
    position: relative;
    z-index: 1;
    max-width: 100%;
}

.services-grid__title {
    font-weight: 700;
    color: var(--color-accent);
    margin: 0 0 0.75rem;
    line-height: 1;
    min-height: 2em;
}

/* Card description hidden — shown only inside the expand panel */
.services-grid__item .services-grid__desc {
    display: none;
}

.services-grid__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* "MORE" label hidden — only the arrow remains in the footer */
.services-grid__more {
    display: none;
}

/* Card arrow — uses the reusable .miv-ring component (ring + chevron) */
.services-grid__number {
    --miv-ring-border: 0.08vw solid rgba(255, 255, 255, 0.7);
    font-size: 0; /* hide the service number text; icon comes from .miv-ring */
    cursor: pointer;
    transition: transform 0.3s ease, --miv-ring-angle 0.6s ease;
}

.services-grid__item:hover .services-grid__number {
    transform: translateX(0.21vw);
    --miv-ring-angle: 360deg;
}

/* QHD — 2560px */
@media screen and (min-width: 2560px) {
    .services-grid__title {
        font-size: 2.25rem;
    }

    .services-grid__desc {
        font-size: 1.5rem;
    }

    .services-grid__number {
        width: 3.063rem;
        height: 3.063rem;
    }
}

/* Ultra-wide — 3440px */
@media screen and (min-width: 3440px) {
    .services-grid__item {
        padding: 5.31rem 10rem;
    }

    .services-grid__title {
        font-size: 2.75rem;
    }

    .services-grid__desc {
        font-size: 1.75rem;
    }

    .services-grid__number {
        width: 4.5rem;
        height: 4.5rem;
    }
}

/* 4K — 3840px */
@media screen and (min-width: 3840px) {
    .services-grid__title {
        font-size: 3.25rem;
    }

    .services-grid__desc {
        font-size: 2.25rem;
    }

    .services-grid__number {
        width: 5.5rem;
        height: 5.5rem;
    }
}

/*------------------------------------------------------------------*\
    Expand Panel
\*------------------------------------------------------------------*/

.services-grid {
    position: relative; /* anchor for absolute panel */
}

.services-grid__panel {
    position: absolute;
    left: 0;
    width: 100%;
    z-index: 10;
    pointer-events: none;
    overflow: hidden;
    clip-path: inset(0 100% 0 0);
}

.services-grid__panel.is-active {
    pointer-events: all;
}

.services-grid__panel-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* Cover video fills the panel image area, behind the overlay */
.services-grid__panel-cover-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.services-grid__panel-overlay {
    position: absolute;
    inset: 0;
    background-color: var(--service-overlay, rgba(0, 0, 0, 0.55));
    z-index: 1;
}

.services-grid__panel-text {
    position: absolute;
    top: 5.31rem;
    left: 0;
    width: 45%;
    z-index: 2;
    padding: 0 8.87rem;
}

.services-grid__panel .services-grid__panel-title {
    font-size: var(--fluid-grid-title) !important;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1.1;
    margin: 0 0 1.5rem;
}

.services-grid__panel .services-grid__panel-desc {
    font-size: var(--fluid-services-grid-desc) !important;
    color: var(--color-text-soft);
    line-height: 1.6;
    margin: 0;
}

.services-grid__panel-close {
    display: none;
}

.services-grid__panel-feature {
    position: absolute;
    right: 15rem;
    top: calc(50% - 258px);
    width: 780px;
    height: 516px;
    background-size: cover;
    background-position: center;
    z-index: 2;
}

.services-grid__panel-feature.has-image,
.services-grid__panel-feature.has-video,
.services-grid__panel-feature.has-slider {
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
}

.services-grid__panel-feature.has-slider {
    background-image: none;
    background-color: rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.services-grid__panel-feature .swiper {
    width: 100%;
    height: 100%;
}

.services-grid__panel-feature .swiper-slide {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.services-grid__panel-feature .swiper-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transform: scale(1);
    transform-origin: center center;
    transition: transform 0.6s ease-out;
}

.services-grid__panel-feature .swiper-slide-active img {
    animation: servicesKenBurns 8s ease-out forwards;
}

@keyframes servicesKenBurns {
    from { transform: scale(1); }
    to   { transform: scale(1.06); }
}

/* Video mode — fills the feature container, no letterbox */
.services-grid__panel-feature.has-video {
    background-image: none;
    background-color: #000;
    overflow: hidden;
}

.services-grid__panel-feature .services-grid__panel-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    display: block;
}

/* YouTube/Vimeo iframes need a wrapper to simulate object-fit via oversizing */
.services-grid__panel-feature.has-video iframe.services-grid__panel-video {
    pointer-events: none;
}

/* Oversize YouTube iframe so the auto-shown chrome (title bar, share, logo) is clipped outside the visible area */
.services-grid__panel-feature.has-video iframe.services-grid__panel-video[src*="youtube"] {
    inset: auto;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    transform: translate(-50%, -50%);
}

.services-grid__panel-feature .swiper-pagination {
    bottom: 0.75rem;
    z-index: 10;
}

.services-grid__panel-feature .swiper-pagination-bullet {
    width: 0.5rem;
    height: 0.5rem;
    background: #fff;
    opacity: 0.4;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.services-grid__panel-feature .swiper-pagination-bullet-active {
    background: var(--color-accent, #d9a96a);
    opacity: 1;
}

/* Panel close arrow — uses the reusable .miv-ring component (ring + chevron) */
.services-grid__panel-nav {
    --miv-ring-border: 0.08vw solid rgba(255, 255, 255, 0.7);
    position: absolute;
    left: 8.87rem;
    bottom: 5.31rem;
    z-index: 3;
    background: none;
    cursor: pointer;
    transition: border-color 0.2s ease, --miv-ring-angle 0.6s ease;
}

.services-grid__panel-nav:hover {
    border-color: #fff;
}

/* Small desktop / iPad landscape — 1366px */
@media screen and (min-width: 768px) and (max-width: 1440px) {
    .services-grid__panel-feature {
        width: 38vw;
        height: calc(38vw / 1.51);
        top: calc(50% - (38vw / 1.51) / 2);
        right: 10rem;
    }

    .services-grid__panel-feature.has-image,
    .services-grid__panel-feature.has-video,
    .services-grid__panel-feature.has-slider {
        width: 50%;
        height: 100%;
        top: 0;
        right: 0;
    }

    .services-grid__panel-nav {
        left: 5rem;
    }

    .services-grid__panel-text {
        padding: 0 5rem;
    }
}

/* iPad — single column grid */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .services-grid {
        grid-template-columns: 1fr;
    }

    .services-grid__item {
        min-height: 56vw;
    }
}

/* iPad portrait / small tablet — 1024px */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .services-grid__panel-feature {
        width: 35vw;
        height: calc(35vw / 1.51);
        top: calc(50% - (32vw / 1.51) / 2);
        right: 10rem;
    }

    .services-grid__panel-feature.has-image,
    .services-grid__panel-feature.has-video,
    .services-grid__panel-feature.has-slider {
        width: 50%;
        height: 100%;
        top: 0;
        right: 0;
    }

    .services-grid__panel-nav {
        left: 3rem;
    }

    .services-grid__panel-text {
        padding: 0 3rem;
        width: 50%;
    }
}

/* Mobile — full screen */
@media screen and (max-width: 767px) {
    .services-grid {
        grid-template-columns: 1fr;
    }

    .services-grid__title {
        font-size: 2.5rem !important;
    }

    .services-grid__item {
        min-height: 56.25vw; /* keep a 16:9 horizontal ratio (not full-height/vertical) */
        padding: 2rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    /* Full-screen takeover (override the JS inline top/height set for desktop rows) */
    .services-grid__panel {
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100svh !important;
        display: flex;
        flex-direction: column;
        overflow: hidden auto;
    }

    .services-grid__panel-text {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        padding: 5rem 2rem 1.5rem;
    }

    .services-grid__panel-feature,
    .services-grid__panel-feature.has-image,
    .services-grid__panel-feature.has-video,
    .services-grid__panel-feature.has-slider {
        position: relative;
        right: auto;
        top: auto;
        width: calc(100% - 4rem);
        height: calc((100vw - 4rem) / 1.51);
        margin: 0 2rem;
        display: block;
        flex-shrink: 0;
    }

    .services-grid__panel-nav {
        left: 2rem;
        bottom: 2rem;
    }

    .services-grid__panel-feature {
        margin-bottom: 5rem;
    }
}
