/*** Variables ***/

@bg: #0d193b; //Background color
@fg: #a0ccff; //Foreground color
@li: #00caca; //Link
@ec: #ffffff; //Extra color

@fg-ten: fade(@fg, 10%);
@fg-twenty: fade(@fg, 20%);

@fg-ten-hard: screen(@bg, @fg-ten);
@fg-twenty-hard: screen(@bg, @fg-twenty);

@pastel-red: #ff7d7d;
@pastel-orange: #ffbb7d;
@pastel-yellow: #ffff7d;
@pastel-lime: #7dff7d;
@pastel-cyan: #7dffff;
@pastel-blue: #7d7dff;
@pastel-magenta: #ff7dff;

@main-fonts: "Arial", "Helvetica Neue", sans-serif;
@monospace-fonts: "Consolas", "Source Code Pro", monospace;


/*** Standard elements ***/

body {
    font-family: @main-fonts;
    background-color: @bg;
    color: @fg;
    box-sizing: border-box;
}

a {
    color: @li;
    text-decoration: none;

    &:hover {
        color: lighten(@li, 25%);
    }

    &:active {
        color: white;
    }

    //Icon link
    //noinspection CssNoGenericFontName
    &:not(.no-icon) {
        //External link
        &::before {
            font-family: "Font Awesome 5 Free";
            font-weight: bold;
            content: "\f0c1";
            margin-right: 4px;
        }

        //Telegram link
        &[href^="https://t.me"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f2c6";
            margin-right: 3px;
        }

        //YouTube link
        &[href^="https://www.youtube.com"]::before, &[href^="https://youtu.be"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f167";
            margin-right: 3px;
        }

        //Vimeo link
        &[href^="https://vimeo.com"]::before, &[href^="https://player.vimeo.com"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f27d";
            margin-right: 4px;
        }

        //GitHub link
        &[href^="https://github.com"]::before, &[href^="https://gist.github.com"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f09b";
            margin-right: 4px;
        }

        //Itchio link
        &[href^="https://itch.io"]::before, &[href^="https://steffo.itch.io"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f83a";
            margin-right: 3px;
        }

        //Kickstarter link
        &[href^="https://www.kickstarter.com"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f3bb";
            margin-right: 4px;
        }

        //Reddit link
        &[href^="https://reddit.com"]::before, &[href^="https://new.reddit.com"]::before, &[href^="https://old.reddit.com"]::before, &[href^="https://redd.it"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f281";
            margin-right: 3px;
        }

        //Twitch link
        &[href^="https://www.twitch.tv"]::before, &[href^="https://clips.twitch.tv"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f1e8";
            margin-right: 4px;
        }

        //Steam link
        &[href^="https://store.steampowered.com"]::before, &[href^="https://steamcommunity.com"]::before, &[href^="https://partner.steamgames.com"]::before, &[href^="steam:"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f1b6";
            margin-right: 4px;
        }

        //Twitter link
        &[href^="https://twitter.com"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f099";
            margin-right: 3px;
        }

        //Wikipedia link
        &[href^="https://it.wikipedia.org"]::before, &[href^="https://en.wikipedia.org"]::before {
            font-family: "Font Awesome 5 Brands";
            font-weight: bold;
            content: "\f266";
            margin-right: 3px;
        }

        //Anchor
        &[href^="#"]::before {
            font-family: "Font Awesome 5 Free";
            font-weight: bold;
            content: "\f13d";
            margin-right: 3px;
        }

        //Unsafe link
        &[href^="http:"]::before {
            font-family: "Font Awesome 5 Free";
            font-weight: bold;
            content: "\f09c";
            margin-right: 4px;
        }

        //Magnet link
        &[href^="magnet:"]::before {
            font-family: "Font Awesome 5 Free";
            font-weight: bold;
            content: "\f076";
            margin-right: 4px;
        }
    }
}

b, strong {
    color: @pastel-yellow;
}

i, em {
    color: @pastel-orange;
}

h1, h2, h3, h4, h5, h6 {
    color: @ec;
    margin-top: 0;
    margin-bottom: 0;
    font-weight: normal;
}

pre {
    padding: 2px 4px 2px 8px;
    margin: 8px;

    color: lightgray;
    border: 1px solid fade(lightgray, 20%);
    background-color: fade(lightgray, 10%);
    font-family: @monospace-fonts;
}

*:not(pre) > code {
    color: lightgray;
    border: 1px solid fade(lightgray, 20%);
    background-color: fade(lightgray, 10%);
}
code {
    font-family: @monospace-fonts;
}

blockquote {
    color: @pastel-lime;
    border-left: 3px solid @pastel-lime;
    background-color: fade(@pastel-lime, 10%);
    padding: 2px 4px 2px 8px;
    margin: 8px;
}

