/*
 * RAWR4Firefall
 *
 * Plain CSS, no framework and no build step. What you see here is what gets served.
 * Styles that only one template needs live in templates/<template>.css and are loaded on that template only.
 */

/* Tokens */

:root {
    --color-bg: #0a0a09;
    --color-surface: #1b1a19;
    --color-surface-hover: #2b2928;
    --color-slate: #30353a;
    --color-slate-dark: #292d32;
    --color-accent: #f78f0b;
    --color-accent-light: #fabc6e;
    --color-text: #ccc;
    --color-heading: #eee;
    --color-muted: #8c8c8c;
    --color-line: rgb(255 255 255 / 15%);
    --color-info: #3498db;
    --color-success: #2ecc71;
    --color-warning: #f1c40f;
    --color-danger: #fbb106;

    --font-sans: "Lato", Helvetica, Arial, sans-serif;
    --font-mono: Consolas, "Cascadia Mono", "SF Mono", Menlo, monospace;

    --measure: 46em; /* ~75 characters per line */
    --gutter: 30px;
    --radius: 5px;
    --nav-height: 53px;
}

/* Fonts */

@font-face {
    font-family: "Lato";
    src: url("../fonts/lato-light-webfont.woff") format("woff"), url("../fonts/lato-light-webfont.ttf") format("truetype");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Lato";
    src: url("../fonts/lato-regular-webfont.woff") format("woff"), url("../fonts/lato-regular-webfont.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Lato";
    src: url("../fonts/lato-italic-webfont.woff") format("woff"), url("../fonts/lato-italic-webfont.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Lato";
    src: url("../fonts/lato-black-webfont.woff") format("woff"), url("../fonts/lato-black-webfont.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Base */

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

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* The padding is used by the fixed navigation, the column keeps the footer at the bottom of short pages */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding-top: var(--nav-height);
    background: var(--color-surface) top center repeat-y;
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;

    /* The background images frame the container, so there's one for each of its widths */
    @media (min-width: 768px) {
        background-color: var(--color-bg);
        background-image: url("../images/bg/small.png");
    }

    @media (min-width: 992px) {
        background-image: url("../images/bg/medium.png");
    }

    @media (min-width: 1200px) {
        background-image: url("../images/bg/large.png");
    }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 1.5em 0 .4em;
    color: var(--color-heading);
    font-weight: 700;
    line-height: 1.25;

    &:first-child {
        margin-top: 0;
    }

    small {
        color: #e6e7e7;
    }
}

h1,
h2,
h3 {
    margin: 1.6em 0 .5em;
}

h1 { font-size: 32px; }
h2 { font-size: 26px; }
h3 { font-size: 22px; }
h4 { font-size: 19px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

h5,
h6 {
    letter-spacing: .5px;
    text-transform: uppercase;
}

p {
    margin: 0 0 .9em;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color .25s, background-color .25s;

    &:hover,
    &:focus {
        color: var(--color-accent-light);
    }
}

:focus-visible {
    outline: 2px solid var(--color-accent-light);
    outline-offset: 2px;
}

ul,
ol {
    margin: 0 0 10px;

    ul,
    ol {
        margin-bottom: 0;
    }
}

small {
    font-size: 85%;
    line-height: 1.5;
}

sub,
sup {
    position: relative;
    font-size: 75%;
    line-height: 0;
    vertical-align: baseline;
}

sup { top: -.5em; }
sub { bottom: -.25em; }

hr {
    height: 0;
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #7d8083;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* A table sizes its columns by their content, a relative width would let the images collapse */
td img,
th img {
    max-width: none;
}

figure {
    margin: 0;

    img {
        display: block;
    }
}

blockquote {
    margin: 0 0 20px;
    padding: 0 0 0 16px;
    border-left: 3px solid #e6e7e7;
    font-size: 20px;

    p {
        margin-bottom: .4em;
        font-size: 18px;
        line-height: 1.55;

        &:last-child {
            margin-bottom: 0;
        }
    }

    footer {
        font-size: 80%;
        line-height: 1.6;

        &::before {
            content: "\2014 \00A0";
        }
    }
}

code,
kbd,
pre {
    font-family: var(--font-mono);
}

code {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-slate);
    color: #e9e9e9;
    font-size: 85%;
}

pre {
    margin: 0 0 20px;
    padding: 12px 15px;
    overflow: auto;
    border-radius: var(--radius);
    background: var(--color-surface);
    font-size: 14px;
    line-height: 1.5;

    code {
        padding: 0;
        background: none;
        font-size: inherit;
    }
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

th {
    text-align: left;
}

button {
    font: inherit;
}

/* Lines of text stay readable, everything else may use the full width */
:is(.layout-guide, .layout-static, .layout-news, .layout-home) #layout-content :is(p, blockquote, ul:not([class]), ol:not([class])) {
    max-width: var(--measure);
}

/* Utilities */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.list-unstyled {
    padding-left: 0;
    list-style: none;
}

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

/* Layout */

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;

    @media (min-width: 768px) { max-width: 750px; }
    @media (min-width: 992px) { max-width: 970px; }
    @media (min-width: 1200px) { max-width: 1170px; }
}

.title img {
    display: block;
    margin: 0 auto;
}

.headline {
    position: relative;
    margin: 10px 0 20px;
    color: #e9e9e9;
    font-size: 24px;

    @media (max-width: 767px) {
        font-size: 20px;
    }

    /* Headings drop their margin at the top of a block, the headline keeps its distance to the title */
    &:first-child {
        margin-top: 10px;
    }

    /* The line runs behind the label */
    &::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        width: 100%;
        border-top: 2px solid var(--color-accent);
    }

    > span {
        display: inline-block;
        position: relative;
        padding: 0 15px;
        border-radius: var(--radius);
        background: var(--color-accent);
    }
}

/* Navigation */

.site-nav {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    background: var(--color-slate);

    > .container {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }
}

.site-brand {
    display: flex;
    align-items: center;
    height: var(--nav-height);
    padding-left: 50px;
    background: url("../images/logos/letter64.png") 0 50% / auto 75% no-repeat;
    color: #fff;
    font-size: 22px;
    font-weight: 700;

    @media (min-width: 768px) {
        margin-left: -11px;
    }

    &:hover,
    &:focus {
        color: var(--color-accent);
    }
}

.site-nav-toggle {
    display: none;
    width: var(--nav-height);
    height: var(--nav-height);
    margin-right: -15px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;

    .bar {
        display: block;
        width: 20px;
        height: 3px;
        margin: 4px auto;
        border-radius: 1px;
        background: #fff;
        transition: background-color .25s;
    }

    &:hover .bar,
    &:focus .bar {
        background: var(--color-accent);
    }
}

.site-menu {
    display: flex;
    margin: 0 -21px 0 0;
    padding: 0;
    list-style: none;

    > li {
        position: relative;

        > a {
            display: flex;
            align-items: center;
            height: var(--nav-height);
            padding: 0 21px;
            color: #fff;

            &:hover,
            &:focus {
                color: var(--color-accent);
            }
        }

        &.active > a,
        &.open > a {
            background: var(--color-accent);
            color: #fff;
        }
    }

    .caret {
        margin-left: 6px;
        border: solid transparent;
        border-width: 8px 6px 0;
        border-top-color: #4a4c4e;
        transition: border-color .25s;
    }

    a:hover .caret,
    a:focus .caret {
        border-top-color: var(--color-accent);
    }

    .active > a .caret,
    .open > a .caret {
        border-top-color: #fff;
    }
}

.site-submenu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 100%;
    margin: 0;
    padding: 3px 4px;
    list-style: none;
    border-radius: 0 0 6px 6px;
    background: var(--color-slate);
    white-space: nowrap;

    /* Closed menus stay in the page, so they can fade */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .25s, transform .25s, visibility .25s;

    .open > & {
        visibility: visible;
        opacity: 1;
        transform: none;
    }

    a {
        display: block;
        padding: 6px 9px;
        border-radius: 4px;
        color: #e0e1e1;

        &:hover,
        &:focus {
            background: var(--color-accent);
            color: #fff;
        }
    }

    .active > a {
        color: #fff;
        font-weight: 700;
    }

    .divider {
        height: 2px;
        margin: 3px -4px;
        background: var(--color-slate-dark);
    }
}

.site-submenu-header {
    margin-top: 6px;
    padding: 10px 9px 2px;
    border-top: 1px solid rgb(255 255 255 / 12%);
    color: var(--color-accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* On a phone the menu folds into a list below the bar */
@media (max-width: 767px) {
    .site-nav-toggle {
        display: block;
    }

    .site-menu {
        display: none;
        flex: 0 0 auto;
        flex-direction: column;
        width: calc(100% + 30px);
        max-height: calc(100vh - var(--nav-height));
        margin: 0 -15px;
        padding: 3px 0;
        overflow-y: auto;
        border-top: 2px solid var(--color-slate-dark);

        .site-nav.open & {
            display: flex;
        }

        > li > a {
            height: auto;
            padding: 7px 21px;
        }
    }

    .site-submenu {
        display: none;
        position: static;
        padding: 0;
        border-radius: 0;
        background: none;
        visibility: visible;
        opacity: 1;
        transform: none;
        transition: none;

        .open > & {
            display: block;
        }

        a {
            padding: 7px 15px 7px 31px;
            border-radius: 0;
            color: #fff;

            &:hover,
            &:focus {
                background: none;
                color: var(--color-accent);
            }
        }

        .divider {
            margin: 3px 0;
        }
    }

    .site-submenu-header {
        padding-left: 31px;
    }
}

/* Footer */

#layout-footer {
    margin-top: auto;
    padding: 20px 0;
    color: #bdc3c7;
    line-height: 25px;

    a {
        color: #bdc3c7;

        &:hover,
        &:focus {
            color: #979c9f;
        }
    }

    .no-mobile {
        display: none;
    }

    nav ul {
        display: flex;
        gap: 25px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .additional-links {
        font-size: 12px;

        a {
            text-decoration: underline;
        }
    }

    .social-icons {
        justify-content: flex-end;
        gap: 15px;

        a {
            color: #979c9f;

            &:hover,
            &:focus {
                color: var(--color-accent);
            }
        }

        svg {
            display: block;
            width: auto;
            height: 20px;
        }
    }

    @media (min-width: 768px) {
        .footer-row {
            display: grid;
            grid-template-columns: 5fr 5fr 2fr;
            gap: var(--gutter);
            align-items: center;
        }

        .no-mobile {
            display: block;
        }

        .social-icons {
            display: flex;
        }
    }

    @media (min-width: 992px) {
        .additional-links {
            text-align: center;
        }
    }
}

/* Tables */

.table {
    width: 100%;
    margin-bottom: 20px;

    th,
    td {
        padding: 8px;
        border-top: 1px solid var(--color-line);
        vertical-align: top;
    }

    thead th {
        border-top: 0;
        border-bottom: 2px solid var(--color-line);
        vertical-align: bottom;
    }
}

.table-hover tbody tr:hover > * {
    background: var(--color-surface);
}

/* Wide tables scroll on their own instead of with the page */
.table-responsive {
    overflow-x: auto;
}

/* Alerts */

.alert {
    margin-bottom: 20px;
    padding: 12px 15px;
    border-left: 4px solid var(--color-info);
    border-radius: var(--radius);
    background: var(--color-surface);
    font-size: 14px;

    p {
        max-width: none !important;
        margin: 0;
        line-height: 1.5;

        + p {
            margin-top: 5px;
        }
    }

    .close {
        float: right;
        margin-left: 10px;
        padding: 0;
        border: 0;
        background: none;
        color: var(--color-muted);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;

        &:hover,
        &:focus {
            color: var(--color-text);
        }
    }
}

.alert-success { border-left-color: var(--color-success); }
.alert-warning { border-left-color: var(--color-warning); }
.alert-danger { border-left-color: var(--color-danger); }

/* Pagination */

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 30px 0 20px;
    padding: 0;
    list-style: none;

    a,
    span {
        display: block;
        min-width: 40px;
        padding: 7px 14px;
        border-radius: var(--radius);
        background: var(--color-slate);
        color: var(--color-text);
        font-size: 15px;
        text-align: center;
    }

    a:hover,
    a:focus {
        background: var(--color-slate-dark);
        color: var(--color-accent);
    }

    .active a {
        background: var(--color-accent);
        color: #fff;
        font-weight: 700;
    }

    /* There's no page to go to at either end */
    .disabled span {
        background: none;
        color: var(--color-muted);
    }
}

/* News */

.post-list {
    list-style: none;

    @media (max-width: 767px) {
        padding-left: 0;
    }

    > li {
        clear: both;
        margin-bottom: 20px;
        overflow: auto;
        border-bottom: 2px solid var(--color-accent);
    }

    img {
        float: left;
        margin: 0 20px 20px 0;
    }

    .post-cover {
        width: 33.3333%;
        padding: 0 15px;

        @media (min-width: 992px) {
            width: 25%;
        }
    }

    .date {
        color: #808080;
        font-size: 12px;
    }
}

.post {
    clear: both;
    margin-bottom: 40px;
    overflow: auto;

    .post-info {
        color: #808080;
        font-size: 12px;
    }

    img {
        float: right;
    }

    .post-cover {
        width: 100%;
        padding: 0 15px;

        @media (min-width: 768px) {
            width: 33.3333%;
        }
    }
}

/* Guides */

.guide-layout {
    @media (min-width: 992px) {
        display: grid;
        grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
        gap: var(--gutter);
        align-items: start;
    }
}

.guide-breadcrumb {
    margin: -10px 0 15px;
    padding: 0;
    list-style: none;
    font-size: 13px;

    li {
        display: inline-block;

        + li::before {
            content: "/\00a0";
            padding: 0 5px;
            color: var(--color-muted);
        }
    }

    .active {
        color: var(--color-muted);
    }
}

.guide-version {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding: 12px 15px;
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius);
    background: var(--color-surface);

    @media (max-width: 767px) {
        display: block;
    }

    p {
        max-width: none !important;
        margin: 0;
        font-size: 14px;
        line-height: 1.5;
    }
}

.guide-version-badge {
    flex: none;
    margin-right: 20px;
    color: var(--color-accent);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;

    @media (max-width: 767px) {
        margin: 0 0 8px;
        text-align: left;
    }

    small {
        display: block;
        margin-top: 4px;
        color: var(--color-text);
        font-size: 11px;
        letter-spacing: 1px;
        text-transform: uppercase;
    }
}

/* The last version of the game doesn't need the warning color */
.guide-version-current {
    border-left-color: var(--color-muted);

    .guide-version-badge {
        color: var(--color-text);
    }
}

.guide-text {
    /* Contains the floated figures */
    &::after {
        content: "";
        display: table;
        clear: both;
    }

    [id] {
        scroll-margin-top: 70px;
    }

    figure {
        clear: both;
        margin: 0 0 20px;
    }

    /* Text flows around aligned images, a line ends the flow */
    .figure-left,
    .figure-right {
        max-width: 40%;

        @media (max-width: 767px) {
            float: none !important;
            max-width: 100%;
            margin: 0 0 20px !important;
        }
    }

    .figure-left {
        float: left;
        margin: 5px 25px 15px 0;
    }

    .figure-right {
        float: right;
        margin: 5px 0 15px 25px;
    }

    hr {
        clear: both;
        margin: 0;
        border: 0;
    }

    blockquote {
        border-left-color: var(--color-accent);
        font-size: inherit;
    }

    .table-responsive {
        clear: both;
        margin-bottom: 20px;
    }

    /* The tables take their colors from the game */
    table {
        width: 100%;

        th,
        td {
            padding: 4px 8px;
            border: 1px solid #0f0f0e;
        }

        th {
            background: #3a3a3a;
            color: #ffd800;
            font-weight: 400;
            text-align: center;
        }

        td {
            background: #2b2b2b;
        }

        small {
            color: var(--color-muted);
        }
    }

    .guide-table-icons td {
        vertical-align: middle;

        &:empty,
        &:has(> .guide-icon:only-child) {
            width: 1%;
            text-align: center;
            white-space: nowrap;
        }
    }
}

.guide-icon {
    width: 40px;
    height: 40px;
    vertical-align: middle;
}

.guide-icon-small {
    width: 24px;
    height: 24px;
}

.guide-icon-large {
    float: left;
    width: 64px;
    height: 64px;
    margin: 0 12px 6px 0;
}

.guide-menu {
    margin-bottom: 20px;
    padding: 5px 15px 10px;
    border-left: 4px solid var(--color-muted);
    border-radius: var(--radius);
    background: var(--color-surface);
    font-size: 14px;

    @media (min-width: 992px) {
        position: sticky;
        top: 70px;
        max-height: calc(100vh - 90px);
        overflow-y: auto;
    }

    h5 {
        margin: 15px 0 5px;
        color: var(--color-muted);
        font-size: 11px;
        letter-spacing: 1px;
    }

    ul {
        margin: 0;
    }

    li {
        padding: 2px 0;
        line-height: 1.4;

        &.active a {
            color: var(--color-text);
            font-weight: 700;
        }
    }
}

.guide-menu-page a {
    color: var(--color-text);
}

.guide-chapters {
    margin-top: 20px;

    li.active a {
        color: var(--color-text);
        font-weight: 700;
    }
}

.guide-chapters-pager {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;

    a {
        padding: 8px 15px;
        border-radius: 6px;
        background: var(--color-slate);
        color: #fff;

        &:hover,
        &:focus {
            background: var(--color-slate-dark);
        }
    }

    .next {
        margin-left: auto;
    }
}

.guide-pager {
    display: flex;
    justify-content: space-between;
    margin: 25px 0 20px;

    a {
        flex: 0 1 48%;
        padding: 10px 15px;
        border-radius: var(--radius);
        background: var(--color-surface);
        color: var(--color-text);

        &:hover,
        &:focus {
            background: var(--color-surface-hover);
        }
    }

    small {
        display: block;
        color: var(--color-muted);
        font-size: 11px;
        letter-spacing: 1px;
        text-transform: uppercase;
    }

    strong {
        display: block;
        color: var(--color-accent);
        font-size: 17px;
        line-height: 1.3;
    }
}

.guide-pager-previous {
    border-left: 4px solid var(--color-accent);
}

.guide-pager-next {
    margin-left: auto;
    border-right: 4px solid var(--color-accent);
    text-align: right;
}

.guide-group {
    scroll-margin-top: 70px;
}

.guide-cards {
    display: grid;
    gap: 15px var(--gutter);
    margin-bottom: 25px;

    @media (min-width: 768px) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    @media (min-width: 992px) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.guide-card {
    display: block;
    position: relative;
    min-height: 92px;
    padding: 12px 15px 12px 79px;
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);

    &:hover,
    &:focus {
        background: var(--color-surface-hover);
        color: var(--color-text);
    }

    img {
        position: absolute;
        top: 14px;
        left: 12px;
        width: 56px;
        height: 56px;
    }

    strong {
        display: block;
        margin-bottom: 3px;
        color: var(--color-accent);
        font-size: 17px;
    }

    span {
        display: block;
        font-size: 13px;
        line-height: 1.4;
    }
}

.guide-list {
    .guide-list-version {
        display: inline-block;
        min-width: 85px;
        color: var(--color-accent);
        font-weight: 700;
    }

    small {
        color: var(--color-muted);
    }
}

/* Battleframes */

.guide-frames {
    display: flex;
    flex-wrap: wrap;
    margin: 0 0 25px;
    padding: 10px 15px;
    border-radius: var(--radius);
    background: var(--color-surface);

    h5 {
        margin: 5px 0;
        color: var(--color-muted);
        font-size: 11px;
        letter-spacing: 1px;
    }

    li {
        padding: 2px 0;
        font-size: 14px;
        white-space: nowrap;

        &.active a {
            color: var(--color-text);
            font-weight: 700;
        }
    }

    img {
        width: 20px;
        height: 20px;
        margin-right: 4px;
        object-fit: contain;
    }
}

.guide-frames-archtype {
    flex: 1 0 150px;
    padding: 5px 10px 5px 0;
}

/* Two archtypes next to each other, each with its text and its render */
.archtypes {
    display: grid;
    gap: 0 var(--gutter);

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

.archtype {
    @media (min-width: 768px) {
        display: grid;
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        gap: var(--gutter);

        /* An archtype with a row of its own sits in the middle */
        &.archtype-centered {
            grid-column: 1 / -1;
            justify-self: center;
            width: calc(50% - var(--gutter) / 2);
        }
    }

    img {
        display: block;
    }
}

.frame-cards {
    display: grid;
    gap: 0 var(--gutter);

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

/* The card of a battleframe followed by its description */
.frame-intro {
    @media (min-width: 768px) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
        gap: var(--gutter);
    }
}

.frame-card {
    .frame-card-stats {
        @media (min-width: 768px) {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: var(--gutter);
        }
    }

    .frame-card-name {
        text-align: center;
    }
}

.img-small-bf {
    display: block;
    width: auto;
    height: 235px;
    margin: 0 auto;
}

.img-small-ico {
    height: 30px;
}
