/* Shared controls; page illustrations and layouts stay in their own stylesheets. */
[data-explainer] [hidden] {
    display: none !important;
}

[data-explainer] {
    --motion-position: 0.25;
}

.guided-flow {
    display: grid;
    gap: 16px;
}

.guided-flow__steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 8px;
}

.guided-flow__step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    min-height: 64px;
    padding: 12px;
    border: 1px solid rgba(0, 255, 65, 0.24);
    border-radius: 6px;
    background: rgba(0, 255, 65, 0.035);
    color: #dfffe8;
    font: inherit;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

.guided-flow__step:hover,
.guided-flow__step[aria-pressed="true"] {
    border-color: rgba(0, 255, 65, 0.72);
    background: rgba(0, 255, 65, 0.1);
    color: #ffffff;
}

.guided-flow__step-index {
    flex: 0 0 auto;
    color: var(--accent-color, #ffff00);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.guided-flow__step-label {
    min-width: 0;
}

.guided-flow__scenes {
    min-width: 0;
}

.guided-flow__scene {
    margin: 0;
}

.guided-flow[data-motion-ready="true"] .guided-flow__scene:not([hidden]) {
    animation: guided-flow-enter 260ms ease-out both;
}

.guided-flow[data-motion-state="manual"] .guided-flow__step[aria-pressed="true"] .guided-flow__step-index {
    color: #ffffff;
}

@keyframes guided-flow-enter {
    from { opacity: 0.55; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

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

    .guided-flow__step {
        min-height: 60px;
        padding: 10px;
    }
}

.motion-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.75rem;
}

[data-motion-toggle] {
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: rgba(130, 230, 186, 0.06);
    color: var(--green);
    font: inherit;
    cursor: pointer;
}

[data-step]:not(:disabled),
[data-motion-toggle] {
    touch-action: manipulation;
}

[data-step]:focus-visible,
[data-motion-toggle]:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 4px;
}

[data-motion-toggle]:hover {
    background: rgba(130, 230, 186, 0.14);
}

.motion-progress {
    width: 100%;
    height: 2px;
    overflow: hidden;
    background: rgba(130, 230, 186, 0.12);
}

.motion-progress::after {
    content: "";
    display: block;
    height: 100%;
    background: var(--green);
    transform: scaleX(var(--motion-position));
    transform-origin: left;
    transition: transform 450ms ease;
}

[data-motion-state="paused"] *,
[data-motion-state="paused"] *::before,
[data-motion-state="paused"] *::after {
    animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
    [data-explainer] *,
    [data-explainer] *::before,
    [data-explainer] *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto;
    }
}

.reveal-ready [data-reveal]:not(.is-revealed) {
    opacity: 0;
    transform: translateY(18px);
}

.reveal-ready [data-reveal] {
    transition: opacity 640ms ease, transform 640ms ease;
    transition-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
    .reveal-ready [data-reveal],
    .reveal-ready [data-reveal]:not(.is-revealed) {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* A paused explainer only stops the autoplay timer; the visible scene must still finish entering. */
[data-motion-state="paused"] [data-scene]:not([hidden]),
[data-motion-state="paused"] [data-scene]:not([hidden]) * {
    animation-play-state: running !important;
}
