MediaWiki:Common.less/mainpage.less

From Old School RuneScape Wiki
Jump to: navigation, search
// <pre>
/* ===================
        MAIN PAGE
   =================== */

// @TODO: switch to grid for layout with flexbox fallback

/* ===================
        variables
   =================== */

@mp-text-light: fade( @white, 90% );
@mp-border-color: @mystic;
@mp-gutter-width: .9rem;

/* ===================
          mixins
   =================== */

// background-image support for high DPI screens
// (not currently used)
.bg-image(@filename; @width: 400; @2xwidth: @width*2;) {
    background-image: url('filepath://@{filename}[email protected]{width}' );

    @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
        background-image: url('filepath://@{filename}[email protected]{2xwidth}' );
    }

}
.mainpage-poll {
	background:#91689E;
	border:none;
}

// skill training colors
.skill-color(@color) {

    // icon
    a:first-child {
        background: desaturate( lighten( @color, 15% ), 20% );
    }

    // skill name
    &:hover a:last-child {
        background: @color;
    }

}

/* ==========================
      page-specific styles
   ========================== */

body.page-Old_School_RuneScape_Wiki {

    // limit max width for readability
    // don't use #mw-content-text because it includes the editform
    .mw-parser-output {
        max-width: 75em;
        margin: 0 auto;
    }

    // not when editing
    &.action-view {

        .catlinks,
        #contentSub,
        // hide pagetitle in favor of .mainpage-header
        #firstHeading,
        // anything listed in the sitenotice should already be on the main page
        #siteNotice {
            display: none;
        }

    }

}

/* ====================
      general styles
   ==================== */

.mainpage-header {
    display: flex;
    margin: 2.6em 1.75em 1.5em;

    .header-intro {
        flex: 2;

        h1 {
            font-size: 2.5em;
            font-weight: bold;
            border: none;
            margin: 0 0 .15em;
        }

        p {
            font-size: 1.1em;
            line-height: 1.7em;
        }

    }

    .header-stats {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-top: -1em;

        ul {
            list-style: none;
        }

    }

}

// main sections
.mainpage-body {
    display: flex;
    flex-flow: row wrap;

    h2 a {
        color: @base-heading-color; // from [[MediaWiki:Common.less/elements.less]]
    }

    .tile {
        padding-left: 1.75em;
        padding-right: 1.75em;
        max-width: 100%;
    }

    .tile-row {
        width: 100%;
        margin-bottom: @mp-gutter-width;
    }

}

// left column
.mainpage-left {
    flex: 2;
    display: flex;
    flex-flow: column wrap;
    margin-right: @mp-gutter-width;

    > * {
        margin: 0 0 @mp-gutter-width;
    }

}

// right column
.mainpage-right {
    flex: 1;
    display: flex;
    flex-flow: column wrap;

    > * {
        margin: 0 0 @mp-gutter-width;
    }

}

/* ====================
        components
   ==================== */

.arrow {
    background: url('filepath://White-chevron.svg') no-repeat;
    display: inline-block;
    height: .7rem;
    width: .45rem;
    vertical-align: middle;

    &.dark {
        filter: invert(80%);
    }

}

// remove after one month
.ribbon {
    position: absolute;
    right: -0.5em;
    top: -0.5em;
    color: @white;
    background: @lima;
    font-size: .7em;
    font-weight: bold;
    letter-spacing: .045em;
    line-height: 2.25em;
    padding: 0 .55em;
    border-radius: .35em;
    box-shadow: @box-shadow;
    pointer-events: none;
}

/* =============================
      section-specific styles
   ============================= */

/* --------------------
      recent updates
   -------------------- */
   
// big tile
.tile.big-tile {
	width: 100%;
    background: linear-gradient(to left, fade( @tile-background-color, 0%), fade( @tile-background-color, 75%), @tile-background-color 40%), url("filepath://Main page Twisted League.png") right / auto 100% no-repeat @white;
    margin-bottom: @mp-gutter-width;
    padding-right: 8vw;
}

.mainpage-recent-updates {

    .tile-halves {
        flex: 1;
        align-content: flex-start;
        margin-right: @mp-gutter-width;

        // zoom on hover
        &:hover .tile-top img {
            transform: scale(1.04);
        }

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

    }

    .tile-bottom.link-button a {
        text-align: left;
        padding: 1rem 1.5rem .75rem;
    }

    h2 {
        margin: -0.5em 0 .3em;
    }

    p:not(.byline) {
        font-size: .9em;
        line-height: 1.75em;
        color: @river-bed;
    }

    .jagex-promotion .byline {
        color: @medium-purple;
    }

}

