/* ==========================================================================
   Business Services V2 - "the turning cube"
   Markup:  Views/Home/homePartialsV2/_buisnessServicesV2.cshtml
   Script:  Content/js/UI-interaction/pio-business-cube.js
   --------------------------------------------------------------------------
   Everything is namespaced under .pio-biz so nothing here can reach the
   original section (_buisnessServices.cshtml / pio-swiper), and nothing in
   style.css aimed at swiper-container can reach this one.

   The cube is plain CSS 3D - no Swiper. Four side faces carry the three
   service illustrations (the script re-paints the face that is hidden behind
   the cube, so the sequence reads 1,2,3,1,2,3 forever), plus a brand lid.
   Direction is logical: in RTL the cube turns the other way, so the next
   face always arrives from the reading direction.
   ========================================================================== */

.pio-biz {
    --biz-ink: #10202B;
    --biz-muted: #5d6874;
    --biz-line: #e6e9ef;
    --biz-accent: var(--pio-primary-color, #FFA000);
    --biz-cyan: var(--pio-primary-color2, #00AACD);
    --biz-stage: #fff;
    --biz-size: clamp(168px, 44vw, 230px);
    --biz-tilt: -13deg;
    --biz-s: 1;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "stage" "rail";
    row-gap: 2rem;
    color: var(--biz-ink);
}

.pio-biz[dir="rtl"],
[dir="rtl"] .pio-biz {
    --biz-s: -1;
}

@media (min-width: 768px) {
    .pio-biz {
        --biz-size: clamp(200px, 30vw, 250px);
    }
}

@media (min-width: 992px) {
    .pio-biz {
        --biz-size: clamp(210px, 21vw, 290px);
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        grid-template-rows: auto 1fr;
        grid-template-areas: "head stage" "rail stage";
        column-gap: clamp(2.5rem, 5vw, 5.5rem);
        row-gap: 2.25rem;
    }
}

/* ---------- heading block ---------- */
.pio-biz__head {
    grid-area: head;
    align-self: end;
}

.pio-biz__eyebrow {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 0 1rem;
    color: var(--biz-cyan);
    font-size: clamp(.875rem, .82rem + .2vw, 1rem);
    font-weight: 700;
}

    .pio-biz__eyebrow::before {
        content: "";
        width: 3.25rem;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
    }

.pio-biz .pio-biz__title {
    margin: 0 0 1rem;
    font-size: clamp(1.75rem, 1.25rem + 1.9vw, 2.75rem);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -.01em;
    text-transform: none;
    text-wrap: balance;
}

.pio-biz__intro {
    max-width: 36rem;
    margin: 0;
    color: var(--biz-muted);
    font-size: clamp(.95rem, .9rem + .2vw, 1.0625rem);
    line-height: 1.75;
}

/* ---------- service rail ---------- */
.pio-biz__rail {
    grid-area: rail;
    align-self: start;
}

.pio-biz__list {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--biz-line);
}

.pio-biz__item {
    --biz-item-tint: var(--biz-cyan);
    position: relative;
    border-bottom: 1px solid var(--biz-line);
}

.pio-biz .pio-biz__h {
    margin: 0;
    font-size: inherit;
    text-transform: none;
}

.pio-biz__tab {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    width: 100%;
    margin: 0;
    padding: 1.15rem 0;
    border: 0;
    background: none;
    color: var(--biz-muted);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: color .35s ease;
}

    .pio-biz__tab:hover {
        color: var(--biz-ink);
    }

    .pio-biz__tab:focus-visible {
        outline: 2px solid var(--biz-cyan);
        outline-offset: 4px;
        border-radius: 4px;
    }

.pio-biz__num {
    flex: 0 0 1.9rem;
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: .08em;
    font-variant-numeric: tabular-nums;
    transition: color .35s ease;
}

.pio-biz__name {
    font-size: clamp(1.0625rem, .98rem + .4vw, 1.375rem);
    font-weight: 600;
    line-height: 1.3;
}

.pio-biz__item.is-active .pio-biz__tab {
    color: var(--biz-ink);
}

.pio-biz__item.is-active .pio-biz__num {
    color: var(--biz-item-tint);
}

/* Descriptions stay in the DOM for crawlers and screen readers; only the
   active one is opened visually. 0fr -> 1fr animates to the real height. */
.pio-biz__panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .55s cubic-bezier(.2, .7, .2, 1);
}

    .pio-biz__panel > div {
        min-height: 0;
        overflow: hidden;
    }

.pio-biz__item.is-active .pio-biz__panel {
    grid-template-rows: 1fr;
}

.pio-biz__desc {
    margin: 0;
    padding: 0 0 1.35rem;
    padding-inline-start: 2.9rem;
    color: var(--biz-muted);
    font-size: clamp(.9rem, .87rem + .15vw, 1rem);
    line-height: 1.75;
    opacity: 0;
    transition: opacity .3s ease;
}

.pio-biz__item.is-active .pio-biz__desc {
    opacity: 1;
    transition-delay: .12s;
}

/* The line under the active service fills as its face turns past - it is
   driven by the cube's angle, so it can never drift out of sync. */
.pio-biz__bar {
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 2px;
    overflow: hidden;
    pointer-events: none;
}

    .pio-biz__bar i {
        display: block;
        height: 100%;
        background: var(--biz-accent);
        transform: scaleX(0);
        transform-origin: left center;
    }

