@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: "Barlow", sans-serif;
}

html {
    font-size: min(18px, 2.75vw);
}

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

footer {
    margin-top: auto;
}

:root {
    /* Primary colour: Jade */
    --clr-primary-very-light: rgb(192, 240, 224);
    --clr-primary-light: rgb(0, 204, 136);
    --clr-primary-medium: rgb(0, 137, 90);
    --clr-primary-dark: rgb(3, 56, 35);
    --clr-primary-very-dark: rgb(4, 20, 12);

    /* Secondary colour: Red */
    --clr-secondary-light: rgb(245, 163, 144);
    --clr-secondary-medium: rgb(217, 53, 38);
    --clr-secondary-dark: rgb(134, 29, 19);
    --clr-secondary-very-dark: rgb(28, 13, 6);

    /* Accent colour: Amber */
    --clr-accent-light: rgb(254, 204, 99);
    --clr-accent-medium: rgb(199, 148, 0);
    --clr-accent-dark: rgb(91, 66, 0);
    --clr-accent-very-dark: rgb(35, 26, 3);
}

.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 200,
        'GRAD' 0,
        'opsz' 24
}

a[data-link]:not(.browser-default) {
    color: inherit;
    font: inherit;
    text-decoration: none;
    background: none;
    border: none;
    margin: 0;
    padding: 0;
    outline: none;
    cursor: pointer;
}

a[data-link]:not(.browser-default):link,
a[data-link]:not(.browser-default):visited,
a[data-link]:not(.browser-default):hover,
a[data-link]:not(.browser-default):active,
a[data-link]:not(.browser-default):focus {
    color: inherit;
    text-decoration: none;
}

/* 
--------------------------------------
HEADER
--------------------------------------
*/

header {
    margin-bottom: 2em;

    @media (max-width: 559.99px) {
        margin-bottom: 0;
        position: sticky;
        top: 0;
        z-index: 1000;
    }
}

header div:first-child {
    background-color: var(--clr-primary-dark);
    color: white;
    display: flex;
}

header h1 {
    flex: 1;
    padding: 2rem 1.5rem;
    font-size: 2.5rem;
    transition: all 0.5s;
}

header h1:hover {
    color: var(--clr-primary-very-light);
    cursor: pointer;
    transition: all 0.5s;
}

header div#menu-toggle {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;

    @media (min-width: 560px) {
        display: none;
    }
}

header div#menu-toggle:hover {
    cursor: pointer;
}

header span.material-symbols-outlined {
    font-size: 3rem;
    padding-inline: 0.25em;
    margin-top: 0.03em;
}

header span#header-menu-text {
    font-size: 1.5rem;
}

header nav {
    border-bottom: 1px solid #aaa;
    width: 100%;
    display: flex;
    justify-content: center;
    box-shadow: 0 12px 15px 1px #aaa;

    @media (max-width: 559.99px) {
        display: none;
    }
}

header nav ul {
    max-width: 1060px;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    justify-content: space-evenly;
    justify-items: center;
    margin: 0.5em;
}

header li {
    list-style: none;
    padding: 0.5em;
    font-weight: 500;
    font-size: 1.2em;
    transition: all 0.3s;
}

header li:hover {
    color: var(--clr-primary-medium);
    cursor: pointer;
    transition: all 0.3s;
}

/* 
--------------------------------------
MOBILE MENU
--------------------------------------
*/

#mobile-menu-anchor {
    z-index: 1001;
}

#mobile-menu {
    position: fixed;
    height: 100vh;
    width: 100vw;
    background: transparent;

    .bg {
        height: 100%;
        width: 100%;

        span.material-symbols-outlined {
            color: white;
            position: fixed;
            margin: 1em;
            padding: 0.25em;
            right: 0;
            font-size: 3em;
        }

        span.material-symbols-outlined:hover {
            cursor: pointer;
        }

        ul {
            height: 100%;
            display: flex;
            flex-direction: column;
            color: white;
            justify-content: center;
            align-items: center;
            list-style: none;

            li {
                font-size: 2em;
                padding: 1em 3em;

                &:not(.visible) {
                    opacity: 0;
                    transform: translateY(20px);
                    transition:
                        opacity 300ms ease,
                        transform 300ms ease;
                }

                &.visible {
                    opacity: 1;
                    transform: translateY(0);
                    transition:
                        opacity 300ms ease,
                        transform 300ms ease;
                }
            }

            li:not(:first-child) {
                border-top: 1px solid #ccc;
            }

            li:hover {
                cursor: pointer;
            }
        }
    }

    .bg:not(.blurred) {
        backdrop-filter: none;
        background-color: transparent;
        transition: all 0.75s ease;
    }

    .bg.blurred {
        backdrop-filter: blur(3px);
        background-color: rgba(0, 0, 0, 0.8);
        transition: all 0.75s ease;
    }
}


