/* The wheel turns; labels and icons counter-rotate to stay upright. */
.carousel-regulator {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    --regulator-scale: 1.05;
    width: calc(380px * var(--regulator-scale));
    height: calc(560px * var(--regulator-scale));
    overflow: hidden;
}
.regulator-wheel {
    position: absolute;
    inset: 10px auto auto 0;
    width: 330px;
    height: 540px;
    transform-origin: 310px 270px;
    transform: rotate(var(--wheel-angle));
    transition: transform 0.75s cubic-bezier(0.22, 0.68, 0.2, 1);
}
.regulator-segment {
    position: absolute;
    inset: 0;
    width: 330px;
    height: 540px;
    padding: 0;
    border: 0;
    background: none;
    pointer-events: none;
    color: #ffffff;
    cursor: pointer;
    transform-origin: 310px 270px;
    transform: rotate(var(--slot-angle));
}
.regulator-segment svg {
    position: absolute;
    inset: 0;
    width: 330px;
    height: 540px;
    max-width: none;
    overflow: visible;
}
.regulator-segment path {
    fill: rgba(255, 86, 86, 0.85);
    pointer-events: visiblePainted;
    transition: fill 0.3s;
}
.regulator-segment.is-active path,
.regulator-segment:hover path {
    fill: rgba(255, 86, 86, 0.85);
}
.regulator-label,
.regulator-icon {
    position: absolute;
    top: 270px;
    transform: translate(-50%, -50%) rotate(calc(0deg - var(--slot-angle) - var(--wheel-angle)));
    transition: transform 0.75s cubic-bezier(0.22, 0.68, 0.2, 1);
}
.regulator-label {
    left: 94px;
    width: 76px;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    pointer-events: none;
}
.regulator-icon {
    left: 177px;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow:
        0 3px 8px #0006,
        0 1px 2px #0004;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}
.regulator-icon img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}
.regulator-segment:focus-visible {
    outline: none;
}
.regulator-segment:focus-visible path {
    stroke: #3584ff;
    stroke-width: 3;
}
@media (prefers-reduced-motion: reduce) {
    .regulator-wheel,
    .regulator-label,
    .regulator-icon,
    .regulator-segment path {
        transition: none;
    }
}

