/* ============================================
   CUSTOMIZATION: Colors and fonts can be
   adjusted via the custom properties below.
   ============================================ */

/* ============= CSS CUSTOM PROPERTIES ============= */
:root {
    --color-bg-primary: #faf8f5;
    --color-bg-secondary: #f0ebe4;
    --color-text-primary: #2c2420;
    --color-text-secondary: #6b5e54;
    --color-accent-gold: #b8935a;
    --color-accent-gold-light: #d4b87a;
    --color-accent-gold-dark: #96763e;
    --color-dark: #1a1a1a;
    --color-dark2: #2a2a2a;

    --font-heading: "Montserrat", sans-serif;
    --font-body: "Montserrat", sans-serif;
    --font-accent: "Montserrat", sans-serif;
}

/* ============= RESET & BASE ============= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--color-text-primary);
    background-color: var(--color-dark);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-accent-gold);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-text-primary);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============= PRELOADER ============= */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader__content {
    text-align: center;
}

.preloader__rings {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
}

.preloader__rings .ring {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 50%;
    animation: preloaderSpin 1.5s linear infinite;
}

.preloader__rings .ring:nth-child(1) {
    width: 100px;
    height: 100px;
    top: 0;
    left: 0;
    border-top-color: var(--color-accent-gold);
    animation-duration: 1.5s;
}

.preloader__rings .ring:nth-child(2) {
    width: 70px;
    height: 70px;
    top: 15px;
    left: 15px;
    border-right-color: var(--color-accent-gold-light);
    animation-duration: 1.2s;
    animation-direction: reverse;
}

.preloader__rings .ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 30px;
    left: 30px;
    border-bottom-color: var(--color-accent-gold);
    animation-duration: 0.9s;
}

@keyframes preloaderSpin {
    to { transform: rotate(360deg); }
}

.preloader__text {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-accent-gold);
    font-size: 24px;
    opacity: 0;
    animation: fadeInUp 1s ease 0.5s forwards;
}

/* ============= ENVELOPE ============= */
.envelope-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    transition: opacity 1s ease, visibility 1s ease;
}

.envelope-wrapper.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.envelope-scene {
    perspective: 1000px;
    position: relative;
}

.envelope {
    width: 420px;
    height: 290px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
}

.envelope__body {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #f5e6c8, #e8d5a3, #f5e6c8);
    border-radius: 4px;
    position: relative;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.envelope__body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5L55 30 30 55 5 30z' stroke='%23b8935a' stroke-width='0.3' fill='none' opacity='0.15'/%3E%3C/svg%3E");
    opacity: 0.5;
}

.envelope__flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(145deg, #f5e6c8, #e8d5a3);
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    transform-origin: top center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.envelope__flap::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(184, 147, 90, 0.2), transparent);
}

.envelope.opened .envelope__flap {
    transform: rotateX(-180deg);
}

.envelope__seal {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    z-index: 3;
    background: radial-gradient(circle, var(--color-accent-gold), var(--color-accent-gold-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.3), inset 0 1px 3px rgba(255, 255, 255, 0.3);
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.envelope.opened .envelope__seal {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.envelope__seal svg {
    width: 34px;
    height: 34px;
    fill: var(--color-bg-primary);
}

.envelope__card {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 370px;
    height: 240px;
    background: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
    z-index: 1;
}

.envelope.opened .envelope__card {
    transform: translateX(-50%) translateY(-320px);
}

/* Hide card text until envelope is opened */
.envelope__card-names,
.envelope__card-date {
    opacity: 0;
    transition: opacity 0.6s ease 0.8s;
}

.envelope.opened .envelope__card-names,
.envelope.opened .envelope__card-date {
    opacity: 1;
}

.envelope__card-names {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 30px;
    color: var(--color-accent-gold-dark);
    text-align: center;
    line-height: 1.3;
}

.envelope__card-date {
    font-family: var(--font-accent);
    font-size: 15px;
    letter-spacing: 3px;
    color: var(--color-text-secondary);
    margin-top: 12px;
}

.envelope__instruction {
    text-align: center;
    margin-top: 30px;
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--color-accent-gold-light);
    font-size: 13px;
    letter-spacing: 2px;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ============= CONFETTI ============= */
.confetti-piece {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    z-index: 9999;
    pointer-events: none;
    animation: confettiFall 3s ease forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ============= PARTICLES ============= */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-accent-gold);
    border-radius: 50%;
    opacity: 0;
    animation: floatParticle 6s ease-in-out infinite;
}

@keyframes floatParticle {
    0% { opacity: 0; transform: translateY(100vh) scale(0); }
    20% { opacity: 0.6; }
    80% { opacity: 0.2; }
    100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* ============= MAIN CONTENT ============= */
.main-content {
    opacity: 0;
    transition: opacity 1s ease;
    position: relative;
    z-index: 2;
    background: var(--color-bg-primary);
}

.main-content.visible {
    opacity: 1;
}

/* ============= SECTIONS ============= */
.section {
    padding: 100px 0;
}

/* ============= HERO ============= */
.section--hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--color-dark);
    padding: 0;
}

.hero__bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hero__bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.55));
    z-index: 1;
}

.hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px 20px;
    margin-top: -280px;
}

.hero__name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(38px, 8vw, 60px);
    color: #fff;
    line-height: 1.2;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.hero__ampersand {
    display: block;
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(32px, 6vw, 50px);
    color: var(--color-accent-gold);
    margin: 12px 0;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

.hero__divider {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-accent-gold), transparent);
    margin: 24px auto;
}

.hero__date {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 20px;
    letter-spacing: 5px;
    color: var(--color-accent-gold-light);
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.scroll-indicator span {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--color-accent-gold-light);
}

.scroll-arrow {
    width: 18px;
    height: 18px;
    border-right: 1.5px solid var(--color-accent-gold);
    border-bottom: 1.5px solid var(--color-accent-gold);
    transform: rotate(45deg);
    animation: scrollBounce 2s ease infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(8px); }
}

/* ============= GREETING ============= */
.section--greeting {
    background: var(--color-bg-secondary);
}

.greeting-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 24px;
    line-height: 2;
    text-align: center;
    color: var(--color-text-primary);
    max-width: 560px;
    margin: 0 auto;
}

.ornament {
    text-align: center;
    color: var(--color-accent-gold);
    margin-bottom: 40px;
}

.ornament--bottom {
    margin-bottom: 0;
    margin-top: 40px;
}

/* ============= SECTION TITLE ============= */
.section-title {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 32px;
    text-align: center;
    color: var(--color-text-primary);
    margin-bottom: 48px;
}

/* ============= CALENDAR ============= */
.section--calendar {
    background: var(--color-bg-primary);
}

.calendar {
    max-width: 420px;
    margin: 0 auto;
}

.calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.calendar__header {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 13px;
    color: var(--color-text-secondary);
    padding: 8px 0;
}

.calendar__day {
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: 18px;
    color: var(--color-text-primary);
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
}

.calendar__day--empty {
    visibility: hidden;
}

.calendar__day--highlight {
    background: var(--color-accent-gold);
    color: #fff;
    border-radius: 50%;
    font-weight: 600;
    animation: pulse-gold 2s ease-in-out infinite;
}

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 0 0 rgba(184, 147, 90, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(184, 147, 90, 0); }
}

/* ============= COUNTDOWN ============= */
.countdown {
    max-width: 420px;
    margin: 40px auto 0;
    display: flex;
    justify-content: center;
    gap: 24px;
}

.countdown__block {
    text-align: center;
}

.countdown__number {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 42px;
    color: var(--color-accent-gold);
    line-height: 1;
}

.countdown__label {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 12px;
    color: var(--color-text-secondary);
    letter-spacing: 1px;
    margin-top: 6px;
}

.countdown__separator {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 42px;
    color: var(--color-accent-gold);
    opacity: 0.4;
    line-height: 1;
}

@media (max-width: 480px) {
    .countdown {
        gap: 16px;
    }

    .countdown__number {
        font-size: 32px;
    }

    .countdown__separator {
        font-size: 32px;
    }

    .countdown__label {
        font-size: 10px;
    }
}

/* ============= TIMELINE ============= */
.section--timeline {
    background: var(--color-bg-secondary);
}

.timeline {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-accent-gold);
}

.timeline__item {
    position: relative;
    margin-bottom: 60px;
}

.timeline__item:last-child {
    margin-bottom: 0;
}

.timeline__dot {
    position: absolute;
    left: -33px;
    top: 8px;
    width: 12px;
    height: 12px;
    background: var(--color-accent-gold);
    border-radius: 50%;
    border: 2px solid var(--color-bg-secondary);
}

.timeline__time {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 42px;
    color: var(--color-accent-gold);
    line-height: 1;
    margin-bottom: 12px;
}

.timeline__content {
    padding-top: 4px;
}