textarea {
    background-color: @fg-ten;
    color: @fg;
    border: 1px solid @fg;
    padding: 2px;
    margin: 1px;
    font-size: small;
    font-family: @monospace-fonts;
    width: 100%;
    height: 300px;
}

button, input[type="submit"], .btn {
    background-color: @fg-ten;
    color: @fg !important;
    border: 1px solid @fg;
    border-radius: 0;
    padding: 2px 8px;
    margin: 1px;
    font-size: medium;
    font-family: @main-fonts;
    text-decoration: none;
    cursor: default;

    &:hover {
        background-color: @fg-twenty;
        color: lighten(@fg, 25%);
        border-color: lighten(@fg, 25%);
    }

    &:active {
        background-color: fade(@fg, 30%);
        color: white;
        border-color: white;
    }
}

input[type="text"], input[type="password"], input[type="email"] {
    background-color: @fg-ten;
    color: @fg;
    border: none;
    border-bottom: 1px dashed @fg;
    padding: 2px;
    margin: 1px;
    font-size: medium;
    font-family: @main-fonts;
}

select {
    background-color: @fg-ten;
    color: @fg;
    border: none;
    border-bottom: 1px dotted @fg;
    padding: 2px;
    margin: 1px;
    font-size: medium;
    font-family: @main-fonts;

    option {
        background-color: #293c61;
        color: @fg;
    }
}

img {
    margin-left: auto;
    margin-right: auto;
    display: block;
    max-width: 100%;
}

nav {
    display: flex;
    justify-content: space-between;
    height: 50px;
    line-height: 50px;
    min-width: 400px;

    .nav-left {
        text-align: left;
    }

    .nav-center {
        text-align: center;
    }

    .nav-right {
        text-align: right;
    }

    .nav-image {
        height: 50px;
        display: inline;
        vertical-align: middle;
    }

    .nav-sitename {
        font-weight: bold;
    }

    .nav-login-unavailable {
        opacity: 0.25;
    }
}

table {
    border-collapse: collapse;

    thead {
        margin-top: 4px;
        margin-left: 4px;
        margin-right: 4px;
        padding: 8px;

        th {
            background-color: @fg-twenty;
            color: @ec;
            padding-left: 4px;
            padding-right: 4px;
            text-align: left;
            font-size: small;
            font-weight: bold;
        }

        tr:first-child {
            th:first-child {
                border-radius: 4px 0 0 0;
            }

            th:last-child {
                border-radius: 0 4px 0 0;
            }
        }
    }

    tbody {
        margin-bottom: 4px;
        margin-left: 4px;
        margin-right: 4px;
        padding: 8px;

        td {
            background-color: @fg-ten;
            padding-left: 4px;
            padding-right: 4px;
        }

        tr {
            border-bottom: 1px solid @fg-twenty;

            &:last-child {
                border-bottom: none;

                td:first-child {
                    border-radius: 0 0 0 4px;
                }

                td:last-child {
                    border-radius: 0 0 4px 0;
                }
            }
        }
    }
}

form.full {

    label {
        margin-top: 4px;
        margin-bottom: 4px;
        display: flex;

        .label-text {
            margin-right: 12px;
            min-width: 60px;
        }

        input {
            flex-grow: 1;
        }

        &.label-big {
            font-size: x-large;

            * {
                font-size: x-large;
            }
        }
    }
}

*[disabled=""], .disabled {
    opacity: 0.3;
}


/*** Modifiers ***/
.tiny {
    font-size: xx-small;
}

.center {
    margin: auto;
}


/*** Custom elements ***/

//Markdown editor
.CodeMirror {
    font-family: "Consolas", monospace !important;
    background-color: @bg !important;
    color: @fg !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    border-left: 1px solid @fg-twenty !important;
    border-right: 1px solid @fg-twenty !important;
    border-radius: 0 !important;
    caret-color: white;

    .cm-link {
        color: @pastel-cyan !important;
    }

    .cm-url {
        color: @li !important;
    }

    .cm-tag {
        color: @pastel-magenta !important;
    }

    .cm-strong {
        color: @pastel-yellow !important;
    }

    .cm-em {
        color: @pastel-orange !important;
    }

    .cm-quote {
        color: @pastel-lime !important;
    }

    .cm-comment {
        color: lightgray !important;
    }

    .cm-header {
        color: @ec !important;
    }

    .CodeMirror-cursor {
        border-left: 1px solid @fg !important;
    }
}
.editor-toolbar, .editor-statusbar {
    background-color: @fg-ten-hard !important;
    color: @fg !important;
    opacity: 1 !important;

    a {
        color: @fg !important;
        border: 0 !important;

        &:hover {
            background-color: @fg-twenty !important;
            color: lighten(@fg, 25%) !important;
        }

        &.active {
            background-color: fade(@fg, 30%) !important;
            color: white !important;

            &:hover {
                background-color: @fg-twenty !important;
                color: lighten(@fg, 25%) !important;
            }
        }
    }

    .fas, .far, .fab {
        color: @fg !important;

        &:hover {
            color: @fg !important;
        }

        &:active {
            color: white !important;
        }
    }
}
.editor-toolbar {
    border-top: 1px solid @fg-twenty-hard !important;
    border-left: 1px solid @fg-twenty-hard !important;
    border-right: 1px solid @fg-twenty-hard !important;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}
