/* Round16 — Marketplace — section-steps
   Figma: 4096:6169, ring states 4096:8542/8577/8612/8647 (desktop) | 4096:6306 (tablet/mobile,
   "4 steps" -- the actual section frame with padding; 4096:8682 was a stray/unused variant
   with a taller 331px ring window, do not use it -- 4096:6306's ring window is only 150px).
   Desktop: pinned scroll-jack, 3-col row (rotating number dial | copy | screenshot).
   Tablet/mobile: same dial/copy/media, stacked vertically, smaller dial radius; no pin —
   click a marker to switch step, scroll just reveals the section (fade-up-animations). */

.r16-steps {
    /* Dark theme tokens come from global.css (body.page-template-static-pages-R16page-
       marketplace-php) -- not redefined here. */

    position: relative;
    display: flex;
    justify-content: center;
    background: var(--color-1st-bg);
    /* Papers over a hairline sub-pixel gap some browsers can render between two
       adjacent same-color sections (fractional computed heights from flex/aspect-ratio
       layout round independently per element) -- paint-only, doesn't affect layout.
       Both edges: a neighbor with its own overflow:hidden (e.g. section-proven) can't
       show its own copy of this shadow, so covering both sides here is what protects it. */
    box-shadow: 0 -2px 0 0 var(--color-1st-bg), 0 2px 0 0 var(--color-1st-bg);
    padding: var(--var-140, 140px) var(--section-horizontal-padding, 32px);
    font-family: var(--font-body);
}

.r16-steps * {
    box-sizing: border-box;
}

.r16-steps__content {
    /* Figma: this section's content-wrapper has NO max-w-1400px class (unlike every
       other section on this page) -- it spans the section's full width minus padding. */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--section-gap, 80px);
    width: 100%;
}

.r16-steps__headings {
    display: flex;
    justify-content: center;
    width: 100%;
}

.r16-steps__title {
    max-width: 800px;
    margin: 0;
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: var(--fs-h2, 48px);
    line-height: var(--lh-heading, 1.15);
    color: var(--color-1st-fg);
}

.r16-steps__scroller {
    position: relative;
    width: 100%;
}

.r16-steps__viewport {
    position: sticky;
    top: 0;
    width: 100%;
}

.r16-steps__row {
    display: flex;
    align-items: center;
    gap: var(--var-80, 80px);
    width: 100%;
    height: 1076px;
}

/* ---------- Dial (rotating ring of numbered markers) ---------- */
.r16-steps__dial {
    --ring-size: 1076px;
    --track-size: 1000px;
    --radius: 500px;
    --track-inset: 65.42px;
    --ring-inset: 27.42px;
    /* Where marker --angle:0deg points (see .r16-steps__marker below): 3 o'clock on
       desktop, redefined to 6 o'clock (90deg) for tablet's bottom-anchored dial. Must
       live here (an ancestor), not on .marker itself, so the tablet override below
       can actually reach it through inheritance. */
    --anchor-offset: 0deg;

    position: relative;
    flex: 1 0 0;
    height: 100%;
    overflow: hidden;
}

.r16-steps__track {
    position: absolute;
    right: var(--track-inset);
    top: 50%;
    transform: translateY(-50%);
    width: var(--track-size);
    height: var(--track-size);
    display: block;
}

.r16-steps__ring {
    position: absolute;
    right: var(--ring-inset);
    top: 50%;
    width: var(--ring-size);
    height: var(--ring-size);
    transform: translateY(-50%) rotate(var(--ring-angle, 0deg));
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.r16-steps__marker {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    transform: rotate(calc(var(--angle) + var(--anchor-offset))) translateX(var(--radius));
    cursor: pointer;
}

.r16-steps__marker-inner {
    /* Counter-rotate by -anchor-offset only, cancelling the position shift above so
       content tilt still follows the same (ring-angle + angle) formula as desktop --
       the active marker's text stays upright regardless of the anchor point. */
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%) rotate(calc(-1 * var(--anchor-offset)));
    display: flex;
    align-items: center;
    gap: 8px;
}

.r16-steps__marker-dot {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff000f;
    opacity: 0;
    transition: opacity 0.4s ease;
    flex-shrink: 0;
}

.r16-steps__marker-num {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: var(--fs-h4, 32px);
    line-height: 1;
    color: var(--color-1st-fg);
    opacity: 0.3;
    transition: opacity 0.4s ease;
    white-space: nowrap;
}

.r16-steps__marker.is-active .r16-steps__marker-dot {
    opacity: 1;
}

.r16-steps__marker.is-active .r16-steps__marker-num {
    opacity: 1;
}

/* Desktop: a no-op wrapper -- .panel/.media stay flat, equal-width siblings of .dial
   in the 3-column row exactly as before. Tablet (media query below) turns it into the
   actual grouping column Figma uses. */