.timeline__photo-wrapper {
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.timeline__photo {
    width: 100%;
    display: block;
}

.timeline__title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 22px;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.timeline__venue {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 16px;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}

.timeline__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 14px;
    color: var(--color-accent-gold);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.timeline__link:hover {
    border-bottom-color: var(--color-accent-gold);
    color: var(--color-accent-gold);
}

.timeline__links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.icon--map {
    flex-shrink: 0;
}

/* ============= COUPLE PHOTOS ============= */
.section--photos {
    background: var(--color-bg-primary);
    padding: 80px 0 120px;
}

.photos-gallery {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: center;
}

.photo-frame {
    flex: 0 1 380px;
    background: #fff;
    padding: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.5s ease;
}

.photo-frame img {
    width: 100%;
    display: block;
}

.photo-frame--left {
    transform: rotate(-3deg);
}

.photo-frame--right {
    transform: rotate(3deg);
}

.photo-frame:hover {
    transform: rotate(0deg) scale(1.03);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* ============= FOOTER ============= */
.footer {
    background: var(--color-bg-secondary);
    padding: 60px 24px;
    text-align: center;
}

.footer__text {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 20px;
    color: var(--color-text-secondary);
}

/* ============= MUSIC TOGGLE ============= */
.music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 900;
    width: 45px;
    height: 45px;
    background: rgba(26, 26, 26, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(184, 147, 90, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.music-toggle--visible {
    opacity: 1;
    pointer-events: auto;
}

.music-toggle:hover {
    background: rgba(184, 147, 90, 0.2);
    border-color: var(--color-accent-gold);
}

.music-bars {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 16px;
}

.music-bar {
    width: 3px;
    background: var(--color-accent-gold);
    border-radius: 2px;
    animation: musicBar 0.8s ease infinite alternate;
}

.music-bar:nth-child(1) { height: 6px; animation-delay: 0s; }
.music-bar:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.music-bar:nth-child(3) { height: 8px; animation-delay: 0.3s; }
.music-bar:nth-child(4) { height: 14px; animation-delay: 0.1s; }

@keyframes musicBar {
    to { height: 4px; }
}

.music-toggle.paused .music-bar {
    animation-play-state: paused;
    height: 3px;
}

/* ============= SCROLL REVEAL ANIMATIONS ============= */
.reveal {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                filter 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

/* ============= GENERAL ANIMATIONS ============= */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============= RESPONSIVE: TABLET ============= */
@media (max-width: 768px) {
    .section {
        padding: 72px 0;
    }

    .hero__name {
        font-size: clamp(32px, 7vw, 48px);
    }

    .greeting-text {
        font-size: 24px;
    }

    .section-title {
        font-size: 28px;
    }

    .timeline__time {
        font-size: 34px;
    }

    .photos-gallery {
        gap: 24px;
    }

    .photo-frame {
        flex: 0 1 300px;
    }

    .envelope {
        width: 360px;
        height: 250px;
    }

    .envelope__card {
        width: 320px;
        height: 200px;
    }

    .envelope.opened .envelope__card {
        transform: translateX(-50%) translateY(-280px);
    }

    .envelope__card-names {
        font-size: 26px;
    }
}

/* ============= RESPONSIVE: MOBILE ============= */
@media (max-width: 480px) {
    .section {
        padding: 56px 0;
    }

    .hero__name {
        color: var(--color-accent-gold-light);
        font-size: 32px;
    }

    .hero__ampersand {
        font-size: 28px;
        margin: 8px 0;
    }

    .hero__date {
        font-size: 16px;
        letter-spacing: 3px;
    }

    .greeting-text {
        font-size: 21px;
        line-height: 1.9;
    }

    .section-title {
        font-size: 24px;
        margin-bottom: 32px;
    }

    .calendar__day {
        font-size: 15px;
        padding: 8px 0;
    }

    .calendar__header {
        font-size: 11px;
    }

    .timeline {
        padding-left: 30px;
    }

    .timeline::before {
        left: 10px;
    }

    .timeline__dot {
        left: -26px;
    }

    .timeline__time {
        font-size: 28px;
    }

    .timeline__title {
        font-size: 18px;
    }

    .timeline__venue {
        font-size: 14px;
    }

    .photos-gallery {
        flex-direction: column;
        gap: 30px;
        align-items: center;
    }

    .photo-frame {
        flex: none;
        width: 85%;
        max-width: 340px;
    }

    .photo-frame--left {
        transform: rotate(-2deg);
    }

    .photo-frame--right {
        transform: rotate(2deg);
    }

    .footer__text {
        font-size: 20px;
    }

    .music-toggle {
        width: 40px;
        height: 40px;
        top: 14px;
        right: 14px;
    }

    .envelope {
        width: 300px;
        height: 210px;
    }

    .envelope__card {
        width: 260px;
        height: 170px;
    }

    .envelope.opened .envelope__card {
        transform: translateX(-50%) translateY(-240px);
    }

    .envelope__card-names {
        font-size: 22px;
    }

    .envelope__seal {
        width: 55px;
        height: 55px;
    }

    .envelope__seal svg {
        width: 26px;
        height: 26px;
    }
}

/* ============= REDUCED MOTION ============= */
@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        filter: none;
        transform: none;
        transition: none;
    }

    .preloader__rings .ring {
        animation: none;
    }

    .preloader__text {
        animation: none;
        opacity: 1;
    }

    .envelope__flap,
    .envelope__seal,
    .envelope__card {
        transition: none;
    }

    .confetti-piece {
        animation: none;
        display: none;
    }

    .particle {
        animation: none;
        display: none;
    }

    .calendar__day--highlight {
        animation: none;
    }

    .music-bar {
        animation: none;
    }

    .scroll-arrow {
        animation: none;
    }

    .envelope__instruction {
        animation: none;
        opacity: 0.7;
    }

    .photo-frame {
        transition: none;
    }

    .photo-frame--left,
    .photo-frame--right {
        transform: none;
    }
}
