/* ===========================================
   CSC WEDGE LINK BLOCKS
   Card-style navigation with expanding image on hover
   =========================================== */

/* Container for the wedge links section */
.csc-wedge-links {
    padding: 2rem 0;
}

.csc-wedge-links-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Main wedge link component */
.csc-wedge-link {
    display: flex;
    align-items: stretch;
    width: 470px;
    max-width: 100%;
    height: 150px;
    background-color: var(--csc-white);
    border-left: 5px solid var(--csc-light-green);
    border-right: 5px solid var(--csc-light-green);
    overflow: hidden;
    text-decoration: none;
    color: inherit;

    /* Smooth transitions for all animated properties */
    transition:
        width 0.3s ease,
        background-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* Image container - fixed width that expands on hover */
.csc-wedge-link-image {
    width: 146px;
    min-width: 146px;
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
    transition: width 0.3s ease, min-width 0.3s ease;
}

.csc-wedge-link-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Content area with title and description */
.csc-wedge-link-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem 1.5rem;
    gap: 0.5rem;
    /* Fixed width so it doesn't change on hover */
    width: 324px;
    flex-shrink: 0;
    min-width: 0; /* Allow text truncation */
}

.csc-wedge-link-title {
    
    font-size: 24px;
    color: var(--csc-dark-green);
    margin: 0;
    line-height: 1.2;
}

.csc-wedge-link-description {
    
    /* font-size: 16px; */
    font-weight: 300;
    color: var(--csc-darkest-neutral);
    margin: 0;
    line-height: 1.4;

    /* Limit to 2 lines with ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ===========================================
   HOVER STATE
   Expands width and image, changes background
   =========================================== */

.csc-wedge-link:hover {
    width: 740px;
    background-color: #E9FCEC; /* Light mint */
    box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.15);
}

.csc-wedge-link:hover .csc-wedge-link-image {
    width: 416px;
    min-width: 416px;
}


/* ===========================================
   FOCUS STATE
   Accessibility-compliant focus indicator
   =========================================== */

.csc-wedge-link:focus-visible {
    outline: 3px solid var(--govuk-focus-colour);
    outline-offset: 2px;
    background-color: var(--govuk-focus-colour);
}

.csc-wedge-link:focus-visible .csc-wedge-link-title {
    color: #000;
}


/* ===========================================
   ACTIVE STATE
   Slight press effect
   =========================================== */

.csc-wedge-link:active {
    transform: translateY(1px);
    box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.1);
}


/* ===========================================
   RESPONSIVE STYLES
   Adapt for tablets and mobile devices
   =========================================== */

/* Tablet - reduce sizes proportionally */
@media (max-width: 768px) {
    .csc-wedge-link {
        width: 100%;
        height: auto;
        min-height: 130px;
    }

    .csc-wedge-link-image {
        width: 120px;
        min-width: 120px;
    }

    .csc-wedge-link:hover {
        width: 100%;
    }

    .csc-wedge-link:hover .csc-wedge-link-image {
        width: 200px;
        min-width: 200px;
    }

    .csc-wedge-link-content {
        width: auto;
        flex: 1;
    }

    .csc-wedge-link-title {
        font-size: 20px;
    }

    .csc-wedge-link-description {
        font-size: 14px;
    }
}

/* Mobile - stack vertically, disable width expansion */
@media (max-width: 480px) {
    .csc-wedge-link {
        flex-direction: column;
        width: 100%;
        height: auto;
    }

    .csc-wedge-link-image {
        width: 100%;
        min-width: 100%;
        height: 150px;
    }

    /* Disable hover expansion on mobile (touch devices) */
    .csc-wedge-link:hover {
        width: 100%;
        /* Keep the background and shadow effects */
    }

    .csc-wedge-link:hover .csc-wedge-link-image {
        width: 100%;
        min-width: 100%;
        height: 180px;
    }

    .csc-wedge-link-content {
        padding: 1rem;
    }

    .csc-wedge-link-title {
        font-size: 18px;
    }

    .csc-wedge-link-description {
        font-size: 14px;
        -webkit-line-clamp: 3;
    }
}


/* ===========================================
   NO-IMAGE VARIANT
   For wedge links without a featured image
   =========================================== */

.csc-wedge-link--no-image {
    border-left-width: 8px;
}

.csc-wedge-link--no-image .csc-wedge-link-content {
    padding-left: 2rem;
}

.csc-wedge-link--no-image:hover {
    width: 550px;
}

@media (max-width: 768px) {
    .csc-wedge-link--no-image:hover {
        width: 100%;
    }
}