/* 
--------------------------------------
HERO IMAGE
--------------------------------------
*/

div.hero {
    display: none;
    width: 100%;
    height: 12em;
    background-color: #ccc;
    margin-block: 2em;
    background-size: cover;
    background-position: center;

    @media (max-width: 559.99px) {
        margin-top: 0;
    }

    &:not(.hidden) {
        opacity: 1;
        transition: opacity 0.4s;
        transition-delay: 0.1s;
    }

    &.hidden {
        opacity: 0;
        transition: opacity 0.4s;
    }
}

/* 
--------------------------------------
MAIN CONTENT
--------------------------------------
*/

main {
    padding-inline: 4rem;
    contain: layout paint;

    &:not(.hidden) {
        opacity: 1;
        transition: opacity 0.4s;
        transition-delay: 0.1s;
    }

    &.hidden {
        opacity: 0;
        transition: opacity 0.4s;
    }
}

/* 
--------------------------------------
FOOTER
--------------------------------------
*/

footer {
    text-align: center;
    color: white;
    font-size: 0.75em;
    background-color: var(--clr-primary-dark);
    padding-block: 1em;

    br {
        margin-block: 4px;
    }
}

/* 
--------------------------------------
CARD
--------------------------------------
*/

.card {
    border-radius: 1em;
    border: 1px solid #aaa;
    padding: 1em 1.2em;
    display: flex;
    flex-direction: column;

    h3 {
        font-size: 1.5rem;
        margin-bottom: 0.5em;
    }

    p {
        font-size: 1.2rem;
    }
}

/* 
--------------------------------------
TABLE
--------------------------------------
*/

.table {
    display: flex;
    flex-direction: column;

    .table-row {
        display: flex;
        border-bottom: 1px solid #aaa;

        &.highlight-primary {
            background-color: var(--clr-primary-light);
        }

        &.highlight-secondary {
            background-color: var(--clr-secondary-light);
        }

        &.highlight-accent {
            background-color: var(--clr-accent-light);
        }
    }

    .table-header {
        display: flex;
        background-color: var(--clr-primary-dark);
        font-weight: 600;
        color: white;
        border-top: 2px solid var(--clr-primary-very-dark);
        border-bottom: 2px solid var(--clr-primary-very-dark);
    }

    .cell {
        padding: 0.5em 0.8em;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: stretch;
    }

    .cell>* {
        flex: 1;
    }
}

/* 
--------------------------------------
MATCH LISTING
--------------------------------------
*/

div.match-listing {
    display: flex;
    font-size: 1.35em;
    margin-block: 0.75em;

    &>div {
        flex: 1;
    }

    &.fixture {

        .score-display:nth-child(2),
        .score-display:nth-child(3) {
            display: none !important;
        }
    }

    &.result {
        .score-display:nth-child(4) {
            display: none !important;
        }
    }

    div.endcap {
        max-width: 1.15rem;
        background-color: #aaa;
        border: 1px solid #888;

        &:first-child {
            border-right: none;
            border-top-left-radius: 0.75rem;
            border-bottom-left-radius: 0.75rem;
        }

        &:last-child {
            border-left: none;
            border-top-right-radius: 0.75rem;
            border-bottom-right-radius: 0.75rem;
        }
    }

    div.content-container>div:first-child {
        display: flex;

        &>div {
            flex: 1;
            padding: 0.75em 1em;
        }

        .player-name {
            display: flex;
            align-items: center;
            border-top: 1px solid #888;

            &>span {
                flex: 1
            }
        }

        .player-name:last-child {
            text-align: end;
        }

        .score-display {
            display: flex;
            align-items: center;
            max-width: min(3.5em, 15%);
            font-weight: 600;
            color: white;
            background-color: var(--clr-primary-dark);
            text-align: center;

            &>span {
                flex: 1
            }

            &:nth-child(2) {
                border-right: 1px solid var(--clr-primary-medium);
            }
        }
    }

    .description {
        background-color: #eee;
        font-size: 0.6em;
        padding: 0.6em;
        border-bottom: 1px solid #888;
        text-align: center;

        span.divider {
            padding-inline: 1em;
        }

        @media (max-width: 560px) {
            span:first-child {
                display: none;
            }
        }
    }
}

