<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
    <meta name="theme-color" content="#FDFDFD">
    <title>دعوة زفاف - حمدي وهديل</title>
    
    <!-- الخطوط العربية الفاخرة -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Aref+Ruqaa:wght@400;700&family=Tajawal:wght@200;300;400;700&display=swap" rel="stylesheet">

    <style>
        :root {
            --text-primary: #2C3330;
            --text-secondary: #5F6B62;
            --accent-gold: #9C8856;
            --rose-gold: #B09175;
            --bg-overlay: rgba(253, 252, 250, 0.6);
        }

        *, *::before, *::after {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        html, body {
            height: 100%;
            overflow: hidden;
        }

        body {
            font-family: 'Tajawal', sans-serif;
            background-color: #FDFDFD;
            color: var(--text-primary);
        }

        /* زر الموسيقى (مثبت وفوق كل شيء) */
        .music-toggle {
            position: fixed;
            top: 35px;
            left: 25px;
            width: 40px;
            height: 40px;
            background-color: rgba(255, 255, 255, 0.8);
            border: 1px solid var(--accent-gold);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 2147483647; /* أعلى قيمة ممكنة لضمان عدم اختفائه */
            font-size: 18px;
            line-height: 1;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
        }

        .music-toggle:hover {
            transform: scale(1.05);
        }

        /* ========================================================
           المشهد الأول
           ======================================================== */
        .scene-container {
            width: 100%;
            height: 100vh;
            height: 100dvh;
            position: fixed;
            top: 0;
            left: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            padding: 12vh 20px;
            opacity: 0;
            z-index: 100;
            animation: fadeInScreen 2s ease forwards;
            transition: opacity 1s ease, transform 1.2s ease, filter 1s ease;
        }

        .scene-container.hidden {
            opacity: 0;
            transform: scale(1.15);
            filter: blur(20px);
            pointer-events: none;
        }

        .bg-layer {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background-image: url('https://z-cdn-media.chatglm.cn/files/8fc53ef9-ae34-49fe-ad5b-c212a1363404.png?auth_key=1886889132-f244b46f363d45d4a86ff2bbda5338b8-0-74c3a5fd2c4d73fd3eb797bd0e43e29b');
            background-size: cover;
            background-position: center;
            z-index: -2;
            transform: scale(1.05);
            animation: kenBurns 30s ease-in-out infinite alternate;
        }

        .overlay-gradient {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.3) 40%, rgba(255,255,255,0.85) 100%);
            z-index: -1;
        }

        .bismillah {
            font-family: 'Amiri', serif;
            font-size: clamp(1.2rem, 5vw, 1.5rem);
            color: var(--accent-gold);
            text-shadow: 0 2px 10px rgba(255,255,255,0.6);
            opacity: 0;
            transform: translateY(-30px);
            animation: dropDown 1.8s 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

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

        .names-container {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 25px;
            margin-bottom: 20px;
        }

        .name {
            font-family: 'Aref Ruqaa', serif;
            font-size: clamp(3.5rem, 18vw, 6rem);
            line-height: 1;
            color: var(--text-primary);
            text-shadow: 0 4px 20px rgba(255, 255, 255, 0.7);
            opacity: 0;
            transform: scale(0.8);
        }

        .name.groom { animation: scaleIn 1.8s 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
        .name.bride { animation: scaleIn 1.8s 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

        .heart-icon {
            font-size: clamp(1.5rem, 6vw, 1.8rem);
            color: var(--rose-gold);
            opacity: 0;
            transform: scale(0);
            animation: popIn 1s 1.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
            filter: drop-shadow(0 2px 5px rgba(255,255,255,0.5));
        }

        .subtitle {
            font-family: 'Tajawal', sans-serif;
            font-weight: 300;
            font-size: clamp(1rem, 4vw, 1.1rem);
            letter-spacing: 1px;
            color: var(--text-secondary);
            opacity: 0;
            transform: translateY(30px);
            animation: fadeUp 1.5s 2.2s ease forwards;
            text-shadow: 0 2px 10px rgba(255,255,255,0.6);
            background: rgba(255,255,255,0.4);
            padding: 5px 15px;
            border-radius: 20px;
            backdrop-filter: blur(3px);
        }

        .enter-btn {
            background: none;
            border: none;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 15px;
            cursor: pointer;
            opacity: 0;
            transform: translateY(30px);
            animation: fadeUp 1.5s 2.8s ease forwards;
            transition: transform 0.3s ease;
        }

        .enter-btn:active { transform: scale(0.95); }

        .wax-seal {
            width: 90px;
            height: 90px;
            background-image: url('https://z-cdn-media.chatglm.cn/files/bec6fc04-c9f3-449d-a927-747f24da65fe.png?auth_key=1886889132-8e617fa3bece455ca62198fd51c9c0d5-0-92673193b97f04fcf5fc70847e3a081e');
            background-size: cover;
            background-position: center;
            border-radius: 50%;
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
            position: relative;
        }

        .enter-btn:hover .wax-seal {
            transform: scale(1.08) rotate(-5deg);
            box-shadow: 0 15px 35px rgba(0,0,0,0.15);
        }

        .wax-seal::after {
            content: '';
            position: absolute;
            top: -5px; left: -5px; right: -5px; bottom: -5px;
            border-radius: 50%;
            border: 1px solid var(--accent-gold);
            opacity: 0;
            animation: pulse 2.5s 3.5s infinite;
        }

        .enter-text {
            font-family: 'Tajawal', sans-serif;
            font-weight: 400;
            font-size: 1rem;
            color: var(--text-primary);
            letter-spacing: 2px;
            position: relative;
            padding-bottom: 5px;
        }

        .enter-text::after {
            content: '';
            position: absolute;
            bottom: 0; right: 0;
            width: 0; height: 1px;
            background: var(--accent-gold);
            transition: width 0.4s ease;
        }

        .enter-btn:hover .enter-text::after { width: 100%; }

        /* ========================================================
           حاوية التمرير السلس (Scroll Wrapper)
           ======================================================== */
        .scroll-wrapper {
            position: fixed;
            top: 0; left: 0;
            width: 100%;
            height: 100vh;
            height: 100dvh;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            scroll-snap-type: y mandatory;
            scroll-behavior: smooth;
            z-index: 10;
            opacity: 0;
            pointer-events: none;
            transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1);
            background-color: #F9F8F6;
        }

        .scroll-wrapper.active {
            opacity: 1;
            pointer-events: auto;
        }

        .scroll-section {
            position: relative;
            height: 100vh;
            height: 100dvh;
            width: 100%;
            scroll-snap-align: start;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            overflow: hidden;
            padding: 20px;
        }

        /* ========================================================
           المشهد الثاني
           ======================================================== */
        #scene2 {
            background-image: url('https://z-cdn-media.chatglm.cn/files/e81981a5-3259-4f14-9853-75cde93dbe12.jpg?auth_key=1886896555-b77471a13e264e22909757ccd719f036-0-b0a49a80c9ce6a63bc724fae0c6c28ac');
            background-size: cover;
            background-position: center;
        }

        .scene2-names-wrapper {
            position: absolute;
            top: 62%; 
            left: 50%;
            transform: translate(-50%, -50%);
            width: 65%; 
            display: flex;
            justify-content: space-between; 
            align-items: center;
            direction: ltr; 
            opacity: 0;
            transition: opacity 1s ease 1s;
        }

        .scroll-wrapper.active .scene2-names-wrapper {
            opacity: 1;
        }

        .scene2-name {
            font-family: 'Aref Ruqaa', serif;
            font-size: clamp(2rem, 8vw, 3.5rem);
            line-height: 1;
            color: #2C3330; 
            text-shadow: 0 1px 2px rgba(255,255,255,0.9);
        }

        .scene2-name.groom { transform: translateX(30px); }
        .scene2-name.bride { transform: translateX(-30px); }

        .scroll-indicator {
            position: absolute;
            bottom: 5vh;
            left: 50%;
            transform: translateX(-50%);
            text-align: center;
            color: var(--accent-gold);
            font-size: clamp(0.8rem, 3vw, 0.9rem);
            letter-spacing: 1px;
            opacity: 0;
        }

        .scroll-wrapper.active .scroll-indicator {
            opacity: 0.8;
            animation: fadeUp 1.5s 2.5s ease forwards, gentleBounce 2s 4s ease-in-out infinite;
        }

        .scroll-indicator svg {
            width: 20px;
            height: 20px;
            margin-top: 5px;
            display: block;
            margin-left: auto;
            margin-right: auto;
        }

        /* ========================================================
           المشهد الثالث — التقويم والعد التنازلي
           ======================================================== */
        #scene3 {
            background-image: url('https://z-cdn-media.chatglm.cn/files/b8a71e8e-c2b8-4a1e-bdf5-b59b671f8610.png?auth_key=1886902450-4a47da0e15d24ac0a5d9f69d33c0b7d1-0-1cafce28720e4e0d303defc028c42f44');
            background-size: cover;
            background-position: center;
            justify-content: center;
        }

        .calendar-title {
            font-family: 'Amiri', serif;
            font-size: clamp(1.5rem, 6vw, 2rem);
            color: var(--accent-gold);
            margin-bottom: 20px;
            letter-spacing: 2px;
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 1s ease, transform 1s ease;
        }

        .calendar-card {
            background: rgba(255, 255, 255, 0.4);
            backdrop-filter: blur(4px);
            padding: 30px 50px;
            width: 85%;
            max-width: 400px;
            border-radius: 150px 150px 15px 15px;
            border: 1px solid rgba(156, 136, 86, 0.3);
            box-shadow: 0 15px 40px rgba(0,0,0,0.05);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            opacity: 0;
            transform: scale(0.9) translateY(20px);
            transition: opacity 1s ease, transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        #scene3.in-view .calendar-title {
            opacity: 1;
            transform: translateY(0);
            transition-delay: 0.3s;
        }

        #scene3.in-view .calendar-card {
            opacity: 1;
            transform: scale(1) translateY(0);
            transition-delay: 0.6s;
        }

        .cal-month {
            font-family: 'Tajawal', sans-serif;
            font-weight: 400;
            font-size: clamp(1.5rem, 6vw, 1.8rem);
            color: var(--accent-gold);
            text-transform: uppercase;
            letter-spacing: 4px;
            margin-bottom: 10px;
        }

        .cal-day {
            font-family: 'Aref Ruqaa', serif;
            font-size: clamp(4rem, 18vw, 6rem);
            line-height: 1;
            color: var(--text-primary);
            margin: 0;
            text-shadow: 2px 2px 0px rgba(156, 136, 86, 0.1);
        }

        .calendar-divider {
            width: 80px;
            height: 1px;
            background: var(--accent-gold);
            margin: 15px 0;
            opacity: 0.6;
        }

        .calendar-verse {
            font-family: 'Amiri', serif;
            font-size: clamp(0.9rem, 3.5vw, 1.1rem);
            color: var(--text-secondary);
            text-align: center;
            max-width: 90%;
            margin-top: 20px;
            line-height: 1.8;
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 1s ease, transform 1s ease;
        }

        #scene3.in-view .calendar-verse {
            opacity: 1;
            transform: translateY(0);
            transition-delay: 0.9s;
        }

        /* مؤقت العد التنازلي */
        .countdown-wrapper {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 20px;
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 1s ease, transform 1s ease;
        }

        #scene3.in-view .countdown-wrapper {
            opacity: 1;
            transform: translateY(0);
            transition-delay: 1.2s;
        }

        .time-block {
            display: flex;
            flex-direction: column;
            align-items: center;
            background: rgba(255, 255, 255, 0.5);
            backdrop-filter: blur(4px);
            border: 1px solid rgba(156, 136, 86, 0.2);
            border-radius: 10px;
            padding: 8px 5px;
            width: 65px;
        }

        .time-value {
            font-family: 'Aref Ruqaa', serif;
            font-size: clamp(1.5rem, 6vw, 2rem);
            color: var(--text-primary);
            line-height: 1;
        }

        .time-label {
            font-family: 'Tajawal', sans-serif;
            font-size: clamp(0.7rem, 3vw, 0.8rem);
            color: var(--accent-gold);
            margin-top: 5px;
        }

        /* ========================================================
           المشهد الرابع — بطاقات أنيقة منفصلة (مع تأثير Zoom)
           ======================================================== */
        #scene4 {
            background-image: url('https://z-cdn-media.chatglm.cn/files/b8a71e8e-c2b8-4a1e-bdf5-b59b671f8610.png?auth_key=1886902450-4a47da0e15d24ac0a5d9f69d33c0b7d1-0-1cafce28720e4e0d303defc028c42f44');
            background-size: cover;
            background-position: center;
        }

        .program-container {
            width: 90%;
            max-width: 400px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .program-title {
            font-family: 'Amiri', serif;
            font-size: clamp(1.8rem, 7vw, 2.2rem);
            color: var(--accent-gold);
            text-align: center;
            margin-bottom: 25px;
            letter-spacing: 2px;
            opacity: 0;
            transform: scale(0.8); 
            transition: opacity 1s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .event-card {
            background: rgba(255, 255, 255, 0.6);
            backdrop-filter: blur(6px);
            width: 100%;
            padding: 25px 20px;
            border-radius: 15px;
            border: 1px solid rgba(156, 136, 86, 0.25);
            box-shadow: 0 10px 30px rgba(0,0,0,0.05);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            opacity: 0;
            transform: scale(0.8); 
            transition: opacity 1s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
        }

        /* تم الإصلاح هنا: استخدام nth-child للتمييز بين البطاقات والنقاط (Dots) */
        #scene4.in-view .program-title {
            opacity: 1;
            transform: scale(1);
            transition-delay: 0.2s;
        }

        #scene4.in-view .event-card:nth-child(2) {
            opacity: 1;
            transform: scale(1);
            transition-delay: 0.4s;
        }
        
        #scene4.in-view .event-card:nth-child(4) {
            opacity: 1;
            transform: scale(1);
            transition-delay: 0.7s;
        }
        
        #scene4.in-view .event-card:nth-child(6) {
            opacity: 1;
            transform: scale(1);
            transition-delay: 1s;
        }

        .program-dot {
            width: 6px;
            height: 6px;
            background-color: var(--accent-gold);
            border-radius: 50%;
            margin: 15px 0;
            opacity: 0.5;
        }

        .event-day {
            font-family: 'Aref Ruqaa', serif;
            font-weight: 700;
            font-size: clamp(1.4rem, 5.5vw, 1.6rem);
            color: var(--accent-gold);
            letter-spacing: 1px;
        }

        .event-date {
            font-family: 'Tajawal', sans-serif;
            font-weight: 300;
            font-size: clamp(1.1rem, 4.5vw, 1.3rem);
            color: var(--text-secondary);
            line-height: 1.2;
        }

        .event-venue {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-family: 'Tajawal', sans-serif;
            font-weight: 400;
            font-size: clamp(1rem, 4vw, 1.1rem);
            color: var(--text-primary);
            background: rgba(156, 136, 86, 0.1);
            border: 1px solid rgba(156, 136, 86, 0.3);
            padding: 8px 18px;
            border-radius: 25px;
            text-decoration: none;
            transition: background 0.3s ease, transform 0.3s ease;
            margin-top: 5px;
            word-break: break-word;
        }

        .event-venue svg {
            width: 14px;
            height: 14px;
            fill: var(--accent-gold);
            flex-shrink: 0;
        }

        a.event-venue:hover {
            background: rgba(156, 136, 86, 0.2);
            transform: scale(1.02);
        }

        /* ========================================================
           المشهد الخامس — صورة العروسين وكلمة شكر
           ======================================================== */
        #scene5 {
            background-image: url('https://z-cdn-media.chatglm.cn/files/b8a71e8e-c2b8-4a1e-bdf5-b59b671f8610.png?auth_key=1886902450-4a47da0e15d24ac0a5d9f69d33c0b7d1-0-1cafce28720e4e0d303defc028c42f44');
            background-size: cover;
            background-position: center;
            justify-content: center;
        }

        .final-message-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 25px;
            width: 90%;
            max-width: 400px;
        }

        .photo-frame {
            width: 100%;
            padding: 10px;
            background: rgba(255, 255, 255, 0.6);
            backdrop-filter: blur(4px);
            border: 1px solid rgba(156, 136, 86, 0.3);
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            border-radius: 15px;
            opacity: 0;
            transform: scale(0.9);
            transition: opacity 1s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
        }

        #scene5.in-view .photo-frame {
            opacity: 1;
            transform: scale(1);
            transition-delay: 0.3s;
        }

        .wedding-photo {
            width: 100%;
            height: auto;
            display: block;
            border-radius: 8px;
        }

        .final-text {
            font-family: 'Amiri', serif;
            font-size: clamp(1.2rem, 5vw, 1.4rem);
            line-height: 1.8;
            color: var(--text-primary);
            text-align: center;
            margin-top: 10px;
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 1s ease, transform 1s ease;
        }

        #scene5.in-view .final-text {
            opacity: 1;
            transform: translateY(0);
            transition-delay: 0.6s;
        }

        .footer-names {
            font-family: 'Aref Ruqaa', serif;
            font-size: clamp(2rem, 8vw, 2.5rem);
            color: var(--accent-gold);
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 1s ease, transform 1s ease;
        }

        #scene5.in-view .footer-names {
            opacity: 1;
            transform: translateY(0);
            transition-delay: 0.9s;
        }

        /* الحركات */
        @keyframes kenBurns { 0% { transform: scale(1.05) translateY(0); } 100% { transform: scale(1.1) translateY(-15px); } }
        @keyframes fadeInScreen { to { opacity: 1; } }
        @keyframes dropDown { to { opacity: 1; transform: translateY(0); } }
        @keyframes scaleIn { to { opacity: 1; transform: scale(1); } }
        @keyframes popIn { to { opacity: 1; transform: scale(1); } }
        @keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
        @keyframes pulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.3); opacity: 0; } }
        @keyframes gentleBounce { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(10px); } }

        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
                scroll-behavior: auto !important;
            }
            .bg-layer { animation: none; transform: scale(1); }
            .bismillah, .name, .heart-icon, .subtitle, .enter-btn { opacity: 1; transform: none; }
            .scene2-names-wrapper { opacity: 1; transform: translate(-50%, -50%); }
            .scroll-wrapper.active { opacity: 1; }
            .scene-container.hidden { filter: none; }
            #scene3.in-view .calendar-title, #scene3.in-view .calendar-card, #scene3.in-view .calendar-verse, #scene3.in-view .countdown-wrapper,
            #scene4.in-view .program-title, #scene4.in-view .event-card,
            #scene5.in-view .photo-frame, #scene5.in-view .final-text, #scene5.in-view .footer-names { opacity: 1; transform: none; }
        }
    </style>
