/* Global */

html,body {
    overflow-x:clip;
}

/* Homepage */

#home-intro {
    margin-bottom: var(--space-medium);
}

section.project-carousel {
    overflow: visible;
    .header {
        padding: 0 15px;
        margin-bottom: 30px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    h2 {
        font-size: var(--f-m);
        line-height: var(--lh-1);
        font-weight: var(--bold);
        margin: 0;
    }
}

.section-stats {
    margin-top: var(--space-large);
}

.home {
    .news {
        margin-top: var(--space-small);
    }
}

.cta {
    margin-top: calc(var(--space-medium) * 1.5);
}

/* Projects Block Grid and Map View Styles */

.projects {
    .tags {
        li {
            font-size: var(--f-xs);
            padding: .5em .9em;
            line-height: var(--lh-1);
        }
    }
}


.view-toggle {
  display: flex;
  margin-left: auto;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0 0.8em;
  background: transparent;
  border:none;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: .5;
  font-size: calc(var(--f-body) * 0.8);
  height: 2em;
  &:before {
    content: '';
    background-color: var(--highlight);
    mask-size: contain;
    mask-repeat: no-repeat;
    width: 1em;
    height: 1em;
  }

  + .view-btn {
    border-left: 2px solid #000000;
  }
}

.view-btn:hover {
}

.view-btn.active {
    opacity: 1;
}

.grid-view:before {
    mask-image: url('../images/icon-grid.svg');
}

.map-view:before {
    mask-image: url('../images/icon-map.svg');
}

#project-filter {
    width: 100%;
    margin-bottom: calc(var(--space-small) * 1.5);

    .filter-wrap {
        display: flex;
        justify-content: space-between;
    }

    .tags {
        position: absolute;
        top: calc(100% + 20px);
        li {
            background-color: rgba(0, 177, 64, 0.2);
            color: var(--highlight);
        }
    }


    /* Filter Group Styling */
    .filter-options {
        width: 50%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding-right: calc(var(--gutter) / 2);
        gap: var(--gutter);
    }

    .filter-group {
        background: #f9f9f9;
        border-radius: 4px;
    }

    .filter-group h4 {
        margin-bottom: 10px;
        font-weight: 600;
        font-size: 14px;
        text-transform: uppercase;
    }

    .filter-group ul {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .filter-group li {
        cursor: pointer;
        padding: 6px 0;
        font-size: 14px;
        transition: all 0.3s ease;
        color: #666;
    }


    /* Filter Select Dropdown Styling */
    .filter-select {
        width: 100%;
        padding: 10px 12px;
        font-size: calc(var(--f-body) * 0.8);
        border: none;
        border-radius: 4px;
        background: #F4F2F0;
        color: #333;
        cursor: pointer;
        transition: all 0.3s ease;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-image: url("../images/icon-arrowdown.svg");
        background-repeat: no-repeat;
        background-position: right 8px center;
        padding-right: 32px;
    }

    .filter-select:focus {
        outline: none;
        background-color: #F4F2F0;
    }

    @media (max-width: 1680px) {
        .filter-options {
            width: 66.666%;
        }
    }

    @media (max-width: 450px) {
        display: flex;
        flex-direction: column;

        h3 {
            order: 2;
        }

        .filter-wrap {
            display: contents;
        }

        .view-toggle {
            order: 1;
        }

        .filter-options {
            width: 100%;
            order: 3;
        }
    }

}

/* Grid View */
#project-list {
    display: none;
    position: relative;
    margin-top: 30px;
    width: 100%;
    box-sizing: border-box;

    .project.card {
        width: 25%;
        padding-left: calc(var(--gutter) / 2);
        padding-right: calc(var(--gutter) / 2);
        overflow: hidden;
        box-sizing: border-box;
        height: clamp(350px,36vw,650px);

        .block-wrap {
            position: relative;
        }

        header h3 {
            margin: 0 0 0.4em 0;
            line-height: 1.2;
        }

        .details {
            font-size: var(--f-xs);
            text-transform: uppercase;
            color: var(--highlight);
            font-weight: 600;
            opacity: 1;

            .detail {
                display: flex;

                &:not(:first-child):before {
                    content: '|';
                    color: #ababab;
                    margin: 0 0.8em;
                }
            }

        }
        .tags {
            margin-bottom: 1rem;
            position: absolute;
            top: 1.5em;
            right: 1.5em;
            z-index: 10;
            li {
                background-color: var(--highlight);
                color: white;;
            }
        }

        .readmore {
            order: 99;
            margin-top: auto;
            margin-bottom: calc(var(--inset)/2);
            align-self: flex-start;
            padding: 0;
            font-weight: bold;
            font-size: var(--f-s);
            color: var(--highlight);
            text-decoration: underline;
            text-underline-offset: .4em;
            text-decoration-thickness: .175em;
        }

        .text {
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 5;    /* Change this number to your desired line count */
            overflow: hidden;
        }

        &.feature {
            width: 50%;
            height: clamp(350px,38vw,540px);
            .block-wrap {
                flex-direction: row-reverse;
            }
            .content {
                width: 50%;
            }
            .image {
                width: 50%;
                picture {
                    aspect-ratio: 1;
                }
            }

            &.text_over_image {
                z-index: 0;
                .block-wrap {
                    color: white;
                    &:before {
                        content: '';
                        position: absolute;
                        width: 100%;
                        height: 100%;
                        display: block;
                        z-index: 1;
                        background: linear-gradient(90deg, #000000, rgba(0, 0, 0, 0.36) 36%, transparent);
                    }
                }
                .content {
                    flex-direction: column;
                    justify-content: center;
                    z-index: 1;
                }
                .readmore {
                    margin: 0;
                }
                .image {
                    width: 100%;
                    height: 100%;
                    position: absolute;
                    picture {
                        aspect-ratio: 2;
                    }
                }
                .tags {
                    position: static;
                }
            }
        }
    }

    @media (max-width: 1680px) {
        .project.card {
            width: 33.3333%;

            &.feature {
                width: 66.6666%;
            }
        }
    }

    @media (max-width: 768px) {
        .project.card {
            width: 50%;

            &.feature {
                width: 100%;
            }
        }
    }

    @media (max-width: 450px) {
        .project.card {
            width: 100%;

            &.feature {
                width: 100%;
                .block-wrap {
                    flex-direction: column;

                }
                .content {
                    width: 100%;
                }
                .image {
                    width: 100%;
                    picture {
                        aspect-ratio: 2;
                    }
                }
            }
        }
    }
}

#project-list,
#project-map {
    display: none;
    &.active {
        display: block;
    }
}