/* 
--------------------------------------
HOME PAGE
--------------------------------------
*/

#home {
    h1 {
        font-size: 3rem;
        text-align: center;
    }

    p#intro {
        text-align: center;
        font-size: 1.75em;
        margin: 1em 0 1.5em 0;
    }

    #main-content {
        display: flex;
        margin-bottom: 3em;

        @media (max-width: 1079.99px) {
            flex-direction: column;
        }

        @media (min-width: 1080px) {
            flex-direction: row;
        }
    }

    #main-content>div {
        flex: 1;

        @media (min-width: 1080px) {
            padding-inline: 1em;
        }
    }

    #sub-image {
        background-color: #aaa;
        background-image: url('../img/rat-and-pigeon-throwing.jpg');
        background-size: cover;
        background-position: center;
        margin-top: 2.5em;
        min-height: 14em;

        @media (min-width: 1080px) {
            max-width: 40%;
            height: auto;
            margin-top: 0;
        }
    }

    #content-container {
        font-size: 1.25rem;
    }

    .content-block {
        display: flex;

        &:not(:last-child) {
            margin-bottom: 2.5em;
        }
    }

    .content {
        flex: 1;
        padding: 1em 2em;
        border: 1px solid;
    }

    .content-block .content {
        border-right-width: 1.2em;
    }

    .content-block:nth-child(1) .content {
        border-color: var(--clr-primary-dark);
    }

    .content-block:nth-child(2) .content {
        border-color: var(--clr-secondary-dark);
    }

    .content-block:nth-child(3) .content {
        border-color: var(--clr-accent-medium);
    }

    .content-block .content-image {
        border-top-left-radius: 3em;
        border-bottom-left-radius: 3em;
    }

    .content-image {
        width: 25%;
        min-width: 100px;
        display: flex;
        justify-content: center;
        align-items: center;
        color: white;
    }

    .content-block:nth-child(1) .content-image {
        background-color: var(--clr-primary-dark);
    }

    .content-block:nth-child(2) .content-image {
        background-color: var(--clr-secondary-dark);
    }

    .content-block:nth-child(3) .content-image {
        background-color: var(--clr-accent-medium);
    }

    .content-image span.material-symbols-outlined {
        font-size: min(5em, 88px);
    }

    .content-block-header {
        font-size: 1.5em;
        padding-bottom: 0.5em;
    }
}

/* 
--------------------------------------
404 PAGE
--------------------------------------
*/

#not-found {
    h2 {
        margin-block: 2em;
    }
}

/* 
--------------------------------------
ABOUT US PAGE
--------------------------------------
*/

#about-us {
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    margin-bottom: 2em;

    h1 {
        text-align: center;
        font-size: 3em;
        margin-bottom: 0.5em;
    }

    section {
        font-size: 1.25rem;
        border-bottom: 1px solid #aaa;
        padding-block: 1em;

        h2 {
            font-size: 1.5em;
            margin-bottom: 0.5em;
        }

        p:not(:first-child) {
            margin-top: 0.5em;
        }
    }

    section:last-child {
        border: none;
    }
}

/* 
--------------------------------------
MATCHES PAGE
--------------------------------------
*/

