@import '../arch_definitions';

/* hide logo text, but keep its box in the layout */
#p-logo-text {
    visibility: hidden;
}

/* let body take the full height so its background applies in dark mode */
body {
    height: 100%;
}

/* make room for archnavbar and disable fixed searchbar */
#mw-content-container {
    margin-top: 0;
}
#mw-content-container {
    border-bottom: none;
    padding-top: .5em;
    background-color: var(--archwiki-body-background-color);
    background-image: none;
}
#mw-header-hack, #mw-header-nav-hack {
    display: none !important;
}
#mw-header-container {
    position: initial;
    background: var(--archwiki-body-background-color);
}
#mw-content {
    border: var(--archwiki-content-border-style);
    border-color: var(--archwiki-content-border-color);
}
#content {
    border: none;
    background: transparent;
}

/* integrate footer into page background */
#mw-footer {
    margin-top: 1em;
    margin-bottom: 1em;
    padding-left: 16em;
    padding-right: 18em;
}
#mw-footer > * {
    font-size: .8em;
}
.mw-footer-container {
    border-top: none;
    line-height: 1;
    color: inherit;
    box-shadow: none;
}
.mw-footer-container a, a {
    color: var(--archwiki-link-color-normal);
    &:active {
        color: var(--archwiki-link-color-active);
    }
    &:hover {
        color: var(--archwiki-link-color-hover);
    }
    &:visited {
        color: var(--archwiki-link-color-visited);
        &:hover {
            color: var(--archwiki-link-color-hover);
        }
    }
}

/* reset special border of the page title */
.mw-body {
    h1.firstHeading {
        border-bottom: solid 3px #c8ccd1;
    }
}

/* change MediaWiki's @blue color to Arch's blue */
.suggestions {
    .suggestions-result-current {
        background-color: var(--archwiki-link-color-normal);
    }
}
.tools-inline li.selected {
    border-bottom-color: var(--archwiki-link-color-normal);
}

// reset hardcoded white-on-blue colors to black-on-gray as in Vector
// (this affects e.g. the "Compare selected revisions" button on the history page)
body.skin-timeless form:not( .oo-ui-layout ) {
    button,
    input[ type='submit' ] {
        background-color: #f8f9fa;
        color: #202122;
        border-color: #a2a9b1;

        &:not( :disabled ):hover,
        &:not( :disabled ):active {
            background-color: #ffffff;
            color: #404244;
        }
    }
}


/* fixes for specific widths */
@media screen and (max-width:1339px) {
    #mw-footer {
        padding-right: 1em;
    }
}
@media screen and (min-width:851px) and (max-width:1099px) {
    #p-logo-text {
        display: none;
    }
    #mw-footer {
        padding-left: 1em;
    }
    #mw-content {
        margin-top: 1.75em;
    }
    /* avoid relative and absolute positioning, set the layout using grid */
    #mw-content-block {
        position: unset;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto;
        /* content takes all columns on second row */
        #mw-content-wrapper {
            grid-row: 2;
            grid-column-start: 1;
            grid-column-end: -1;
            /* remove margin that was for relative/absolute positioning */
            #mw-content {
                margin-top: 0;
            }
        }
        /* Navigation, Wiki tools and Page tools take columns in the first row */
        #mw-site-navigation, #mw-related-navigation {
            grid-row: 1;
            position: unset;
            top: unset;
            left: unset;
            right: unset;
        }
        /* align navigation to the search box */
        #mw-site-navigation {
            margin-left: 2em;
        }
        /* Swap left and right margins since it is aligned to the left */
        #mw-related-navigation > * {
            margin-left: 0em;
            margin-right: 1em;
        }
    }
}
@media screen and (max-width:850px) {
    #p-logo-text {
        display: none;
    }
    #mw-footer {
        padding-left: 1em;
    }
    #site-navigation h2, #site-tools h2, #user-tools h2, #personal-extra {
        top: 75px;
    }
    .sidebar-inner, .dropdown {
        top: 7.75em;
    }
    #menus-cover {
        top: 65px;
    }
    /* reset background for the box with category links (placed below the content) */
    #mw-content-block {
        background: var(--archwiki-body-background-color);
    }
}


// Assign consistent "indentation" margin to definition lists
// (upstream rule disappeared after MediaWiki 1.43 upgrade)
@media screen {
    dd {
        margin-left: 1.6em;
    }
}

// Assign consistent border width to tables (Timeless sets 0.2em at the bottom)
body.skin-timeless .wikitable {
    border-width: 1px;
}

// Use the fallback "sans-serif", "serif" and "monospace" names for the fonts
// See also https://phabricator.wikimedia.org/T173228

input {
    font-family: sans-serif;
}

body .mw-editfont-monospace {
    font-family: monospace, monospace;
}

body .mw-editfont-sans-serif {
    font-family: sans-serif;
}

body .mw-editfont-serif {
    font-family: serif;
}

body {
    font-family: sans-serif;
}

#p-logo-text a {
    font-family: sans-serif;
}

.mw-editsection {
    font-family: sans-serif;
}

.skin-timeless .monospace {
    font-family: monospace, monospace;
}

.skin-timeless .serif {
    font-family: serif;
}

.skin-timeless .sans-serif {
    font-family: sans-serif;
}

.mw-body {
    .mw-heading,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    dt {
        font-family: serif;
    }
}

#siteSub {
    font-family: serif;
}

.mw-body .toctitle h2 {
    font-family: sans-serif;
}

#mw-site-navigation,
#mw-related-navigation {
    h2 {
        font-family: serif;
    }
}

#personal h2 {
    font-family: serif;
}

#p-variants-desktop h3 {
    font-family: sans-serif;
}

.wikiEditor-ui-text textarea {
    &.mw-editfont-monospace {
        font-family: monospace, monospace !important;
    }
    &.mw-editfont-sans-serif {
        font-family: sans-serif !important;
    }
    &.mw-editfont-serif {
        font-family: serif !important;
    }
}

@media screen {
    div.CodeMirror, .cm-editor .cm-scroller {
        font-family: monospace, monospace;
    }
}

.ve-ui-mwWikitextSurface .ve-ce-attachedRootNode {
    font-family: monospace, monospace;
}
