:root {
    --primary-color: #FFFFFF;
    /* Bianco per titoli e accenti */
    --secondary-color: #739079;
    /* Verde leggermente più scuro */
    --text-color: #F1F8F2;
    /* Bianco sporco/ghiaccio per testo */
    --bg-color: #849F89;
    /* Verde Salvia - Sfondo Principale */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    /* background-color: var(--bg-color); Removed for gradient */
    background: linear-gradient(180deg, var(--bg-color) 0%, rgba(255, 255, 255, 0.8) 100%);
    background-attachment: fixed;
    /* Optional: keeps gradient fixed or specific style */
    color: var(--text-color);
    line-height: 1.8;
    min-height: 100vh;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 400;
}

h1 {
    font-size: 3.5rem;
}

h2 {
    font-size: 2.5rem;
    border-bottom: 1px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 0.5rem;
}

.gatekeeper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--secondary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.8s ease;
}

.gatekeeper.hidden {
    opacity: 0;
    pointer-events: none;
}

.gatekeeper-content {
    text-align: center;
    padding: 3rem;
    background: white;
    border: 1px solid var(--primary-color);
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.input-group {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input {
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 0;
    font-size: 1rem;
    text-align: center;
    font-family: var(--font-body);
}

button {
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    /* Testo verde su sfondo bianco */
    border: none;
    cursor: pointer;
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background 0.3s;
}

button:hover {
    background-color: #8a6246;
}

.hidden {
    display: none;
}

.hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: var(--secondary-color);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-image-container {
    width: 100%;
    max-width: 800px;
    height: 50vh;
    margin-bottom: 2rem;
    overflow: hidden;
    border-radius: 200px 200px 0 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.hero-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    z-index: 10;
}

.names {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.date {
    font-size: 1.2rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.countdown {
    display: flex;
    gap: 3rem;
    justify-content: center;
    margin-top: 2rem;
}

.time-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-unit span {
    font-size: 2rem;
    font-family: var(--font-heading);
    color: #FFFFFF;
    /* Bianco puro per massimo contrasto */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    /* Ombra per stacco */
    font-weight: bold;
}

.time-unit label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #FFFFFF;
    /* Bianco puro */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    /* Ombra per stacco */

}

.section {
    padding: 6rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.section-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    margin: 1.5rem auto 2rem;
    max-width: 800px;
    font-style: italic;
}

#proposal-gallery {
    display: flex;
    overflow-x: auto;
    gap: 2rem;
    padding: 3rem 1rem;
    justify-content: flex-start;
    align-items: center;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: auto;
}

#proposal-gallery::-webkit-scrollbar {
    display: none;
}

.proposal-item {
    flex: 0 0 300px;
    background: white;
    padding: 1rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    transform: rotate(var(--rotation));
    transition: transform 0.3s ease, z-index 0.3s;
    position: relative;
    cursor: pointer;
}

.proposal-item:hover {
    transform: scale(1.1) rotate(0deg);
    z-index: 10;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}

.proposal-item img {
    width: 100%;
    height: auto;
    display: block;
    border-bottom: 1px solid #eee;
}

.proposal-caption {
    font-family: 'Indie Flower', cursive, sans-serif;
    text-align: center;
    margin-top: 0.5rem;
    color: #555;
    font-size: 1.2rem;
}

/* Backstage Layout: Video sopra, Foto sotto */
.backstage-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    width: 100%;
    min-height: auto;
    /* Rimuoviamo l'altezza minima forzata */
    padding: 2rem 1rem;
}

.video-section-header {
    width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
    /* Adatta l'altezza al contenuto */
    height: auto;
}

.backstage-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1200px;
}

.backstage-photo-item {
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-radius: 4px;
    /* Rettangolare con leggero smusso */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background: #fff;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 1;
}

/* Stato espanso (click) */
.backstage-photo-item.expanded {
    transform: scale(2.0);
    z-index: 1000 !important;
    /* Molto alto per stare sopra tutto */
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.7);
    border-radius: 8px;
}

/* --- BACKSTAGE GALLERY: Scattered Layout --- */
.backstage-scattered {
    position: relative;
    width: 100%;
    height: 600px;
    margin: 2rem 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.backstage-scattered-item {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), z-index 0s;
    cursor: pointer;
    width: 250px;
    height: 180px;
    /* Rettangolare orizzontale */
    background: white;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.backstage-scattered-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

/* Hover effect is handled by JS to maintain random rotation */

.backstage-scattered-item.expanded {
    z-index: 2000 !important;
    /* Reset rotation to 0 for clear viewing when expanded */
    transform: translate(-50%, -50%) scale(2.5) rotate(0deg) !important;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.7);
    cursor: zoom-out;
    /* Ensure aspect ratio adaptation if needed via object-fit on img */
    background: transparent;
    /* Remove white bg to just show image */
}

