/* ==========================================================================
   mobile.css: phone layout for the landing page
   Load it AFTER styles.css. It replaces the old "@media (max-width: 768px)"
   block at the end of styles.css (delete that block).
   ========================================================================== */

/* Hidden everywhere except phones */
.kontakt-mobile,
.mobile-nav,
.scroll-hint {
    display: none;
}

@media (max-width: 768px) {

    :root {
        --margin: 5vw;
        --gutter: 5vw;
        --bar: 3rem;                         /* height of the bottom navigation */
    }


    /* Snapping between the sections: a short swipe moves the page a little and springs back,
       a longer swipe snaps to the next section. The page never rests between two sections.
       On phones <main> is the scrolling area (not the whole page): Safari snaps much more
       reliably inside a scrolling area, and the browser bars no longer change the height. */
    html, body {
        height: 100%;
        overflow: hidden;
        scroll-snap-type: none;
    }

    main.container {
        height: 100vh;
        height: 100svh;                      /* visible height on phones */
        overflow-y: auto;
        overscroll-behavior-y: contain;      /* no rubber-band of the whole page behind it */
        scroll-snap-type: y mandatory;
        scroll-behavior: smooth;             /* the arrow glides to the contact section */
        scrollbar-width: none;
    }

    main.container::-webkit-scrollbar {
        display: none;
    }

    /* Header: white background, so the list never runs through the wordmark */
    header {
        top: 0;
        padding: var(--header-top) 0 0.6rem;
        background: #fff;
    }

    .off-canvas-trigger,
    footer {
        display: none;                       /* contact is reached through the bottom bar */
    }


    /* 1. Slideshow: image box and caption centered in the visible screen.
       "section.slideshow" = only the outer section, not the inner .slideshow loaded from slideshow.html */
    section.slideshow {
        height: 100vh;
        height: 100svh;                      /* visible height on phones (without the browser bars) */
        justify-content: center;
        padding: var(--content-top) var(--margin) 8vh;   /* bottom: room for the arrow */
    }

    .slideshow-container {
        flex: none;
        height: min(100vw, 60svh);           /* fits a portrait image (4:5) at full width */
    }

    .slideshow img {
        top: 50%;                            /* center each image inside the box */
        transform: translate(-50%, -50%);
    }

    .slideshow-caption {
        min-height: 3em;                     /* one- and two-line captions don't shift the layout */
    }

    /* Arrow at the bottom of the slideshow: shows that the page continues; tap = glide to contact */
    section.slideshow {
        position: relative;                  /* reference for the arrow */
    }

    .scroll-hint {
        display: block;
        position: absolute;
        left: 50%;
        bottom: calc(1.5vh + env(safe-area-inset-bottom, 0px));
        z-index: 12;                         /* above the left/right tap zones */
        transform: translateX(-50%);
        padding: 0.5rem 1rem;                /* larger tap target */
        font-family: 'Relaxed Typing Mono', monospace;
        font-size: 1.1rem;
        font-weight: 300;
        line-height: 1;
        color: #999;
        text-decoration: none;
        animation: scroll-hint-bob 1.6s ease-in-out 1.5s 2;   /* moves gently twice after loading */
    }

    @keyframes scroll-hint-bob {
        0%, 100% { transform: translate(-50%, 0); }
        50%      { transform: translate(-50%, 0.4rem); }
    }

    @media (prefers-reduced-motion: reduce) {
        .scroll-hint {
            animation: none;                 /* respects the phone's "reduce motion" setting */
        }
    }

    /* 2. Werkliste: as tall as its content, scrolls with the page */
    .Werkliste {
        height: auto;
        min-height: 100vh;
        overflow: visible;
        padding: var(--content-top) var(--margin) calc(var(--bar) + 2rem);
        display: none;
    }

    .Werkliste-container {
        flex: none;
        overflow: visible;
        font-size: 0.95rem;
    }

    .werkliste-group h2 {
        font-weight: 700;
    }

    .werkliste-group li {
        padding: 0.7em 0;                    /* larger tap targets */
    }

    /* 3. Contact */
    .kontakt-mobile {
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        min-height: 100vh;
        min-height: 100svh;                  /* exactly one screen, like the slideshow */
        scroll-snap-align: start;            /* snap point (the slideshow has one in styles.css) */
        padding: var(--content-top) var(--margin) calc(var(--bar) + 2rem);
        font-family: 'Relaxed Typing Mono', monospace;
        font-size: 1.1rem;
        font-weight: 300;
        line-height: 1.6;
        color: #333;
    }

    .kontakt-mobile h2 {
        margin: 0 0 1.5rem;
        font-size: inherit;
        font-weight: 700;
    }

    .kontakt-mobile h2::before {
        content: "/ ";
    }

    .kontakt-mobile p {
        margin: 0 0 1.5rem;
        line-height: 1.2;
    }

    .kontakt-mobile a {
        display: inline-block;
        line-height: 1.2;
        padding: 0.2em 0;                    /* larger tap targets */
        color: inherit;
        text-decoration: none;
        text-decoration-color: #bbb;
        text-decoration-thickness: 1px;
        text-underline-offset: 0.25em;
    }

    .kontakt-mobile .legal {
        display: flex;
        flex-wrap: wrap;
        gap: 0 1.5rem;
        margin: auto 0 0;                    /* pushes the legal links to the bottom */
        font-size: 0.8rem;
    }

    /* Bottom navigation */
    .mobile-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2000;
        height: var(--bar);
        padding: 0 var(--margin);
        background: #fff;
        border-top: 1px solid #ddd;
        font-family: 'Relaxed Typing Mono', monospace;
        font-size: 1rem;
        font-weight: 300;
    }

    .mobile-nav a {
        display: flex;
        align-items: center;
        height: 100%;
        color: #333;
        text-decoration: none;
    }
}