body {
    background-color: white;
    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-color: black;
    color: white;
}
body.dark-mode nav {
    background-color: black;
}
body.dark-mode .nav-toggle {
    color: white;
}
body.dark-mode nav .left ul li a {
    color: white;
}
body.dark-mode nav .right svg {
    color: white;
}
body.dark-mode #icon-sun {
    display: inline;
}
body.dark-mode #icon-moon {
    display: none;
}
body.dark-mode nav .left .logo {
    filter: brightness(0) invert(1);
}
body.dark-mode nav .left ul li a,
body.dark-mode nav .left ul li a:visited {
    color: white;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 300;
    padding: 0.5em 0.5em;
}
nav .left {
    display: flex;
    align-items: center;
}
nav .left .logo {
    display: block;
    width: clamp(20px, 1em, 40px);
    height: clamp(20px, 1em, 40px);
}
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 silver, 0 0 12px silver;
}
nav .left ul li a {
    color: black;
    text-decoration: none;
}
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.7em, 40px);
    margin-left: auto;
    margin-right: 1em;
}
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;
}

#icon-sun {
    display: none;
}
#icon-moon {
    display: inline;
}

p.map-title {
    margin: 0;
    position: relative;
    text-align: center;
    font-family: monospace;
    font-size: 0.6em;
    font-weight: 100;
}

#map-pulsar {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 1;
}

#cvs-pulse {
    display: none;
    position: absolute;
    z-index: 1;
}

#cvs-help {
    position: absolute;
    width: 20px;
    height: 20px;
    bottom: 60px;
    right: 60px;
    z-index: 2;
    cursor: auto;
    border-radius: 50%;
}

#help-box {
    position: absolute;
    min-width: 600px;
    max-width: 650px;
    min-height: 350px;
    max-height: 400px;
    padding: 14px 14px;
    font-family: monospace;
    font-size: 13px;
    z-index: 2;
    display: none;
    pointer-events: none;
    white-space: pre-line;
}

/* 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;
}
.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) {
    nav {
        flex-wrap: wrap;
        position: relative;
    }

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

    .nav-toggle {
        display: block;
    }

    nav .left ul {
        flex-direction: column;
        gap: 1rem;
        width: 20%;
        max-height: 0;
        overflow: hidden;
        background: transparent;
        background-color: rgba(0, 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: fixed;
        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: 1rem 0 1rem 1.1rem;
        opacity: 1;
    }

    nav .left ul li a {
        display: block;
        padding: 0rem 0rem;
    }

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

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

    #help-box {
        min-width: 300px;
        max-width: 350px;
        min-height: 580px;
        max-height: 600px;
    }
}

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

    #help-box {
        font-size: 10px;
    }
}