/* ==========================================================================
   CUSTOM STYLES
   Table of Contents:
   1. Custom Icons
   2. QLD Design System Overrides
   3. Card Components
   4. Index Page - Hero Banner
   5. Index Page - Border Radius Utilities
   6. Index Page - Banner Containers
   7. Background Image Slideshow
   8. Search & Filter Components
   9. Pagefind Integration
   10. Full Width Content
   11. Swiper Carousel
   12. Image Modal
   13. Utilities
   14. MapLibre Overrides
   15. Asset Page
   ========================================================================== */


/* ==========================================================================
   1. CUSTOM ICONS
   ========================================================================== */

.qld-icon-archive {
    --qgds-icon-archive: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='20' height='5' x='2' y='3' rx='1'/><path d='M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8'/><path d='M10 12h4'/></svg>");

    mask-image: var(--qgds-icon-archive);
    -webkit-mask-image: var(--qgds-icon-archive)
}

.qld-icon-building {
  mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWJ1aWxkaW5nLWljb24gbHVjaWRlLWJ1aWxkaW5nIj48cGF0aCBkPSJNMTIgMTBoLjAxIi8+PHBhdGggZD0iTTEyIDE0aC4wMSIvPjxwYXRoIGQ9Ik0xMiA2aC4wMSIvPjxwYXRoIGQ9Ik0xNiAxMGguMDEiLz48cGF0aCBkPSJNMTYgMTRoLjAxIi8+PHBhdGggZD0iTTE2IDZoLjAxIi8+PHBhdGggZD0iTTggMTBoLjAxIi8+PHBhdGggZD0iTTggMTRoLjAxIi8+PHBhdGggZD0iTTggNmguMDEiLz48cGF0aCBkPSJNOSAyMnYtM2ExIDEgMCAwIDEgMS0xaDRhMSAxIDAgMCAxIDEgMXYzIi8+PHJlY3QgeD0iNCIgeT0iMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjIwIiByeD0iMiIvPjwvc3ZnPg==");
  -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWJ1aWxkaW5nLWljb24gbHVjaWRlLWJ1aWxkaW5nIj48cGF0aCBkPSJNMTIgMTBoLjAxIi8+PHBhdGggZD0iTTEyIDE0aC4wMSIvPjxwYXRoIGQ9Ik0xMiA2aC4wMSIvPjxwYXRoIGQ9Ik0xNiAxMGguMDEiLz48cGF0aCBkPSJNMTYgMTRoLjAxIi8+PHBhdGggZD0iTTE2IDZoLjAxIi8+PHBhdGggZD0iTTggMTBoLjAxIi8+PHBhdGggZD0iTTggMTRoLjAxIi8+PHBhdGggZD0iTTggNmguMDEiLz48cGF0aCBkPSJNOSAyMnYtM2ExIDEgMCAwIDEgMS0xaDRhMSAxIDAgMCAxIDEgMXYzIi8+PHJlY3QgeD0iNCIgeT0iMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjIwIiByeD0iMiIvPjwvc3ZnPg==");
}

.icon-background {
    width: 4rem;
    height: 4rem;
    mask-size: 4rem;
    background-size: 4rem;
    background-color: var(--qld-default-background-shade);
    margin-left: 1.5rem;
    border-radius: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ==========================================================================
   2. QLD DESIGN SYSTEM OVERRIDES
   ========================================================================== */

.qld-tabs .tabs-area{
    z-index: 5;
}

.qld-search-input .form-control {
    border-radius: 0.25rem;
    border-right-width: 0.125rem;
}

.qld-search-input #search-clear {
    display: none;
    position: absolute;
    right: 1rem;
    top: 50%;
    height: 1.5rem;
    width: 1.5rem;
    transform: translateY(-50%);
    border: none;
    cursor: pointer;
    background-color: var(--qld-icon-color);
}

.qld-search-input input:not(:placeholder-shown) + #search-clear {
    display: block;
}

