/* ---------- Section ---------- */
.why-section {
    background: var(--color-why-section);
    padding: 64px 0 56px;
    font-family: inherit;
}

.why-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 40px;
}

/* ---------- Title ---------- */
.why-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-white);
    margin: 0 0 48px;
    line-height: 1.35;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================
   DESKTOP GRID — 3 columns
   Order: 1,4,7 / 2,5,8 / 3,6,[empty]
   We use CSS grid-column to reorder visually
   ========================================================== */
.why-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 0;
    margin-bottom: 48px;
}

/* Re-order items into column-first visual order:
   Col1: 1,2,3  Col2: 4,5,6  Col3: 7,8,[empty]
   But HTML order is 1-8 + empty = we use grid-column/row */
.why-block:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}
.why-block:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}
.why-block:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
}
.why-block:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
}
.why-block:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
}
.why-block:nth-child(6) {
    grid-column: 2;
    grid-row: 3;
}
.why-block:nth-child(7) {
    grid-column: 3;
    grid-row: 1;
}
.why-block:nth-child(8) {
    grid-column: 3;
    grid-row: 2;
}
.why-block--empty {
    grid-column: 3;
    grid-row: 3;
}

/* ---------- Feature Block ---------- */
.why-block {
    position: relative;
    padding: 28px 24px 28px 24px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    overflow: hidden;
}

/* Remove right border on last column */
.why-block:nth-child(3n-0),
.why-block:nth-child(7),
.why-block:nth-child(8),

/* Remove bottom border on last row */
.why-block:nth-child(3),
.why-block:nth-child(6),
.why-block--empty {
    border-bottom: none;
}

/* ---------- Ghost Number ---------- */
.why-block__number {
    position: absolute;
    right: 20%;
    top: 50%;
    transform: translateY(-50%);
    font-size: 150px;
    font-weight: 400;
    color: var(--color-white);
    line-height: 1;
    pointer-events: none;
    user-select: none;
    letter-spacing: -4px;
    opacity: 0.5;
}

/* ---------- Text Content ---------- */
.why-block__content {
    position: relative;
    z-index: 1;
    max-width: calc(100% - 60px); /* не перекрывать число */
}

.why-block__title {
    font-size: 16px;
    font-weight: 400;
    color: var(--color-white);
    margin: 0 0 8px;
    line-height: 1.35;
    text-transform: none;
}

.why-block__desc {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-white);
    margin: 0;
    line-height: 1.55;
}

/* ---------- Empty block ---------- */
.why-block--empty {
    background: transparent;
    pointer-events: none;
}

/* ==========================================================
   MOBILE SLIDER — hidden on desktop/tablet
   ========================================================== */
.why-slider {
    display: none;
    overflow: hidden;
}

.why-slider__track {
    display: flex;
    width: 100%;
    transition: transform 0.35s ease;
    will-change: transform;
}

/* ==========================================================
   CTA BUTTONS
   ========================================================== */
.why-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.why-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 20px 65px;
    background: var(--color-white);
    color: var(--color-primary);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 400;
    text-decoration: none;
    line-height: 1.4;
    text-align: center;
    transition: opacity var(--transition);
}

.why-btn:hover,
.why-btn:focus-visible {
    opacity: 0.88;
    outline: none;
}

@media (max-width: 768px) {
    .why-block {
        padding: 28px 0;
    }
    .why-container {
        padding: 0 24px;
    }
    .why-title {
        font-size: 1.15rem;
        margin-bottom: 36px;
    }

    .why-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(4, auto);
    }

    .why-block:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    .why-block:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }
    .why-block:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }
    .why-block:nth-child(4) {
        grid-column: 1;
        grid-row: 4;
    }
    .why-block:nth-child(5) {
        grid-column: 2;
        grid-row: 1;
    }
    .why-block:nth-child(6) {
        grid-column: 2;
        grid-row: 2;
    }
    .why-block:nth-child(7) {
        grid-column: 2;
        grid-row: 3;
    }
    .why-block:nth-child(8) {
        grid-column: 2;
        grid-row: 4;
    }
    .why-block--empty {
        display: none;
    }

    .why-block:nth-child(7),
    .why-block:nth-child(8) {
        border-bottom: none;
    }

    .why-block__content {
        max-width: calc(100%-30px);
    }

    /* Stacked buttons on tablet */
    .why-buttons {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    .why-btn {
        width: 100%;
    }
    .why-buttons .why-btn:last-child {
        max-width: 550px;
    }
    .why-block__number {
        right: 4%;
    }
}

@media (max-width: 580px) {
    .why-title {
        font-size: 23px;
    }
    .why-block {
        max-width: 510px;
    }
    .why-slide .why-block__content {
        max-width: calc(100% - 45px);
    }
    .why-block__number {
        right: 0;
    }
    .why-btn {
        font-weight: 500;
    }
}

@media (max-width: 540px) {
    .why-block {
	max-width: 480px;
    }
}

@media (max-width: 510px) {
    .why-block {
	max-width: 460px;
    }
}

@media (max-width: 480px) {
    .why-block {
	max-width: 440px;
    }
}

@media (max-width: 457px) {
    .why-block {
	max-width: 400px;
    }
}

@media (max-width: 420px) {
    .why-block {
	max-width: 360px;
    }
}

@media (max-width: 390px) {
    .why-block {
	max-width: 335px;
    }
}

@media (max-width: 376px) {
    .why-block {
	max-width: 320px;
    }
}

@media (max-width: 350px) {
    .why-block {
	max-width: 300px;
    }
}

@media (max-width: 315px) {
    .why-block {
	max-width: 270px;
    }
}

@media (max-width: 580px) {
    .why-section {
        padding: 40px 0 36px;
    }
    .why-container {
        padding: 0 16px;
    }
    .why-title {
        font-size: 1.05rem;
        margin-bottom: 28px;
    }

    /* Hide grid, show slider */
    .why-grid {
        display: none;
    }
    .why-slider {
        display: block;
        margin-bottom: 36px;
    }

    /* Slider track */
    .why-slider__track {
        display: flex;
        width: 100%;
        transition: transform 0.35s ease;
        will-change: transform;
    }

    .why-slide {
        min-width: 100%;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
    }

    .why-slide .why-block:last-child {
        border-bottom: none;
    }

    .why-slide .why-block__content {
        max-width: calc(100% - 52px);
    }

    /* Pagination dots */
    .why-slider__dots {
        display: flex;
        justify-content: center;
        gap: 10px;
        /*margin-top: 20px;*/
        height: 30px;
    }

    .why-slider__dot {
        width: 10px;
        height: 10px;
        border-radius: 2px; /* ← квадрат вместо круга */
        background: rgba(255, 255, 255, 0.45);
        border: none;
        cursor: pointer;
        padding: 0;
        transition: background var(--why-transition);
    }

    /* Active dot — square frame as per design */
    .why-slider__dot--active {
        background: transparent;
        outline: 2px solid rgba(255, 255, 255, 0.9);
        outline-offset: 2px;
        border-radius: 2px; /* ← тоже квадрат */
        width: 10px;
        height: 10px;
    }

    /* Full-width buttons on mobile */
    .why-buttons {
        flex-direction: column;
        gap: 10px;
    }
    .why-btn {
        max-width: 100%;
        width: 100%;
        font-size: 0.82rem;
        padding: 13px 16px;
    }
}
