/**
 * Variable
 */
:root {
    --app-color-accent: #34563d;
    --app-color-accent-alpha: #34563daa;
    --app-color-accent-text: #fff;
    --app-color-error: #cf5236;
    --app-color-error-alpha: #cf5236aa;
    --app-color-error-text: #fff;
    --app-color-primary: #222;
    --app-color-primary-alpha: #222222aa;
    --app-color-primary-dark: #040301;
    --app-color-primary-dark-alpha: #040301aa;
    --app-color-primary-light: #999691;
    --app-color-primary-light-alpha: #999691aa;
    --app-color-primary-text: #fff;
    --app-color-primary-text-alpha: #ffffffaa;
}

/**
 * Font
 */
@font-face {
    font-family: cms;
    font-display: swap;
    font-style: normal;
    font-weight: 900;
    src: url(font/cms.woff2) format('woff2');
}

@font-face {
    font-family: titan;
    font-display: swap;
    font-style: normal;
    font-weight: normal;
    src: url('font/titan.woff2') format('woff2');
}

/**
 * Global
 */
body {
    line-height: 1.5rem;
    padding-bottom: 12rem;
    font-family: sans-serif;
    color: var(--app-color-primary-text);
    background: var(--app-color-primary-alpha) url(crop-720/bg.jpg) no-repeat center center fixed;
    background-size: cover;
}

::selection {
    color: var(--app-color-accent-text);
    background: var(--app-color-accent-alpha);
}

:is(article, aside, details, form, fieldset, figure, main, section) > :not(:first-child),
[class|=block] > :not(:first-child),
[data-type=textarea] > :not(:first-child) {
    margin-top: 1.5rem;
}

/**
 * Text
 */
h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: 1.125rem;
}

hr {
    height: 1.5rem;
    background: linear-gradient(to left, var(--app-color-primary-dark-alpha), var(--app-color-primary-dark-alpha)) no-repeat center;
    background-size: auto 0.5rem;
}

pre {
    padding: 0.75rem;
    color: var(--app-color-primary-text);
    background: var(--app-color-primary-dark-alpha);
}

ol,
ul {
    padding-left: 2rem;
}

nav ul {
    padding-left: 0;
}

a {
    color: var(--app-color-accent);
}

a:not([role=button]):not([data-action]):hover {
    text-decoration: underline;
}

kbd,
mark {
    padding: 0.125rem 0.25rem;
    border-radius: 0.125rem;
}

kbd {
    color: var(--app-color-primary-text);
    background: var(--app-color-primary-dark-alpha);
}

mark {
    color: var(--app-color-accent-text);
    background: var(--app-color-accent-alpha);
}

time[data-attr] {
    display: block;
}

img {
    max-width: 15rem;
    max-height: 15rem;
    object-fit: contain;
}

/**
 * Details
 */
details {
    padding: 0.6875rem 0.3125rem;
    color: var(--app-color-primary-text);
    background: var(--app-color-primary-dark-alpha);
    border: 0.0625rem solid var(--app-color-primary-dark);

    &[open] {
        color: var(--app-color-accent-text);
        background: var(--app-color-accent-alpha);

        summary {
            padding-bottom: 0.6875rem;
            border-bottom: 0.0625rem solid var(--app-color-primary-dark);
        }
    }

    a:not([role=button]) {
        color: var(--app-color-primary-dark);
    }
}

/**
 * Figure
 */
figure {
    &.left {
        max-width: 50%;
        float: left;
        margin-right: 0.75rem;
    }

    &.center {
        max-width: 80%;
        margin-left: auto;
        margin-right: auto;
    }

    &.right {
        max-width: 50%;
        float: right;
        margin-left: 0.75rem;
    }
}

figcaption {
    font-size: 0.875rem;
}

/**
 * Blockquote
 */
figure.blockquote,
:not(figure.blockquote) > blockquote {
    position: relative;
    padding: 0.6875rem 3.375rem 0.6875rem 0.75rem;
    text-align: center;
    border-top: 0.0625rem solid var(--app-color-accent);
    border-bottom: 0.0625rem solid var(--app-color-accent);

    &::before {
        position: absolute;
        right: 0;
        top: calc(50% - 1.5rem);
        display: block;
        line-height: 3rem;
        font-family: cms;
        font-size: 3rem;
        color: var(--app-color-accent);
        content: '\e80a';
    }
}

/**
 * Table
 */
table {
    width: 100%;
    font-size: 0.875rem;
}

tfoot {
    font-weight: bold;
}

td,
th {
    padding: 0.5rem 0.375rem;
    border-bottom: 0.0625rem dotted;
}

th[scope=row] {
    font-weight: normal;
}

/**
 * Stat Table + Fixture
 */