/* --------------------
      wiki contents
   -------------------- */
@mp-contents-height: 4.5rem;

.mainpage-contents {

    .tile-halves {
        flex: 1;
        margin-right: @mp-gutter-width;

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

    }

    .tile-top {
        height: @mp-contents-height;
        position: relative; // needed for ribbon

        h2 a {
            display: block;
            text-align: center;
            text-decoration: none;
            line-height: @mp-contents-height;
            padding-left: .45rem; // to make up for arrow width
        }

    }

    h2 {
        margin: 0;
        padding: 0;
    }

}

/* --------------------
      skill training
   -------------------- */

.mainpage-skills {

    ul {
        columns: 3;
        margin: 1em .7em .7em 1em;
    }

    // skill row
    li {
        display: flex;
        margin-bottom: .29em;

        a {

            // skill icon
            &:first-child {
                border-radius: 3px;
                padding: 4px;
                width: 25px;
                height: 25px;
                text-align: center;
            }

            // skill text
            &:last-child {
                flex: 1;
                display: flex;
                align-items: center;
                color: @base-text-color; // from [[MediaWiki:Common.less/elements.less]]
                font-weight: bold;
                padding-left: .7em;
                text-decoration: none;
            }

        }

        &:hover a {

            &:first-child {
                border-radius: 3px 0 0 3px;
            }

            &:last-child {
                color: @mp-text-light;
                border-radius: 0 3px 3px 0;
            }

        }

    }

}

