*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

:root {
    --bg: #E18C23;
    --black: #333;
    --blue: #226B9A;
    --red: #D65442;
    --white: #F8F3EE;
    --light-bg: #EEE0B3;
    --max-content-width: 1024px;
    --dark-grey: #475056;
    --side-image-inset: calc(var(--content-width) * .3 - 1rem);
    --side-image-width: calc(var(--side-image-inset) + var(--overflow-margin));
    --overflow-margin: max(0px, calc((100vw - var(--max-content-width)) / 2));
    overscroll-behavior: none;
    --content-width: min(var(--max-content-width), 100vw);
}

a {
    color: inherit;
}

a.cta {
    background-color: var(--blue);
    border: 1px solid var(--black);
    border-radius: 5px;
    box-shadow: var(--dark-grey) 1px 1px 5px;
    color: var(--white);
    display: block;
    margin: 1rem auto;
    padding: 0.5em 1rem;
    text-decoration: none;
    width: fit-content;

    &:active {
        filter: brightness(0.8);
    }

    &.disabled {
        background-color: var(--dark-grey);
        color: #7a90a0;
        &:active {
            filter: none;
        }
    }
}

img {
    display: block;
    padding: 0;
}

body {
    background-color: var(--bg);
    font-family: sans-serif;
}

input, button, textarea, select {
    font: inherit;
}

header {
    display: grid;
    grid-gap: 0 2rem;
    grid-template-areas: "logo donate" "logo info";
    grid-template-columns: 4fr minmax(20rem, 1fr);
    grid-template-rows:  min-content min-content;
    margin: auto;
    max-width: 1024px;
    position: relative;

    picture, a:has(picture) {
        align-content: center;
        grid-area: logo;
    }
    img {
        height: 100%;
        max-height: 7.5rem;
        object-fit: contain;
        object-position: left center;
        padding: 0.5rem;
        width: 100%;
    }

    .info {
        color: var(--light-bg);
        display: grid;
        font-size: 1.5rem;
        font-weight: bold;
        grid-area: info;
        grid-gap: 0 0.5rem;
        grid-template-columns: 1fr 1fr;
        margin: 0.5rem;
        white-space: nowrap;

        & > div {
            display: inline-block;
            font-weight: bold;
            text-transform: uppercase;
        }

        .location {
            text-align: right;

            span:first-child {
                color: var(--blue);
            }

            span:last-child {
                color: var(--red);
            }
        }

        .date {
            sup, sub {
                font-size: 50%;
            }
        }
    }
    .donate {
        grid-area: donate;
        a {
            box-shadow: rgb(from var(--dark-grey) r g b / 50%) 1px 1px 5px;
            margin: 0.5rem auto;
        }
    }

    .language-switcher {
        display: flex;
        position: absolute;
        right: 0;
        top: 0.5rem;

        a, span {
            border-right: 1px solid var(--black);
            padding: 0 0.5rem;

            &:last-child {
                border-right-width: 0;
            }
        }

        a {
            color: var(--dark-grey);
            font-weight: normal;
            text-decoration: none;
        }

        span {
            font-weight: bold;
        }
    }
}

#banner {
    position: relative;

    picture {
    }

    img {
        filter: saturate(75%) sepia(20%);
        max-height: 40vh;
        max-width: 100%;
        object-fit: cover;
        object-position: 50% 65%;
    }
}

menu {
    background: var(--light-bg);
    display: flex;
    flex-wrap: wrap;
    font-size: 1.25rem;
    justify-content: space-around;
    margin: 0 auto 0.5rem;
    max-width: 1024px;
    padding: 0;
    position: relative;

    #banner + & {
        margin-top: -1.5rem;
    }
    header + & {
        margin-top: 1rem;
    }

    li {
        display: inline-block;
        flex-grow: 0;
        margin: auto;
        text-align: center;
    }

    a {
        color: var(--dark-grey);
        display: block;
        font-weight: bold;
        padding: 0.75rem 1.5rem;
        text-decoration: none;

        &:hover, &:active {
            background: hsl( from var(--light-bg) h calc(s * 0.85) calc(l * 0.85));
            color: var(--black);
            text-shadow: var(--light-bg) 1px 1px;
        }
    }
}

section.content {
    clear: both;
    margin: 3rem auto 2rem;
    max-width: 1024px;
    min-height: 10rem;
    position: relative;

    h2, h3, p {
        margin: 1rem 0;
        padding: 0 1rem;
    }
    h2 {
        border-bottom: 1px solid rgba(0, 0, 0, 0.5);
        color: var(--blue);
    }
    h3 {
        margin: 1rem 0 0.5rem;

    }
    h2 + p {
        margin-top: 0.75rem;
    }
    p, ul {
        margin-bottom: 0.5rem;
    }
    li {
        margin-bottom: 0.25rem;
    }

    p {
        line-height: 1.5em;

        &.spaced {
            margin-top: 4rem;
        }
    }

    & {
    }

    &:has(p), &:has(div), &:has(ul) {
        min-height: 0;
    }
}

.side-image {
    float: right;
    margin: 0 calc(-1 * var(--overflow-margin)) 0.5em 1rem;
    max-height: 80vh;
    object-fit: cover;
    width: var(--side-image-width);
}