table.stat,
[class|=fixture]  {
    a {
        color: inherit;
    }

    input:is([type=datetime-local], [type=number]) {
        height: 1.375rem;
        padding: 0;
        color: var(--app-color-primary-text);
        background: var(--app-color-primary-dark-alpha);
        border: 0;
    }

    input[type=number] {
        width: 3rem;
        text-align: center;
    }

    input[type=checkbox] {
        margin: 0;
    }

    .date,
    .team {
        text-align: left;
    }

    .team-home {
        text-align: right;

        a.team-link {
            padding: 0 2.25rem 0 0;

            img {
                left: initial;
                right: 0;
            }
        }
    }

    .result {
        text-align: center;

        a {
            color: inherit;
        }

        time {
            font-size: 0.75rem;
        }
    }
}

table.stat {
    thead {
        position: sticky;
        top: 3rem;
        z-index: 1;
        font-weight: bold;
        color: var(--app-color-primary-text);
        background: var(--app-color-primary-dark-alpha);
        border-bottom-style: solid;
    }

    td,
    th {
        white-space: nowrap;
        text-align: center;

        &.min {
            width: 1%;
        }

        &.team {
            width: 50%;
        }

        &.desktop {
            display: none;
        }
    }
}

[class|=fixture] {
    font-size: 0.875rem;
    text-wrap: nowrap;

    &  > * {
        padding: 0.5rem 0.375rem;
    }

    &  > :not(:first-child) {
        margin-top: 0;
    }

    .weekday {
        font-weight: bold;
        border-bottom: 0.0625rem solid;
    }

    .item {
        display: grid;
        grid-template-columns: 10fr 1fr 10fr;
        gap: 0.75rem;
    }
}

.fixture-day .item {
    grid-template-rows: 1fr 1fr;
    grid-template-columns: repeat(3, 1fr);

    & > .date {
        grid-area: 1 / 1 / 2 / 3;
    }

    & > .counted {
        grid-area: 1 / 3 / 2 / 4;

        label {
            display: inline-block;
            margin-right: 0.75rem;
            font-size: 0.75rem;
            color: var(--app-color-accent);
        }
    }
}

.block-daily table.stat thead .result a.team-link {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;

     img {
        position: static;
    }

     span {
        display: none;
    }
}

:root[data-id='league:view'] .block-league table.stat tbody tr:is(
    :nth-of-type(4),
    :nth-of-type(5),
    :nth-of-type(6),
    :nth-of-type(15),
    :nth-of-type(16)
) td,
:root[data-id='betleague:view:1']:not([data-season='2010']) .block-league table.stat tbody tr:nth-of-type(15) td,
:root[data-id='betleague:view:1'][data-season='2010'] .block-league table.stat tbody tr:nth-of-type(14) td,
:root[data-id='betleague:view:2']:not([data-season='2010']) .block-league table.stat tbody tr:is(:nth-of-type(3), :nth-of-type(15)) td,
:root[data-id='betleague:view:2'][data-season='2010'] .block-league table.stat tbody tr:nth-of-type(4) td,
:root[data-id='betleague:view:3'] .block-league table.stat tbody tr:nth-of-type(3) td,
:is(.block-daily, .block-overall, .block-stat, .block-streak) table.stat tbody tr:nth-of-type(10n):not(:last-child) td {
    border-bottom-style: dashed;
}

/**
 * Alert
 */
