/* Generic Sicily Popup Styles - shared by all popup types */

#backdrop-blur {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block !important;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 1001;
    transition: backdrop-filter .45s ease-in-out, -webkit-backdrop-filter .45s ease-in-out;
    pointer-events: none;
}

#backdrop-blur.show {
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
}

#sicily-popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Flex with `safe center` centers the popup when it fits and falls back
       to top-aligned scrolling when content is taller than the viewport — so
       no clipping of the top edge when you need to scroll. */
    display: flex !important;
    align-items: safe center;
    justify-content: center;
    z-index: 1002;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.45s ease, opacity 0.45s ease;
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: none;
    -ms-overflow-style: none;
    /* Internet Explorer 10+ */
    scrollbar-width: none;
    /* Firefox, Safari 18.2+, Chromium 121+ */
}

#sicily-popup-container::-webkit-scrollbar {
    display: none;
    /* Older Safari and Chromium */
}

#sicily-popup-container.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#sicily-popup {
    display: flow-root;
    position: relative;
    width: 90%;
    max-width: 1160px;
    margin: 20px auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: clip;
}

.sicily-popup-close-btn {
    position: sticky;
    top: 20px;
    width: 36px;
    height: 36px;
    margin-left: calc(100% - 56px);
    margin-top: 20px;
    margin-bottom: -58px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all .4s ease;
    z-index: 10;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

.sicily-popup-close-btn:hover {
    background: #000;
    transform: translateZ(0) scale(1.1);
}

.sicily-popup-close-btn img {
    width: 10px;
    height: 10px;
}

.sicily-popup-close-btn:hover img {
    filter: invert(1);
}


.sicily-popup-content-wrapper {
    width: 100%;
}

.sicily-popup-content-item {
    display: none;
}

.sicily-popup-content-item.active {
    display: block;
}

.sicily-popup-image-header {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.sicily-popup-header-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

/* Fast transition for location changes */
.sicily-popup-header-image.fast-transition {
    transition: opacity .5s ease-in-out;
}

.sicily-popup-header-image.active {
    opacity: 1;
}

/* For map popup: only show images that are both in active-group AND have active class */
.sicily-popup-map-images .sicily-popup-header-image {
    opacity: 0;
}

.sicily-popup-map-images.active-group .sicily-popup-header-image.active {
    opacity: 1;
}

.sicily-popup-title {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'GuthenBloots', arial, sans-serif;
    font-size: clamp(72px, 7vw, 130px);
    font-weight: 400;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin: 0;
    text-align: center;
}

.sicily-popup-navigation {
    display: none;
    gap: 15px;
    position: relative;
    top: -30px;
}

.sicily-popup-nav-link {
    background: none;
    border: none;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 15px;
    font-weight: 300;
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    padding-top: 10px;
    transition: all 0.3s ease;
}

.sicily-popup-nav-link:hover {
    color: rgba(0, 0, 0, 0.7);
}

.sicily-popup-nav-link.active {
    font-weight: 400;
    color: black;
}

.sicily-popup-content {
    padding: 20px 20px 40px;
    font-family: 'Roboto Condensed', sans-serif;
}

.sicily-popup-intro {
    text-align: left;
    margin-bottom: 30px;
}

.sicily-popup-intro h2 {
    font-size: clamp(20px, 2.1rem, 33px);
    font-weight: 350;
    color: #000;
    line-height: 1.1;
    margin-bottom: 20px;
}

.sicily-popup-intro h3 {
    font-size: clamp(20px, 2rem, 32px);
    font-weight: 250;
    color: #000;
    line-height: 1.3;
    margin-top: -20px;
    margin-bottom: 10px;
}

.sicily-popup-intro p {
    font-size: clamp(19px, 1.8vw, 22px);
    font-weight: 350;
    color: #2c3e50;
    line-height: 1.4;
    margin: 0;
}

.sicily-popup-section {
    margin-bottom: 40px;
}

.sicily-popup-section:last-child {
    margin-bottom: 0;
}

.sicily-popup-section h2,
.sicily-popup-section h3 {
    font-size: clamp(15px, 1.5rem, 24px);
    font-weight: 350;
    color: #000;
    margin: 0 0 20px 0;
    line-height: 1.3;
}

.sicily-popup-section p {
    font-size: clamp(16px, 1.6vw, 19px);
    line-height: 1.6;
    color: #4a5967;
    margin: 0 0 0 0;
}

.sicily-popup-section .bold {
    color: #000;
    font-weight: 400;
}

.sicily-popup-section p:last-child {
    margin-bottom: 0;
}

.sicily-popup-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
}

.sicily-popup-list li {
    font-size: clamp(15px, 1.5vw, 17px);
    line-height: 1;
    color: #4a5967;
    padding-left: 15px;
    position: relative;
    margin-bottom: 12px;
}

.sicily-popup-list li:before {
    content: "•";
    position: absolute;
    left: 0px;
    font-size: 14px;
    font-weight: bold;
    top: 2px;
}

.sicily-popup-list.two-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px 20px;
}

