body {
    background: linear-gradient(
        to right,
        rgb(163, 255, 182) 40%,
        white 90%
    );
    background-color: white;
    transition: background 0.6s ease, color 0.4s ease;
    color: black;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: calc(1vw + 1vh);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body.dark-mode {
    background: linear-gradient(
        to right,
        rgb(163, 255, 182) 30%,
        rgb(126, 197, 140) 55%,
        rgb(90, 142, 101) 70%,
        black 100%
    );
    background-color: black;
    color: black;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 300;
    padding: 0.5em 0.5em;
}
/*
body.dark-mode nav {
    background-color: black;
}
*/

nav .left {
    display: flex;
    align-items: center;
}

nav .left .logo {
    display: block;
    width: clamp(20px, 1em, 40px);
    height: clamp(20px, 1em, 40px);
}
body.dark-mode nav .left .logo {
    filter: brightness(0) invert(0);
}

nav .left ul {
    list-style: none;
    margin: 0;
    margin-left: 2em;
    padding: 0;
    display: flex;
    gap: 2em;
    font-size: clamp(10px, 0.5em, 40px);
}
nav .left ul li:hover {
    cursor: pointer;
    text-shadow: 0 0 8px rgb(55, 123, 35), 0 0 12px rgb(55, 123, 35);
}

nav .left ul li a {
    color: black;
    text-decoration: none;
}
nav .left ul li a:visited {
    color: black;
}
body.dark-mode nav .left ul li a,
body.dark-mode nav .left ul li a:visited {
    color: black;
}

nav .right {
    display: flex;
    align-items: center;
    gap: 0.5em;
    color: red;
    font-size: clamp(15px, 0.65em, 40px);
    margin-left: auto;
    margin-right: 1em;
}
body.dark-mode nav .right {
    color: red;
}

nav .right .heart,
nav .right .heart:visited,
nav .right .heart:hover,
nav .right .heart:active {
    position: relative;
    text-decoration: none;
    color: red;
}
nav .right .heart::after {
    content: "Buy me a coffee!";
    position: absolute;
    top: 120%;
    right: 50%;
    transform: translateX(50%);
    background: white;
    color: black;
    font-size: 0.65em;
    padding: 0.3em 0.6em;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
body.dark-mode nav .right .heart::after {
    background: black;
    color: white;
    text-shadow: 0 0 8px rgb(255, 149, 149), 0 0 12px rgb(255, 149, 149);
}
@media (hover: hover) {
    nav .right .heart:hover,
    nav .right .heart:hover > * {
        cursor: pointer;
        text-shadow: 0 0 8px red, 0 0 12px red;
    }
    nav .right .heart:hover::after {
        opacity: 1;
    }
}
nav .right .heart.show-hint {
    text-shadow: 0 0 8px red, 0 0 12px red;
}
/* Allow JS to force-show the tooltip */
nav .right .heart.show-hint::after {
    opacity: 1;
}

nav .right button {
    border: none;
    background: transparent;
    cursor: pointer;
}
nav .right svg {
    width: clamp(20px, 1.4vw, 40px);
    height: clamp(20px, 1.4vw, 40px);
    color: black;
}
body.dark-mode nav .right svg {
    color: white;
}

#icon-sun {
    display: none;
}
body.dark-mode #icon-sun {
    display: inline;
}

#icon-moon {
    display: inline;
}
body.dark-mode #icon-moon {
    display: none;
}

.video-script-container {
    display: flex;
    position: relative;
}

.video-container {
    display: flex;
    position: relative;
    flex-direction: column;
    width: 30%;
    align-items: center;
    justify-content: center;
}

.demo-video {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    border: none;
    outline: none;
    display: block;
}

#mute-toggle {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    padding: 8px 8px;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 1.0 ease;
}

#mute-toggle:hover {
    transform: scale(1.1);
}

#mute-toggle:active {
    transform: scale(0.95)
}

.speaker-icon {
    width: 20px;
    height: 20px;
    color: black;
}

.mute-slash {
    opacity: 1;
    transition: opacity 0.5s ease;
}

#mute-toggle.unmuted .mute-slash {
    opacity: 0;
}

#replay-button {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    width: 1.4em;
    height: 1.4em;
    font-size: 2.2em;
    line-height: 1.4em;
    text-align: center;
    padding: 0;
    cursor: pointer;
    color: black;
}

.script-container {
    width: 70%;
    min-height: 60vh;
    max-height: 80vh;
    display: flex;
    align-items: center;
    position: relative;
}

.script-text {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 1.8em;
    opacity: 0;
    transition: opacity 1s;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 25%;
    max-width: 55%;
    white-space: normal;
    word-break: break-word;
    text-align: left;
    pointer-events: none;
    will-change: transform, opacity;
}

.script-text.active {
    opacity: 1;
    pointer-events: auto;
}

.inline-btn {
    display: inline-block;
    padding: 0.6em 0.6em;
    border-radius: 1.2em;
    background-color: rgb(221, 254, 195);
    color: rgb(55, 123, 35);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 0.7em;
    font-weight: 600;
}

.app-link:link, 
.app-link:visited {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-weight: 600;
    color: rgb(106, 165, 118);
    text-decoration: none;
    display: inline-block;
    transition: transform 0.25s ease;
}