[role=alert] {
    padding: 0.75rem;
    color: var(--app-color-accent-text);
    background: var(--app-color-accent-alpha);

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

/**
 * Form
 */
::file-selector-button {
    height: 1.5rem;
    padding: 0.25rem;
    color: var(--app-color-primary-text);
    background: var(--app-color-primary-dark-alpha);
    border: 0;
}

::placeholder {
    color: var(--app-color-primary-light);
}

input:is(
    [type=date],
    [type=datetime-local],
    [type=email],
    [type=number],
    [type=password],
    [type=search],
    [type=tel],
    [type=text],
    [type=time],
    [type=url]
),
legend,
select,
textarea {
    padding: 0.71875rem 0;
    border-bottom: 0.0625rem solid var(--app-color-primary-dark);
}

fieldset input:is(
    [type=date],
    [type=datetime-local],
    [type=email],
    [type=number],
    [type=password],
    [type=search],
    [type=tel],
    [type=text],
    [type=time],
    [type=url]
),
fieldset select {
    width: 100%;
    max-width: 30rem;
}

button,
input:is([type=button], [type=submit]) {
    padding: 0.75rem;
    color: var(--app-color-primary-text);
    background: var(--app-color-primary-dark-alpha);
}

a[role=button],
input[type=reset] {
    padding: 0.75rem;
    color: var(--app-color-primary-text);
    background: var(--app-color-primary-light-alpha);
}

input[type=file] {
    font-size: 0.75rem;
}

.file-current,
.file-delete {
    font-size: 0.875rem;
}

legend,
textarea {
    width: 100%;
}

label,
output {
    display: block;
}

select[multiple],
textarea {
    height: 15rem;
}

select {
    background: none;
}

input:is([type=checkbox], [type=radio]) {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0.125rem 0;
    padding: 0.5625rem 0;
    border: 0.0625rem solid var(--app-color-primary-dark);
    appearance: none;

    &:checked {
        color: var(--app-color-accent-text);
        background: var(--app-color-accent-alpha);
    }

    & + label {
        display: inline-block;
        margin: 0 0.5rem 0 0.25rem;
    }

    &[disabled] + label {
        opacity: 0.2;
    }
}

input[type=radio] {
    border-radius: 1rem;
}

div:has([required]) > label:first-child::after {
    content: '*';
}

form:invalid [type=submit] {
    color: var(--app-color-error-text);
    background: var(--app-color-error-alpha);
}

div:has(:user-invalid, .error) {
    color: var(--app-color-error);

    :user-invalid {
        color: var(--app-color-error-text);
        background: var(--app-color-error-alpha);
        border-bottom: 0.0625rem solid var(--app-color-error);
    }
}

/**
 * Error
 */
.error {
    margin: 0;
    font-size: 0.875rem;
    font-weight: bold;
    color: var(--app-color-error);
}

/**
 * Action
 */
a[data-action] {
    display: inline-block;
    line-height: 1;
    font-family: cms;
    font-size: 0;

    &::before {
        font-size: 1rem;
    }
}

a[data-action=add]::before {
    content: '\e804';
}

a[data-action=edit]::before {
    content: '\e805';
}

a[data-action=delete]::before {
    content: '\e806';
}

a[data-action=view]::before {
    content: '\e807';
}

/**
 * Teamlink
 */
a.team-link {
    display: inline-block;
    position: relative;
    padding: 0 0 0 2.25rem;
    color: inherit;

    img {
        position: absolute;
        left: 0;
        top: calc(50% - 0.75rem);
        width: 1.5rem;
        height: 1.5rem;
        object-fit: contain;
    }

    span {
        display: block;
    }

    span.team-name {
        display: none;
    }
}

/**
 * Fixture View
 */
.block-fixtureview {
     & > * {
        text-align: center;
    }

    .result {
        font-size: 3rem;
    }

    .date {
        font-size: 1.25rem;
    }

    .info {
        margin-top: 0;
        font-size: 0.875rem;
        font-weight: bold;
    }

    a.team-link {
        padding: 0;
        text-align: center;
    }

    a.team-link img {
        position: static;
        display: block;
        width: 7.5rem;
        height: 7.5rem;
        margin: 0 auto;
    }
}

/**
 * Links
 */
.links {
    font-size: 0.875rem;

    .desktop {
        display: none;
    }

    a {
        color: var(--app-color-primary-text);

        &:not(:first-child) {
            margin-left: 0.5rem;
        }

        &[aria-current] {
            color: var(--app-color-primary-dark);
        }
    }

    select {
        width: 100%;
        padding: 0 0.375rem;
        color: var(--app-color-primary);
        background: var(--app-color-primary-text-alpha);
        border: 0;
    }
}

/**
 * Change
 */
[data-change] {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;

    &::after {
        font-family: cms;
        font-size: 1.25rem;
        content: '\e801';
    }
}

[data-change='']::after {
    content: '\e800';
}

[data-change='0']::after {
    content: '\e802';
}

[data-change^='-']::after {
    content: '\e803';
}

/**
 * Points
 */
[data-points] {
    display: inline-block;
    white-space: nowrap;

    &::after {
        display: inline-block;
        vertical-align: super;
        line-height: 1;
        margin-left: 0.0625rem;
        font-size: 0.75rem;
        color: var(--app-color-accent);
        content: attr(data-points);
    }
}

[data-points='0']::after {
    visibility: hidden;
}

/**
 * Toolbar
 */
#toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: grid;
    grid-template-areas: "icon shortcut day" "toolbar toolbar toolbar";
    grid-template-columns: minmax(max-content, 1.5rem) minmax(min-content, 1fr) minmax(min-content, 6rem);
    column-gap: 0.75rem;
    padding: 0.75rem;
    color: var(--app-color-primary-text);
    background: var(--app-color-primary-dark-alpha);

    &[data-open] {
        position: relative;
    }

    a {
        display: inline-block;
        color: inherit;
    }

    &::before,
    a[aria-haspopup=true]::after {
        line-height: 1;
        font-family: cms;
        cursor: pointer;
    }

    &::before {
        font-size: 1.5rem;
        content: '\e809';
    }

    &[data-open]::before {
        content: '\e808';
    }

    a[aria-haspopup=true]::after {
        margin-left: 0.375rem;
        content: '\e802';
    }

    a[aria-haspopup=true][aria-expanded=true]::after {
        margin-left: 0.375rem;
        content: '\e803';
    }

    a:is([aria-current], .current-path) {
        color: var(--app-color-accent);
    }

    &[data-open] > ul,
    a[aria-expanded=true] + ul {
        display: block;
    }

    ul {
        display: none;
        margin-left: 1.5rem;
    }

    &[data-open] ul {
        display: block;
    }

    & > ul {
        grid-area: toolbar;
        margin: 1.5rem 0 0;
    }

    div.shortcut {
        grid-area: shortcut;
        display: flex;
        gap: 0.75rem;
    }

    .block-day {
        grid-area: day;
        justify-self: end;
    }

    .block-day > :not(:first-child),
    .block-day > div > :not(:first-child) {
        margin-top: 0;
    }

    .block-day,
    .block-day > :is(.season, .day),
    &[data-open] .block-day > .season {
        display: flex;
        column-gap: 0.375rem;
    }

    &[data-open] div.shortcut,
    .block-day > .season {
        display: none;
    }

    .block-day label {
        display: inline-block;
    }

    .block-day select {
        padding: 0 0.375rem;
        color: var(--app-color-primary-text);
        background: var(--app-color-primary-alpha);
        border: 0;
    }
}