.backstage-scattered-item.expanded img {
    object-fit: contain;
    /* Show full image without cropping */
    background: transparent;
    /* Solo l'immagine deve vedersi */
    box-shadow: none;
    /* Rimuoviamo ombre interne se ce ne sono */
}



/* --- TRIP GALLERY: Central Messy Pile Layout --- */
.scattered-grid {
    position: relative;
    width: 100%;
    height: 800px;
    margin: 2rem 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scattered-item {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    transition: transform 0.3s ease, z-index 0s;
    cursor: pointer;
}

.trip-photo {
    background-color: #ffffff;
    padding: 12px 12px 45px 12px;
    /* Polaroid Style */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    width: 250px;
    height: auto;
    transform-style: preserve-3d;
    transition: box-shadow 0.3s ease;
}

.trip-photo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border: 1px solid #f0f0f0;
}

.scattered-item:hover {
    z-index: 100 !important;
}

.scattered-item:hover .trip-photo {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.video-wrapper-inner {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden;
    position: relative;
    background: #000;
}

/* Icona play in sovraimpressione */
.video-wrapper-inner::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 3rem;
    opacity: 0.8;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    border: 3px solid white;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 5px;
    /* Compensa visivamente il triangolo */
}

.video-container-vertical video {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    /* Mostra tutto il video senza zoom */
    display: block;
    background: #000;
}

.story-slideshow {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 300px;
    margin: 3rem auto;
    perspective: 1000px;
    overflow: visible;
}

.story-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.8s ease-in-out;
    opacity: 0;
    z-index: 0;
    transform-style: preserve-3d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.story-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-slide.active {
    opacity: 1;
    z-index: 10;
    transform: translateX(0) scale(1);
}

.story-slide.prev {
    opacity: 0.6;
    z-index: 5;
    transform: translateX(-60%) scale(0.8) rotateY(30deg);
}

.story-slide.next {
    opacity: 0.6;
    z-index: 5;
    transform: translateX(60%) scale(0.8) rotateY(-30deg);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.gallery-grid img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    transition: transform 0.5s ease;
    filter: grayscale(20%);
}

.gallery-grid img:hover {
    transform: scale(1.03);
    filter: grayscale(0%);
}

.video-container {
    max-width: 900px;
    margin: 3rem auto;
    border: 10px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.timeline {
    max-width: 700px;
    margin: 4rem auto;
    border-left: 1px solid var(--primary-color);
    padding-left: 3rem;
    text-align: left;
}

.timeline-item {
    margin-bottom: 3rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -3.35rem;
    top: 0.5rem;
    width: 0.7rem;
    height: 0.7rem;
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
}

.timeline-time {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.timeline-icon {
    font-size: 1.5rem;
    margin: 0 0.5rem;
    display: inline-block;
}

.timeline-description {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-color);
    font-style: italic;
    line-height: 1.6;
}

.iban-container {
    margin: 3rem auto;
    padding: 3rem;
    background: var(--secondary-color);
    display: inline-block;
    text-align: center;
    /* Assicura che tutto sia centrato */
}

/* Centrare il QR code */
#qrcode {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#qrcode img {
    border: 5px solid white;
    /* Bordo bianco per visibilità */
    border-radius: 5px;
}

.iban-text {
    font-family: 'Courier New', monospace;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(166, 123, 91, 0.3);
    transition: all 0.3s ease;
    background: white;
    color: #333;
    /* Testo scuro su sfondo bianco */
    padding: 10px;
    cursor: pointer;
}

.dream-item:hover {
    transform: scale(1.15) rotate(0deg) !important;
    z-index: 100 !important;
    box-shadow: 0 25px 50px rgba(166, 123, 91, 0.6);
}

.dream-item img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 10px;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 95%;
    max-height: 95%;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 50px;
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.3s;
    z-index: 2001;
}

.lightbox-close:hover {
    color: var(--primary-color);
}

/* Trip photos - postcard style */
.trip-photo {
    width: 280px !important;
    height: 200px !important;
    border-radius: 0 !important;
    padding: 0.8rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease-out;
    transform-origin: center center;
}