#project-map {
    width: 100%;
    height: clamp(600px, 40vw, 1000px);
    position: relative;
}

#map-canvas {
    width: 100% !important;
    height: 100% !important;
}

#project-filter {

  h3 {
    font-weight: bold;
  }

}

.project-list-inner {
    padding: 0;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}



/* Override generic .card styles for project cards - Isotope needs full control */





/* Map Info Popup */
.map-info-popup {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 100;
    width: 380px;
    max-width: calc(100% - 40px);
    overflow: hidden;
    padding: 0;
    margin: 0;
    border: none;
    max-height: 80vh;
    overflow-y: auto;

    .map-popup-image {
        width: 100%;
        height: 200px;
        overflow: hidden;

        img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
    }

    .map-popup-body {
        padding: 20px;
    }

    .map-popup-close {
        position: absolute;
        top: 12px;
        right: 12px;
        background: none;
        border: none;
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        color: #666;
        padding: 0;
        width: 24px;
        height: 24px;

        &:hover {
            color: #000;
        }
    }

    h3 {
        margin: 0 30px 12px 0;
        font-size: 17px;
        line-height: 1.3;
        color: #111;
    }

    .map-popup-label {
        display: block;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #888;
        margin-bottom: 2px;
    }

    .map-popup-value {
        font-size: 13px;
        color: #333;
    }

    .map-popup-tags {
        list-style: none;
        padding: 0;
        margin: 0 0 14px;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;

        li {
            background: var(--highlight);
            color: white;
            padding: 3px 10px;
            border-radius: 99px;
            font-size: 12px;
            text-indent: unset;
        }
    }

    .map-popup-intro {
        font-size: 13px;
        line-height: 1.5;
        color: #555;
        margin-bottom: 16px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 5;    /* Change this number to your desired line count */
        overflow: hidden;

        p {
            margin: 0;
        }
    }

    .map-popup-link {
        font-weight: bold;
        font-size: var(--f-xs);
        color: var(--highlight);
        text-decoration: underline;
        text-underline-offset: .4em;
        text-decoration-thickness: .175em;
    }
}

.map-info-popup.active {
    z-index: 9999 !important;
    opacity: 1 !important;
    pointer-events: all !important;
    visibility: visible !important;
}

.map-popup-content {
    position: relative;
}

.map-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #333;
    z-index: 10;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-popup-close:hover {
    color: #000;
}

.map-popup-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
}

.map-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-popup-body {
    padding: 20px;
}

.map-popup-body h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
}

.map-popup-details {
    margin-bottom: 15px;
    line-height: 1;
}

.map-popup-details .detail {
    font-size: 13px;
}

.map-popup-details .detail .label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.map-popup-details .detail .value {
    color: #666;
    font-size: 12px;
}

.map-popup-tags {
    position: absolute;
    top: 10px;
    right: 10px;
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.map-popup-tags li {
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #666;

    &:before {
        content: none;
    }
}

.map-popup-intro {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
    margin: 0 0 15px 0;
}

.map-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #333;
    z-index: 10;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-popup-close:hover {
    color: #000;
}

