<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Genjo - Calm for Eco-Anxiety</title>


    <!-- SEO Meta Tags -->

    <meta name="description" content="Genjo helps you manage eco-anxiety and find calm through guided reflections, lessons, and mindfulness practices.">


    <!-- Open Graph Meta Tags (used by Facebook, LinkedIn, WhatsApp, and fallback for Twitter/X) -->

    <meta property="og:type" content="website">

    <meta property="og:title" content="Genjo - Calm for Eco-Anxiety">

    <meta property="og:description" content="Find calm in an anxious world. Join Genjo to explore mindfulness and reflection practices for eco-anxiety relief.">

    <meta property="og:image" content="https://links.genjo.app/og-image.png">

    <meta property="og:image:width" content="1200">

    <meta property="og:image:height" content="630">

    <meta property="og:url" content="https://links.genjo.app">

    <meta property="og:site_name" content="Genjo App">


    <!-- Twitter/X Card Meta Tags -->

    <meta name="twitter:card" content="summary_large_image">

    <meta name="twitter:site" content="@genjoapp">


    <style>

      body {

        background: #f5f5f5;

        color: #333;

        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

        margin: 0;

        padding: 0;

        display: flex;

        justify-content: center;

        align-items: center;

        min-height: 100vh;

      }


      .container {

        text-align: center;

        padding: 20px;

      }


      h1 {

        font-size: 24px;

        margin-bottom: 10px;

        font-weight: 600;

      }


      p {

        font-size: 16px;

        color: #666;

        margin-bottom: 20px;

      }


      .spinner {

        border: 3px solid #f3f3f3;

        border-top: 3px solid #3498db;

        border-radius: 50%;

        width: 40px;

        height: 40px;

        animation: spin 1s linear infinite;

        margin: 20px auto;

      }


      @keyframes spin {

        0% { transform: rotate(0deg); }

        100% { transform: rotate(360deg); }

      }


      .manual-link {

        margin-top: 30px;

        font-size: 14px;

        color: #999;

      }


      .manual-link a {

        color: #3498db;

        text-decoration: none;

      }


      .manual-link a:hover {

        text-decoration: underline;

      }

    </style>

  </head>

  <body>

    <div class="container">

      <h1>Genjo</h1>

      <p>Redirecting you to the right place...</p>

      <div class="spinner"></div>

      <div class="manual-link">

        Not redirecting? <a href="#" id="manual-redirect">Click here</a>

      </div>

    </div>


    <script>

      (function() {

        // Get the current path for deep linking

        const currentPath = window.location.pathname + window.location.search + window.location.hash;


        // Deep link schemes

        const APP_SCHEME = 'genjo://'; // iOS/Android custom scheme

        const IOS_UNIVERSAL_LINK = 'https://links.genjo.app'; // Universal link domain


        // Store URLs

        const APP_STORE_URL = 'https://apps.apple.com/pk/app/genjo-calm-for-eco-anxiety/id6476467190';

        const PLAY_STORE_URL = 'https://play.google.com/store/apps/details?id=com.genjo.genjoapp&pcampaignid=web_share';

        const WEBSITE_URL = 'https://genjo.app/'; // Your main website


        function detectPlatform() {

          const userAgent = navigator.userAgent || navigator.vendor || window.opera;


          // iOS detection

          if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {

            return 'ios';

          }


          // Android detection

          if (/android/i.test(userAgent)) {

            return 'android';

          }


          // Default to web

          return 'web';

        }


        function attemptAppRedirect() {

          const platform = detectPlatform();


          if (platform === 'ios' || platform === 'android') {

            // First, try to open the app with the deep link

            const deepLink = APP_SCHEME + currentPath.substring(1); // Remove leading slash


            // Create a hidden iframe to attempt app launch

            const iframe = document.createElement('iframe');

            iframe.style.display = 'none';

            iframe.src = deepLink;

            document.body.appendChild(iframe);


            // Set a timeout to redirect to store if app doesn't open

            setTimeout(function() {

              // If we're still on this page, the app didn't open

              if (document.hidden || document.webkitHidden) {

                // App opened successfully, do nothing

                return;

              }


              // Redirect to appropriate store

              if (platform === 'ios') {

                window.location.href = APP_STORE_URL;

              } else {

                window.location.href = PLAY_STORE_URL;

              }

            }, 2500);


            // Clean up iframe after attempt

            setTimeout(function() {

              if (iframe.parentNode) {

                iframe.parentNode.removeChild(iframe);

              }

            }, 3000);

          } else {

            // Desktop/web - redirect to website

            window.location.href = WEBSITE_URL;

          }

        }


        function redirect() {

          attemptAppRedirect();

        }


        // Set up manual redirect link

        document.getElementById('manual-redirect').addEventListener('click', function(e) {

          e.preventDefault();

          redirect();

        });


        // Auto-redirect after a short delay to show the loading state

        setTimeout(redirect, 1500);

      })();

    </script>

  </body>

</html>