.skill-agility,
.skill-melee {
    .skill-color( #932419 ); // red
}

.skill-ranged {
    .skill-color( #4c6215 ); // green
}

.skill-magic {
    .skill-color( #304791 ); // blurple
}

.skill-fishing,
.skill-fletching {
    .skill-color( #1a6671 ); // bluish
}

.skill-cooking,
.skill-thieving {
    .skill-color( #713684 ); // purple
}

.skill-farming,
.skill-woodcutting {
    .skill-color( #306f25 ); // dark green
}

.skill-mining {
    .skill-color( #315f8d ); // dark blue
}

.skill-smithing {
    .skill-color( #b69213 ); // gold
}

/* --------------------
        wiki news
   -------------------- */

.mainpage-wikinews {

    .news-date {
        font-weight: bold;
        margin-bottom: .3em;
    }

    p:not(.news-date) {
        margin-left: 1em;
    }

}

/* --------------------
      popular pages
   -------------------- */

.popular-pages ul {
    display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-gap: .6em;
    margin: 1em 0 .7em 0;
}

// skill row
.mp-popular-page-light {
	display: flex;
	align-items: center;
	list-style: none;
    background-color: #605443;

    a {
    	flex: 1;
    	display: block;
        color: white;
        font-weight: bold;
        text-align: center;
        text-decoration: none;
        padding: .7em 1em;
    }

    &:hover {
        filter: brightness(115%);
        transition: 0.2s;
    }

}

@media screen and (max-width: 1000px) {

	.popular-pages  ul {
		grid-template-columns: repeat(2, 1fr);
	}

}

/* --------------------
    article of the week 
   -------------------- */

.mainpage-articleoftheweek {
    flex: 1; // expands so that the columns match
        a {
            flex: 1;
            position: relative; // allow link to cover icon
            text-decoration: none;

            &:hover .arrow {
                transform: translateX(50%);
            }

        }

    }
/* --------------------
      discord server
   -------------------- */
.mainpage-discord  {
    border: none;
    box-shadow: @box-shadow-dark;

    .tile-top {
        display: flex;
        align-items: center;
        background: @discord-bg;
        padding: 1em 1.75em;

        a {
            flex: 1;
            position: relative; // allow link to cover icon
            text-decoration: none;

            &:hover .arrow {
                transform: translateX(50%);
            }

        }

    }

    .tile-bottom {
        background: @discord-bg-dark;
        border: none;
        padding: 1em 1.75em;

        p {
            color: @white;
            font-weight: bold;
            font-size: .9em;
            text-align: center;
            text-transform: uppercase;
            letter-spacing: .03em;
            margin: 0;
        }

    }

    .partner-icon {
        margin-right: .75em;
    }

    .server-name {
        color: @white;
        font-weight: bold;
        font-size: 1.25em;
        margin: .5em 0 -0.15em;
    }

    .server-tagline {
        color: @mp-text-light;
        margin-bottom: .5em;
    }

    .arrow {
        position: absolute;
        top: ~"calc(50% - .5em)"; // center arrow on its point
        right: 0;
        height: 1em;
        width: .7em;
        background-size: .7em 1em;
        transition: .3s ease-out;
    }

}

/* --------------------
         Twitter
   --------------------*/
@twitter-blue: #00ACED;
@twitter-dark-blue: #0084B4;

.mainpage-twitter {
    border: none;
    box-shadow: @box-shadow-dark;

    .tile-top {
        display: flex;
        align-items: center;
        background: @twitter-blue;
        padding: 1em 1.75em;

        a {
            flex: 1;
            position: relative; // allow link to cover icon
            text-decoration: none;

            &:hover .arrow {
                transform: translateX(50%);
            }

        }

    }

    .tile-bottom {
        background: @twitter-dark-blue;
        border: none;
        padding: 1em 1.75em;

        p {
            color: @white;
            font-weight: bold;
            font-size: .9em;
            text-align: center;
            text-transform: uppercase;
            letter-spacing: .03em;
            margin: 0;
        }

    }

    .twitter-logo {
        margin-right: .75em;
    }

    .twitter-name {
        color: @white;
        font-weight: bold;
        font-size: 1.25em;
        margin: .5em 0 -0.15em;
    }

    .twitter-tagline {
        color: @mp-text-light;
        margin-bottom: .5em;
    }

    .arrow {
        position: absolute;
        top: ~"calc(50% - .5em)"; // center arrow on its point
        right: 0;
        height: 1em;
        width: .7em;
        background-size: .7em 1em;
        transition: .3s ease-out;
    }

}

/* --------------------
      edit the wiki
   -------------------- */

.mainpage-editing {
    border: none;
    box-shadow: @box-shadow-dark;
    

    .tile-top {
        background: @steel-blue;
    }

    .tile-bottom {
        background: saturate( darken( @steel-blue, 4% ), 4% );
        border: none;
        padding: .8rem 1.5rem .4rem;
    }

    h2,
    a {
        color: @white;
    }

    p {
        color: @mp-text-light;
    }

    ul {
        list-style-image: url('filepath://Transparent-chevron.svg');
    }
    
    a:visited {
    	color:#ffffff
    }

}

/* ==========================
          media queries
   ========================== */

@media only screen and (max-width: 65.999rem) {

    .mainpage-recent-updates {

        .tile-halves {

            // hide third recent update
            &:last-child {
                display: none;
            }
            
        	// zoom on hover
			&:hover .tile-top img {
				transform: scale(1.04);
        	}

            // remove margin for the (now) last tile
            &:nth-last-child(2) {
                margin-right: 0;
            }

        }

        .tile-top {
            height: 18vw;
        }

    }

    // switch to two rows of three tiles
    .mainpage-contents {

        .tile-halves {

            &:nth-child(1),
            &:nth-child(2),
            &:nth-child(3) {
                margin-bottom: @mp-gutter-width;
            }

            &:nth-child(3) {
                margin-right: 0;
            }

        }

        // this forces the tiles into a new row
        .line-break {
            width: 100%;
        }

    }

    .mainpage-skills {

        ul {
            columns: 2 9em;
        }

        // remove one skill to make columns even
        .skill-thieving {
            display: none;
        }

    }

    // hide patch notes
    .mainpage-news {

        .news-updates {
            padding-right: 0;
            border-right: none;
        }

        .news-patchnotes {
            display: none;
        }

    }

    // hide other things
    .mainpage-header .header-stats,
    .mainpage-articleoftheweek {
        display: none;
    }

}

@media only screen and (min-width: 66rem) and (max-width: 81.999rem) {

    // hide sixth contents tile
    .mainpage-contents {

        .contents-minigames {
            display: none;
        }

        // remove margin for the (now) last tile
        .contents-calculators {
            margin-right: 0;
        }

    }

    .mainpage-header .header-stats,
    .mainpage-contents .line-break {
        display: none;
    }

}

@media only screen and (min-width: 82rem) {

    .mainpage-header .header-intro {
        margin-right: 2em;
    }

    .mainpage-contents .line-break {
        display: none;
    }

}

/* Hover Image Light */
#mp-recent .image-light {
    -o-transition: 0.2s;
    -webkit-transition: 0.2s;
    -moz-transition: 0.2s;
    transition: 0.2s;
}
 
#mp-recent .image-light:hover {
    -webkit-filter: brightness(120%);
    filter: brightness(120%);
}