.qld-search-input input:not(:placeholder-shown) + #search-clear:hover {
    background-color: var(--qld-light-action-primary-hover)
}

/* ==========================================================================
   3. CARD COMPONENTS
   ========================================================================== */

.result-focused {
    animation: result-highlight 3s ease-out;
}

@keyframes result-highlight {
    0% {
        outline: 3px solid var(--qld-light-action-primary, #09549f);
        outline-offset: 2px;
    }
    
    100% {
        outline: 3px solid transparent;
        outline-offset: 2px;
    }
}

/* Equal-height card helpers (apply by adding `equal-height` to the .row) */
.qld-card-grid .row.equal-height > [class*="col-"] {
    display: flex;
}

.qld-card-grid .row.equal-height > [class*="col-"] .card {
    /* Make each card take the full height of the column */
    display: flex;
    flex: 1 1 auto;
}

.qld-card-grid .row.equal-height .card-body {
    /* Let the body grow so footers/actions can sit at bottom if needed */
    flex: 1 1 auto;
}

/* Multi-action card image - fill container without distortion */
.card-img-right {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left center;
}

/* Result cards (search results) */
.result-card .card-title {
    font-size: 1.25rem;
}

.result-card .card-text {
    font-size: 0.8rem;
}

.card-image {
	width: 6rem;
	height: 6rem;
	flex-shrink: 0;
	mask-size: 4rem;
	background-size: 4rem;
	background-color: var(--qld-card-icon-background-color);
	margin-left: 1.25rem;
	margin-block-start: 0.5rem;
    border-radius: 0.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
    overflow: hidden;
}

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

/* Hide image and show fallback icon when image fails to load */
.card-image.no-thumbnail span {
    display: none;
}

.card-image.no-thumbnail .card-image-fallback {
    display: block;
}

.link-list {
    flex-direction: row !important;
    gap: 3rem !important;
}

.result-card .card-footer .link-list .link-item a {
    gap: 0.25rem;
}

.result-card .card-footer {
    padding-bottom: 0.5rem;
}

.result-card .card-footer::before {
    margin: 0.75rem 0;
}

/* ==========================================================================
   4. INDEX PAGE - HERO BANNER
   ========================================================================== */

.hero-banner {
    max-width: 504px;
    background-color: rgba(0,94,184, 0.8);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.hero-banner.loaded {
    opacity: 1;
}

@media (max-width: 991.98px) {
    .hero-banner {
        position: static;
        top: auto;
        transform: none;
        max-width: 100%;
        border-radius: 0 !important;
    }
}

.banner-title {
    font-size: 2rem;
}

.banner-abstract.banner-hero-abstract {
    font-size: 1.25rem;
}

.banner-content-full {
    grid-column: none !important
}

.slide-text {
    position: absolute;
    bottom: 1.5rem;
    right: 3rem;
    color: white;
    background: rgba(0,94,184, 0.8);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem 0.5rem 1rem 0.5rem;
    text-shadow: 0 0 10px rgba(0,0,0,0.7);
    z-index: 2;
}


/* ==========================================================================
   5. INDEX PAGE - BORDER RADIUS UTILITIES
   ========================================================================== */

.radius .hero-banner {
    border-radius: 1rem 1rem 3rem 1rem
}

.radius .banner-floating {
    border-radius: 1rem 1rem 3rem 1rem
}

.radius .navbar {
    border-top-left-radius: 2rem;
    border-top-right-radius: 2rem;
}

.radius .banner-container-with-image-slide,
.radius .banner-radius,
.radius .swiper {
    border-bottom-left-radius: 2rem;
    border-bottom-right-radius: 2rem;
}

.image-panel section {
    border-top-left-radius: 3rem;
    border-bottom-left-radius: 3rem;
    border-bottom-right-radius: 3rem;
}

.image-panel .video-embed,
.image-panel .video-thumbnail-image {
    border-top-left-radius: 3rem;
}

@media (max-width: 991.98px) {

    .radius .banner-container-with-image-slide,
    .radius .banner-radius,
    .radius .swiper {
        border-bottom-left-radius: 0rem;
        border-bottom-right-radius: 0rem;
    }

    .image-panel section {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .image-panel .video-embed,
    .image-panel .video-thumbnail-image {
        border-top-left-radius: 0;
    }
}


/* ==========================================================================
   6. INDEX PAGE - BANNER CONTAINERS
   ========================================================================== */

.banner-container-with-image-slide {
    width: 100%;
    margin: 0;
    display: flex;
    flex-wrap: nowrap;
    position: relative;
    box-sizing: border-box;
}

@media (max-width: 991.98px) {
    .banner-container-with-image-slide {
        flex-direction: column;
        flex-wrap: wrap;
    }

    .banner-container-with-image-slide .swiper {
        width: 100%;
        height: 240px;
        flex-shrink: 0;
    }
}

@media (max-width: 699px) {
    .banner-container-with-image-slide {
        border-radius: 0;
        padding-left: 0;
        padding-right: 0;
    }
}

.banner-container-with-image-slide .mobile-banner {
    display: none;
}

@media (max-width: 699px) {
    .banner-container-with-image-slide .mobile-banner {
        top: 0;
        left: 0;
        right: 0;
        display: block;
        }
}

.navbar [id="burgerCloseBtn"]::before {
	--nav-header-icon-color: var(--qld-white);
}

/* ==========================================================================
   7. BACKGROUND IMAGE SLIDESHOW
   ========================================================================== */

@media (max-width: 699) {
    .background-image {
        display: none;
    }
}

.background-image {
    width: 100%;
    margin: 0;
    display: flex;
    flex-wrap: nowrap;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    min-height: 400px;
}

.background-image::before,
.background-image::after,
.background-image .bg-slide-3 {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: 0;
}

.background-image::before {
    background-image: url("/img/promo-image.jpg");
    animation: slide-show-1 15s ease-in-out infinite;
}

.background-image::after {
    background-image: url("/img/peanut-silo.jpg");
    animation: slide-show-2 15s ease-in-out infinite;
}

/* For third image, we'll use a child element approach in HTML */
.background-image .bg-slide-3 {
    background-image: url("/img/promo-image.jpg");
    animation: slide-show-3 15s ease-in-out infinite;
}

.background-image > *:not(.bg-slide-3) {
    position: relative;
    z-index: 1;
}

/* Crossfade animations */
@keyframes slide-show-1 {
    0%,
    33% {
        opacity: 1;
    }

    36%,
    100% {
        opacity: 0;
    }
}

@keyframes slide-show-2 {
    0%,
    30% {
        opacity: 0;
    }

    33%,
    66% {
        opacity: 1;
    }

    69%,
    100% {
        opacity: 0;
    }
}

@keyframes slide-show-3 {
    0%,
    63% {
        opacity: 0;
    }

    66%,
    99% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}


/* ==========================================================================
   8. SEARCH & FILTER COMPONENTS
   ========================================================================== */

.search-filter {
    background-color: var(--qld-color-default-color-dark-background-default);
    border-radius: 1rem 1rem 2rem 1rem;
}

.search-filter-title {
    color: white;
    margin: 0;
}

#active-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

#active-filters::-webkit-scrollbar {
    height: 4px;
}

#active-filters::-webkit-scrollbar-track {
    background: transparent;
}

#active-filters::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

#active-filters .tag-item {
    flex-shrink: 0;
}