.trip-photo:hover {
    opacity: 0.6;
    z-index: 5;
    transform: translateX(-60%) scale(0.8) rotateY(30deg);
}

.story-slide.next {
    opacity: 0.6;
    z-index: 5;
    transform: translateX(60%) scale(0.8) rotateY(-30deg);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.gallery-grid img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    transition: transform 0.5s ease;
    filter: grayscale(20%);
}

.gallery-grid img:hover {
    transform: scale(1.03);
    filter: grayscale(0%);
}

.video-container {
    max-width: 900px;
    margin: 3rem auto;
    border: 10px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.timeline {
    max-width: 700px;
    margin: 4rem auto;
    border-left: 1px solid var(--primary-color);
    padding-left: 3rem;
    text-align: left;
}

.timeline-item {
    margin-bottom: 3rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -3.35rem;
    top: 0.5rem;
    width: 0.7rem;
    height: 0.7rem;
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
}

.timeline-time {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.timeline-icon {
    font-size: 1.5rem;
    margin: 0 0.5rem;
    display: inline-block;
}

.timeline-description {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    color: #666;
    font-style: italic;
    line-height: 1.6;
}

.iban-container {
    margin: 3rem auto;
    padding: 3rem;
    background: var(--secondary-color);
    display: inline-block;
}

.iban-text {
    font-family: 'Courier New', monospace;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(166, 123, 91, 0.3);
    transition: all 0.3s ease;
    background: white;
    padding: 10px;
    cursor: pointer;
}

.dream-item:hover {
    transform: scale(1.15) rotate(0deg) !important;
    z-index: 100 !important;
    box-shadow: 0 25px 50px rgba(166, 123, 91, 0.6);
}

.dream-item img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 10px;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 95%;
    max-height: 95%;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 50px;
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.3s;
    z-index: 2001;
}

.lightbox-close:hover {
    color: var(--primary-color);
}

/* Trip photos - postcard style */
.trip-photo {
    width: 280px !important;
    height: 200px !important;
    border-radius: 0 !important;
    padding: 0.8rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease-out;
    transform-origin: center center;
}

.trip-photo:hover {
    transform: scale(1.15) rotate(0deg) !important;
    z-index: 100 !important;
    box-shadow: 0 25px 50px rgba(166, 123, 91, 0.6);
}

.trip-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
}

/* Audio Player Styles */
.audio-player-container {
    margin: 3rem auto;
    max-width: 700px;
    padding: 0 1rem;
}

.audio-player {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #fff 100%);
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 10px 30px rgba(166, 123, 91, 0.2);
    transition: all 0.3s ease;
}

.audio-player:hover {
    box-shadow: 0 15px 40px rgba(166, 123, 91, 0.3);
    transform: translateY(-2px);
}

.play-pause-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.play-pause-btn:hover {
    background: #8a6246;
    transform: scale(1.1);
}

.play-pause-btn svg {
    width: 24px;
    height: 24px;
    color: white;
}

.play-pause-btn .pause-icon {
    display: none;
}

.play-pause-btn.playing .play-icon {
    display: none;
}

.play-pause-btn.playing .pause-icon {
    display: block;
}

.audio-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.audio-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 600;
    text-align: left;
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(166, 123, 91, 0.2);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, #8a6246 100%);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 10px;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
    font-family: 'Courier New', monospace;
}

.volume-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.volume-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.volume-btn svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.volume-btn:hover svg {
    color: white;
}

/* Responsive adjustments for audio player */
@media (max-width: 768px) {
    .audio-player {
        flex-direction: column;
        padding: 1.5rem;
        gap: 1rem;
    }

    .audio-title {
        text-align: center;
    }

    .volume-btn {
        display: none;
    }
}

/* Location Section Styles */
.location-content {
    max-width: 100%;
    margin: 0 auto;
}

.location-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

#map-container {
    width: 100%;
    height: 400px;
    border-radius: 10px;
    overflow: hidden;
    /* Cornice decorativa stile wedding */
    border: 8px solid var(--secondary-color);
    outline: 2px solid var(--primary-color);
    outline-offset: -4px;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(166, 123, 91, 0.1);
}

#map-container iframe {
    width: 100%;
    height: 100%;
}

.location-image-main {
    width: 100%;
    height: 400px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background-color: var(--secondary-color);
}

.location-image-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Mostra l'immagine intera senza zoom */
    display: block;
}

/* Responsive design for location section */
@media (max-width: 768px) {
    .location-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    #map-container,
    .location-image-main {
        height: 300px;
    }
}