/*
Copyright: (c) 2026 Jörn Menne
Licensed under the Apache License, Version 2.0
See NOTICE file for details.
*/

/*TODO: Find a good styling for no javascript*/

:root {
    /* Color definitions */
    --blue: #0d6efd;
    --dark-blue: #0a4b9c;
    --blue-pb: #014f8d;
    --red: #b3261e;
    --yellow: #f2c230;

    --gray: #d9d9d9;
    --field-border: #767676;

    /* Color assignments */
    --color-shadow: black;
    --color-header-bg: var(--dark-blue);
    --color-header-txt: white;
    --color-header-link-visited: #cccccc;
    --color-header-hover-bg: rgb(255 255 255 / 0.15);

    --color-bg: #e6e6e6;
    --color-txt: black;

    /*Variables */
    --border-radius: 8px;
    --dur: 0.33s;
    --map-height: 60vh;

    /* Stacking order (Leaflet controls use z-index 800, leaflet pane 400) */
    --z-menu: 1100;
    --z-skip: 1200;
}

/* Include padding and border in width/height */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-txt);
    margin: 0;

    /* Keep footer at the bottom on short pages */
    min-height: 100vh; /* fallback for browsers without dvh */
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

header,
footer {
    background-color: var(--color-header-bg);
    color: var(--color-header-txt);

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

header {
    padding: 0.3125rem 0.625rem;
    gap: 1rem;
}

footer {
    flex-wrap: wrap;
    gap: 1rem 2rem;
    padding: 1.5rem 2rem;

    address {
        margin: 0;
        line-height: 1.4;

        p {
            margin: 0.5rem 0 0;
        }
    }

    .footer-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

address {
    font-style: normal;
}
h1{
    padding:1rem;
    text-align:center;
}

#branding {
    display: flex;
    align-items: center;
    color: var(--color-header-txt);
    text-decoration: none;

    &:focus-visible {
        outline: 2px solid var(--color-header-txt);
        outline-offset: 4px;
    }
}

#icon {
    display: block;
    height: 2.5rem;
}

#udh-title {
    margin: 0.5rem;
}

#maintitle {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.1em 0;
}
#subtitle {
    display: block;
    font-size: 1em;
    font-weight: bold;
    margin: 0.1em 0;
    font-style: italic;
}

nav {
    position: relative;
}

.skip-link {
    position: absolute;
    left: 0;
    top: 0;
    z-index: var(--z-skip);
    padding: 0.75rem 1rem;
    transform: translateY(-100%);

    color: var(--color-header-txt);
    background-color: var(--color-header-bg);

    transition: transform var(--dur);

    &:focus {
        transform: translateY(0);
        outline: 3px solid var(--color-header-txt);
        outline-offset: -6px;
    }
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.25rem;
    align-items: center;

    margin: 0;
    padding: 0;
}

/* Reset native button styles without overriding .link-pill */
:where(button.link-pill) {
    background: none;
    border: 0;
    font: inherit;
}

.link-pill {
    color: var(--color-header-txt);
    text-decoration: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.3125rem;

    border-radius: var(--border-radius);

    transition: background-color var(--dur), translate var(--dur), box-shadow var(--dur);

    /* Only on devices with a real pointer, so taps don't leave a stuck hover */
    @media (hover: hover) {
        &:hover {
            background-color: var(--color-header-hover-bg);
            box-shadow: 1px 1px 2px 2px var(--color-shadow);
            translate: 0 -2px;
        }
    }
    &:active {
        box-shadow: inset 1px 1px 2px 2px var(--color-shadow);
        translate: none;
    }
    &:focus-visible {
        outline: 2px solid var(--color-header-txt);
    }

    &[aria-current="page"] {
        text-decoration: underline;
        text-underline-offset: 0.3em;
    }

    /* TODO: Renable visited status for links */
    /* &:visited{
        text-decoration: none;
        color: var(--color-header-link-visited);
    } */
}

.visited {
    text-decoration: none;
    color: var(--color-header-link-visited);
}

/* hide hamburger on wide screens */
.hamburger {
    display: none;
    cursor: pointer;

    /* Reset native button styles */
    background: none;
    border: 0;
    padding: 0;

    span {
        display: block;
        width: 28px;
        height: 3px;
        background: var(--color-header-txt);
        margin: 5px 0;
        transition:
            transform var(--dur),
            opacity var(--dur);
    }
}

@media (max-width: 65rem) {
    .hamburger {
        display: block;
    }
    /* Turn the hamburger into an X while the menu is open */
    .hamburger[aria-expanded="true"] {
        span:nth-child(1) {
            /* bar centers are 8px apart (3px height + 5px margin) */
            transform: translateY(8px) rotate(45deg);
        }

        span:nth-child(2) {
            opacity: 0;
        }

        span:nth-child(3) {
            transform: translateY(-8px) rotate(-45deg);
        }
    }

    .hamburger:focus-visible {
        outline: 2px solid var(--color-header-txt);
        outline-offset: 4px;
    }

    /* Menu is hidden until the hamburger is expanded */
    .nav-links {
        position: absolute;
        top: 100%;
        margin-top: 0.5rem;
        right: 0;
        z-index: var(--z-menu);

        width: 13.75rem;
        max-width: calc(100vw - 2rem);
        padding: 1.25rem;

        border-radius: var(--border-radius);
        background-color: var(--color-header-bg);

        flex-direction: column;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-10px) scale(0.98);
        transform-origin: top right;

        transition:
            opacity var(--dur) ease,
            transform var(--dur) ease,
            visibility 0s linear var(--dur);
        li {
            a,
            button {
                padding: 0.6rem 0.75rem;
            }
        }
    }
    .hamburger[aria-expanded="true"] + .nav-links {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        transition-delay: 0s;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --dur: 0s;
    }
}

/* Keyboard focus on all pages. Elements with their own focus style (e.g. header links) override it */
:focus-visible {
    outline: 3px solid var(--dark-blue);
    outline-offset: 2px;
}

#map {
    height: var(--map-height);
}

/* Text fields and selects, use with class="field" */
.field {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.6rem 0.75rem;

    font: inherit;
    font-size: 1rem;
    color: black;
    background-color: #fff;
    border: 2px solid var(--field-border);
    border-radius: var(--border-radius);
}

/* Primary button and link-button, use with class="button" */
.button {
    display: inline-block;
    min-height: 2.75rem;
    padding: 0.7rem 1.5rem;

    font: inherit;
    font-weight: bold;
    color: white;
    text-decoration: none;
    background-color: var(--dark-blue);
    border: 0;
    border-radius: var(--border-radius);
    cursor: pointer;

    @media (hover: hover) {
        &:hover {
            filter: brightness(1.12);
        }
    }
}

/* Visually hidden, but still read by screen readers. */
.sr-only,
/* Visually hidden only when JavaScript runs (the .js class on <html>).*/
.js .js-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}



.no-js .js-only{
    display:none;
}
