/* ── Items Path (Ścieżka - Kroki) ────────────────────────────────────────── */

.ip-block {
    padding: 96px 0;
}

.ip-panel {
    display: flex;
    flex-direction: column;
    gap: 64px;
    padding: 64px;
    background: var(--wp--preset--color--pink-100, #FFEAF4);
    border: 1px solid rgba(255, 229, 0, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(2px);
}

/* ── Intro ────────────────────────────────────────────────────────────────── */

.ip-intro {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 640px;
}

.ip-label-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ip-label-bar {
    width: 4px;
    height: 24px;
    flex-shrink: 0;
    background: var(--wp--preset--color--pink-500, #DF006E);
}

.ip-label {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: var(--wp--preset--color--pink-500, #DF006E);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ip-title {
    margin: 0;
    font-size: 32px;
    font-weight: 400;
    line-height: 1.25;
    color: var(--wp--preset--color--black, #1A1A25);
}

.ip-desc,
.ip-desc p {
    margin: 0;
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
    color: var(--wp--preset--color--dark, #2E2E39);
}

.ip-desc p+p {
    margin-top: 16px;
}

/* ── Rows: serpentine layout ──────────────────────────────────────────────── */

.ip-rows {
    display: flex;
    flex-direction: column;
    gap: 64px;
}

.ip-row {
    display: grid;
    grid-template-columns: repeat(var(--ip-cols, 4), 1fr);
    column-gap: 64px;
    position: relative;
}

.ip-item {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.ip-item-top {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* ── Dot ──────────────────────────────────────────────────────────────────── */

.ip-dot {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--wp--preset--color--pink-500, #DF006E);
    flex-shrink: 0;
}

/* ── Arrow connector (SVG) ────────────────────────────────────────────────── */

.ip-arrow {
    flex: 1 0 0;
    min-width: 0;
    display: block;
    align-self: center;
    color: var(--wp--preset--color--pink-500, #DF006E);
}

.ip-arrow--left {
    transform: scaleX(-1);
}

/* ── Bracket connectors (right/left × outgoing/incoming) ─────────────────────
   Anchored to the row's own box, aligned onto the last (or first, for the
   mirrored --left variants) column's dot via a width computed from the
   number of columns (--ip-cols) and the fixed 64px column gap. ── */

.ip-row--bo-right::after {
    content: '';
    position: absolute;
    right: 0;
    top: 8px;
    bottom: -32px;
    width: calc((100% - (var(--ip-cols, 4) - 1) * 64px) / var(--ip-cols, 4) - 28px);
    border: 1.5px solid var(--wp--preset--color--pink-500, #DF006E);
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 32px;
    pointer-events: none;
}

.ip-row--bi-right::before {
    content: '';
    position: absolute;
    right: 0;
    top: -32px;
    height: 40px;
    width: calc((100% - (var(--ip-cols, 4) - 1) * 64px) / var(--ip-cols, 4) - 28px);
    border: 1.5px solid var(--wp--preset--color--pink-500, #DF006E);
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 32px;
    pointer-events: none;
}

/* Left-side bracket (row wraps via the left edge, 3rd+ row onward) is
   intentionally not drawn - same convention as kf-event-path, which only
   renders the connector on the right side. */

/* ── Typography ───────────────────────────────────────────────────────────── */

.ip-item-title {
    font-size: 24px;
    font-weight: 400;
    color: var(--wp--preset--color--dark, #2E2E39);
    line-height: 1.2;
    max-width: 280px;
    margin: 0;
}

.ip-item-desc {
    font-size: 14px;
    font-weight: 400;
    color: var(--wp--preset--color--neutral-300, #747481);
    margin: 0;
    line-height: 20px;
    max-width: 280px;
}

/* ── Show more (mobile only) ──────────────────────────────────────────────── */

.ip-more-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    color: var(--wp--preset--color--dark, #2E2E39);
}

.ip-more-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.ip-more-icon svg {
    width: 20px;
    height: 20px;
}

.ip-block.is-expanded .ip-more-btn {
    display: none;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 991px) {
    .ip-block {
        padding: 40px 0;
    }

    .ip-panel {
        gap: 40px;
        padding: 40px 24px;
    }

    .ip-title {
        font-size: 26px;
    }

    .ip-rows {
        gap: 0;
    }

    .ip-more-btn {
        display: flex;
    }

    /* All rows stack vertically, read top-to-bottom regardless of desktop LTR/RTL. */
    .ip-row {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .ip-row--rtl {
        flex-direction: column-reverse;
    }

    /* Only the first row shows by default; the rest wait behind "Pokaż więcej".
       Must come AFTER the ".ip-row { display: flex }" rule above, otherwise
       that rule (equal specificity, later in source) would win and undo this. */
    .ip-row--collapsible {
        display: none;
    }

    .ip-block.is-expanded .ip-row--collapsible {
        display: flex;
    }

    /* Item: dot column (left) + text column (right) */
    .ip-item {
        display: grid;
        grid-template-columns: 16px 1fr;
        grid-template-rows: auto auto;
        column-gap: 16px;
        row-gap: 16px;
        width: 100%;
        padding-bottom: 24px;
    }

    .ip-item-top {
        grid-column: 1;
        grid-row: 1 / 3;
        flex-direction: column;
        align-items: center;
        align-self: stretch;
        gap: 0;
    }

    .ip-item-top::after {
        content: '';
        flex: 1;
        width: 12px;
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 64" preserveAspectRatio="none"><path d="M6.27344 0.75C6.27344 0.335786 5.93765 1.81059e-08 5.52344 0C5.10922 -1.81059e-08 4.77344 0.335786 4.77344 0.75L5.52344 0.75L6.27344 0.75ZM4.9931 63.2803C5.286 63.5732 5.76087 63.5732 6.05376 63.2803L10.8267 58.5074C11.1196 58.2145 11.1196 57.7396 10.8267 57.4467C10.5338 57.1538 10.059 57.1538 9.76608 57.4467L5.52343 61.6893L1.28079 57.4467C0.987901 57.1538 0.513028 57.1538 0.220134 57.4467C-0.0727593 57.7396 -0.0727593 58.2145 0.220134 58.5074L4.9931 63.2803ZM5.52344 0.75L4.77344 0.75L4.77343 62.75L5.52343 62.75L6.27343 62.75L6.27344 0.75L5.52344 0.75Z" fill="%23DF006E"/></svg>');
        background-size: 12px;
        background-repeat: no-repeat;
        background-position: bottom center;
        margin-top: 8px;
        margin-bottom: 0;
    }

    .ip-item-title {
        grid-column: 2;
        grid-row: 1;
    }

    .ip-item-desc {
        grid-column: 2;
        grid-row: 2;
    }

    /* Last item overall: no trailing connector/gap */
    .ip-row:last-child.ip-row--ltr .ip-item:last-child,
    .ip-row:last-child.ip-row--rtl .ip-item:first-child {
        padding-bottom: 0;
    }

    .ip-row:last-child.ip-row--ltr .ip-item:last-child .ip-item-top::after,
    .ip-row:last-child.ip-row--rtl .ip-item:first-child .ip-item-top::after {
        display: none;
    }

    /* Hide horizontal arrows and bracket connectors - mobile uses the vertical
       dot-to-dot connector above instead. */
    .ip-arrow,
    .ip-row--bo-right::after,
    .ip-row--bi-right::before,
    .ip-row--bo-left::after,
    .ip-row--bi-left::before {
        display: none;
    }
}

/* ── Dark mode ────────────────────────────────────────────────────────────── */

html[data-theme="dark"] .ip-panel {
    background: rgba(223, 0, 110, 0.1);
    border-color: rgba(223, 0, 110, 0.25);
}

html[data-theme="dark"] .ip-title {
    color: var(--wp--preset--color--white);
}

html[data-theme="dark"] .ip-desc,
html[data-theme="dark"] .ip-desc p {
    color: rgba(255, 255, 255, 0.7);
}

html[data-theme="dark"] .ip-item-title {
    color: var(--wp--preset--color--white);
}

html[data-theme="dark"] .ip-item-desc {
    color: rgba(255, 255, 255, 0.6);
}

html[data-theme="dark"] .ip-more-btn {
    color: var(--wp--preset--color--white);
}
