<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8">

<meta name="viewport"
      content="width=device-width,
      initial-scale=1.0,
      maximum-scale=1.0,
      user-scalable=no">

<title>System Tutorial</title>

<style>

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #ffffff;
    color: #5f5f5f;
}

body {
    overflow-x: hidden;
}


/* ==========================================
   TOP BAR
========================================== */

.topbar {

    width: 100%;
    height: 68px;

    background: #007d5f;

    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;
}

.title {

    color: #ffffff;

    font-size: 30px;

    font-weight: 700;

    line-height: 1;
}


/* ==========================================
   BACK ARROW
========================================== */

.back {

    position: absolute;

    left: 28px;
    top: 25px;

    width: 18px;
    height: 18px;

    border-left:
        3px solid #ffffff;

    border-bottom:
        3px solid #ffffff;

    transform: rotate(45deg);

    cursor: pointer;
}


/* ==========================================
   TUTORIAL LIST
========================================== */

.tutorial-list {

    width:
        calc(100% - 74px);

    margin: 0 auto;
}


/* ==========================================
   TUTORIAL ITEM
========================================== */

.tutorial-item {

    width: 100%;

    height: 105px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom:
        1px solid #eeeeee;

    cursor: pointer;

    transition:
        background 0.15s ease;
}

.tutorial-item:active {

    background: #f7f7f7;
}


/* ==========================================
   ITEM TEXT
========================================== */

.item-title {

    font-size: 20px;

    font-weight: 400;

    color: #616161;

    line-height: 1.2;
}


/* ==========================================
   RIGHT ARROW
========================================== */

.arrow {

    flex-shrink: 0;

    width: 15px;
    height: 15px;

    margin-left: 20px;

    border-top:
        3px solid #999999;

    border-right:
        3px solid #999999;

    transform: rotate(45deg);
}


/* ==========================================
   IMAGE VIEWER
========================================== */

.image-viewer {

    display: none;

    position: fixed;

    inset: 0;

    width: 100%;
    height: 100%;

    background: #ffffff;

    z-index: 99999;

    overflow-y: auto;

    overflow-x: hidden;
}


/* ==========================================
   IMAGE VIEWER HEADER
========================================== */

.image-header {

    position: sticky;

    top: 0;

    width: 100%;

    height: 58px;

    background: #007d5f;

    display: flex;

    align-items: center;

    justify-content: center;

    z-index: 10;
}


/* ==========================================
   IMAGE HEADER TITLE
========================================== */

.image-header-title {

    color: #ffffff;

    font-size: 20px;

    font-weight: 700;

    line-height: 1;
}


/* ==========================================
   IMAGE BACK BUTTON
========================================== */

.image-back {

    position: absolute;

    left: 28px;
    top: 25px;

    width: 18px;
    height: 18px;

    border-left:
        3px solid #ffffff;

    border-bottom:
        3px solid #ffffff;

    transform: rotate(45deg);

    cursor: pointer;
}


/* ==========================================
   FULL IMAGE
========================================== */

.full-image {

    display: block;

    width: 100%;

    height: auto;

    min-height: calc(100vh - 68px);

    object-fit: contain;

    object-position: top center;

    background: #ffffff;
}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 500px) {

    .topbar {
        height: 58px;
    }

    .title {
        font-size: 24px;
    }

    .back {
        left: 27px;
        top: 25px;

        width: 18px;
        height: 18px;
    }

    .tutorial-list {

        width:
            calc(100% - 74px);
    }

    .tutorial-item {

        height: 105px;
    }

    .item-title {

        font-size: 24px;
    }

    .arrow {

        width: 16px;
        height: 16px;
    }

    .image-header-title {

        font-size: 24px;
    }
}


/* ==========================================
   SMALL PHONES
========================================== */

@media (max-width: 380px) {

    .tutorial-list {

        width:
            calc(100% - 48px);
    }

    .item-title {

        font-size: 18px;
    }

    .title {

        font-size: 18px;
    }

    .back {

        left: 21px;
    }

    .image-back {

        left: 21px;
    }

    .image-header-title {

        font-size: 20px;
    }
}