</head>
<body>

    <div id="youtube-player" style="position: absolute; width: 1px; height: 1px; left: -9999px; top: -9999px;"></div>

    <!-- زر الموسيقى مع الإيموجي -->
    <button class="music-toggle" id="musicToggle" aria-label="تشغيل أو إيقاف الموسيقى">
        <span id="musicIcon">🎵</span>
    </button>

    <!-- ================================================
         المشهد الأول
         ================================================ -->
    <div class="scene-container" id="scene1">
        <div class="bg-layer"></div>
        <div class="overlay-gradient"></div>

        <div class="bismillah">بسم الله الرحمن الرحيم</div>

        <div class="names-wrapper">
            <div class="names-container">
                <span class="name groom">حمدي</span>
                <span class="heart-icon">❤</span>
                <span class="name bride">هديل</span>
            </div>
            <div class="subtitle">هنا تبدأ حكايتنا</div>
        </div>

        <button class="enter-btn" id="openInvitation">
            <div class="wax-seal"></div>
            <span class="enter-text">اكتشفوا دعوتنا</span>
        </button>
    </div>

    <!-- ================================================
         الحاوية القابلة للتمرير السلس (تحتوي المشاهد 2, 3, 4, و 5)
         ================================================ -->
    <div class="scroll-wrapper" id="scrollWrapper">
        
        <!-- المشهد الثاني -->
        <section class="scroll-section" id="scene2">
            <div class="scene2-names-wrapper">
                <span class="scene2-name groom">حمدي</span>
                <span class="scene2-name bride">هديل</span>
            </div>

            <div class="scroll-indicator">
                <span>اكتشفوا التاريخ</span>
                <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <line x1="12" y1="5" x2="12" y2="19"></line>
                    <polyline points="19 12 12 19 5 12"></polyline>
                </svg>
            </div>
        </section>

        <!-- المشهد الثالث — تقويم الزفاف مع مؤقت العد التنازلي -->
        <section class="scroll-section" id="scene3">
            <h2 class="calendar-title">احفظوا التاريخ</h2>
            
            <div class="calendar-card">
                <span class="cal-month">أكتوبر</span>
                <div class="calendar-divider"></div>
                <span class="cal-day">1</span>
            </div>

            <p class="calendar-verse">وَمِنْ آيَاتِهِ أَنْ خَلَقَ لَكُم مِّنْ أَنفُسِكُمْ أَزْوَاجًا لِّتَسْكُنُوا إِلَيْهَا وَجَعَلَ بَيْنَكُم مَّوَدَّةً وَرَحْمَةً</p>
            
            <!-- مؤقت العد التنازلي -->
            <div class="countdown-wrapper" id="countdown">
                <div class="time-block">
                    <span class="time-value" id="days">00</span>
                    <span class="time-label">يوم</span>
                </div>
                <div class="time-block">
                    <span class="time-value" id="hours">00</span>
                    <span class="time-label">ساعة</span>
                </div>
                <div class="time-block">
                    <span class="time-value" id="minutes">00</span>
                    <span class="time-label">دقيقة</span>
                </div>
                <div class="time-block">
                    <span class="time-value" id="seconds">00</span>
                    <span class="time-label">ثانية</span>
                </div>
            </div>
        </section>

        <!-- المشهد الرابع — برنامج أيام الزفاف (بطاقات أنيقة منفصلة) -->
        <section class="scroll-section" id="scene4">
            <div class="program-container">
                <h2 class="program-title">برنامج أيام الفرح</h2>
                
                <div class="event-card">
                    <span class="event-day">حنة العروسة</span>
                    <span class="event-date">29 Septembre</span>
                    <a href="https://maps.google.com/?q=Le+Serail+salle+des+fetes+Akouda+VHMG%2B97X" target="_blank" class="event-venue">
                        <svg viewBox="0 0 24 24"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></svg>
                        Le Serail - Akouda
                    </a>
                </div>

                <div class="program-dot"></div>

                <div class="event-card">
                    <span class="event-day">السلامية</span>
                    <span class="event-date">30 Septembre</span>
                    <a href="https://maps.google.com/?q=Rue+de+la+poste+kalaa+kabira+sousse" target="_blank" class="event-venue">
                        <svg viewBox="0 0 24 24"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></svg>
                        Rue de la poste kalaa kabira
                    </a>
                </div>

                <div class="program-dot"></div>

                <div class="event-card">
                    <span class="event-day">الزفاف</span>
                    <span class="event-date">1 Octobre</span>
                    <a href="https://maps.google.com/?q=Salle+Des+Fetes+Le+Palace+Hammam+Sousse+VHQF%2B8F3" target="_blank" class="event-venue">
                        <svg viewBox="0 0 24 24"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></svg>
                        Le Palace - Hammam Sousse
                    </a>
                </div>
            </div>
        </section>

        <!-- المشهد الخامس — كلمة شكر وصورة العروسين -->
        <section class="scroll-section" id="scene5">
            <div class="final-message-container">
                <div class="photo-frame">
                    <img src="https://z-cdn-media.chatglm.cn/files/43a240ae-5006-4398-ad35-3aa74ded97ae.png?auth_key=1886903726-11b2eef3b9344c7da2cd8e071806c061-0-5de231715bc8a32941f1ac46e6ae8d69" alt="حمدي وهديل" class="wedding-photo">
                </div>
                <p class="final-text">بكل تفاصيلنا الصغيرة والكبيرة، نحتفل اليوم ببداية أجمل فصول حياتنا.<br>شكراً لأنكم كنتم جزءاً من حكايتنا.</p>
                <div class="footer-names">حمدي و هديل</div>
            </div>
        </section>

    </div>

    <script>
        // ================================================
        // مشغل يوتيوب والموسيقى
        // ================================================
        var tag = document.createElement('script');
        tag.src = "https://www.youtube.com/iframe_api";
        var firstScriptTag = document.getElementsByTagName('script')[0];
        firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

        var player;
        var isMusicPlaying = false;

        function onYouTubeIframeAPIReady() {
            player = new YT.Player('youtube-player', {
                height: '0',
                width: '0',
                videoId: 'irLdBYnktJg', 
                playerVars: {
                    'autoplay': 0,
                    'controls': 0,
                    'loop': 1,
                    'playlist': 'irLdBYnktJg',
                    'modestbranding': 1,
                    'playsinline': 1
                },
                events: { 'onReady': onPlayerReady }
            });
        }

        function onPlayerReady(event) {}

        const musicToggle = document.getElementById('musicToggle');
        const openBtn = document.getElementById('openInvitation');
        const scene1 = document.getElementById('scene1');
        const scrollWrapper = document.getElementById('scrollWrapper');
        const scene3 = document.getElementById('scene3');
        const scene4 = document.getElementById('scene4');
        const scene5 = document.getElementById('scene5');

        function toggleMusic() {
            if (!player) return;
            if (isMusicPlaying) {
                player.pauseVideo();
                isMusicPlaying = false;
                musicToggle.style.backgroundColor = 'rgba(255, 255, 255, 0.5)';
                musicToggle.style.borderColor = 'rgba(255, 255, 255, 0.7)';
            } else {
                player.playVideo();
                isMusicPlaying = true;
                musicToggle.style.backgroundColor = 'rgba(255, 255, 255, 0.8)';
                musicToggle.style.borderColor = 'var(--accent-gold)';
            }
        }

        musicToggle.addEventListener('click', toggleMusic);

        openBtn.addEventListener('click', () => {
            if (!isMusicPlaying) {
                toggleMusic();
            }
            
            scene1.classList.add('hidden');
            
            setTimeout(() => {
                scrollWrapper.classList.add('active');
            }, 400);

            setTimeout(() => {
                scene1.style.display = 'none';
            }, 1800);
        });

        // ================================================
        // كشف العناصر عند التمرير لها (Intersection Observer)
        // ================================================
        const observer = new IntersectionObserver((entries) => {
            entries.forEach(entry => {
                if (entry.isIntersecting) {
                    entry.target.classList.add('in-view');
                } else {
                    entry.target.classList.remove('in-view');
                }
            });
        }, { threshold: 0.3 }); 

        observer.observe(scene3);
        observer.observe(scene4);
        observer.observe(scene5);

        // ================================================
        // مؤقت العد التنازلي (Countdown Timer)
        // ================================================
        // تحديد تاريخ الزفاف: 1 أكتوبر 2026
        const weddingDate = new Date("Oct 01, 2026 00:00:00").getTime();

        function updateCountdown() {
            const now = new Date().getTime();
            const distance = weddingDate - now;

            // حساب الوقت المتبقي
            const days = Math.floor(distance / (1000 * 60 * 60 * 24));
            const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
            const seconds = Math.floor((distance % (1000 * 60)) / 1000);

            // إضافة صفر للأرقام أقل من 10
            document.getElementById("days").innerText = days < 10 ? "0" + days : days;
            document.getElementById("hours").innerText = hours < 10 ? "0" + hours : hours;
            document.getElementById("minutes").innerText = minutes < 10 ? "0" + minutes : minutes;
            document.getElementById("seconds").innerText = seconds < 10 ? "0" + seconds : seconds;
        }

        // تشغيل المؤقت فوراً وتحديثه كل ثانية
        updateCountdown();
        setInterval(updateCountdown, 1000);

    </script>
</body>
</html>

Scroll to Top