@font-face {
    font-family: "Damsterdam";
    src: url("assets/fonts/Damsterdam.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --z-nav: 1000;
    --z-nav-toggle: 1001;
    --nav-toggle-size-min: 4vw;
    --nav-toggle-size-preferred: 5vw;
    --nav-toggle-size-max: 6vw;
}

html.nav-open,
body.nav-open {
    overflow: hidden;
    height: 100%;
}

body.nav-open {
    position: fixed;
    inset: 0;
    width: 100%;
    touch-action: none;
}

.nav-toggle {
    position: fixed;
    top: var(--safe-top, max(3vw, calc(env(safe-area-inset-top, 0px) + 0.5rem)));
    right: var(--safe-right, max(3vw, env(safe-area-inset-right, 0px)));
    z-index: var(--z-nav-toggle);
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    line-height: 0;
}

.nav-toggle img {
    width: clamp(var(--nav-toggle-size-min), var(--nav-toggle-size-preferred), var(--nav-toggle-size-max));
    height: auto;
    display: block;
    filter: drop-shadow(0 0.15rem 0.35rem rgba(0, 0, 0, 0.28));
}

.nav-menu {
    position: fixed;
    inset: 0;
    z-index: var(--z-nav);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 100svh;
    padding:
        env(safe-area-inset-top, 0px)
        max(2vw, env(safe-area-inset-right, 0px))
        env(safe-area-inset-bottom, 0px)
        max(2vw, env(safe-area-inset-left, 0px));
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    background-color: var(--color-blue, #95d4f0);
}

.nav-menu.is-open {
    visibility: visible;
    pointer-events: auto;
}

.nav-menu__panel {
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.nav-menu__content {
    --nav-vh: calc(100svh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 0.75rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 1.5svh, 1rem);
    width: 100%;
    height: var(--nav-vh);
    max-height: var(--nav-vh);
}

.nav-menu__logo {
    width: auto;
    max-width: 92vw;
    max-height: calc(var(--nav-vh) * 0.24);
    height: auto;
    flex: 0 0 auto;
    object-fit: contain;
}

.nav-stack {
    position: relative;
    flex: 1 1 0;
    width: min(92vw, calc(var(--nav-vh) * 0.72 * 726 / 1108));
    max-height: calc(var(--nav-vh) * 0.72);
    min-height: 0;
    aspect-ratio: 726 / 1108;
    margin-inline: auto;
}

@media (min-width: 768px) {
    .nav-menu__content {
        --nav-vh: calc(100svh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.5rem);
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 2vw;
    }

    .nav-menu__logo {
        grid-column: 1;
        grid-row: 1;
        justify-self: end;
        max-height: calc(var(--nav-vh) * 0.88);
        max-width: min(44vw, 26rem);
        margin-right: 2vw;
    }

    .nav-stack {
        grid-column: 2;
        grid-row: 1;
        flex: none;
        height: calc(var(--nav-vh) * 0.92);
        width: auto;
        max-width: min(40vw, 30rem);
        max-height: calc(var(--nav-vh) * 0.92);
        margin-inline: 0;
    }
}

.nav-stack__reveal {
    clip-path: inset(0 0 100% 0);
    height: 100%;
}

.nav-menu.is-open .nav-stack__reveal {
    animation: nav-image-reveal 0.75s ease-out forwards;
}

.nav-stack__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.nav-stack__layers {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: var(--nav-stack-start, 0%);
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.nav-stack__btn {
    flex: 0 0 var(--nav-slot-height, 20%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-black, #000);
    font-size: clamp(1.35rem, 6vw, 2.5rem);
    font-family: var(--font-display, "Damsterdam", cursive);
    font-weight: normal;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
    text-align: center;
    line-height: 1.1;
    padding: 0 0.5rem;
}

.nav-stack__btn--label {
    cursor: default;
    pointer-events: none;
}

.nav-stack__btn:not(.nav-stack__btn--label):hover,
.nav-stack__btn:not(.nav-stack__btn--label):focus-visible {
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

@keyframes nav-image-reveal {
    from { clip-path: inset(0 0 100% 0); }
    to   { clip-path: inset(0 0 0 0); }
}
