/* ========================================
   FEATURES CAROUSEL STYLES
   ======================================== */

/* Font definitions fallback */
:root {
    --font-heading: 'Syne', sans-serif;
    --font-body: 'Niramit', sans-serif;
    --alife-primary: rgb(241, 126, 24);
    --alife-dark: rgb(65, 36, 196);
}

/* Section Container */
.features-section {
    padding: 60px 0 80px;
    background: #f5f4f0;
    position: relative;
}

/* Section Header */
.features-section__header {
    text-align: center;
    margin-bottom: 32px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--alife-dark);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.section-subtitle {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   FILTER PILLS
   ======================================== */
.features-section__filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}

.features-pill {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid rgba(65, 36, 196, 0.3);
    color: #555;
    border-radius: 100px;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.features-pill:hover {
    border-color: var(--alife-dark);
    color: var(--alife-dark);
}

.features-pill.active {
    background: var(--alife-dark);
    border-color: var(--alife-dark);
    color: #fff;
}

/* ========================================
   MONUMENTI GRID
   ======================================== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.mgrid__card {
    display: block;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 4 / 3;
    background: #1a1a2e;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.mgrid__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.mgrid__img-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}

.mgrid__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.35s ease;
}

.mgrid__card:hover .mgrid__img-wrap img {
    transform: scale(1.05);
}

.mgrid__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 14px 14px;
    background: linear-gradient(to top, rgba(10, 10, 20, 0.82) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mgrid__cat {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

.mgrid__title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

/* Carousel Container - full width (outside Bootstrap container) */
#featuresCarousel {
    width: 100%;
    position: relative;
    padding: 0;
    min-height: 400px;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Carousel Track - Holds all cards */
.carousel-track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 10px 60px; /* Space for arrows */
    min-height: 380px;
    /* Limit width to show only 3 cards: 300px * 3 + 20px * 2 gaps = 940px */
    width: calc(300px * 3 + 20px * 2);
    max-width: calc(300px * 3 + 20px * 2);
    margin: 0 auto;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

/* Carousel Item - Each card - renamed to avoid Bootstrap conflict */
.monument-card-item {
    flex: 0 0 auto;
    flex-shrink: 0;
    scroll-snap-align: start;
    width: 300px;
    max-width: 300px;
    min-width: 300px;
    height: 350px;
    min-height: 350px;
}

/* Ensure card inside maintains fixed size */
.monument-card-item .feature-card {
    width: 300px;
    max-width: 300px;
    min-width: 300px;
}

/* Feature Card */
.feature-card {
    background: #fff;
    border-radius: 12px;
    padding: 0;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    height: 100%;
    min-height: 350px;
    width: 300px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(241, 126, 24, 0.15);
    border-color: var(--alife-primary);
}

/* Feature Card Image */
.feature-card__image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    position: relative;
}

.feature-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-card__image img {
    transform: scale(1.05);
}

/* Feature Icon */
.feature-card__icon {
    font-size: 2rem;
    color: var(--alife-primary);
    margin: 10px 0;
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-card__icon {
    transform: scale(1.1);
}

/* Feature Title */
.feature-card__title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--alife-dark);
    margin: 8px 12px 6px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

/* Feature Description */
.feature-card__description {
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.4;
    color: #666;
    margin: 0 12px 8px 12px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Feature Link */
.feature-card__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: rgb(185, 85, 0);
    text-decoration: none;
    transition: all 0.3s ease;
    align-self: center;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 15px;
}

.feature-card__link i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.feature-card__link:hover {
    background: var(--alife-primary);
    color: #fff;
    transform: translateX(5px);
}

/* Carousel Indicators */
.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 20px;
    list-style: none;
    padding: 0;
}

.carousel-indicators button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--alife-primary);
    border: none;
    opacity: 0.5;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}
.carousel-indicators button::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}

.carousel-indicators button.active {
    opacity: 1;
    width: 30px;
    border-radius: 10px;
}

/* Carousel Controls */
.carousel-control-prev,
.carousel-control-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: var(--alife-primary);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.carousel-control-prev {
    left: calc(50% - 470px - 40px); /* Center of track - half width - button width */
}

.carousel-control-next {
    right: calc(50% - 470px - 40px); /* Center of track - half width - button width */
}

.carousel-control-prev i,
.carousel-control-next i {
    font-size: 16px;
}

/* ========================================
   HUB PAGE CARDS (chiese.html, monumenti.html)
   ======================================== */

/* Section container for hub pages */
.monuments-grid-section {
    padding: 60px 0;
    background: #f8f9fa;
}

/* Hub Card - wrapper link */
.monument-card {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: transform 0.3s ease;
}

