/* Gravity Projex Website | Gravity Projex Proprietary License
   Copyright (c) 2026 Gravity Projex. All Rights Reserved. | gravityprojex.com.au */

/*
 * Home page only (auto-enqueued by inc/assets.php for page-home-template.php).
 *   1. Digital Translator: jargon to plain English toggle in the hero
 *   2. Orbit timeline: "How We Work" line that draws itself on scroll
 * Added in 4.10.0.
 */

/* ========================================
   1. DIGITAL TRANSLATOR
   ======================================== */

.gp-translator {
    max-width: 640px;
    margin: 56px auto 0;
    padding: 20px 22px 18px;
    text-align: left;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(13, 27, 42, 0.65);
    box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.6);
}

.gp-translator__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.gp-translator__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gp-coral, #ff6b6b);
}

.gp-translator__label::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px 1px rgba(255, 107, 107, 0.6);
}

.gp-translator__switch {
    display: inline-flex;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.gp-translator__switch[hidden] { display: none; }

.gp-translator__opt {
    appearance: none;
    border: 0;
    margin: 0;
    padding: 7px 14px;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.gp-translator__opt:hover { color: #ffffff; }

.gp-translator__opt[aria-pressed="true"] {
    background: linear-gradient(135deg, #ff6b6b, #ff8a8a);
    color: #ffffff;
}

.gp-translator__opt:focus-visible,
.gp-translator__next:focus-visible {
    outline: 2px solid #ff8a8a;
    outline-offset: 2px;
}

.gp-translator__body { position: relative; }

.gp-translator__text {
    margin: 0;
    transition: color 0.3s ease;
}

.gp-translator__text.is-jargon {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 15px;
    line-height: 1.65;
    color: #cbd5e1;
}

.gp-translator__text.is-plain {
    font-size: 18px;
    line-height: 1.55;
    color: #ffffff;
}

/* Without JS both lines show, so the point still lands. */
.gp-translator__fallback {
    margin: 10px 0 0;
    font-size: 17px;
    line-height: 1.55;
    color: #ffffff;
}

.gp-translator.is-ready .gp-translator__fallback { display: none; }

.gp-translator__next {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: #ff8a8a;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.gp-translator__next[hidden] { display: none; }
.gp-translator__next:hover { color: #ffffff; }
.gp-translator__next svg { transition: transform 0.4s ease; }
.gp-translator__next:hover svg { transform: rotate(180deg); }

.gp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 639px) {
    .gp-translator { margin-top: 40px; padding: 16px; border-radius: 16px; }
    .gp-translator__text.is-jargon { font-size: 14px; }
    .gp-translator__text.is-plain { font-size: 16px; }
}

/* ========================================
   2. ORBIT TIMELINE (How We Work)
   Mobile: vertical line down the left.
   Desktop: horizontal line through the nodes.
   Default styles are the finished state, so browsers without
   scroll-driven animations (and reduced-motion users) see it complete.
   ======================================== */

/* overflow: clip (not hidden) so the section is not a scroll container;
   otherwise the scroll-driven timeline would attach to it and never move. */
.gp-orbit-section { overflow: clip; }

.gp-orbit {
    --node: 56px;
    --line: 2px;
    position: relative;
}

.gp-orbit__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 32px;
}

.gp-orbit__step {
    display: grid;
    grid-template-columns: var(--node) 1fr;
    gap: 20px;
    align-items: start;
}

.gp-orbit__track {
    position: absolute;
    top: calc(var(--node) / 2);
    bottom: calc(var(--node) / 2);
    left: calc(var(--node) / 2 - var(--line) / 2);
    width: var(--line);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.gp-orbit__fill {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #ff6b6b, #ff8a8a);
    transform-origin: top center;
}

.gp-orbit__node {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--node);
    height: var(--node);
    border-radius: 50%;
    border: 2px solid #ff6b6b;
    background: linear-gradient(rgba(255, 107, 107, 0.14), rgba(255, 107, 107, 0.14)), #0d1b2a;
    color: #ff6b6b;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 0 24px -4px rgba(255, 107, 107, 0.55);
    transition: transform 0.3s ease;
}

.gp-orbit__step:hover .gp-orbit__node { transform: scale(1.08); }

.gp-orbit__copy { padding-top: 6px; }

.gp-orbit__title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.gp-orbit__desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #94a3b8;
}

@media (min-width: 1024px) {
    .gp-orbit__steps {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 16px;
    }

    .gp-orbit__step {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .gp-orbit__copy { padding-top: 0; }
    .gp-orbit__desc { font-size: 13px; }

    .gp-orbit__track {
        top: calc(var(--node) / 2 - var(--line) / 2);
        bottom: auto;
        left: calc(100% / 14);
        right: calc(100% / 14);
        width: auto;
        height: var(--line);
    }

    .gp-orbit__fill {
        background: linear-gradient(to right, #ff6b6b, #ff8a8a);
        transform-origin: left center;
    }
}

/* Scroll-driven version: runs on the compositor, no JavaScript, no scroll listeners. */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {

        .gp-orbit {
            view-timeline-name: --gp-orbit;
            view-timeline-axis: block;
            /* Fill runs from --r0 to (--r0 + 6 x --step) of the section's
               journey through the viewport. Tuned so the line tip tracks
               roughly where the eye is reading. */
            --r0: 22%;
            --step: 8%;
        }

        .gp-orbit__fill {
            animation: gp-orbit-fill-y linear both;
            animation-timeline: --gp-orbit;
            animation-range: cover var(--r0) cover calc(var(--r0) + var(--step) * 6);
        }

        .gp-orbit__node,
        .gp-orbit__copy {
            animation-timeline: --gp-orbit;
            animation-fill-mode: both;
            animation-timing-function: ease-out;
            animation-range:
                cover calc(var(--r0) + var(--step) * var(--i) - 1%)
                cover calc(var(--r0) + var(--step) * var(--i) + 3%);
        }

        .gp-orbit__node { animation-name: gp-orbit-node; }
        .gp-orbit__copy { animation-name: gp-orbit-copy; }

        @media (min-width: 1024px) {
            .gp-orbit { --r0: 20%; --step: 5%; }
            .gp-orbit__fill { animation-name: gp-orbit-fill-x; }
        }
    }
}

@keyframes gp-orbit-fill-y { from { transform: scale(1, 0); } }
@keyframes gp-orbit-fill-x { from { transform: scale(0, 1); } }

@keyframes gp-orbit-node {
    from {
        border-color: rgba(255, 255, 255, 0.12);
        color: #64748b;
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
        background: linear-gradient(rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02)), #0d1b2a;
    }
}

@keyframes gp-orbit-copy {
    from { opacity: 0.35; }
}
