/* Home page "What we do" (home.html): the skills as a segmented ring that spins.
   One arc per skill around the Kanidata emblem, each with its name along it. The arcs sit on
   a wheel that turns by --turn so the picked arc rests on the right, facing the list; there
   it slides outward (--dx, --dy) and turns mint. Its tools are written along a thin arc around
   the right side. engineer-profile.js turns the wheel; skill-ring-extras.js writes the tools. One SVG (viewBox -158..158),
   so the ring scales as a whole. */
@property --turn {
    syntax: "<angle>";
    inherits: true;
    initial-value: 90deg;
}

.sring-wrap {
    width: 100%;
    max-width: 31rem;
    margin: 0 auto;
}

.sring {
    --turn: 90deg;
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: --turn 0.75s cubic-bezier(0.34, 1.25, 0.64, 1);
}

.sring.is-dragging {
    cursor: grabbing;
    transition: none;
}

.sring__wheel {
    transform: rotate(var(--turn));
}

/* The arcs: thick strokes in a pale brand tint; the picked one is mint and sits further out */
.sring-seg {
    cursor: pointer;
    transition: transform 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.sring-seg__arc {
    fill: none;
    stroke: color-mix(in srgb, var(--kd-brand) 16%, #FFFFFF);
    stroke-width: 34;
    transition: stroke 0.35s ease;
}

.sring-seg:hover .sring-seg__arc {
    stroke: color-mix(in srgb, var(--kd-brand) 26%, #FFFFFF);
}

.sring-seg.is-active {
    transform: translate(var(--dx), var(--dy));
}

.sring-seg.is-active .sring-seg__arc {
    stroke: var(--kd-mint);
}

/* Each arc has its name twice, running both ways round; the one that reads upright where
   the arc has come to rest is shown (is-flipped on the lower half). While the ring spins the
   names step out, so none is seen upside down. */
.sring-seg__name {
    fill: var(--kd-brand-deep);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    pointer-events: none;
    transition: opacity 0.25s ease, fill 0.35s ease;
}

.sring-seg__name--ccw,
.sring-seg.is-flipped .sring-seg__name--cw {
    display: none;
}

.sring-seg.is-flipped .sring-seg__name--ccw {
    display: inline;
}

.sring-seg.is-active .sring-seg__name {
    fill: #FFFFFF;
}

.sring.is-spinning .sring-seg__name {
    opacity: 0;
    transition-duration: 0.12s;
}

/* The tools: a thin mint guide around the right side with the picked skill's tools on it,
   in two halves either side of the slot. They fade while the ring spins. */
.sring__guide {
    fill: none;
    stroke: color-mix(in srgb, var(--kd-mint) 45%, transparent);
    stroke-width: 1;
}

.sring__tools-text {
    fill: var(--kd-mint-ink);
    font-size: 8.6px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.sring__tools {
    transition: opacity 0.3s ease;
}

.sring__tools.is-hidden {
    opacity: 0;
}

/* The centre: the Kanidata emblem on a brand-blue disc; it never turns */
.sring__hub {
    fill: var(--kd-brand);
}

.sring__mark {
    pointer-events: none;
}

/* Sweeps in on scroll: the inline script after the ring adds is-waiting before the first
   paint; engineer-profile.js swaps it for is-opening when the ring comes into view, and each
   arc draws itself round, one after another, with its name and the centre fading in. */
.sring.is-waiting .sring-seg__arc {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}

.sring.is-waiting .sring-seg__name,
.sring.is-waiting .sring__hub,
.sring.is-waiting .sring__mark,
.sring.is-waiting .sring__tools {
    opacity: 0;
}

.sring.is-opening .sring-seg__arc {
    stroke-dasharray: 1;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 0.8, 0.25, 1) calc(var(--i) * 0.1s), stroke 0.35s ease;
}

.sring.is-opening .sring-seg__name {
    transition: opacity 0.4s ease calc(0.35s + var(--i) * 0.1s), fill 0.35s ease;
}

.sring.is-opening .sring__hub,
.sring.is-opening .sring__mark {
    transition: opacity 0.5s ease;
}

.sring.is-opening .sring__tools {
    transition: opacity 0.5s ease 0.8s;
}

/* Nothing animates until engineer-profile.js marks the block is-ready after its first paint,
   so the ring loads in its first state instead of sliding into it. */
.kpro:not(.is-ready) .sring,
.kpro:not(.is-ready) .sring-seg,
.kpro:not(.is-ready) .sring-seg *,
.kpro:not(.is-ready) .kpro-skill,
.kpro:not(.is-ready) .kpro-skill * {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .sring,
    .sring-seg,
    .sring-seg *,
    .sring__tools {
        transition: none;
    }
}
