/* How It Works — scoped interactive stepper (SyncMySkills landing) */

.hiw-section {
    --hiw-brand-primary: #4F2FE0;
    --hiw-brand-violet: #6D4BFF;
    --hiw-brand-cyan: #2FD3E0;
    --hiw-gradient: linear-gradient(135deg, #2FD3E0 0%, #4F2FE0 52%, #A855F7 100%);
    --hiw-gradient-h: linear-gradient(90deg, #2FD3E0 0%, #4F2FE0 50%, #A855F7 100%);
    --hiw-font-display: 'Sora', system-ui, sans-serif;
    --hiw-font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --hiw-panel-radius: 24px;
    --hiw-step-duration: 5000ms;
    font-family: var(--hiw-font-body);
}

.hiw-section,
.hiw-section .section-heading,
.hiw-section p {
    font-family: var(--hiw-font-body);
    text-transform: none;
    letter-spacing: normal;
}

.hiw-section h2,
.hiw-section h3 {
    font-family: var(--hiw-font-display) !important;
    color: var(--hiw-text);
    margin: 0;
}

[data-theme="light"] .hiw-section {
    --hiw-text: #14142B;
    --hiw-text-secondary: #5C5C76;
    --hiw-panel-bg: rgba(255, 255, 255, 0.72);
    --hiw-panel-border: rgba(79, 47, 224, 0.1);
    --hiw-rail-inactive: rgba(85, 85, 110, 0.55);
    --hiw-rail-active-bg: rgba(255, 255, 255, 0.92);
    --hiw-glow: rgba(79, 47, 224, 0.12);
    --hiw-orb-1: rgba(47, 211, 224, 0.18);
    --hiw-orb-2: rgba(168, 85, 247, 0.12);
    --hiw-shadow: 0 20px 56px rgba(20, 20, 43, 0.07);
    --hiw-track: rgba(79, 47, 224, 0.14);
}

[data-theme="dark"] .hiw-section {
    --hiw-text: #EEF1FA;
    --hiw-text-secondary: #9AA2BD;
    --hiw-panel-bg: rgba(14, 16, 30, 0.82);
    --hiw-panel-border: rgba(109, 75, 255, 0.2);
    --hiw-rail-inactive: rgba(154, 162, 189, 0.5);
    --hiw-rail-active-bg: rgba(255, 255, 255, 0.06);
    --hiw-glow: rgba(109, 75, 255, 0.28);
    --hiw-orb-1: rgba(47, 211, 224, 0.1);
    --hiw-orb-2: rgba(168, 85, 247, 0.14);
    --hiw-shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
    --hiw-track: rgba(109, 75, 255, 0.35);
}

/* Section header */
.hiw-section-heading {
    margin-bottom: 2.5rem;
}

.hiw-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hiw-brand-violet);
    background: rgba(79, 47, 224, 0.08);
    border: 1px solid rgba(79, 47, 224, 0.12);
}

[data-theme="dark"] .hiw-badge {
    color: #c4b5fd;
    background: rgba(109, 75, 255, 0.15);
    border-color: rgba(109, 75, 255, 0.25);
}

.hiw-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hiw-brand-cyan);
    box-shadow: 0 0 8px rgba(47, 211, 224, 0.6);
}

.hiw-headline {
    font-family: var(--hiw-font-display) !important;
    font-weight: 600 !important;
    font-size: clamp(1.75rem, 3.5vw, 2.5rem) !important;
    line-height: 1.2 !important;
    letter-spacing: -0.025em !important;
    text-transform: none !important;
    color: var(--hiw-text) !important;
    margin-bottom: 0.65rem !important;
}

.hiw-headline-accent {
    background: var(--hiw-gradient-h);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hiw-hint {
    margin: 0;
    font-size: 1rem;
    color: var(--hiw-text-secondary);
    letter-spacing: -0.01em;
}

/* Unified panel */
.hiw-interactive {
    max-width: 1040px;
    margin: 0 auto;
}

.hiw-panel {
    display: grid;
    grid-template-columns: minmax(200px, 260px) 1fr;
    border-radius: var(--hiw-panel-radius);
    background: var(--hiw-panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--hiw-panel-border);
    box-shadow: var(--hiw-shadow);
    overflow: hidden;
}

/* Vertical step rail */
.hiw-rail {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.75rem 1.25rem;
    border-right: 1px solid var(--hiw-panel-border);
}

.hiw-rail-track {
    position: absolute;
    left: 1.72rem;
    top: 2.35rem;
    bottom: 2.35rem;
    width: 2px;
    background: linear-gradient(180deg, var(--hiw-brand-cyan), var(--hiw-brand-primary), var(--hiw-brand-violet));
    opacity: 0.45;
    border-radius: 2px;
    pointer-events: none;
}

.hiw-rail-btn {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--hiw-rail-inactive);
    text-align: left;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    font-family: var(--hiw-font-body);
}

