/* Technology Global User (TGU) - ScrollMorph section: cards that gather into a slowly turning circle.
   Every class is prefixed tgu-morph (BEM). Behaviour lives in assets/js/morph.js.
   Without JavaScript (or for print and reduced motion) the finished circle is shown. */

/* ---------- Section ---------- */
.tgu-morph {
    --tgu-morph-card-w: 160px;
    --tgu-morph-card-h: 222px;
    position: relative;
    padding: 0;
    height: clamp(880px, 104vh, 1000px);
    overflow: hidden;
    background:
        radial-gradient(560px 420px at 50% 50%, #ffffff, transparent 70%),
        radial-gradient(640px 520px at 12% 18%, #c9dcff, transparent 70%),
        radial-gradient(620px 520px at 88% 22%, #ddd3ff, transparent 70%),
        radial-gradient(700px 520px at 78% 92%, #c8f1ff, transparent 70%),
        radial-gradient(640px 480px at 15% 90%, #e3dcff, transparent 70%),
        var(--tgu-morph-background, linear-gradient(180deg, #f5f8ff, #eef1ff));
    color: var(--navy);
}

/* Soft dotted texture and a dashed guide ring behind the cards */
.tgu-morph::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(#2f80ff26 1px, transparent 1.3px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(55% 55% at 50% 50%, transparent 30%, #000 60%, transparent 85%);
    mask-image: radial-gradient(55% 55% at 50% 50%, transparent 30%, #000 60%, transparent 85%);
    pointer-events: none;
}

.tgu-morph::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(820px, 84vw);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px dashed #2f80ff38;
    box-shadow: 0 0 0 90px #ffffff40, 0 0 0 91px #6d5dfc1f;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.tgu-morph__stage {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1400px;
}

/* ---------- Texts ---------- */
.tgu-morph__content {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 6;
    width: min(340px, 60%);
    transform: translate(-50%, -50%);
    text-align: center;
}


.tgu-morph__content-title {
    margin: 0 0 clamp(6px, 1.2vh, 12px);
    color: var(--tgu-morph-content-title-color, var(--navy));
    font-family: var(--tgu-morph-content-title-font, var(--f));
    font-size: var(--tgu-morph-content-title-size, clamp(28px, 2.6vw, 38px));
    font-weight: var(--tgu-morph-content-title-weight, 800);
    letter-spacing: var(--tgu-morph-content-title-spacing, -1px);
    line-height: var(--tgu-morph-content-title-line, 1.12);
}

.tgu-morph__content-text {
    margin: 0 auto clamp(10px, 2vh, 20px);
    max-width: 600px;
    color: var(--tgu-morph-content-text-color, var(--mut));
    font-family: var(--tgu-morph-content-text-font, var(--f));
    font-size: var(--tgu-morph-content-text-size, 14px);
    font-weight: var(--tgu-morph-content-text-weight, 400);
    letter-spacing: var(--tgu-morph-content-text-spacing, 0);
    line-height: var(--tgu-morph-content-text-line, 1.6);
}

/* ---------- Cards ---------- */
.tgu-morph__cards {
    position: absolute;
    inset: 0;
    z-index: 3;
}

.tgu-morph__card {
    position: absolute;
    width: var(--tgu-morph-card-w);
    height: var(--tgu-morph-card-h);
    outline: none;
    transform: translate(-50%, -50%) rotate(var(--fr, 0deg));
    /* Static arc: positions are percentages of the stage. */
    left: calc(50% + var(--fx, 0px));
    top: calc(50% + var(--fy, 0px));
    perspective: 900px;
    will-change: transform;
}

.tgu-morph__card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    box-shadow: 0 24px 50px #1f3f8040, 0 0 0 1px #ffffff80;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
}

.tgu-morph__card:hover .tgu-morph__card-inner,
.tgu-morph__card.tgu-is-flipped .tgu-morph__card-inner {
    box-shadow: 0 34px 70px #1f3f8059, 0 0 50px #6d9dff80;
}

.tgu-morph__card.tgu-is-flipped .tgu-morph__card-inner {
    transform: rotateY(180deg);
}

.tgu-morph__face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 18px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.tgu-morph__face--front img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Glass edge on the front of each card */
.tgu-morph__face--front::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1.5px #ffffff59, inset 0 1px 0 1.5px #ffffff40;
    background: linear-gradient(160deg, #ffffff2e, transparent 38%);
    pointer-events: none;
}

.tgu-morph__label {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    padding: 34px 16px 16px;
    background: linear-gradient(transparent, #050d1fb3);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.2;
    text-shadow: 0 2px 10px #00000059;
}

.tgu-morph__face--back {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 18px;
    border: 1.5px solid #ffffff38;
    background: linear-gradient(160deg, #1a3a78, #0b1a38);
    color: #fff;
    transform: rotateY(180deg);
    visibility: hidden;
    transition: visibility 0s 0.3s;
}

.tgu-morph__card.tgu-is-flipped .tgu-morph__face--back {
    visibility: visible;
    transition: visibility 0s;
}

.tgu-morph__face--back h3 {
    margin: 0;
    font-size: 16px;
    letter-spacing: -0.3px;
}

.tgu-morph__face--back p {
    margin: 0;
    color: #b6c6e3;
    font-size: 12.5px;
    line-height: 1.45;
}

.tgu-morph__face--back a {
    margin-top: 4px;
    color: #7cc4ff;
    font-size: 13px;
    font-weight: 700;
}

/* ---------- Live mode (JavaScript positions the cards from the centre) ---------- */
.tgu-is-live .tgu-morph__card {
    left: 50%;
    top: 50%;
    margin-left: calc(var(--tgu-morph-card-w) / -2);
    margin-top: calc(var(--tgu-morph-card-h) / -2);
    transform: none;
}

.tgu-is-live .tgu-morph__card-inner {
    cursor: grab;
}

/* ---------- Dragging ---------- */
.tgu-morph.tgu-is-dragging .tgu-morph__card-inner {
    cursor: grabbing;
}

.tgu-morph__cards {
    touch-action: pan-y;
}

/* ---------- Print: always show the finished circle ---------- */
@media print {
    .tgu-morph {
        height: auto;
        min-height: 900px;
    }

    .tgu-morph .tgu-morph__card {
        left: calc(50% + var(--fx, 0px)) !important;
        top: calc(50% + var(--fy, 0px)) !important;
        margin: 0 !important;
        transform: translate(-50%, -50%) rotate(var(--fr, 0deg)) !important;
    }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
    .tgu-morph {
        height: 760px;
        --tgu-morph-card-w: 84px;
        --tgu-morph-card-h: 116px;
    }

    .tgu-morph__content {
        top: 28px;
        width: min(560px, 90%);
        transform: translateX(-50%);
    }

    .tgu-morph__content-title {
        font-size: var(--tgu-morph-content-title-size-mobile, clamp(24px, 7vw, 32px));
    }

    .tgu-morph__content-text {
        font-size: var(--tgu-morph-content-text-size-mobile, 15px);
        margin-bottom: 14px;
    }

    .tgu-morph__label {
        padding: 20px 8px 8px;
        font-size: 12px;
    }

    .tgu-morph__face--back {
        padding: 10px;
        gap: 4px;
    }

    .tgu-morph__face--back h3 {
        font-size: 13px;
    }

    .tgu-morph__face--back p {
        display: none;
    }
}

/* ---------- Below 992px: no motion, the cards sit in a simple grid ---------- */
@media (max-width: 991px) {
    .tgu-morph {
        height: auto;
        padding: 80px 0;
    }

    .tgu-morph::after {
        display: none;
    }

    .tgu-morph__stage {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 36px;
        height: auto;
        padding: 0 20px;
        perspective: none;
    }

    .tgu-morph__content {
        position: static;
        width: min(560px, 100%) !important;
        transform: none;
    }

    .tgu-morph__cards {
        position: relative;
        inset: auto;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
        width: min(640px, 100%);
    }

    .tgu-morph .tgu-morph__card {
        position: relative;
        left: auto !important;
        top: auto !important;
        width: auto;
        height: auto;
        aspect-ratio: 13 / 18;
        margin: 0 !important;
        transform: none !important;
        opacity: 1 !important;
    }

    .tgu-morph__label {
        padding: 26px 12px 12px;
        font-size: 15px;
    }

    .tgu-morph__face--back p {
        display: block;
        font-size: 12px;
    }
}

@media (max-width: 560px) {
    .tgu-morph__cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

/* Heading: always one or two lines, the second line in the brand gradient */
.tgu-morph__content-title span {
    display: block;
    background: linear-gradient(90deg, #2f80ff, #6d5dfc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.tgu-morph__content-text {
    margin-top: 14px;
}

.tgu-morph__content .tgu-btn {
    margin-top: 10px;
}
