/*
 * Common stylesheets applied to all skins.
 */

@import 'arch_definitions';

// hide logo at the top (sidebar or header)
#p-logo,
.mw-logo {
  display: none;
}

// hide logos in the footer
// (they can be disabled in LocalSettings.php by setting $wgFooterIcons)
#footer-icons {
    display: none;
}

// general colors according to Arch definitions
body {
    color: var(--archwiki-text-color);
    background: var(--archwiki-body-background-color);

    table,
    h1,
    h2,
    h3,
    h4,
    h5,
    pre,
    code,
    tt {
        color: var(--archwiki-text-color);
    }
}

#content {
    background: var(--archwiki-content-background-color);
    border: var(--archwiki-content-border-style);
    border-color: var(--archwiki-content-border-color);
}

// article Table of Contents
#toc,
.toc,
.mw-warning,
.toccolours {
    background-color: var(--archwiki-toc-background-color);
    border: var(--archwiki-toc-border-style);
    border-color: var(--archwiki-toc-border-color);
}

// general content styling
// (unlike mw-body-content, this class does not affect pages in the Special: namespace)
.mw-parser-output {
    // Hide <br> elements at the start/end of paragraphs. They are produced by
    // MediaWiki parser when multiple consecutive blank lines appear in the text.
    p > br:is(:first-child, :last-child) {
        display: none;
    }

    // Eliminate useless margin of last-child paragraphs
    p:last-child {
        margin-bottom: 0;
    }

    table {
        border-collapse: collapse;
    }

    td {
        padding: 2px;
    }

    // Assign consistent vertical margin to code blocks
    pre {
        margin: 1em 0;
    }

    pre:not([class*="CodeMirror"]) {
        border: var(--archwiki-code-border-style);
        border-color: var(--archwiki-code-border-color);
        overflow: auto;
        word-break: break-all;
        white-space: pre-wrap !important;
    }

    pre:not([class*="CodeMirror"]),
    code,
    tt {
        background-color: var(--archwiki-code-background-color);
        font-family: monospace, monospace;
    }

    code,
    tt {
        // Inline-block prevents code from wrapping when starting too close to
        // the end of a line; it also lets select the entire code line with a
        // triple click
        display: inline-block;
        padding: 0 0.3em;
        // A border would be inherited by the default style sheets, but we
        // do not want it
        border-width: 0;
        border-radius: 0;
    }

    // Make all links coming from the rendered wiki markup bold
    a {
        font-weight: bold;
    }
    #toc a {
        font-weight: normal;
    }

    // Use the same icon for all external links
    // The default MediaWiki style assigns icons only to external links and not
    // interwiki links, so we use this to have an icon for all links pointing
    // to external sites.
    a.external, a.extiw {
        background: url(../../../resources/src/mediawiki.skinning/images/external-ltr.svg) center right no-repeat;
        padding-right: 13px;
    }
}

/* Colors of links */
a {
	color: var(--archwiki-link-color-normal);
	&:visited {
		color: var(--archwiki-link-color-visited);
	}
	&:active {
		color: var(--archwiki-link-color-active);
	}
}
#content,
header.mw-header li:not(.new), // Vector
#mw-panel-toc,                // Vector
#mw-navigation li:not(.new),  // Legacy Vector
#mw-panel li:not(.new),       // Legacy Vector
#footer {
  a:not([role=button]) {
    &:not(.new) {
      text-decoration: none;
      color: var(--archwiki-link-color-normal) !important;
      &:hover {
        text-decoration: underline;
        background-color: transparent;
        color: var(--archwiki-link-color-hover) !important;
      }
    }

    &:active, &:focus,
    /* a:hover overrides a:active, which we don't want' */
    &:active:hover, &:focus:hover {
      color: var(--archwiki-link-color-active) !important;
    }
  }
}

/* Color of visited links for content and left column
 * (not for MediaWiki navigation elements above the page) */
#content,
#mw-panel li:not(.new)      // Legacy Vector
{
  a:not(.new):not([role=button]):visited {
    color: var(--archwiki-link-color-visited) !important;
  }
}

/* Color for links to inexistent pages */
a.new,
a.new:visited,
#mw-navigation li.new a,         // Vector
#mw-navigation li.new a:visited  // Vector
{
    color: var(--archwiki-link-color-new) !important;
}