.search-filter .dropdown-toggle {
    padding-inline: .5rem;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    height: var(--qld-header-preheader-height);
    background-color: var(--dropdown-bg);
}

.search-filter .dropdown-toggle::after {
    --_icon-size: 1.5rem;

    display: inline-block;
    width: var(--_icon-size);
    height: var(--_icon-size);
    background-position: center center;
    background-repeat: no-repeat;
    mask-position: center center;
    mask-repeat: no-repeat;
    mask-size: contain;
    background-size: contain;
    vertical-align: middle;
    color: var(--qld-icon-color, var(--qld-action-icon-color, inherit));
    background-color: currentcolor;
    mask-image: var(--qgds-icon-chevron-down);
    -webkit-mask-image: var(--qgds-icon-chevron-down);
    margin-left: .5rem;
    transition: transform 0.3s ease;
}

.search-filter .dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.filter-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease-in-out;
}

.filter-content.expanded {
    max-height: 800px;
    transition: max-height 0.4s ease-in-out;
}

.filter-content ul {
    padding: 0 0.5rem !important
}

.content-item {
    display: none
}

.content-item.active {
    display: block;
}

/* Persistent selected state for tag-link */
.tag-link.selected {
    background-color: var(--qld-dark-action-primary-hover) !important;
    color: var(--QLD-color-dark__link--on-action) !important;
    outline: 3px solid var(--qld-dark-action-primary-hover) !important;
    outline-offset: 2px !important;
    text-decoration: underline;
}