/* Leave the far side empty and fade sectors as they recede. */
.regulator-segment svg,
.regulator-label {
    opacity: var(--depth-opacity, 0.2);
}
.regulator-label {
    transition:
        transform 0.75s cubic-bezier(0.22, 0.68, 0.2, 1),
        opacity 0.75s;
}
.regulator-segment:not(.has-content) .regulator-label,
.regulator-segment:not(.has-content) .regulator-icon {
    visibility: hidden;
    pointer-events: none;
}
.regulator-segment:not(.has-content) path {
    pointer-events: none;
}
.regulator-segment svg {
    transform-origin: 94px 270px;
    filter: drop-shadow(0 3px 5px #0005);
    transition:
        transform 0.75s,
        opacity 0.75s;
}
.regulator-segment.has-content:is(.is-active, :hover, :focus-visible) svg {
    transform: scale(1.06);
}

@media (prefers-reduced-motion: reduce) {
    .regulator-segment,
    .regulator-segment svg {
        transition: none;
    }
}

.regulator-stage {
    position: relative;
    width: 380px;
    height: 560px;
    transform: scale(var(--regulator-scale));
    transform-origin: top left;
}
@media (min-width: 1600px) {
    .carousel-regulator {
        --regulator-scale: 1.15;
    }
}
@media (min-width: 2000px) {
    .carousel-regulator {
        --regulator-scale: 1.05;
    }
}
@media (max-width: 1100px) {
    .carousel-regulator {
        --regulator-scale: 0.95;
    }
}
@media (max-width: 850px) {
    .carousel-regulator {
        --regulator-scale: 0.8;
    }
}
@media (max-width: 720px) {
    .carousel-regulator {
        --regulator-scale: 0.8;
        margin: 0 0 0 auto;
    }
    .regulator-label {
        font-size: 12px;
    }
}
@media (max-width: 360px) {
    .carousel-regulator {
        --regulator-scale: 0.7;
    }
}

.regulator-segment.has-content:is(.is-active, :hover, :focus-visible) {
    z-index: 2;
}
.regulator-segment.has-content:is(.is-active, :hover, :focus-visible) svg,
.regulator-segment.has-content:is(.is-active, :hover, :focus-visible) .regulator-label {
    opacity: 1;
}

/* Icons retain their size and radial position in every state. */
.regulator-icon {
    transition: transform 0.75s cubic-bezier(0.22, 0.68, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
    .regulator-icon {
        transition: none;
    }
}

.regulator-icon {
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    .regulator-label {
        transition: none;
    }
}

/* Feather the fixed viewport edge, so rotating sectors disappear before clipping. */
.carousel-regulator {
    -webkit-mask-image: linear-gradient(
        to right,
        #000 0%,
        #000 79%,
        rgba(0, 0, 0, 0.85) 85%,
        rgba(0, 0, 0, 0.4) 93%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        #000 0%,
        #000 79%,
        rgba(0, 0, 0, 0.85) 85%,
        rgba(0, 0, 0, 0.4) 93%,
        transparent 100%
    );
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* Hover takes priority over selection: enlarge only one sector at a time. */
.regulator-wheel:has(.regulator-segment.has-content:hover)
    .regulator-segment.has-content:not(:hover)
    svg {
    transform: none;
}
.regulator-wheel:not(:has(.regulator-segment.has-content:hover)):has(
        .regulator-segment.has-content:focus-visible
    )
    .regulator-segment.has-content:not(:focus-visible)
    svg {
    transform: none;
}

@media (min-width: 1100px) and (max-width: 1799px) {
    .carousel-regulator {
        --regulator-scale: 0.9;
    }
}
@media (min-width: 1800px) and (max-width: 1999px) {
    .carousel-regulator {
        --regulator-scale: 0.95;
    }
}
/* Mobile regulator: a centered horizontal arc with upright labels and icons. */
@media (max-width: 720px) {
    .carousel-regulator {
        width: 100%;
        min-width: 0;
        height: calc(330px * var(--regulator-scale));
        margin: 8px auto 0;
        -webkit-mask-image: linear-gradient(
            to bottom,
            #000 0%,
            #000 76%,
            rgba(0, 0, 0, 0.85) 86%,
            rgba(0, 0, 0, 0.4) 94%,
            transparent 100%
        );
        mask-image: linear-gradient(
            to bottom,
            #000 0%,
            #000 76%,
            rgba(0, 0, 0, 0.85) 86%,
            rgba(0, 0, 0, 0.4) 94%,
            transparent 100%
        );
    }
    .carousel-regulator .regulator-stage {
        position: absolute;
        left: 50%;
        top: calc(280px * var(--regulator-scale));
        transform-origin: 0 0;
        transform: scale(var(--regulator-scale)) rotate(90deg) translate(-310px, -280px);
    }
    .regulator-label,
    .regulator-icon {
        transform: translate(-50%, -50%)
            rotate(calc(-90deg - var(--slot-angle) - var(--wheel-angle)));
    }
    .regulator-label {
        width: calc(clamp(44px, 10vw, 76px) / var(--regulator-scale));
        font-size: calc(clamp(8px, 1.7vw, 12px) / var(--regulator-scale));
        overflow-wrap: anywhere;
    }
}

/* Leave room for the slide copy above the centered mobile arc. */
@media (max-width: 720px) {
    .carousel-regulator {
        --regulator-scale: 0.62;
        margin-top: 4px;
    }
}
@media (max-width: 400px) {
    .carousel-regulator {
        --regulator-scale: 0.56;
    }
}
@media (max-width: 360px), (max-width: 720px) and (max-height: 700px) {
    .carousel-regulator {
        --regulator-scale: 0.48;
    }
}