.side-image.left {
    float: left;
    margin: 0 1rem 0.5em calc(-1 * var(--overflow-margin));
}
.content:has(.side-image):after {
    clear: both;
    content: "";
    display: block;
}

.ml-embedded {
    .ml-form-embedContent {
        br:only-child {
            display: none;
        }
    }
    .ml-form-embedBody {
        padding-top: 0 !important;
    }
    .ml-form-embedSubmit {
        float: none !important;
        margin-bottom: 0 !important;
    }
}


@media (orientation: landscape) {
    .content.race-info {
        min-height: 60vh;
    }
}

.content.schedule {
    .days {
        --gap: 0.5rem;
        display: grid;
        grid-gap: 1px 1px;
        grid-template-columns: repeat(2, 1fr);
        margin-top: 1rem;
        overflow: hidden;

        & > div {
            min-height: 5rem;
            padding: var(--gap);
            position: relative;
            text-align: center;

            h3 {
                text-align: center;
            }

            &::before,
            &::after {
                background-color: #ae6e1e;
                content: '';
                position: absolute;
                z-index: 1;
            }
            &::after {
                block-size: 1px;
                inline-size: 100vw;
                inset-block-start: -1px;
                inset-inline-start: 0;
            }
            &::before {
                block-size: 100vh;
                inline-size: 1px;
                inset-inline-start: -1px;
            }
        }
    }
    .agenda {
        display: grid;
        grid-column-gap: var(--gap);
        grid-row-gap: var(--gap);
        grid-template-columns: calc(30% - 0.5rem) 70%;
        text-align: left;
        > {
            justify-self: start;
        }
        em {
            font-weight: 300;
            justify-self: end;
            opacity: 0.8;
            text-align: right;
        }
        @media (max-width: 767px) {
            grid-row-gap: 0.25rem;
            grid-template-columns: 1fr;
            text-align: center;
            em {
                justify-self: center;
                text-align: center;
            }
            span + em {
                margin-top: 1rem;
            }
            span:last-child {
                margin-bottom: 0.5rem;
            }
        }
    }
}

.content.registration {
    .side-image {
        max-height: min(20rem, 80vh);
        object-fit: contain;
        object-position: right;
    }

    .ml-form-embedContent h4 {
        display: none;
    }
}

.content.volunteer {
    .side-image {
        max-height: max(40vh, 350px);
        object-position: center 20%;
    }
}

.content.contact {
    ul {
        margin: auto;
        padding: 0 1rem;
        width: fit-content;
    }
    li {
        list-style: none;
        margin: 0.75rem 0;

        img.icon {
            display: inline-block;
            height: 1.5em;
            margin: 0 0.25rem;
            vertical-align: middle;
            width: 24px;
        }
    }
}

.content.sponsors {
    background-image: url("images/IMG_2309@0.5x.webp");
    background-size: cover;
    margin: 0 auto;
    max-width: none;
    padding: 1rem 0 5rem;

    h2 {
        height: 0;
        visibility: hidden;
    }

    .logos {
        column-gap: 1rem;
        display: flex;
        justify-content: center;
        padding: 0 1rem;
    }

    .logos img {
        border-radius: 50%;
        height: auto;
        max-width: 100px;
    }
}

@media screen and (max-width: 767px) {
    header {
        grid-template-areas: "logo" "info";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        .language-switcher {
            right: 1rem;
        }
        .donate {
            display: none;
        }
        img {
            object-position: center center;
        }
    }
    #banner img {
        max-height: 33vh;
    }

    .registration:has(.side-image:not(.left)) > p:first-of-type:has(.cta) {
        margin-right: 30%;
    }
    .content {
        & .side-image {
            display: none;
            max-height: 10rem;
        }
        .ml-embedded {
            max-width: 100%;
        }
    }
}

@media screen and (min-width: 768px) {
    br.sm {
        display: none;
    }
    #banner img {
        max-height: 50vh;
        width: 100%;
    }

    header {
        img {
            max-width: 60vw;
        }
    }

    .content {
        &:has(.side-image) {
            .ml-embedded, .content-block {
                max-width: calc(var(--content-width) - var(--side-image-inset));
            }
        }
    }

    .content.registration {
        .ml-subscribe-form {
            min-width: 22rem;
        }
    }

    .content.sponsors {
        background-position: 50% 40%;
    }
}

@media screen and (width < 1024px) {
}

@media screen and (width >= 1024px) {
    header {
        padding-left: 0;
        padding-right: 0;

        h1 {
            background-position-x: 0;
            margin-left: -25px;
            padding-left: calc(25px + 1rem);
        }
    }

    #banner > div {
        position: absolute;
        right: var(--overflow-margin);
    }

    menu {
        clip-path: polygon(
                0 0,
                100% 0,
                calc(100% - var(--ribbon-indent)) 50%,
                100% 100%,
                0 100%,
                var(--ribbon-indent) 50%
        );
        --ribbon-indent: .25em;
        max-width: calc(var(--content-width) + 4 * var(--ribbon-indent));
        padding: 0 calc(2 * var(--ribbon-indent));
    }
    .content.schedule {
        .days {
            grid-template-columns: repeat(3, 1fr);
        }
    }

    .content.sponsors {
        background-image: url("images/IMG_2309.webp");
        background-position: 50% 40%;
        padding: 1rem var(--overflow-margin) 5rem;
    }
}
