:root {
    --color-primary: #194781;
    --color-olive-dark: #536e31;
}

/* --- VISIBILITY SWITCH --- */
@media (max-width: 1024px) { .desktop-only { display: none !important; } }
@media (min-width: 1025px) { .mobile-only { display: none !important; } }

/* --- SHARED BASE STYLES --- */
.beratung-process-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    background-repeat: no-repeat;
    background-position: center;
    overflow: visible; 
}

.beratung-process-wrapper {
    margin: 0 auto;
    padding: 0;
    align-content: start;
    overflow: visible;
}

.process-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

.step-icon {
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.step-icon svg, .step-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    color: var(--color-olive-dark, #536e31);
}

.step-title {
    font-size: var(--fs-fluid-sm);
    line-height: var(--lh-fluid-sm);
    font-weight: var(--fw-bold);
    color: var(--color-primary, #194781);
    margin-top: -20px;
}

/* --- DESKTOP ENGINE (1025px+) --- */
.desktop-only {
    background-image: url('/wp-content/uploads/2026/07/Desktop-Line-01.svg');
    background-size: 100% 100%;
    min-height: 500px;
}

.desktop-only .beratung-process-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 86%;
    max-width: 1112px;
}

.desktop-only .process-item {
    margin-top: 110px;
}

.desktop-only .step-popup {
    display: none;
    position: absolute;
    top: 100%;
    margin-top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    z-index: 999;
    width: 280px;
    color: var(--color-primary);
    border-radius: 0px;
    pointer-events: none;
    font-size: var(--fs-fluid-s);
    line-height: var(--lh-fluid-s);
    font-weight: var(--fw-light);
    text-align: left;
}

.desktop-only .step-popup ul {
    margin-inline-start: 1.3rem;
}

.desktop-only .step-popup::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #fff;
}

.desktop-only .process-item:hover .step-popup { display: block; }

/* --- MOBILE ENGINE (1024px and below) --- */
.mobile-only {
    --icon-gap: 1rem;          /* actual space between icon and title */
    --title-margin-was: 1rem;  /* the theme's old <p> margin-top */
    --gap-tune: 12px;          /* Zone 1 (below 600px) — dialled in, leave alone */

    background-image: url('/wp-content/uploads/2026/07/Mobile-Line-02.svg');
    background-repeat: no-repeat;
    background-size: 70% auto;
    background-position: center top;
    min-height: 800px;
    padding-top: calc(37.963vw - 84px); /* was -88px, now +4px more down */
    padding-bottom: 20%;
}

@media (min-width: 600px) {
    .mobile-only {
        padding-top: calc(32.963vw - 50px); /* was -54px */
    }
}

@media (min-width: 1000px) {
    .mobile-only {
        --gap-tune: 12px;      /* Zone 3 (above 1000px) — still untested */
        padding-top: calc(37.963vw - 100px); /* was -104px */
    }
}

.mobile-only .beratung-process-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* Zone 1: below 600px */
    gap: calc(56.77vw - 122px + var(--title-margin-was) - var(--icon-gap) - var(--gap-tune));
}

@media (min-width: 600px) {
    .mobile-only .beratung-process-wrapper {
        /* Zone 2: 600–1000px — coefficient fitted to 700px and 999px readings */
        gap: calc(44.76vw - 88.76px + var(--title-margin-was) - var(--icon-gap));
    }
}

@media (min-width: 1000px) {
    .mobile-only .beratung-process-wrapper {
        /* Zone 3: above 1000px */
        gap: calc(56.77vw - 153.57px + var(--title-margin-was) - var(--icon-gap) - var(--gap-tune));
    }
}

.mobile-only .process-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative; /* anchor for .step-popup */
}

/* Icon must also scale, or it stops being in sync with the line at other widths */
.mobile-only .step-icon {
    width: clamp(70px, 10vw, 100px);
    height: clamp(70px, 10vw, 100px);
    margin: 0 auto var(--icon-gap);
}

.mobile-only .step-icon svg,
.mobile-only .step-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    color: var(--color-olive-dark, #536e31);
}

/* Kill the theme's paragraph margin so --icon-gap is the only spacing */
.mobile-only .step-title p {
    margin-top: 0;
}

.mobile-only .step-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    width: 85%;
    margin: 10px auto;
    background: #fff;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    color: var(--color-primary);
    font-size: var(--fs-fluid-s);
    line-height: var(--lh-fluid-s);
    font-weight: var(--fw-light);
}

.mobile-only .process-item:active .step-popup {
    display: block;
}