body.dark-mode .app-link:link, 
body.dark-mode .app-link:visited {
    color: rgb(221, 255, 195);
}

.app-link:hover,
.app-link:active,
.app-link:focus {
    transform: translateY(-0.15em);
}

.privacy-text {
    display: block;
    color: black;
    font-size: 0.3em;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.2;
    margin-top: 0.6em;
}

.privacy-divider {
    height: 1px;
    width: fit-content;
    min-width: 16em;
    max-width: 100%;
    background-color: currentColor;
    margin: 0 0 0.4em 0;
}

/* Hamburger menu for narrow screens */
.nav-toggle {
    display: none;
    position: relative;
    left: 10%;
    width: 16px;
    height: 12px;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 0.3em;
    color: black;
}
body.dark-mode .nav-toggle {
    color: white;
}

.nav-toggle span {
    position: absolute;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: transform 0.3s ease, top 0.3s ease; opacity: 0.3s ease;
}

.nav-toggle span:nth-child(1) {
    top: 0;
}

.nav-toggle span:nth-child(2) {
    top: 6px;
}

.nav-toggle span:nth-child(3) {
    top: 12px;
}

nav.open .nav-toggle span:nth-child(1) {
    top: 9px;
    transform: rotate(45deg);
}

nav.open .nav-toggle span:nth-child(2) {
    opacity: 0;
}

nav.open .nav-toggle span:nth-child(3) {
    top: 9px;
    transform: rotate(-45deg)
}

/* Narrow screen */
@media (max-width: 700px) {
    body {
        background: linear-gradient(
            to bottom,
            rgb(163, 255, 182) 80%,
            white 100%
        );
    }

    body.dark-mode {
        background: linear-gradient(
            to bottom,
            rgb(163, 255, 182) 78%,
            rgb(126, 197, 140) 89%,
            rgb(106, 165, 118) 92%,
            rgb(85, 135, 96) 94%,
            rgb(65, 103, 73) 96%,
            rgb(45, 71, 50) 98%,
            black 100%
        );
        background-color: black;
    }

    nav {
        flex-wrap: wrap;
        position: relative;
        z-index: 1;
    }

    nav .left .logo {
        width: 3.5em;
        height: 3.5em;
        margin-left: 1em;
    }

    .nav-toggle {
        display: block;
    }

    body.dark-mode .nav-toggle {
        color: black;
    }

    nav .left ul {
        flex-direction: column;
        gap: 1rem;
        width: 20%;
        max-height: 0;
        overflow: hidden;
        background: transparent;
        background-color: rgba(0, 0, 0, 0);
        border-radius: 0 0 0 0;
        backdrop-filter: blur(6px);
        padding: 1em 0;
        padding-left: 1.2rem;
        box-sizing: border-box;
        font-size: 1em;
        position: absolute;
        top: 3.8rem; /* sit right below nav */
        left: 0;
        margin-left: 7.5%;
        opacity: 0;
        transition: max-height 0.5s ease, opacity 0.5s ease;
    }

    /* Show menu when nav is toggled */
    nav.open .left ul {
        max-height: 300px;
        padding: 1em 0;
        opacity: 1;
    }

    nav .right {
        font-size: 1.9em;
        margin: 0.3em;
    }

    nav .right .heart::after {
        background: rgb(163, 255, 182);
    }

    body.dark-mode nav .right .heart::after {
        background: rgb(163, 255, 182);
        color: black;
    }

    nav .right svg {
        width: 7vw;
        height: 7vw;
    }

    body.dark-mode nav .right svg {
        color: black;
    }

    .video-script-container {
        flex-direction: column;
    }

    .video-container {
        position: relative;
        width: 70vw;
        height: 70vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background-color: transparent;
        left: 50%;
        transform: translateX(-50%);
    }

    .script-container {
        position: relative;
        width: 80vw;
        min-height: 20vh;
        max-height: 25vh;
        margin-top: 0em;
        display: flex;
        justify-content: center;
        left: 50%;
        transform: translateX(-50%);
    }

    .script-text {
        position: absolute;
        top: 10%;
        left: 50%;
        transform: translateX(-50%);
        max-width: 100%;
        text-align: center;
        margin: 0;
        white-space: normal;
        word-break: break-word;
        line-height: 1.5em;
    }

    .privacy-divider {
        height: 1px;
        width: fit-content;
        min-width: 32em;
        max-width: 100%;
        background-color: currentColor;
        margin: 0 0 0.4em 0;
    }
}

@media (hover: none) and (pointer: coarse) {
    @keyframes triple-jump {
        0% { transform: translateY(0); }

        /* Jump 1 */
        10% { transform: translateY(-0.4em);}
        20% { transform: translateY(0); }

        /* Jump 2 */
        35% { transform: translateY(-0.4em); }
        45% { transform: translateY(0); }

        /* Jump 3 */
        70% { transform: translateY(-0.4em); }
        80% { transform: translateY(0); }

        /* Rest */
        100% { transform: translateY(0); }
    }

    .app-jump {
        animation: triple-jump 12s cubic-bezier(0.45, 0.05, 0.1, 1);
    }

    nav .right .heart::after {
        content: "Double tap to Buy me a coffee!";
        right: 30%;
        transform: translateX(30%);
        font-size: 0.55em;
    }
}