/* =========================================
   Category Accordion Widget
   ========================================= */

.agrivont-cat-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 450px;
    gap: 14px;
    background-color: transparent;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

.agrivont-cat-item {
    position: relative;
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 0%;
    min-width: 70px;
    overflow: hidden;
    cursor: pointer;
    outline: none;
    border-radius: 12px;
    background-color: #dbe4fb;
    transition: flex-grow 0.7s cubic-bezier(0.25, 1, 0.5, 1);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    --agrivont-pad-top: 0px;
    --agrivont-pad-right: 0px;
    --agrivont-pad-bottom: 0px;
    --agrivont-pad-left: 0px;
    --agrivont-pad-active-top: 0px;
    --agrivont-pad-active-right: 0px;
    --agrivont-pad-active-bottom: 0px;
    --agrivont-pad-active-left: 0px;
}

.agrivont-cat-item.agrivont-cat-active {
    flex-grow: 3;
}

/* ---------- Thumbnail (collapsed state) ---------- */

.agrivont-cat-thumb {
    display: block;
    position: absolute;
    top: var(--agrivont-pad-top);
    right: var(--agrivont-pad-right);
    bottom: var(--agrivont-pad-bottom);
    left: var(--agrivont-pad-left);
    width: auto;
    height: auto;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    object-fit: cover;
    object-position: center;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.agrivont-cat-item.agrivont-cat-active .agrivont-cat-thumb {
    opacity: 0;
    pointer-events: none;
}

/* ---------- Illustration + description (expanded state) ---------- */

.agrivont-cat-illustration {
    display: block;
    position: absolute;
    top: var(--agrivont-pad-active-top);
    right: var(--agrivont-pad-active-right);
    bottom: var(--agrivont-pad-active-bottom);
    left: var(--agrivont-pad-active-left);
    width: auto;
    height: auto;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s ease 0.1s;
}

.agrivont-cat-item.agrivont-cat-active .agrivont-cat-illustration {
    opacity: 0.9;
}

.agrivont-cat-content-inner {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 40px 56px;
    pointer-events: none;
}

.agrivont-cat-text-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.agrivont-cat-item.agrivont-cat-active .agrivont-cat-text-wrapper {
    grid-template-rows: 1fr;
}

.agrivont-cat-text-inner {
    overflow: hidden;
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.agrivont-cat-item.agrivont-cat-active .agrivont-cat-text-inner {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.5s ease 0.15s, transform 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.15s;
}

.agrivont-cat-heading {
    color: #2e3a56;
    font-size: 22px;
    line-height: 1.5;
    font-weight: 500;
    max-width: 100%;
}

.agrivont-cat-heading p {
    margin: 0;
}

.agrivont-cat-link {
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* ---------- Rotated label (shared) ---------- */

.agrivont-cat-label {
    position: absolute;
    bottom: calc(24px + var(--agrivont-pad-bottom));
    left: calc(34px + var(--agrivont-pad-active-left));
    z-index: 3;
    writing-mode: vertical-rl;
    transform: translateX(-50%) rotate(180deg);
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 0;
    color: #ffffff;
    pointer-events: none;
    transition: left 0.7s cubic-bezier(0.25, 1, 0.5, 1), bottom 0.7s cubic-bezier(0.25, 1, 0.5, 1), transform 0.7s cubic-bezier(0.25, 1, 0.5, 1), color 0.5s ease, text-shadow 0.5s ease;
}

.agrivont-cat-item.agrivont-cat-active .agrivont-cat-label {
    bottom: calc(24px + var(--agrivont-pad-active-bottom));
    transform: rotate(180deg);
    color: #22304a;
    text-shadow: none;
}

@media (max-width: 1250px) {
    .agrivont-cat-container {
        height: 560px;
    }
}

@media (max-width: 768px) {
    .agrivont-cat-container {
        flex-direction: column;
        height: auto;
    }

    .agrivont-cat-item {
        flex: none;
        height: 64px;
        min-width: 0;
        transition: height 0.7s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .agrivont-cat-item.agrivont-cat-active {
        flex: none;
        height: 320px;
    }

    /* Darken the collapsed bar's photo so the overlaid label stays legible;
       fades away once the panel is active, revealing the plain panel color. */
    .agrivont-cat-item::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 2;
        background: rgba(0, 0, 0, 0.45);
        pointer-events: none;
        transition: opacity 0.5s ease;
    }

    .agrivont-cat-item.agrivont-cat-active::before {
        opacity: 0;
    }

    .agrivont-cat-content-inner {
        padding: 64px 24px 24px 24px;
    }

    .agrivont-cat-heading {
        max-width: 100%;
        font-size: 16px;
    }

    .agrivont-cat-label {
        writing-mode: horizontal-tb;
        bottom: auto;
        top: 50%;
        left: calc(20px + var(--agrivont-pad-left));
        transform: translateY(-50%);
        font-size: 18px;
    }

    .agrivont-cat-item.agrivont-cat-active .agrivont-cat-label {
        top: calc(24px + var(--agrivont-pad-active-top));
        left: calc(24px + var(--agrivont-pad-active-left));
        transform: none;
        font-size: 20px;
    }
}