.sicily-popup-two-columns {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

/* Tablet styles - 600px and up */
@media (min-width: 600px) {
    #sicily-popup {
        margin: 40px auto;
        border-radius: 22px;
    }

    .sicily-popup-image-header {
        height: 300px;
    }

    .sicily-popup-navigation {
        display: flex;
    }

    .sicily-popup-content {
        padding: 40px 30px 40px;
    }

    .sicily-popup-intro {
        margin-bottom: 10px;
    }

    .sicily-popup-intro h2 {
        font-size: clamp(26px, 2.8rem, 44px);
    }

    .sicily-popup-section h2,
    .sicily-popup-section h3 {
        font-size: clamp(20px, 2rem, 32px);
        padding-top: 40px;
        margin: 0 0 10px 0;
    }

    .sicily-popup-section p {
        line-height: 1.4;
    }

    .sicily-popup-list {
        margin: 15px 0 0 0;
    }

    .sicily-popup-list li {
        margin-bottom: 0px;
        font-size: clamp(15px, 1.5vw, 16px);
        line-height: 1.6;
    }

    #popup-map .maplibregl-ctrl-bottom-left {
        left: 60px;
        bottom: 40px;
    }
}

/* Desktop styles - 900px and up */
@media (min-width: 900px) {
    #sicily-popup {
        margin: 60px auto;
    }

    .sicily-popup-title {
        bottom: 20px;
    }

    .sicily-popup-content {
        padding: 75px 100px 100px;
    }

    .sicily-popup-two-columns {
        flex-direction: row;
        gap: 96px;
        padding-top: 20px;
    }

    .sicily-popup-two-columns .sicily-popup-section {
        flex: 1;
        margin-bottom: 0;
    }

    .sicily-popup-list.two-columns {
        grid-template-columns: repeat(2, 1fr);
    }

}

/* Castellammare places swiper */
.swiper-popup-gallery-wrapper {
    position: relative;
    margin: 0 0 40px 0;
}

.sicily-popup-places {
    overflow: hidden;
}

.swiper-popup-places {
    overflow: hidden;
}

.sicily-popup-place-card {
    width: 67vw;
    flex-shrink: 0;
}

.sicily-popup-place-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
}

.sicily-popup-place-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sicily-popup-place-card h3,
.sicily-popup-place-card .sicily-popup-place-title {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 15px;
    font-weight: 300;
    color: #000;
    margin: 8px 0 0 0;
    line-height: 1.3;
}

.sicily-popup-place-card p:not(.sicily-popup-place-title) {
    display: none;
}

@media only screen and (min-width: 601px) {
    .sicily-popup-place-card {
        width: 300px;
        padding: 0 10px;
    }

    .sicily-popup-place-card h3,
    .sicily-popup-place-card .sicily-popup-place-title {
        display: block;
        font-family: 'Roboto Condensed', sans-serif;
        font-size: 18px;
        font-weight: 300;
        color: #000;
        margin: 0 0 8px 0;
        line-height: 1.3;
    }

    .sicily-popup-place-card p:not(.sicily-popup-place-title) {
        display: block;
        font-family: 'Roboto Condensed', sans-serif;
        font-size: 15px;
        font-weight: 350;
        color: #4a5967;
        line-height: 1.5;
        margin: 0;
    }

    .sicily-popup-place-image {
        margin-bottom: 15px;
    }
}

