.header {
    --header-image-px: 60px;
    --header-link-margin: 14px;
    --header-background-mask-image: linear-gradient(180deg, var(--background-colour) 0, transparent 100%);

    flex: 0 0 auto;
}
.header__background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-pattern);
    background-color: var(--header-accent-colour);
    background-blend-mode: multiply;
    mask-image: var(--header-background-mask-image);
    -webkit-mask-image: var(--header-background-mask-image); /* fuck chrome */
}

/** DESKTOP HEADER **/
.header__desktop {
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    padding: 4px;
    max-width: var(--site-max-width);
    height: var(--header-height-desktop);
}
.header__desktop__logo {
    flex: 0 0 auto;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    display: block;
    background: no-repeat center / cover;
    background-image: var(--site-logo);
    width: var(--header-image-px);
    height: var(--header-image-px);
    font-size: 0;
    transition: width .1s, height .1s;
}

.header__desktop__link {
    color: inherit;
    text-decoration: none;
    display: block;
    min-width: 100px;
    cursor: pointer;
    border-radius: 2px;
    padding: 4px 10px;
    transition: background-color .2s;
}
.header__desktop__link:hover,
.header__desktop__link:focus {
    background-color: rgba(255, 255, 255, .2);
}
.header__desktop__link:active {
    background-color: rgba(255, 255, 255, .1);
}

.header__desktop__menus {
    display: flex;
    flex: 0 0 auto;
    height: 100%;
}
.header__desktop__menu {
    margin: 0 5px;
}
.header__desktop__menu__link {
    margin: var(--header-link-margin) 0;
    font-size: 1.2em;
    padding: 6px 10px;
    text-align: center;
}

.header__desktop__submenu {
    position: absolute;
    z-index: 100;
    overflow: hidden;
    max-height: 0;
    transition: max-height .2s;
    left: -5px;
    top: 50px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.header__desktop__submenu__link {
    margin: 5px;
}
.header__desktop__submenu__background {
    background: var(--header-accent-colour);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
.header__desktop__submenu__content {
    background: var(--background-colour-translucent-9);
    overflow: hidden;
}
.header__desktop__menu:hover .header__desktop__submenu,
.header__desktop__menu:focus .header__desktop__submenu,
.header__desktop__menu:focus-within .header__desktop__submenu,
.header__desktop__menu:active .header__desktop__submenu {
    max-height: 200px;
}

.header__desktop__user {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    margin-left: auto;
}
.header__desktop__user__avatar {
    width: var(--header-image-px);
    height: var(--header-image-px);
    margin-left: 5px;
    transition: width .1s, height .1s;
    box-shadow: 0 0 4px #111;
}
.header__desktop__user__avatar:hover,
.header__desktop__user__avatar:focus,
.header__desktop__user__avatar:active {
    box-shadow: inset 0 0 0 1px var(--user-colour), 0 0 4px #111;
}
.header__desktop__user__button {
    margin: 2px;
    color: inherit;
    text-decoration: none;
    font-size: 1.5em;
    line-height: 32px;
    width: 32px;
    height: 32px;
    transition: background-color .2s;
    border-radius: 4px;
    text-align: center;

}
.header__desktop__user__button:hover,
.header__desktop__user__button:focus {
    background-color: rgba(255, 255, 255, .2);
}
.header__desktop__user__button:active {
    background-color: rgba(255, 255, 255, .1);
}
.header__desktop__user__button__count {
    position: absolute;
    bottom: 1px;
    right: 1px;
    font-size: 10px;
    background-color: var(--header-accent-colour);
    opacity: .9;
    border-radius: 4px;
    line-height: 12px;
    padding: 2px 4px;
}

/** MOBILE HEADER **/
.header__mobile {
    --header-icon-px: 40px;
    display: block;
}


.header__mobile__icons {
    display: flex;
    justify-content: space-between;
    height: var(--header-height-mobile);
    padding: 5px;
    z-index: 100;

    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.header__mobile__icon {
    flex: 0 0 auto;
    cursor: pointer;
    font-size: 32px;
    width: var(--header-icon-px);
    height: var(--header-icon-px);
    display: flex;
    justify-content: center;
    align-items: center;

    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.header__mobile__logo {
    color: inherit;
    text-decoration: none;
    background: no-repeat center / cover;
    background-image: var(--site-logo);
    font-size: 0;
}

.header__mobile__avatar {
    transition: box-shadow .2s;
    box-shadow: 0 0 4px #111;
}

.header__mobile__toggle {
    display: none;
}

.header__mobile__menu {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
    background: var(--background-pattern);
    background-color: var(--header-accent-colour);
    background-blend-mode: multiply;
    transition: max-height .2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    max-height: 0;
    overflow: hidden;
}
.header__mobile__menu__spacer {
    height: var(--header-height-mobile);
}

.header__mobile__toggle:checked ~ .header__mobile__menu {
    max-height: 600px;
}

.header__mobile__user {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid #fff;
    padding: 5px 5px 3px; /* extra 2px is provided by the buttons */
}

.header__mobile__navigation {
    padding: 5px;
}

.header__mobile__link {
    color: inherit;
    text-decoration: none;
    display: block;
    padding: 8px;
    padding-left: 20px;
    cursor: pointer;
    border-radius: 2px;
    transition: background-color .2s, margin .1s, opacity .1s;
    font-size: 1.2em;
}
.header__mobile__link:not(:last-child) {
    margin-bottom: 2px;
}
.header__mobile__link--primary {
    font-size: 1.5em;
    padding: 10px;
}
.header__mobile__link--user {
    margin: 2px;
    font-size: 1.5em;
    padding: 10px;
}
.header__mobile__link:hover,
.header__mobile__link:focus {
    background-color: rgba(255, 255, 255, .2);
}
.header__mobile__link:active {
    background-color: rgba(255, 255, 255, .1);
}

@media (max-width: 800px) {
    .header__desktop { display: none; }
}
@media (min-width: 801px) {
    .header__mobile { display: none; }
}