.r16-steps__group {
    display: contents;
}

/* ---------- Copy panel (step title + description, one visible at a time) ---------- */
.r16-steps__panel {
    position: relative;
    flex: 1 0 0;
    height: 100%;
}

.r16-steps__copy {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--var-28, 28px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
}

.r16-steps__copy.is-visible {
    opacity: 1;
    visibility: visible;
}

.r16-steps__copy-title {
    margin: 0;
    max-width: 800px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: var(--fs-h4, 32px);
    line-height: var(--lh-heading, 1.15);
    color: var(--color-1st-fg);
}

.r16-steps__copy-desc {
    margin: 0;
    max-width: 600px;
    font-size: var(--fs-body, 16px);
    line-height: var(--lh-body, 1.4);
    color: var(--color-2nd-fg);
}

/* ---------- Screenshot media (one visible at a time) ---------- */
.r16-steps__media {
    position: relative;
    flex: 1 0 0;
    height: 100%;
}

.r16-steps__media-item {
    /* Sized by its own aspect-ratio (inline style, per screenshot) against the
       column's WIDTH, then vertically centered -- matching Figma (the image wrapper
       is `aspect-[w/h]`, not stretched to the row's full height). Forcing height:100%
       here would force object-fit:cover to crop most of the image's width away. */
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.r16-steps__media-item.is-visible {
    opacity: 1;
}

.r16-steps__media-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Responsive (tablet + mobile share this single breakpoint) ---------- */
@media (max-width: 1024px) {
    .r16-steps {
        /* Figma 4096:6306: py-[var(--var-72,72px)] -- --var-140 doesn't auto-respond
           to the breakpoint on its own, unlike --section-horizontal-padding. */
        padding-top: var(--var-72, 72px);
        padding-bottom: var(--var-72, 72px);
    }

    .r16-steps__row {
        /* container-type lives here (a plain flex container, not on .dial itself,
           which also carries aspect-ratio + overflow:hidden) so cqw math below can't
           get tangled up in that element's own size-containment/aspect-ratio resolution.
           .dial is width:100% of this row, so cqw here == cqw against .dial's width. */
        container-type: inline-size;
        flex-direction: column;
        align-items: stretch;
        height: auto;
        gap: var(--var-40, 40px);
    }

    .r16-steps__dial {
        /* Figma 4096:6306 ("4-steps", the correct/current tablet frame -- NOT 4096:8682,
           a stray variant with a much taller 331px window that made the ring look far
           bigger than intended): ring window is only 150px tall on a 794px-wide dial
           (≈18.9% of width). Ring/track/radius keep the exact same proportions as
           desktop (track = 800/860.8 of the ring wrapper; radius = track/2) scaled to
           this width instead of desktop's 1076px fixed reference. Bottom offset (~3.9%
           of width) leaves room for the marker number below the dot, measured directly
           off the rendered PNG. */
        --ring-size: 108.4cqw;
        --track-size: 100.8cqw;
        --radius: 50.4cqw;
        --anchor-offset: 90deg;
        flex: none;
        width: 100%;
        aspect-ratio: 794 / 150;
        height: auto;
        overflow: hidden;
    }

    .r16-steps__track,
    .r16-steps__ring {
        left: 50%;
        right: auto;
        top: auto;
        bottom: 3.9cqw;
    }

    .r16-steps__track {
        transform: translateX(-50%);
    }

    .r16-steps__ring {
        transform: translateX(-50%) rotate(var(--ring-angle, 0deg));
    }

    .r16-steps__marker-inner {
        gap: 6.4px;
    }

    .r16-steps__marker-dot {
        width: 16px;
        height: 16px;
    }

    .r16-steps__marker-num {
        font-size: 25.6px;
    }

    .r16-steps__group {
        /* Figma 4096:6306: panel+media are nested in one group, capped at 500px and
           centered in the row -- NOT full-width like the ring above them. */
        display: flex;
        flex-direction: column;
        gap: var(--var-20, 20px);
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }

    .r16-steps__panel {
        flex: none;
        width: 100%;
        height: auto;
    }

    .r16-steps__copy {
        position: relative;
        inset: auto;
        display: none;
        gap: var(--var-16, 16px);
    }

    .r16-steps__copy.is-visible {
        display: flex;
    }

    .r16-steps__copy-title {
        font-size: var(--fs-h4, 22px);
    }

    .r16-steps__media {
        flex: none;
        width: 100%;
        height: auto;
    }

    .r16-steps__media-item {
        display: none;
    }

    .r16-steps__media-item.is-visible {
        display: block;
        position: relative;
        inset: auto;
        top: auto;
        transform: none;
        width: 100%;
    }

    .r16-steps__media-img {
        height: auto;
    }
}
