/* Vänsterkantsflikar (desktop) + mobilmeny — bagskytte.nu */

@media (min-width: 769px) {
    /* Utrymme för rail utan att rubba headern (padding på body drar in allt) */
    body:has(.ecosystem-rail) {
        padding-left: 2.75rem;
    }

    body:has(.ecosystem-rail) .header-section {
        margin-left: -2.75rem;
        width: calc(100% + 2.75rem);
        box-sizing: border-box;
    }
}

.ecosystem-rail {
    display: none;
}

@media (min-width: 769px) {
    .ecosystem-rail {
        display: block;
        position: fixed;
        left: 0;
        /* Under header + nav — inte centrerat i viewport (krockade med header) */
        top: clamp(11rem, 26vh, 15rem);
        z-index: 40;
    }

    .ecosystem-rail__inner {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        align-items: flex-start;
    }

    .ecosystem-rail__tab {
        position: relative;
        display: block;
        box-sizing: border-box;
        width: 2.55rem;
        min-height: 7.25rem;
        padding: 0;
        border-radius: 0 10px 10px 0;
        border: 1px solid rgba(44, 62, 80, 0.12);
        border-left: none;
        box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.08);
        color: #2c3e50;
    }

    /* Hela ordet roterat 90° medurs (inte bokstav-för-bokstav) */
    .ecosystem-rail__tab-text {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%) rotate(90deg);
        white-space: nowrap;
        font-size: 0.88rem;
        font-weight: 700;
        letter-spacing: 0.035em;
        line-height: 1;
        text-align: center;
        text-transform: uppercase;
        pointer-events: none;
    }

    .ecosystem-rail__tab--1 {
        background: linear-gradient(135deg, #ffffff 0%, #e8f4fc 100%);
    }

    .ecosystem-rail__tab--2 {
        background: linear-gradient(135deg, #f0f7fb 0%, #d6eaf8 100%);
    }

    .ecosystem-rail__tab--3 {
        background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    }

    a.ecosystem-rail__tab {
        text-decoration: none;
        color: inherit;
        cursor: pointer;
        transition: filter 0.15s ease, box-shadow 0.15s ease;
    }

    a.ecosystem-rail__tab:hover {
        filter: brightness(0.97);
        box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.12);
    }

    a.ecosystem-rail__tab:focus-visible {
        outline: 2px solid #3498db;
        outline-offset: 2px;
        filter: brightness(0.97);
    }
}

/* Mobil */
.ecosystem-mobile {
    display: none;
}

@media (max-width: 768px) {
    .ecosystem-mobile {
        display: block;
    }
}

.ecosystem-mobile__toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1040;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ecosystem-mobile__toggle:hover,
.ecosystem-mobile__toggle:focus-visible {
    filter: brightness(1.08);
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.ecosystem-mobile__toggle-icon {
    display: block;
    width: 1.1rem;
    height: 1px;
    background: currentColor;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.ecosystem-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ecosystem-mobile__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1041;
    background: rgba(44, 62, 80, 0.45);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.ecosystem-mobile__panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(18rem, 86vw);
    z-index: 1042;
    background: #fff;
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.15);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.ecosystem-mobile__panel:not([hidden]) {
    transform: translateX(0);
}

.ecosystem-mobile__title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.02em;
    color: #2c3e50;
    margin: 0 0 0.25rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

a.ecosystem-mobile__item {
    display: block;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #2c3e50;
    text-decoration: none;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.08) 0%, rgba(44, 62, 80, 0.06) 100%);
    border-radius: 8px;
    border: 1px solid rgba(44, 62, 80, 0.1);
    cursor: pointer;
}

a.ecosystem-mobile__item:hover,
a.ecosystem-mobile__item:focus-visible {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.18) 0%, rgba(44, 62, 80, 0.1) 100%);
    border-color: rgba(52, 152, 219, 0.35);
    color: #1a252f;
    outline: none;
}

a.ecosystem-mobile__item:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3498db;
}

body.ecosystem-mobile-open {
    overflow: hidden;
}

@media (min-width: 769px) {
    .ecosystem-mobile {
        display: none !important;
    }

    body.ecosystem-mobile-open {
        overflow: auto;
    }
}