.tag-link.selected a {
    color: var(--QLD-color-dark__link--on-action) !important;
}

#help-toggle {
    min-height: 0;
    min-width: 0;
}

.filter-options-wrap {
    max-height: 300px;
    overflow: auto;
}


/* ==========================================================================
   9. PAGEFIND INTEGRATION
   ========================================================================== */

.filter-options-wrap .pagefind-modular-filter-pills {
    overflow-x: auto;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 300px;
}

.filter-options-wrap .pagefind-modular-filter-pills-wrapper {
    overflow-x: unset;
    padding: 0;
    flex: 1;
}


/* ==========================================================================
   10. FULL WIDTH CONTENT
   ========================================================================== */

.full-width-content {
    display: flex;
    flex-direction: column;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    width: 100vw;
    padding: 0;
    min-height: 24rem;
    background: var(--qld-light-background);
    justify-content: center;
    align-items: center;
}

.full-width-content .tab-content {
    border: none;
}

.full-width-content #map {
    flex: 1
}

.asset-map {
    width: 100%;
}


/* ==========================================================================
   11. SWIPER CAROUSEL
   ========================================================================== */

/* Base swiper styles */
.swiper {
    padding-top: 50px;
    padding-bottom: 50px;
    position: relative;
}

.swiper-coverflow {
    border-bottom-left-radius: 0rem !important;
    border-bottom-right-radius: 0rem !important;
}

/* Slide styles */
.swiper-slide {
    background-position: center;
    background-size: cover;
    height: 300px !important;
}

.swiper-slide.hero {
    height: 400px !important;
}

.swiper-slide.coverflow {
    width: 300px !important;
}

.swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #e0e0e0;
}

@media (max-width: 991.98px) {
    .banner-container-with-image-slide .swiper {
        height: 200px;
    }
    .swiper-slide.hero img{
        height: 50%;
    }
    .slide-text {
        right: 0.5rem;
        top: 0.5rem;
        bottom: unset;
        font-size: 0.8rem;
    }
}

/* Loading state */
.swiper-loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    transition: opacity 0.3s ease-in-out;
}

.swiper.loaded .swiper-loading {
    opacity: 0;
    pointer-events: none;
}

.swiper .swiper-wrapper {
    opacity: 0;
}

.swiper.loaded .swiper-wrapper {
    opacity: 1;
}

/* Placeholder shimmer animation */
.placeholder-shimmer {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: inherit;
    mask-image: radial-gradient(ellipse 80% 70% at center, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at center, black 40%, transparent 100%);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    
    100% {
        background-position: -200% 0;
    }
}


/* ==========================================================================
   12. IMAGE MODAL
   ========================================================================== */