.pio-biz[dir="rtl"] .pio-biz__bar i,
[dir="rtl"] .pio-biz .pio-biz__bar i {
    transform-origin: right center;
}

.pio-biz__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pio-biz .pio-biz__cta {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    width: auto;
    padding: .8rem 1.5rem;
    border: 0;
    border-radius: 8px;
    background: var(--biz-accent);
    color: #fff;
    font-size: clamp(.875rem, .84rem + .15vw, 1rem);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .25s ease, box-shadow .25s ease;
}

    .pio-biz .pio-biz__cta:hover {
        background: #f29400;
        color: #fff;
        box-shadow: 0 8px 22px -10px rgba(255, 160, 0, .9);
    }

    .pio-biz .pio-biz__cta:focus-visible {
        outline: 3px solid var(--biz-ink);
        outline-offset: 3px;
    }

    .pio-biz .pio-biz__cta svg {
        transition: transform .25s ease;
    }

    .pio-biz .pio-biz__cta:hover svg {
        transform: translateX(calc(3px * var(--biz-s)));
    }

.pio-biz[dir="rtl"] .pio-biz__cta svg,
[dir="rtl"] .pio-biz .pio-biz__cta svg {
    scale: -1 1;
}

/* ---------- stage ---------- */
.pio-biz__stage {
    grid-area: stage;
    position: relative;
    display: grid;
    place-items: center;
    min-height: calc(var(--biz-size) * 2.55);
    border-radius: 28px;
    background: var(--biz-stage);
    overflow: hidden;
    isolation: isolate;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

@media (min-width: 992px) {
    .pio-biz__stage {
        min-height: max(540px, calc(var(--biz-size) * 2.05));
        height: 100%;
    }
}

.pio-biz__stage.is-dragging {
    cursor: grabbing;
}

/* one glow per service, cross-faded - picks up the colour of the face in front */
.pio-biz__glow {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: -2;
    width: calc(var(--biz-size) * 2.6);
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--biz-glow, #6a3db4), transparent 72%);
    opacity: 0;
    transform: translate(-50%, -54%);
    transition: opacity 1.4s ease;
}

    .pio-biz__glow.is-on {
        opacity: .26;
    }

/* the turntable under the cube */
.pio-biz__floor {
    position: absolute;
    top: calc(50% + var(--biz-size) * .64);
    left: 50%;
    z-index: -1;
    width: calc(var(--biz-size) * 1.72);
    aspect-ratio: 1;
    transform: translate(-50%, -50%) scaleY(.24);
    pointer-events: none;
}

    .pio-biz__floor svg {
        display: block;
        width: 100%;
        height: 100%;
        overflow: visible;
    }

.pio-biz__shadow {
    position: absolute;
    top: calc(50% + var(--biz-size) * .64);
    left: 50%;
    z-index: -1;
    width: calc(var(--biz-size) * 1.05);
    height: calc(var(--biz-size) * .2);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(16, 32, 43, .38), rgba(16, 32, 43, 0));
    transform: translate(-50%, -50%) scaleX(1.2);
    pointer-events: none;
}

.pio-biz__scene {
    width: var(--biz-size);
    height: var(--biz-size);
    perspective: calc(var(--biz-size) * 4.5);
    perspective-origin: 50% 20%;
}

.pio-biz__float,
.pio-biz__cube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.pio-biz__cube {
    transform: rotateX(var(--biz-tilt)) rotateY(calc(30deg * var(--biz-s)));
    will-change: transform;
}

.pio-biz__face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #173a57;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

    .pio-biz__face img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        pointer-events: none;
        -webkit-user-drag: none;
    }

    /* soft top-left sheen */
    .pio-biz__face::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(140deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 42%);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
        pointer-events: none;
    }

/* darkens a face as it turns away from the viewer (opacity set by the script) */
.pio-biz__shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #06121c;
    opacity: 0;
    pointer-events: none;
}

.pio-biz__face[data-face="0"] { transform: rotateY(0deg) translateZ(calc(var(--biz-size) / 2)); }
.pio-biz__face[data-face="1"] { transform: rotateY(calc(90deg * var(--biz-s))) translateZ(calc(var(--biz-size) / 2)); }
.pio-biz__face[data-face="2"] { transform: rotateY(180deg) translateZ(calc(var(--biz-size) / 2)); }
.pio-biz__face[data-face="3"] { transform: rotateY(calc(-90deg * var(--biz-s))) translateZ(calc(var(--biz-size) / 2)); }

/* the lid: brand orange with the same diamond linework as the illustrations */
.pio-biz__face--top {
    transform: rotateX(90deg) translateZ(calc(var(--biz-size) / 2));
    background: linear-gradient(135deg, #FFC04D 0%, #FFA000 55%, #F28C00 100%);
}

    .pio-biz__face--top svg {
        position: absolute;
        inset: 12%;
        width: 76%;
        height: 76%;
    }

.pio-biz__face--bottom {
    transform: rotateX(-90deg) translateZ(calc(var(--biz-size) / 2));
    background: #0d2233;
}

/* ---------- stage chrome ---------- */
.pio-biz__count {
    position: absolute;
    inset-block-start: 1.15rem;
    inset-inline-start: 1.35rem;
    color: var(--biz-muted);
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .1em;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

    .pio-biz__count b {
        color: var(--biz-ink);
        font-weight: 700;
    }

@media (prefers-reduced-motion: reduce) {
    .pio-biz__panel,
    .pio-biz__desc,
    .pio-biz__glow {
        transition: none;
    }
}
