/* ===========================
   How It Works – base tokens
   =========================== */

:root {
    --hiw-bg: var(--bg-color, #26265A);
    --hiw-text: var(--text-color, #FFFFFF);
    --hiw-accent: var(--button-color, #06FE02);
    --hiw-ink: #26265A;
    --hiw-radius: 16px;
    --hiw-gap: 30px;
    --hiw-shadow: 0 8px 24px rgba(0,0,0,.12);
}

/* ===========================
   Section / container
   =========================== */

.how-it-works-section {
    background: var(--hiw-bg);
    color: var(--hiw-text);
    width: 100%;
    max-width: 1500px;
    margin-inline: auto;
    border-radius: var(--hiw-radius);
    overflow: hidden;
    /* płynne odstępy na różnych viewportach */
    padding: clamp(40px, 6vw, 120px) clamp(16px, 5vw, 80px);
    animation: fadeInUp .6s ease-out both;
    box-shadow: var(--hiw-shadow);
}

.how-it-works-container {
    margin: 0 auto;
}

/* ===========================
   Layout
   =========================== */

.how-it-works-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--hiw-gap);
    align-items: center;
}

/* ===========================
   Left – text & buttons
   =========================== */

.how-it-works-text {
    display: flex;
    flex-direction: column;
    gap: 32px;
    /* nie blokuj layoutu na małych ekranach */
    max-width: 620px;
}

.how-it-works-title {
    /* płynny rozmiar */
    font-size: clamp(24px, 4.2vw, 50px);
    line-height: 1.2;
    font-weight: 900;
    color: var(--hiw-text);
    margin: 0;
}

.how-it-works-description {
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    opacity: .9;
    color: var(--hiw-text);
    display: none;
    /* jeśli ma być ukryty – lepiej sterować klasą `.is-hidden` niż display:none na stałe */
}

.active-step-description {
    position: relative;
}

/* Jeden mechanizm ukrywania – bez `display: none`, którego nie da się animować */
.step-description {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .4s ease, transform .4s ease, visibility 0s linear .4s;
    pointer-events: none;
    position: absolute;      /* stackuje się nad sobą – aktywny zdejmuje pozycjonowanie */
    inset: 0 auto auto 0;
    max-width: 500px;
}

.step-description.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
    position: relative;      /* przywróć przepływ */
    pointer-events: auto;
}

.step-description h3 {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 12px 0;
    color: var(--hiw-accent);
}

.step-description p {
    font-size: 18px;
    line-height: 1.5;
    margin: 0;
    color: var(--hiw-text);
}

/* Buttons group */

.how-it-works-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background-color: #fff;
    width: fit-content;
    border-radius: 12px;
    border: 1px solid var(--hiw-accent);
}

.how-it-works-btn {
    appearance: none;
    background: transparent;
    color: var(--hiw-ink);
    padding: 12px 14px;
    border-radius: 8px;
    font: 900 16px/1.2 'Suisse Intl', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    cursor: pointer;
    letter-spacing: .5px;
    text-transform: uppercase;
    border: 0;
    transition: transform .15s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.how-it-works-btn:hover {
    transform: translateY(-1px);
}

.how-it-works-btn:active {
    transform: translateY(0);
}

.how-it-works-btn:focus-visible {
    outline: 2px solid var(--hiw-accent);
    outline-offset: 2px;
}

.how-it-works-btn.active,
.how-it-works-btn[aria-selected="true"] {
    background: var(--hiw-ink);
    color: #fff;
}

/* ===========================
   Right – images
   =========================== */

.how-it-works-images {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 220px;
}

.how-it-works-image {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease, visibility 0s linear .5s, transform .5s ease;
    transform: translateY(8px);
    width: 100%;
}

.how-it-works-image.active {
    position: relative;
    inset: auto;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

/* Multiple images in a step */

.step-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
    min-height: 220px;
}

.step-image {
    inline-size: clamp(120px, 12vw, 140px);
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    transition: transform .2s ease;
}

.how-it-works-section:hover .step-image {
    transform: scale(1.05);
}

/* Placeholder */

.placeholder-image {
    background: rgba(255,255,255,0.08);
    border: 2px dashed rgba(255,255,255,0.28);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    min-height: 150px;
    display: grid;
    place-items: center;
    width: 100%;
}

.placeholder-content h3 {
    font-size: 18px;
    margin: 0 0 10px 0;
    color: var(--hiw-text);
}

.placeholder-content p {
    font-size: 14px;
    margin: 0;
    opacity: .7;
    color: var(--hiw-text);
}
.step-figure{
    max-width: 140px;
    width: 100%;

}
.step-caption{
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
    max-width: 140px;
}
/* ===========================
   Responsive
   =========================== */

/* >=1024px => grid 2 kolumny jest domyślny; poniżej – kolumna */
@media (max-width: 1024px) {
    .how-it-works-section {
        padding: clamp(40px, 6vw, 60px) clamp(16px, 5vw, 30px);
    }

    .how-it-works-content {
        display: flex;
        flex-direction: column;
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .how-it-works-content {
        gap: 30px;
    }

    .how-it-works-title {
        font-size: clamp(22px, 6.5vw, 28px);
    }

    .how-it-works-buttons {
        width: 100%;
        justify-content: center;
        flex-direction: column;
    }

    .how-it-works-btn {
        width: 100%;
        max-width: 320px;
        text-align: center;
        font-size: 14px;
        padding: 10px 16px;
    }

    .how-it-works-images {
        min-height: 250px;
    }

    .step-images-container {
        gap: 20px;
    }
}

/* ultra-small tweaks */
@media (max-width: 380px) {
    .step-images-container { gap: 16px; }
}

/* ===========================
   Motion & keyframes
   =========================== */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Zmniejsz ruch dla osób, które tego wymagają */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