/* Castellammare places swiper navigation arrows (desktop only) */
.swiper-popup-places-next,
.swiper-popup-places-prev {
    position: absolute;
    color: #000;
    top: 125px;
}

.swiper-popup-places-next::after,
.swiper-popup-places-prev::after {
    font-size: 22px;
    font-weight: bold;
}

.swiper-popup-places-next {
    right: -55px;
}

.swiper-popup-places-prev {
    left: -40px;
}

@media (min-width: 600px) and (max-width: 900px) {
    .swiper-popup-places-next,
    .swiper-popup-places-prev {
        display: none;
    }
}

/* Map popup specific styles */
.sicily-popup-map-container {
    position: relative;
    width: 100%;
}

#popup-map {
    width: 100%;
    height: 0;
    background: white;
    display: none;
}

#popup-map .maplibregl-ctrl-scale {
    background-color: unset;
    height: 6px;
    border: 1.5px solid #333;
    border-top: #333;
    margin: 0 0 12px 12px;
    line-height: 0.5;
    text-indent: -40px;
}

.sicily-popup-map-content {
    padding: 30px 20px;
    font-family: 'Roboto Condensed', sans-serif;
}

.sicily-popup-map-location {
    display: none;
}

.sicily-popup-map-location.active {
    display: block;
}

.sicily-popup-map-images {
    display: block;
}

/* Mobile: map stays hidden, content shows normally */
@media (max-width: 600px) {
    .sicily-popup-map-content {
        padding: 30px 20px;
    }
}

/* Tablet: original stacked layout — image header on top, map below with text overlay */
@media (min-width: 601px) and (max-width: 1050px) {
    #popup-map {
        display: block;
        height: 800px;
    }

    .sicily-popup-map-container {
        position: relative;
        padding: 0;
    }

    .sicily-popup-map-content {
        position: absolute;
        right: 0px;
        top: 0px;
        width: 500px;
        max-width: 55%;
        background: transparent;
        padding: 65px 90px 0px 0px;
        z-index: 10;
        text-align: right;

    }

    .sicily-popup-map-content .sicily-popup-intro {
        margin-bottom: 10px;
        text-align: right;

    }

    .sicily-popup-map-content .sicily-popup-intro h2 {
        font-size: 28px;
        margin: 0;
    }

    .sicily-popup-map-content .sicily-popup-section p {
        font-size: 16px;
        line-height: 1.4;
        margin: 0;
    }
}

/* Desktop: side-by-side layout — map left, image+text right */
@media (min-width: 1051px) {
    .sicily-popup-map-item.active {
        display: flex;
        flex-direction: row;
        position: relative;
        min-height: 700px;
    }

    .sicily-popup-map-item > .sicily-popup-image-header {
        position: relative;
        width: 50%;
        height: auto !important;
        order: 2;
        flex-shrink: 0;
        overflow: hidden;
    }

    .sicily-popup-map-container {
        width: 50%;
        order: 1;
        display: flex;
        flex-direction: column;
    }

    #popup-map {
        display: block;
        height: 100%;
        flex: 1;
    }

    .sicily-popup-map-content {
        position: absolute;
        right: 0;
        top: 20px;
        width: calc(80% - 50px);
        z-index: 10;
        padding: 40px 50px 40px 40px;
        box-sizing: border-box;
        text-align: right;
    }

    .sicily-popup-map-content .sicily-popup-intro {
        margin-bottom: 10px;
        text-align: right;
    }

    .sicily-popup-map-content .sicily-popup-intro h2 {
        font-size: 28px;
        margin: 0;
    }

    .sicily-popup-map-content .sicily-popup-section p {
        font-size: 16px;
        line-height: 1.4;
        margin: 0;
    }
}

/* External links - reset global styles from _common.css */
.sicily-link {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: normal;
    text-transform: none;
    line-height: inherit;
    color: #4a5967;
}

.sicily-link:hover {
    color: rgb(57, 159, 249);
}