.hiw-rail-btn:hover {
    color: var(--hiw-text);
    background: rgba(79, 47, 224, 0.05);
}

.hiw-rail-btn:focus-visible {
    outline: 2px solid var(--hiw-brand-cyan);
    outline-offset: 2px;
}

.hiw-rail-btn.is-active {
    color: var(--hiw-text);
    background: var(--hiw-rail-active-bg);
    border-color: rgba(79, 47, 224, 0.12);
    box-shadow: 0 4px 20px var(--hiw-glow);
}

[data-theme="dark"] .hiw-rail-btn.is-active {
    border-color: rgba(109, 75, 255, 0.3);
}

.hiw-rail-node {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: var(--hiw-panel-bg);
    border: 2px solid var(--hiw-track);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    z-index: 1;
}

.hiw-rail-btn.is-active .hiw-rail-node {
    border-color: var(--hiw-brand-cyan);
    background: var(--hiw-brand-cyan);
    box-shadow: 0 0 12px rgba(47, 211, 224, 0.55);
    transform: scale(1.15);
}

.hiw-rail-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.hiw-rail-step {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.65;
}

.hiw-rail-btn.is-active .hiw-rail-step {
    opacity: 1;
    color: var(--hiw-brand-violet);
}

[data-theme="dark"] .hiw-rail-btn.is-active .hiw-rail-step {
    color: #a5b4fc;
}

.hiw-rail-title {
    font-family: var(--hiw-font-display) !important;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.35;
    text-transform: none !important;
}

/* Stage */
.hiw-stage {
    position: relative;
    min-height: 360px;
    display: grid;
    grid-template-columns: 1fr minmax(200px, 280px);
    grid-template-rows: 1fr auto;
    overflow: hidden;
}

.hiw-stage-ambient {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.hiw-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.75;
    animation: hiw-orb-drift 16s ease-in-out infinite alternate;
}

.hiw-orb--1 {
    width: 240px;
    height: 240px;
    top: -70px;
    right: -50px;
    background: var(--hiw-orb-1);
}

.hiw-orb--2 {
    width: 200px;
    height: 200px;
    bottom: -50px;
    left: 10%;
    background: var(--hiw-orb-2);
    animation-delay: -6s;
}

.hiw-stage-content {
    position: relative;
    z-index: 2;
    grid-row: 1;
    grid-column: 1;
    padding: 2.5rem 2rem 1.5rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hiw-stage-content.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.hiw-stage-label {
    margin: 0 0 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--hiw-brand-violet);
}

[data-theme="dark"] .hiw-stage-label {
    color: #a5b4fc;
}

.hiw-stage-title {
    font-family: var(--hiw-font-display) !important;
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    text-transform: none !important;
    color: var(--hiw-text);
    margin-bottom: 0.85rem;
    line-height: 1.25;
}

.hiw-stage-desc {
    font-family: var(--hiw-font-body) !important;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: -0.01em;
    text-transform: none !important;
    color: var(--hiw-text-secondary);
    margin: 0;
    max-width: 26rem;
}

.hiw-stage-visual {
    position: relative;
    z-index: 2;
    grid-row: 1;
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    min-height: 240px;
}

.hiw-stage-footer {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 0 2rem 1.35rem;
    position: relative;
    z-index: 3;
}

.hiw-progress {
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: rgba(79, 47, 224, 0.1);
    overflow: hidden;
}

[data-theme="dark"] .hiw-progress {
    background: rgba(255, 255, 255, 0.08);
}

.hiw-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: var(--hiw-gradient-h);
}

.hiw-progress-bar.is-animating {
    animation: hiw-progress-sweep var(--hiw-step-duration) linear forwards;
}