/**
 * Header
 */
#header {
    display: block;
    max-width: 100rem;
    height: 24rem;
    margin: 0 auto;
    padding: 0.75rem;
    text-align: right;

    h1 {
        line-height: 1;
        font-family: titan;
        color: var(--app-color-primary-dark-alpha);
    }
}

/**
 * Main
 */
main {
    max-width: 100rem;
    margin: 24rem auto 0;
}

#header ~ main {
    margin-top: 0;
}

#content {
    &  > * {
        padding: 0.75rem;
        color: var(--app-color-primary-text);
        background: var(--app-color-primary-alpha);

        &.links {
            background: var(--app-color-accent-alpha);
        }
    }
}

/**
 * Desktop
 */
@media screen and (min-width: 721px) {
    body {
        background-image: url(crop-1280/bg.jpg);
    }

    /**
     * Table
     */
    table.stat {
        td,
        th {
            &.desktop {
                display: table-cell;
            }
        }
    }

    /**
     * Fixture Day
     */
    .fixture-day .item {
        grid-template-rows: 1fr;
        grid-template-columns: 3fr 8fr 3fr 8fr 1fr;

        & > :is(.date, .counted) {
            grid-area: auto;
        }

        & > .counted label {
            display: none;
        }
    }

    /**
     * Teamlink
     */
    a.team-link {
         span.team-shortname {
            display: none;
        }

        span.team-name {
            display: block;
        }
    }

    /**
     * Fixture View
     */
    .block-fixtureview {
        display: flex;
        flex-wrap: wrap;
        place-items: center;

        & > :not(:first-child) {
            margin-top: 0;
        }

        .date,
        .info {
            width: 100%;
        }

        .team {
            width: 40%;
        }

        .team-home {
            text-align: right;
        }

        .team-away {
            text-align: left;
        }

        .result {
            width: 20%;
        }
    }

    /**
     * Links
     */
    .links {
        .desktop {
            display: block;
        }

        .mobile {
            display: none;
        }
    }

    /**
     * Header
     */
    #header h1 {
        line-height: 6rem;
        font-size: 4.5rem;
    }
}

@media screen and (min-width: 1041px) {
    /**
     * Toolbar
     */
    #toolbar {
        grid-template-areas: "toolbar day";
        grid-template-columns: minmax(min-content, 1fr) minmax(max-content, 12rem);
        font-size: 0.875rem;

        &::before,
        a:not([aria-expanded=true]) + ul {
            display: none;
        }

        & > ul {
            display: block;
            margin-top: 0;

            & > li {
                display: inline-block;
                margin-right: 0.625rem;
            }
        }

        ul {
            margin-left: 0;
        }

        li {
             ul {
                position: absolute;
                background: var(--app-color-primary-dark-alpha);
            }

            li {
                position: relative;
                display: block;
                padding: 0.375rem;

                ul {
                    top: 0;
                    left: 100%;
                }
            }
        }

        .block-day > .season {
            display: flex;
        }

        div.shortcut {
            display: none;
        }
    }
}

@media screen and (min-width: 1281px) {
    body {
        background-image: url(crop-1920/bg.jpg);
    }
}

@media screen and (min-width: 1921px) {
    body {
        background-image: url(bg.jpg);
    }
}