.modal-container {
    display:none;
    position:fixed;
    top:0;
    left:0;
    width:100vw;
    height:100vh;
    background:rgba(0,0,0,0.9);
    justify-content:center;
    align-items:center;
    z-index:999;
}

.modal-image-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-container img {
    max-width:90vw;
    max-height:80vh;
    box-shadow:0 0 20px #000;
    z-index:999;
}

.modal-container video {
    max-width:90vw;
    max-height:80vh;
    box-shadow:0 0 20px #000;
    z-index:999;
    object-fit: cover;
}

.modal-container #close-modal {
    position:fixed;
    top:2rem;
    right:2rem;
    font-size:2rem;
    color:#fff;
    background:none;
    border:none;
    cursor:pointer;
    z-index:999;
}

.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1000;
    padding: 1rem;
    color: #fff;
}

.modal-nav svg {
    width: 1.5rem;
    height: 2.5rem;
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.8));
}

.modal-nav:hover {
    opacity: 0.7;
}

.modal-nav-prev {
    left: 1rem;
}

.modal-nav-next {
    right: 1rem;
}

@media screen and (max-width: 768px) {
    .modal-container {
        flex-wrap: wrap;
        align-content: center;
    }


    .modal-image-wrapper {
        width: 100%;
        order: 1;
    }

    .modal-nav {
        position: static;
        transform: none;
        order: 2;
        padding: 1.5rem 2rem;
    }

    .modal-nav svg {
        width: 1.25rem;
        height: 2rem;
    }
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    color: #fff;
}

.modal-footer figcaption {
    flex: 1;
    margin: 0;
    padding: 0 1rem;
}

.dropdown.dark {
    background-color: unset;
}

.dropwdown-item {
    color: var(--qld-btn-color) !important;
    background: none;
    border-color: transparent;
    box-shadow: none;
}

.dropdown-item:hover,
.dropdown-item:focus {
    text-decoration: underline;
    background: none;
    border-color: transparent;
    box-shadow: none;
}

.dropdown-item:visited {
    color: inherit;
}

.modal-btn.show {
    display: inline-flex !important;
}

.modal-btn.dropdown-toggle::after {
    display: none;
}


/* ==========================================================================
   13. UTILITIES
   ========================================================================== */

.hidden {
    display: none;
}

/* ==========================================================================
   14. MAPLIBRE OVERRIDES
   ========================================================================== */

.div.maplibregl-popup-content {
    background: none;
    border-radius: 1rem;
}

.maplibregl-popup-close-button {
    margin: 0.75rem 0.5rem;
    color: var(--qld-action-icon-color);
}

.maplibregl-popup-close-button:hover {
    color: var(--qld-action-icon-hover-color) !important;
    background: none !important;
}

.relative-position {
    position: relative; 
    display: inline-block;
}

/* ==========================================================================
   15. ASSET PAGE
   ========================================================================== */

.accordion-group:not(:has(.accordion-item)) .accordion-toggle {
    display: none;
}

.sketchfab-embed-wrapper iframe {
    width: 100vw;
    height: 400px;
}

.swiper-video {
    position: relative;
    text-align: center;
    height: 100%;
    width: 100%;
}

.swiper-video div {
    font-size: 300%;
    z-index: 999;
    position: absolute;
    bottom: 0%;
    left: 0%;
    min-width: 2em;
    color: var(--qld-default-background-shade);
    background-color: var(--qld-light-action-primary);
    border-radius: 0 0.2em;
}



@media (max-width: 991.98px) {
    .sketchfab-embed-wrapper iframe {
        height: 300px;
    }
    .full-width-content {
        min-height: unset;
    }
}

.default-page .container-for-page-body img {
    max-width: 50%;
    min-height: 3em;
}

div.card-img-top.card-img-background-by-img {
    display: inline-block;
    width: 100%;
    overflow: hidden;
}

div.card-img-top.card-img-background-by-img img {
    display: absolute;
    z-index: -1;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