</style>

</head>

<body>


<!-- ==========================================
     MAIN PAGE
========================================== -->

<div id="mainPage">


    <!-- ======================================
         TOP BAR
    ======================================= -->

    <header class="topbar">

        <div
            class="back"
            onclick="history.back()">
        </div>

        <div class="title">
            System Tutorial
        </div>

    </header>


    <!-- ======================================
         TUTORIAL LIST
    ======================================= -->

    <main class="tutorial-list">


        <!-- ==================================
             EXECUTION TASK
        =================================== -->

        <div
            class="tutorial-item"
            onclick="openImage(
                'execution-task.jpeg',
                'SNAP execution task'
            )">

            <div class="item-title">
                SNAP execution task
            </div>

            <div class="arrow"></div>

        </div>


        <!-- ==================================
             TOP-UP STEPS
        =================================== -->

        <div
            class="tutorial-item"
            onclick="openImage(
                'top-up-steps.jpeg',
                'SNAP Top-up Steps'
            )">

            <div class="item-title">
                SNAP Top-up Steps
            </div>

            <div class="arrow"></div>

        </div>


        <!-- ==================================
             REGISTRATION STEPS
        =================================== -->

        <div
            class="tutorial-item"
            onclick="openImage(
                'registration-steps.jpeg',
                'SNAP Registration Steps'
            )">

            <div class="item-title">
                SNAP Registration Steps
            </div>

            <div class="arrow"></div>

        </div>


        <!-- ==================================
             INVITATION STEPS
        =================================== -->

        <div
            class="tutorial-item"
            onclick="openImage(
                'invitation-steps.jpeg',
                'SNAP Invitation Steps'
            )">

            <div class="item-title">
                SNAP Invitation Steps
            </div>

            <div class="arrow"></div>

        </div>


    </main>

</div>


<!-- ==========================================
     IMAGE FULL PAGE VIEWER
========================================== -->

<div
    class="image-viewer"
    id="imageViewer">


    <!-- ======================================
         IMAGE HEADER
    ======================================= -->

    <div class="image-header">

        <div
            class="image-back"
            onclick="closeImage()">
        </div>

        <div
            class="image-header-title"
            id="imageTitle">

            Tutorial

        </div>

    </div>


    <!-- ======================================
         IMAGE
    ======================================= -->

    <img
        src=""
        id="tutorialImage"
        class="full-image"
        alt="Tutorial">


</div>


<script>

/* ==========================================
   ELEMENTS
========================================== */

const imageViewer =
    document.getElementById(
        "imageViewer"
    );

const tutorialImage =
    document.getElementById(
        "tutorialImage"
    );

const imageTitle =
    document.getElementById(
        "imageTitle"
    );


/* ==========================================
   OPEN IMAGE
========================================== */

function openImage(
    imageFile,
    title
) {

    /*
     * Set image.
     */

    tutorialImage.src =
        imageFile;


    /*
     * Set title.
     */

    imageTitle.textContent =
        title;


    /*
     * Show image viewer.
     */

    imageViewer.style.display =
        "block";


    /*
     * Start image from top.
     */

    imageViewer.scrollTop = 0;


    /*
     * Prevent background scrolling.
     */

    document.body.style.overflow =
        "hidden";

}


/* ==========================================
   CLOSE IMAGE
========================================== */

function closeImage() {

    /*
     * Hide viewer.
     */

    imageViewer.style.display =
        "none";


    /*
     * Clear image.
     */

    tutorialImage.src = "";


    /*
     * Restore scrolling.
     */

    document.body.style.overflow =
        "";
}


/* ==========================================
   ESC KEY
========================================== */

document.addEventListener(
    "keydown",
    function(event) {

        if (
            event.key === "Escape" &&
            imageViewer.style.display ===
            "block"
        ) {

            closeImage();

        }

    }
);

</script>


</body>
</html>