:root {
    /* Colours! */
    --primary: #1F5AA7; /* NSF blue */
    --primary-hsl-val: 214deg 69% 39%;
    --background: hsl(214deg 70% 18%); /*#0e2a4e;*/
    --light-grey: #eeeeee;
    /*--grey: #999999;*/
    --grey: #555555;

    /* Shadowy stuff */
    --shadow-color: 214deg 100% 8%;
    --shadow-elevation-low:
        0.3px 0.5px 0.7px hsl(var(--shadow-color) / 0.34),
        0.4px 0.8px 1px -1.2px hsl(var(--shadow-color) / 0.34),
        1px 2px 2.5px -2.5px hsl(var(--shadow-color) / 0.34);
    --shadow-elevation-medium:
        0.3px 0.5px 0.7px hsl(var(--shadow-color) / 0.36),
        0.8px 1.6px 2px -0.8px hsl(var(--shadow-color) / 0.36),
        2.1px 4.1px 5.2px -1.7px hsl(var(--shadow-color) / 0.36),
        5px 10px 12.6px -2.5px hsl(var(--shadow-color) / 0.36);

    --line-height: 1.5;
    --v-grid: calc(var(--line-height) * 1rem);

    --column-width: 36rem;

    /* Junk */
    --duration: 75ms;
    --radius: 4px;
    --component-padding-v: .25em;
    --component-padding-h: .75em;
    --component-padding: var(--component-padding-v) var(--component-padding-h);
    --outline: 3px solid hsl(var(--primary-hsl-val) / .75);
}

/* Use rch if supported */
@supports(width: 55rch) {
    :root {
        --column-width: 55rch;
    }
}

/*
  Josh's Custom CSS Reset
  https://www.joshwcomeau.com/css/custom-css-reset/
*/
*, *::before, *::after {
    box-sizing: border-box;
}
* {
    margin: 0;
}
body {
    line-height: var(--line-height);
    -webkit-font-smoothing: antialiased;
}
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}
input, button, textarea, select {
    font: inherit;
}
p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

/* Basic styling */
html, body {
    height: 100%;
}

body {
    background: black;
    font-family: system-ui, sans-serif; /* Boring font choice */
    color: white;
}

a,
a:visited {
    color: white;
    text-decoration: underline;
    text-decoration-thickness: .1em;
}

a:hover,
a:focus {
    color: white;
    text-decoration: none;
}

p, h1, h2, h3, h4, h5, h6 {
    margin-bottom: var(--v-grid);
}

button {
    font-size: inherit;
    line-height: inherit;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: inline-block;
    border: none;
    border-radius: var(--radius);
    padding: var(--component-padding);
    user-select: none;
    box-shadow: var(--shadow-elevation-low);
    transition-duration: var(--duration);
    transition-property: transform, background-color, box-shadow;
    font-weight: normal;
}

button:hover {
    background: var(--primary);
    box-shadow: var(--shadow-elevation-medium);
    transform: scale(1.05);
    position: relative; /* Pull focussed element to front, so outline won't be interrupted */
    z-index: 11;
}

button:focus {
    outline: var(--outline);
    position: relative; /* Pull focussed element to front, so outline won't be interrupted */
    z-index: 10;
}

button:active {
    background: var(--grey);
}

button.is-fullwidth {
    width: 100%;
}

button.is-large {
    font-size: 1.25em;
}

/*
 * Layout
 * Too many magic numbers from here. Might fix at some point.
 */

body {
    display: flex;
    flex-flow: column;
    min-height: 100vh;
}

main {
    flex: 1 1 100vh;
}

header {
    z-index: 1;
    display: flex;
    flex-flow: column nowrap;
    align-items: center;
    justify-content: space-between;
    background: black;
    color: white;
    box-shadow: var(--shadow-elevation-medium);
    padding: .5rem 1rem;
}

header .logo {
    height: .9em;
    display: inline;
    vertical-align: baseline;
    position: relative;
    top: .1em;
    margin-right: .75rem;
}

header .title {
    font-size: 1.5rem;
    margin-bottom: 0;
    font-weight: bold;
}

footer .credit,
header .credit {
    font-size: small;
    margin-bottom: 0;
}

header .credit {
    display: none;
}

footer {
    background: black;
    text-align: center;
    color: white;
    padding-top: .2rem;
    padding-right: 1rem;
    padding-bottom: max(env(safe-area-inset-bottom), .2rem);
    padding-left: 1rem;
}

section.content {
    margin-top: var(--v-grid);
    padding: 0 1rem;
    width: var(--column-width);
    max-width: 100vw;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 600px) {
    header {
        flex-flow: row nowrap;
    }
    header .title {
        font-size: 2rem;
    }
    header .credit {
        display: block;
    }
    footer {
        display: none;
    }
}


/* Forms */
form .field {
    padding: 0 1rem;
    width: var(--column-width);
    max-width: 100vw;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
}


/* Generic map stuff */
.map .map-marker {
    background-image: url('/img/star.svg');
    background-size: contain;
    width: 25px;
    height: 33px;
}


/* Location picker */
.geocoder-map,
.geocoder .map,
.location-picker .map {
    height: 50vh;
    border: 2px solid black;
    box-shadow: var(--shadow-elevation-medium);
    background: var(--background);
    margin-top: 1rem;
    margin-bottom: 1rem;
}


/* Geocoder */
.geocoder .mapboxgl-ctrl-geocoder {
    width: 100%;
    max-width: none;
}

.geocoder .suggestions-wrapper {
    z-index: 20;
}


/* Map view */
#map-view {
    background: var(--background);
    max-height: 100vh;
    min-height: auto;
}

#map-view .map-container {
    height: 100%;
    width: 100%;
    position: relative;
}

#map-view .map-container .map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}