/* Icon stage visual */
.hiw-visual-panel {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.96);
    transition:
        opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        visibility 0.5s;
    pointer-events: none;
}

.hiw-visual-panel.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.hiw-icon-stage {
    position: relative;
    width: min(200px, 70vw);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hiw-icon-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(79, 47, 224, 0.18);
    animation: hiw-ring-breathe 5s ease-in-out infinite;
}

.hiw-icon-ring--outer {
    width: 100%;
    height: 100%;
}

.hiw-icon-ring--inner {
    width: 78%;
    height: 78%;
    border-color: rgba(47, 211, 224, 0.22);
    animation-delay: -2s;
}

[data-theme="dark"] .hiw-icon-ring {
    border-color: rgba(109, 75, 255, 0.35);
}

[data-theme="dark"] .hiw-icon-ring--inner {
    border-color: rgba(47, 211, 224, 0.28);
}

.hiw-icon-core {
    position: relative;
    z-index: 2;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hiw-gradient);
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 8px 32px rgba(79, 47, 224, 0.35);
}

.hiw-orbit-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    z-index: 1;
}

.hiw-orbit-dot--1 {
    top: 8%;
    right: 18%;
    background: var(--hiw-brand-cyan);
    box-shadow: 0 0 10px rgba(47, 211, 224, 0.5);
    animation: hiw-dot-orbit 12s linear infinite;
}

.hiw-orbit-dot--2 {
    bottom: 14%;
    left: 12%;
    background: #A855F7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.45);
    animation: hiw-dot-orbit 12s linear infinite reverse;
    animation-delay: -4s;
}

/* Keyframes */
@keyframes hiw-progress-sweep {
    from { width: 0%; }
    to { width: 100%; }
}

@keyframes hiw-orb-drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(12px, -10px); }
}

@keyframes hiw-ring-breathe {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.03); opacity: 1; }
}

@keyframes hiw-dot-orbit {
    0% { transform: rotate(0deg) translateX(88px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(88px) rotate(-360deg); }
}

/* Tablet */
@media (max-width: 991px) {
    .hiw-panel {
        grid-template-columns: 220px 1fr;
    }

    .hiw-stage-content {
        padding: 2rem 1.5rem 1.25rem;
    }

    .hiw-stage {
        min-height: 340px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .hiw-section-heading {
        margin-bottom: 1.75rem;
    }

    .hiw-panel {
        grid-template-columns: 1fr;
    }

    .hiw-rail {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 0.4rem;
        padding: 0.85rem;
        border-right: none;
        border-bottom: 1px solid var(--hiw-panel-border);
    }

    .hiw-rail-track {
        display: none;
    }

    .hiw-rail-btn {
        flex: 0 0 auto;
        min-width: 140px;
        scroll-snap-align: start;
        padding: 0.6rem 0.75rem;
    }

    .hiw-rail-node {
        display: none;
    }

    .hiw-stage {
        min-height: auto;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .hiw-stage-visual {
        grid-column: 1;
        grid-row: 1;
        min-height: 180px;
        padding: 1.5rem 1rem 0.5rem;
    }

    .hiw-stage-content {
        grid-column: 1;
        grid-row: 2;
        padding: 1.25rem 1.25rem 0.75rem;
        text-align: center;
        align-items: center;
    }

    .hiw-stage-desc {
        max-width: none;
    }

    .hiw-stage-footer {
        grid-row: 3;
        padding: 0 1.25rem 1rem;
    }

    .hiw-icon-stage {
        width: min(160px, 55vw);
    }

    @keyframes hiw-dot-orbit {
        0% { transform: rotate(0deg) translateX(68px) rotate(0deg); }
        100% { transform: rotate(360deg) translateX(68px) rotate(-360deg); }
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hiw-orb,
    .hiw-icon-ring,
    .hiw-orbit-dot {
        animation: none !important;
    }

    .hiw-progress-bar.is-animating {
        animation: none !important;
        width: 100%;
    }

    .hiw-rail-btn,
    .hiw-stage-content,
    .hiw-visual-panel {
        transition: none !important;
    }

    .hiw-stage-content,
    .hiw-visual-panel.is-visible {
        opacity: 1 !important;
        transform: none !important;
    }
}