.monument-card:hover {
    transform: translateY(-5px);
}

/* Hub Card content */
.hub-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
}

.hub-card:hover {
    box-shadow: 0 10px 30px rgba(241, 126, 24, 0.15);
    border-color: var(--alife-primary);
}

/* Hub Card Image - fixed height with object-fit */
.hub-card__image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.hub-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease;
}

.hub-card:hover .hub-card__image img {
    transform: scale(1.08);
}

/* Hub Card Content */
.hub-card__content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hub-card__category {
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--alife-primary-text, #b85500);
    margin-bottom: 8px;
    font-weight: 600;
}

.hub-card__title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--alife-dark);
    margin-bottom: 8px;
    line-height: 1.3;
}

.hub-card__description {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hub-card__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--alife-primary-text, #b85500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.hub-card__link i {
    transition: transform 0.3s ease;
}

.hub-card:hover .hub-card__link {
    transform: translateX(5px);
}

.hub-card:hover .hub-card__link i {
    transform: translateX(3px);
}

/* Responsive */
@media (max-width: 1200px) {
    /* Screen fits 2 cards (300px * 2 + 20px gap = 620px) */
    .carousel-track {
        width: calc(300px * 2 + 20px * 1);
        max-width: calc(300px * 2 + 20px * 1);
    }

    .carousel-control-prev {
        left: calc(50% - 310px - 40px);
    }

    .carousel-control-next {
        right: calc(50% - 310px - 40px);
    }
}

@media (max-width: 768px) {
    /* Screen fits 1 card (300px) */
    .carousel-track {
        width: 300px;
        max-width: 300px;
        padding: 10px 50px;
    }

    .carousel-control-prev {
        left: 5px;
    }

    .carousel-control-next {
        right: 5px;
    }

    #featuresCarousel {
        padding: 0;
    }

    .feature-card__image {
        height: 150px;
    }

    .section-title {
        font-size: 2rem;
    }

    .feature-card__icon {
        font-size: 1.8rem;
        margin: 8px 0;
    }

    .feature-card__title {
        font-size: 0.95rem;
        margin: 6px 10px 4px 10px;
    }

    .feature-card__description {
        font-size: 0.8rem;
        margin: 0 10px 6px 10px;
        -webkit-line-clamp: 3;
    }

    .feature-card__link {
        font-size: 0.8rem;
        padding: 5px 12px;
        margin-bottom: 12px;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 35px;
        height: 35px;
    }

    .carousel-control-prev i,
    .carousel-control-next i {
        font-size: 14px;
    }

    .carousel-indicators {
        margin-top: 15px;
    }

    /* Hub cards responsive */
    .hub-card__image {
        height: 180px;
    }

    .hub-card__title {
        font-size: 1rem;
    }

    .hub-card__description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
}

@media (max-width: 576px) {
    .hub-card__image {
        height: 200px;
    }

    .hub-card__content {
        padding: 15px;
    }

    .hub-card__title {
        font-size: 0.95rem;
    }

    .hub-card__description {
        font-size: 0.8rem;
        -webkit-line-clamp: 3;
    }

    .hub-card__link {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .features-section {
        padding: 48px 0 60px;
    }

    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .features-pill {
        font-size: 10px;
        padding: 7px 14px;
    }
}

/* =====================================================
   SCROLL SNAP OVERRIDE — carosello CSS nativo
   3 card 300px centrate + peek 4ª, 2 card mobile
   ===================================================== */

/* Contenitore: overflow hidden, mantiene layout originale */
#featuresCarousel {
    overflow: hidden !important;
    min-height: unset !important;
}

/* Track: stessa larghezza originale + 80px peek 4ª card */
.carousel-track {
    width: calc(300px * 3 + 20px * 2 + 80px) !important;
    max-width: calc(300px * 3 + 20px * 2 + 80px) !important;
    padding: 10px 0 20px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    scroll-behavior: auto !important;
    min-height: unset !important;
    cursor: grab !important;
}

/* Card item: dimensioni originali */
.monument-card-item {
    flex: 0 0 300px !important;
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
    height: 350px !important;
    min-height: 350px !important;
    scroll-snap-align: start !important;
}

.monument-card-item .feature-card {
    width: 300px !important;
    max-width: 300px !important;
}

/* Nasconde frecce e indicatori */
.carousel-control-prev,
.carousel-control-next,
.carousel-indicators {
    display: none !important;
}

/* Mobile: 2 card + peek */
@media (max-width: 768px) {
    .carousel-track {
        width: calc(300px * 2 + 20px + 60px) !important;
        max-width: calc(300px * 2 + 20px + 60px) !important;
        padding: 10px 0 16px !important;
    }
}