.editor-statusbar {
    border-bottom: 1px solid @fg-twenty-hard !important;
    border-left: 1px solid @fg-twenty-hard !important;
    border-right: 1px solid @fg-twenty-hard !important;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

//Horizontal container, should contain elements such as main and sidebar
.horizontal-container-main {
    display: flex;
    justify-content: center;
    align-content: center;
    flex-direction: row;

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

//Tripart horizontal container
.columns-3 {
    display: flex;
    justify-content: center;
    align-content: center;
    flex-direction: row;
    flex-wrap: wrap;
    
    .column {
        width: 33.3%;
        min-width: 400px;
    }
}

//Fill the whole parent element and ignore margins
.fill {
    width: 100%;
    height: 100%;
    margin: 0 !important;
}

//Vertical main page container
.vertical-main {
    width: 100%;
    min-width: 400px;
    max-width: 1200px;
}

//A simple box
.box {
    background-color: @fg-ten;
    border-radius: 4px;
    padding: 8px;
    margin: 8px;
}

//A double box
.dbox {
    margin: 8px;

    .dbox-top {
        display: flex;
        justify-content: space-between;
        background-color: @fg-twenty;
        padding: 4px;
        border-radius: 4px 4px 0 0;
        color: @ec;
        font-size: smaller;
        font-weight: bold;
        height: 16px;

        .left {
            align-self: flex-start;
        }

        .right {
            align-self: flex-end;
        }
    }

    .dbox-bot {
        background-color: @fg-ten;
        padding: 8px;
        border-radius: 0 0 4px 4px;
    }
}

//A palette color
.color {
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: inline-block;

    &.color-light {
        border: 1px solid black;
    }

    &.color-dark {
        border: 1px solid white;
    }
}

//Pros and cons of something
.proscons {
    padding: 4px 4px 4px 8px;
    margin: 4px;
    border-radius: 4px;

    //noinspection CssNoGenericFontName
    &.plus {
        color: @pastel-lime;
        background-color: fade(@pastel-lime, 10%);

        &::before {
            font-family: "Font Awesome 5 Free";
            font-weight: bold;
            content: "\f0fe";
            margin-right: 6px;
        }
    }

    //noinspection CssNoGenericFontName
    &.minus {
        color: @pastel-red;
        background-color: fade(@pastel-red, 10%);

        &::before {
            font-family: "Font Awesome 5 Free";
            font-weight: bold;
            content: "\f146";
            margin-right: 6px;
        }
    }

    //noinspection CssNoGenericFontName
    &.stars {
        background-color: fade(@pastel-yellow, 10%);
        color: @pastel-yellow;
        display: flex;

        .stars-0 {
            margin-right: 6px;

            &::after {
                font-family: "Font Awesome 5 Free";
                font-weight: normal;
                content: "\f005\f005\f005\f005\f005";
            }
        }

        .stars-1 {
            margin-right: 6px;

            &::before {
                font-family: "Font Awesome 5 Free";
                font-weight: bold;
                content: "\f005";
            }

            &::after {
                font-family: "Font Awesome 5 Free";
                font-weight: normal;
                content: "\f005\f005\f005\f005";
            }
        }

        .stars-2 {
            margin-right: 6px;

            &::before {
                font-family: "Font Awesome 5 Free";
                font-weight: bold;
                content: "\f005\f005";
            }

            &::after {
                font-family: "Font Awesome 5 Free";
                font-weight: normal;
                content: "\f005\f005\f005";
            }
        }

        .stars-3 {
            margin-right: 6px;

            &::before {
                font-family: "Font Awesome 5 Free";
                font-weight: bold;
                content: "\f005\f005\f005";
            }

            &::after {
                font-family: "Font Awesome 5 Free";
                font-weight: normal;
                content: "\f005\f005";
            }
        }

        .stars-4 {
            margin-right: 6px;

            &::before {
                font-family: "Font Awesome 5 Free";
                font-weight: bold;
                content: "\f005\f005\f005\f005";
            }

            &::after {
                font-family: "Font Awesome 5 Free";
                font-weight: normal;
                content: "\f005";
            }
        }

        .stars-5 {
            margin-right: 6px;

            &::before {
                font-family: "Font Awesome 5 Free";
                font-weight: bold;
                content: "\f005\f005\f005\f005\f005";
            }
        }
    }

    //noinspection CssNoGenericFontName
    &:not(.plus):not(.minus):not(.stars) {
        color: @fg;
        background-color: @fg-ten;

        &::before {
            font-family: "Font Awesome 5 Free";
            font-weight: bold;
            content: "\f0c8";
            margin-right: 6px;
        }
    }

    &.label-big {
        font-size: xx-large;
    }
}

//A spoiler
.spoiler {
    color: transparent;
    background-color: fade(@pastel-red, 10%);
    border: 1px solid fade(@pastel-red, 10%);
    border-radius: 2px;
    padding: 4px;

    b, strong, i, em {
        color: inherit;

        &:hover {
            color: inherit;
        }
    }

    &blockquote {
        border-radius: 2px;
        padding: 4px;
    }

    &:hover {
        color: @pastel-red;
    }
}

//Wiki page
.wiki, .profile-bio {
    .wiki-doublebox {
        .dbox-bot {
            background-color: transparent;
            border-top: 0;
            border-bottom: 4px solid @fg-twenty;
            border-left: 4px solid @fg-twenty;
            border-right: 4px solid @fg-twenty;

            .wikiview-title {
                text-align: center;
                font-size: 42px;
                margin-top: 0;
            }
        }
    }

    h1, h2, h3, h4, h5, h6 {
        margin-top: revert;
        margin-bottom: revert;
    }
}

//An error
.error {
    .error-dbox {
        .dbox-top {
            background-color: fade(@pastel-red, 20%);
            color: @pastel-red;
        }

        .dbox-bot {
            background-color: fade(@pastel-red, 10%);
            color: @pastel-red;
        }
    }
}

//A diario entry
.diario {
    display: grid;
    grid-template-columns: auto auto 40px;

    .diario-content {
        grid-row: 1;
        grid-column-start: 1;
        grid-column-end: 4;

        .diario-img img {
            color: red;
            margin-top: 2px;
            margin-bottom: 2px;
            max-height: 400px;
        }

        .diario-text {
            margin-top: 2px;
            margin-bottom: 2px;
        }
    }

    .diario-quote {
        grid-row: 2;
        grid-column-start: 1;
        grid-column-end: 4;
        font-size: small;
        margin-top: 2px;
        margin-bottom: 2px;

        .diario-context {
            font-style: italic;
        }
    }

    .diario-timestamp {
        grid-row: 3;
        grid-column: 1;
        font-size: x-small;
        margin-top: 2px;
        margin-bottom: 2px;
    }

    .diario-created {
        grid-row: 3;
        grid-column: 2;
        justify-self: end;
        font-size: x-small;
        margin-top: 2px;
        margin-bottom: 2px;
    }

    .diario-id {
        grid-row: 3;
        grid-column: 3;
        justify-self: end;
        font-size: x-small;
        margin-top: 2px;
        margin-bottom: 2px;
    }

    &.diario-spoiler {
        color: transparent;
        background-color: fade(@pastel-red, 10%);
        border-left: 3px solid @pastel-red;

        &:hover {
            color: @pastel-red;
        }
    }
}

//Multicolumn lists
ul.multicolumn, ol.multicolumn {
    column-width: 300px;
}


/*** Page specific classes ***/

.mcstatus-grid {
    display: grid;

    grid-template-columns: 64px auto auto;
    grid-column-gap: 12px;

    align-items: center;

    .mcstatus-icon {
        grid-column: 1;
        grid-row-start: 1;
        grid-row-end: 3;
        width: 64px;
        height: 64px;

        .mcstatus-icon-img {
            width: 64px;
            height: 64px;
        }
    }

    .mcstatus-address {
        font-weight: bold;

        grid-column: 2;
        justify-self: start;
        grid-row: 1;

        .server-up {
            color: @pastel-lime;
        }

        .server-down {
            color: @pastel-red;
        }
    }

    .mcstatus-description {
        grid-column: 2;
        justify-self: start;
        grid-row: 2;
    }

    .mcstatus-players {
        grid-column: 3;
        justify-self: end;
        grid-row: 1;
    }

    .mcstatus-version {
        grid-column: 3;
        justify-self: end;
        grid-row: 2;
    }
}

.profile {

    .profile-links {

        .links-linked {
            font-family: @monospace-fonts;
        }

        .links-missing {
            color: @pastel-red;
        }
    }

    .profile-stats {

        .stats-value {
            font-weight: bold;
        }
    }
}

.tg-login-container {
    width: 238px;
    height: 40px;
}
