<!-- ================================================================= -->
            <!-- OUR VENUE (EMBEDDED GOOGLE MAPS SECTION)                          -->
            <!-- ================================================================= -->
            <?php 
                $mapEvents = array_filter($events, function($e) {
                    // 1. Respect Show Map toggle: if show_map is set to 0 or false, do NOT render map
                    if (isset($e['show_map']) && ((string)$e['show_map'] === '0' || $e['show_map'] === false || $e['show_map'] === 0)) {
                        return false;
                    }
                    
                    // 2. Render card if either maps_embed_url or maps_url exists
                    $hasEmbed = !empty($e['maps_embed_url']);
                    $hasNavUrl = !empty($e['maps_url']);
                    return $hasEmbed || $hasNavUrl;
                });
            ?>
            <?php if (!empty($mapEvents)): ?>
                <section class="py-16 md:py-20 lg:py-24 px-6 md:px-12 space-y-10 border-b <?= $style['borderColor'] ?>">
                    <?php
                    $headerEmoji = '📍';
                    $headerTitle = 'Our Venue';
                    require __DIR__ . '/../partials/section_header.php';
                    ?>
                    <div class="text-center mt-2">
                        <p class="text-xs <?= $style['subText'] ?> max-w-xs mx-auto">Interactive location maps and directions for our wedding ceremonies.</p>
                    </div>

                    <div class="space-y-10 max-w-4xl mx-auto text-left">
                        <?php foreach ($mapEvents as $mEvt): 
                            $mName = $mEvt['event_name'] ?? 'Ceremony';
                            $mVenue = $mEvt['venue_name'] ?? '';
                            $mAddr = $mEvt['venue_address'] ?? '';
                            
                            $mEmbedUrl = $mEvt['maps_embed_url'] ?? '';
                            $mNavUrl = $mEvt['maps_url'] ?? '';
                        ?>
                            <div class="<?= $style['cardBg'] ?> rounded-3xl border <?= $style['borderColor'] ?> shadow-sm overflow-hidden p-6 sm:p-8 space-y-5 hover:border-amber-400/60 transition">
                                
                                <!-- 1. Ceremony Title & Venue Details -->
                                <div class="border-b <?= $style['borderColor'] ?> pb-3">
                                    <h3 class="text-xl font-bold <?= $style['textColor'] ?> <?= $style['fontSerif'] ?> flex items-center gap-2">
                                        <span>📍</span> <?= escape_html($mName) ?>
                                    </h3>
                                    <?php if (!empty($mVenue)): ?>
                                        <p class="text-sm font-bold <?= $style['textColor'] ?> mt-1"><?= escape_html($mVenue) ?></p>
                                    <?php endif; ?>
                                    <?php if (!empty($mAddr)): ?>
                                        <p class="text-xs <?= $style['subText'] ?> mt-0.5 leading-relaxed"><?= escape_html($mAddr) ?></p>
                                    <?php endif; ?>
                                </div>

                                <!-- 2. Dynamically Generated Google Map iframe (Rendered only if maps_embed_url is present) -->
                                <?php if (!empty($mEmbedUrl)): ?>
                                    <div class="w-full h-[400px] md:h-[500px] lg:h-[600px] rounded-2xl overflow-hidden border <?= $style['borderColor'] ?> bg-slate-100 relative shadow-2xs">
                                        <!--
                                            This iframe intentionally uses loading='eager'.

                                            Runtime testing confirmed that native lazy loading causes
                                            Google Maps Embed to render blank in the current layout.

                                            Do not change back to loading='lazy' unless this behavior
                                            has been re-tested.
                                        -->
                                        <iframe 
                                            src="<?= htmlspecialchars($mEmbedUrl) ?>" 
                                            width="100%" 
                                            height="100%" 
                                            style="border:0;" 
                                            allowfullscreen="" 
                                            loading="eager" 
                                            referrerpolicy="strict-origin-when-cross-origin"
                                            class="w-full h-full border-0 rounded-2xl block"
                                        ></iframe>
                                    </div>
                                <?php endif; ?>

                                <!-- 3. Open in Google Maps Button (Rendered only if maps_url is present) -->
                                <?php if (!empty($mNavUrl)): ?>
                                    <div class="pt-1 text-center sm:text-left">
                                        <a 
                                            href="<?= htmlspecialchars($mNavUrl) ?>" 
                                            target="_blank" 
                                            rel="noopener noreferrer"
                                            class="inline-flex justify-center items-center gap-2 px-5 py-2.5 border border-amber-300 text-xs font-bold rounded-xl text-amber-800 <?= $style['accentBg'] ?> hover:bg-amber-100 transition shadow-xs"
                                        >
                                            <span>🗺️</span> Open in Google Maps
                                        </a>
                                    </div>
                                <?php endif; ?>

                            </div>
                        <?php endforeach; ?>
                    </div>
                </section>
            <?php endif; ?>