#matches {
    margin-bottom: 2em;

    div.grid-container {
        display: grid;
        grid-template-columns: repeat(1, 1fr);

        @media (min-width: 1280px) {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    section {
        padding-block: 1em 2em;

        @media (min-width: 1280px) {
            padding-inline: 2em;
        }

        p {
            font-weight: 200;
        }
    }

    section:first-child {
        border-bottom: 1px solid #aaa;
        border-right: none;

        @media (min-width: 1280px) {
            border-right: 1px solid #aaa;
            border-bottom: none;
        }
    }

    h2 {
        font-size: 2em;
        margin-bottom: 1em;
    }
}

/* 
--------------------------------------
LEAGUE PAGE
--------------------------------------
*/

#league {
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;

    h2 {
        margin-top: 1em;
        font-size: 2.25em;
    }

    h3 {
        font-weight: 200;
        font-size: 1.5em;
    }

    h4 {
        font-size: 1.25em;
        margin-bottom: 0.5em;
    }

    section {
        padding-block: 1em;

        p {
            margin-bottom: 0.65em;
        }

        &:not(:last-child) {
            border-bottom: 1px solid #aaa;
        }
    }

    #table-key {

        padding-bottom: 1em;

        div.grid-container {
            display: grid;
            grid-template-columns: repeat(2, 1fr);

            @media (min-width: 760px) {
                grid-template-columns: repeat(3, 1fr);
            }

            @media (min-width: 1280px) {
                grid-template-columns: repeat(6, 1fr);
            }

            .key-item {
                font-size: 0.8em;

                @media (max-width: 760px) {

                    &:nth-child(3),
                    &:nth-child(4) {
                        display: none;
                    }
                }

                flex: 1;
                display: flex;
                margin-block: 0.25em;

                span:first-child {
                    font-weight: 600;
                    flex: 1;
                    max-width: 2.75em;
                }

                span:last-child {
                    flex: 1;
                }
            }
        }
    }

    .table {
        margin-block: 1em;
    }

    .cell {
        @media (min-width: 960px) {
            padding-block: 0.65em;
            font-size: 1.15em;
        }
    }

    /* Rank */
    .cell:nth-child(1) {
        max-width: 2em;
        text-align: center;
    }

    /* Player Name */
    .cell:nth-child(2) {
        text-align: left;
    }

    /* Hide draws and losses at small sizes */
    .cell:nth-child(5),
    .cell:nth-child(6) {
        @media (max-width: 760px) {
            display: none;
        }
    }

    .cell:nth-child(1) {
        @media (max-width: 560px) {
            display: none;
        }
    }

    .cell:nth-child(3),
    .cell:nth-child(4),
    .cell:nth-child(5),
    .cell:nth-child(6),
    .cell:nth-child(7),
    .cell:nth-child(8) {
        max-width: max(3.5em, 10%);
        text-align: center;
    }

    .table-row .cell:nth-child(8) {
        font-weight: 700;
        background-color: var(--clr-primary-very-light);
    }
}

/* 
--------------------------------------
CONTACT PAGE
--------------------------------------
*/

#contact {
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    padding-bottom: 2em;

    h2 {
        font-size: 2.25em;
        margin-block: 0.5em;
    }

    p {
        margin-bottom: 1em;
    }

    form {
        padding-bottom: 1em;
        border-bottom: 1px solid #aaa;

        .grid-container {
            display: grid;

            @media (min-width: 1080px) {
                grid-template-columns: repeat(2, 1fr);
                column-gap: 2em;
            }

            p {
                font-size: 0.85em;
                margin-top: 0.5em;
                margin-bottom: 0;
            }

            div.form-field {
                display: flex;
                flex-direction: column;
                padding-block: 0.5em;

                label {
                    font-size: 0.85em;
                    margin-bottom: 0.25em;
                }

                input, select {
                    font-size: 1em;
                    padding: 0.5em;
                }
            }

            @media (min-width: 1080px) {
                #contact-preference {
                    padding-top: 0.5em;
                    grid-column: 1;
                }
            }

            .radio-group {
                display: flex;
                font-size: 1em;
                padding-block: 0.5em;

                @media (min-width: 1080px) {
                    margin-top: 0.25em;
                }

                label {
                    flex: 1;
                }

                input {
                    position: relative;
                    margin-right: 0.35em;

                    @media (max-width: 560px) {
                        top: 3px;
                        margin-right: 0.2em;
                    }
                }
            }
        }

        button {
            margin-block: 1em;
            border-radius: 0.5em;
            outline: none;
            border: 1px solid var(--clr-accent-dark);
            background-color: var(--clr-accent-light);
            font-weight: 600;
            font-size: 1.25em;
            padding: 0.5em 2em;
            transition: filter 0.3s ease;
        }

        button:hover {
            cursor: pointer;
            filter: brightness(1.2);
            transition: filter 0.3s ease;
        }

        button:disabled {
            cursor: not-allowed;
            background-color: #ccc;
            color: #888;
            border: 1px solid #888;
        }

        .form-submit-error {
            font-size: 1em;
            color: red;
            padding-block: 1em;
        }
    }
}

/* 
--------------------------------------
FORM SUBMIT PAGES
--------------------------------------
*/

#form-submit {

    h2 {
        font-size: 2.25em;
        margin-block: 0.5em;
    }

    p {
        font-size: 1.5em;
        margin-bottom: 0.5em;
    }
}