codeRIT/brickhack.io

View on GitHub
sass/index.scss

Summary

Maintainability
Test Coverage
// Variables
// Using a mix of SASS for easier readability and CSS for easier changability
// Colors
$dark-blue: #193787;
$blue: #1447C8;
$light-blue: #44C6E6;
$off-white: #F6F8FA;
$darker-blue: #081646;
$orange: #FF9C4A;
$grey: #D0D9E2;
$beige: #F8953A;

// Typography
:root {
    --body-font-size: 1.3rem;
}

// Mixins
@mixin button-primary {
    background-color: $blue;
    text-decoration: none;
    user-select: none;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
    display: inline-block;
    color: $off-white;
    font-size: var(--body-font-size);
    cursor: pointer;
    transition: 0.2s all;

    &:hover {
        background-color: $dark-blue;
    }

    &:active {
        transform: translateY(4px);
        color: $off-white;
        background-color: $darker-blue;
    }

    @media screen and (max-width: 900px) {
        font-size: 1em;
    }
}

@mixin button-secondary {
    @include button-primary;
    background-color: white;
    color: $blue;
    border: 2px solid $blue;

    &:hover {
        color: $off-white;
    }
}

// General Styles
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Work Sans', sans-serif;
    line-height: 125%;

    // Transition all elements on the screen
    // (except FAQ panel, which has conflicting transitions)
    // (and except certian nav stuff, which we don't want)
    &:not(.panel):not(.show-nav):not(.left):not(.right) {
        transition-duration: 1s;
        transition-property: margin, padding, width, font-size;
    }
}

body {
    background-color: $grey;
}

// Typography
h1 {
    font-size: 3rem;
    font-weight: 600;
    font-family: 'Sora', sans-serif;
    margin-left: -5px;
    color: $darker-blue;
}

h2 {
    font-size: 2.5rem;
    font-weight: 600;
    padding-bottom: 1rem;
    font-family: 'Sora', sans-serif;
    color: $darker-blue;
}

h3 {
    font-size: 1.75rem;
    font-weight: 600;
    padding-bottom: 2rem;
    color: $darker-blue;
}

p {
    font-size: var(--body-font-size);
    line-height: 133%;
    padding-bottom: 1rem;
    color: $darker-blue;

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

    a {
        text-decoration: none;
        color: $blue;
        border-bottom: 2px solid $blue;

        &:hover, &:focus, &:active {
            font-weight: bold;
            text-decoration: none;
        }
    }
}


// Nav
nav {
    background-color: white;
    border-bottom: 2px solid rgba($light-blue, 25%);
    display: flex;
    justify-content: space-between;
    font-size: var(--body-font-size);
    height: 100px;
    position: fixed;
    padding: 0px 85px 0px 8rem;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;

    .top, .left, .right {
        display: flex;
        align-items: center;
    }

    .left {
        flex-grow: 1;
    }

    #toggle {
        margin-right: 2rem;
        color: $blue;
        font-size: 2rem;
        width: 2rem;
        display: none;
    }

    a {
        margin-right: 2rem;
        text-decoration: none;
        color: $blue;
    }

    .link {
        border-bottom: 2px solid white;
        transition: all 0.2s;

        &:not(:focus):hover {
            // underline upon hover, disable hover upon click
            font-weight: bold;
            border-color: $blue;
        }

        &.active {
            font-weight: bold;
            color: $darker-blue;
            border-color: $darker-blue;

            &:hover {
                border-color: $darker-blue;
            }
        }
    }

    #login {
        @include button-primary;
    }

    #logo {
        width: 80px;
        border: none;

        img {
            width: 100%;
            height: 100%;
        }
    }
}

.mobile-grayout {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: black;
    opacity: 0.25;
    z-index: 3;
    cursor: pointer;
    display: none;
}

// MLH Banner
#mlh-trust-badge {
    display: block;
    position: fixed;
    top: 0;
    right: 5px;
    width: 75px;
    height: 0;
    z-index: 2;
}


// Section padding
section {
    padding: 120px 8rem 0px; // Set up to avoid nav overlap when linked
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
}


// Videos - hiding controls
video::-webkit-media-controls {
    opacity: 0;
}

// Post Event
#post {
    text-align: center;
    background-color: $off-white;

    #devpost {
        @include button-primary();
        width: max-content;
        margin: 1rem auto 0rem;
    }

    p {
        margin-top: 1rem;
    }

    #prizes-ricky {
        width: 50%;
        margin: auto;
    }
}

// Hero
#hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-flow: row nowrap;

    #hero-video video {
        max-width: 100%;
    }

    #hero-content {
        width: max-content;
        margin-right: 2rem;

        h3:not(h3:last-of-type) {
            padding-bottom: 0;
        }

        h3:last-of-type {
            padding-bottom: 3rem;
        }

        #hero-buttons {
            display: flex;
            justify-content: space-between;

            #login {
                @include button-secondary();
                margin-right: 2rem;
                width: 50%;
            }

            #register {
                @include button-secondary;
                width: 50%;
            }
        }
        
        #discord {
            @include button-primary();
            width: 100%;
            margin-top: 1rem;
        }
    }
}

// About
#about {
    #about-cards {
        display: flex;
        justify-content: space-between;
        margin: 3rem 0rem;

        .about-card {
            background-color: white;
            border: 1px solid $light-blue;
            border-radius: 6px;
            padding: 20px;
            width: 48%;
        }
    }

    #about-stats {
        display: flex;
        justify-content: space-between;
        align-items: center;

        #stats-content {
            width: 50%;

            #stats {
                display: flex;
                justify-content: space-between;
                flex-wrap: wrap;

                div {
                    padding-right: 20px;

                    p:first-of-type {
                        padding-bottom: 0;
                    }
                }
            }
        }

        video {
            max-width: 50%;
        }
    }
}

// Schedule
#schedule {
    display: flex;
    flex-flow: row;
    justify-content: space-between;
    row-gap: 1rem;

    #schedule-left {
        display: flex;
        flex-flow: column;

        h2 {
            margin-bottom: 1rem;
        }

        #schedule-days {
            border: 2px solid $blue;
            border-radius: 6px;
            display: flex;
            row-gap: 0;
            margin-bottom: 1rem;
            overflow: hidden;
            width: 100%;

            .day {
                @include button-secondary();
                margin: 0;
                border-radius: 0px;
                border: none;
                width: 50%;

                &:active {
                    transform: translateY(0px);
                }

                &-active {
                    background-color: $blue;
                    color: $off-white;
                }
            }
        }
    }

    #schedule-calendar {
        background-color: #FFFFFF;
        border: 1px solid $light-blue;
        border-radius: 6px;
        padding: 0rem 3rem calc(1rem + 15px);
        width: 55%;
        align-self: flex-start;

        #schedule-tape {
            display: flex;
            justify-content: space-between;
            height: 30px;
            position: relative;
            top: -15px;
            margin-bottom: 1rem;

            &-left {
                width: 35%;
                height: 100%;
                background-color: $orange;
                opacity: 0.25;
            }

            &-right {
                width: 35%;
                height: 100%;
                background-color: $light-blue;
                opacity: 0.25;
            }
        }

        #mar-6-content {
            display: none;
        }

        .schedule-events .event {
            display: flex;
            flex-wrap: wrap;
            column-gap: 1rem;
            padding: 1rem;
            margin-bottom: 1rem;
            border-radius: 6px;
            background-color: #FFFFFF;
            border: 1px solid $light-blue;

            p {
                padding-bottom: 0rem;
            }

            &-complete {
                opacity: 0.3;
                background-color: $light-blue;
                border: none;
            }

            &-live {
                background-color: $blue;
                border: none;

                p {
                    color: #FFFFFF;
                }
            }

            .time {
                opacity: 0.75;
                font-size: 1rem;
                margin: auto 0; // because it's smaller, centering it vertically
            }

            .live {
                font-weight: bold;
                color: $orange;
            }
        }
    }
}

// FAQ
#faq {
    #faq-title {
        display: flex;
        flex-wrap: wrap;
        align-items: center;

        #faq-title-content {
            margin-right: 3rem;
        }
    }

    #faq-cards {
        margin-top: 40px;
        display: flex;
        flex-flow: row wrap;
        justify-content: space-between;

        // TODO: This can be cleaner.
        $card-m: 20px;

        &-left {
            width: calc(50% - (#{$card-m} / 2));
            margin-right: $card-m / 2;
        }

        &-right {
            width: calc(50% - (#{$card-m} / 2));
            margin-left: $card-m / 2;
        }

        .card {
            width: 100%;
            margin-bottom: $card-m;
            border-radius: 6px;
            background-color: white;
            border: 2px solid $blue;

            &:active {
                transform: none;
            }

            .accordion-header {
                background-color: transparent;
                cursor: pointer;
                outline: none;
                color: $blue;
                font-weight: 600;
                text-align: left;
                padding: 20px 30px;
                border: none;
                border-radius: 0px 0px 6px 6px; // making bottom corners round and top corners filled
                width: 100%;
                font-size: var(--body-font-size);

                .fa-plus {
                    margin-right: 10px;

                    &-blue {
                        color: $blue;
                    }

                    &-light-blue {
                        color: $light-blue;
                    }

                    &-orange {
                        color: $orange;
                    }
                }

                .fa-minus {
                    margin-right: 10px;
                    color: white;
                }

                &:hover {
                    background-color: $dark-blue;
                    border-radius: 0;
                    color: white;

                    .fa-plus {
                        color: white;
                    }
                }
            }

            .panel {
                display: none; // Toggled in JS
                padding: 20px 65px; // large side padding aligns with header text

                p, em {
                    color: $blue;
                    line-height: 23px;
                    margin-bottom: 10px;
                }
            }
        }

        .active .accordion-header {
            color: white;
            background-color: $blue;

            &:hover {
                border-radius: 0px 0px 6px 6px; // making bottom corners round and top corners filled
            }
        }
    }
}

// Prizes
#prizes {
    $tape-offset: 35px;  // how far into the card is the tape placed?
    
    @mixin tape-transform($rotation) {
        transform: translate(-50%, -50%) rotate($rotation);
        // this makes it so that we're positioning the tape by its center instead of its top-left, pre-rotation
        // corner, which is significantly easier
    }

    #prizes-ricky {
        // placeholder
        width: 85%;
        max-width: 980px;
        height: auto;
        background-color: blue;
        margin: 0 auto;
    }

    #prizes-card {
        background-color: white;
        border: 1px solid $light-blue;
        border-radius: 6px;
        padding: 75px 95px;
        position: relative;
        width: 100%;

        .tape {
            background-color: $beige;
            height: 40px;
            opacity: 0.25;
            position: absolute;
            width: 165px;

            &.top-left {
                @include tape-transform(-45deg);
                left: $tape-offset;
                top: $tape-offset;
            }

            &.top-right {
                @include tape-transform(45deg);
                right: $tape-offset - 165px;
                top: $tape-offset;
            }

            &.bottom-left {
                @include tape-transform(45deg);
                left: $tape-offset;
                bottom: $tape-offset - 40px;
            }

            &.bottom-right {
                @include tape-transform(-45deg);
                right: $tape-offset - 165px;
                bottom: $tape-offset - 40px;
            }
        }

        & > .content {
            align-items: flex-end;
            column-gap: 50px;
            display: flex;
            flex-direction: row;
            margin-bottom: 100px;

            .graphic {
                flex: 0 0 auto;
            }

            .text {
                display: flex;
                flex-direction: column;
                row-gap: 20px;

                .title {
                    letter-spacing: 1.5rem;
                    opacity: 0.50;
                }
            }
        }

        #inner-prizes-card {
            background-color: white;
            border: 1px solid $light-blue;
            border-radius: 6px;
            padding: 35px;
            width: 100%;

            .title {
                padding-bottom: 20px;
            }

            .content {
                align-items: flex-start;
                display: flex;
                flex-direction: row;
                column-gap: 30px;
            }
        }

        #prizes-corner-text {
            font-size: 1.125rem;
            position: absolute;
            bottom: calc(75px / 2);
            right: 95px;
            opacity: 0.50;
            transform: translateY(50%);  // easy way to perfectly vertical center the text
        }
    }
}

// Sponsors
#sponsors {
    #sponsor-btns {
        margin: 1rem 0 2rem;
        display: flex;

        #prospectus {
            @include button-primary();
            margin-right: 2rem;
        }

        #email {
            @include button-secondary();
        }
    }

    .logo-group {
        align-items: center;
        display: flex;
        justify-content: space-evenly;
        flex-wrap: wrap;
        row-gap: 3rem;
        column-gap: 5rem;
        padding: 2rem 0;

        img {
            transition: all 0.2s;

            &:hover {
                transform: translateY(-10px);
                transition: all 0.2s;
            }
        }
    }

    #brick-tier img {
        height: 275px;
        max-width: 100%;
    }

    #platinum-tier img {
        height: 255px;
        max-width: 100%;
    }

    #gold-tier img {
        height: 175px;
    }

    #bronze-silver-tier img {
        height: 150px;
    }
    
    #partners {
        padding-top: 1rem;

        img {
            height: 75px;
        }

        #stickermule { // their brand's padding messes with size consistancy
            height: 100px;
        }

        #simone { // their logo's shape messes with size consistancy
            height: 50px;
        }
    }
}

// Leadership
#leadership #team {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    column-gap: 5rem;
    row-gap: 2.5rem;

    .leader {
        .leader-img {
            display: flex;
            flex-flow: column;
            align-items: center;
            margin-bottom: 0.75rem;

            .tape {
                opacity: 0.5;
                width: 50%;
                height: 30px;
                border-radius: 2px;
                transform: translateY(15px);
                margin: auto;

                &-orange {
                    background-color: $orange;
                }

                &-blue {
                    background-color: $light-blue;
                }
            }

            img {
                border-radius: 6px;
                width: 100%;
            }
        }

        .leader-role {
            font-size: 1.2rem;
            opacity: 0.7;
            font-weight: 500;
            padding-bottom: 0px;
        }

        .leader-name {
            font-weight: bold;
        }
    }
}

// Contact
#contact {
    padding-bottom: 0;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    min-height: auto;

    #contact-content {
        width: 50%;
        padding-right: 20px;
    }

    #contact-socials {
        align-self: flex-end;
        background-image: url("../assets/bh8/contact-monitor.svg");
        width: 430px;
        max-width: 50%;
        height: 330px;
        margin-bottom: -2px; // Gets rid of gap between svg and footer
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center bottom;
        padding: 1rem 2.5rem 5rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        #social-icons {
            display: flex;
            flex-wrap: wrap;

            a {
                margin: 1rem;

                i {
                    font-size: 3rem;
                    color: $blue;

                    &:hover {
                        color: $dark-blue;
                    }
                }
            }
        }
    }
}


// Footer
footer {
    background-color: $grey;
    padding: 2rem 5rem;
    display: flex;
    justify-content: space-between;

    p {
        line-height: 2.5rem;
    }

    #footer-left {
        padding-right: 1rem;
    }

    #footer-right {
        display: flex;
        justify-content: space-between;

        p {
            padding-bottom: 0;

            &:not(p:last-of-type) {
                padding-right: 1rem;
            }
        }
    }
}


@media screen and (max-width: 1500px) {
    // FAQ
    #faq {
        #faq-title {
            flex-direction: column;
            align-items: flex-start;
        }

        #faq-cards {
            flex-direction: column;

            &-left, &-right {
                margin: 0;
                width: 100%;
            }
        }
    }
}

@media screen and (max-width: 1220px) {
    // Nav
    nav {
        padding: 0px 85px 0px 5rem;
    }

    // Section padding
    section {
        padding: 120px 5rem 0px; // Set up to avoid nav overlap when linked
    }

    // Hero
    #hero {
        flex-direction: column;
        align-items: center;

        #hero-content {
            width: auto;
            margin-right: 0;
            flex-basis: auto;
            text-align: center;
        }
    }

    // About
    #about #about-content #about-buttons {
        width: 100%;
    }

    // Leadership
    #leadership #team {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
    }

    // Footer
    footer #footer-right {
        flex-direction: column;
        text-align: right;

        p:not(p:last-of-type) {
            padding-right: 0;
        }
    }
}

@media screen and (max-width: 955px) {
    // Nav
    nav {
        height: 70px;
        padding: 0px 3.5rem;

        #toggle {
            display: block;
        }

        #logo {
            width: 60px;
        }

        .link, #login {
            display: none;
        }
    }

    .show-nav {
        height: 100vh;
        width: 50vw;
        min-width: max-content;
        padding: 0px 3.5rem;
        border-bottom: none;
        border-right: 2px solid rgba($light-blue, 25%);
        flex-direction: column;
        justify-content: flex-start;
        z-index: 4;

        .top {
            height: 68px;
        }

        .left, .right {
            align-items: flex-start;
            margin-top: 2rem;

            a {
                margin-right: 0rem;
                margin-top: 2rem;
            }
        }

        .left {
            flex-direction: column;
            flex-grow: 0;
            order: 2;
        }

        .right {
            flex-direction: column-reverse;
            order: 1;
        }

        .link, #login {
            display: block;
        }
    }

    .show-gray {
        display: block;
    }

    // MLH Banner
    #mlh-trust-badge {
        width: 50px;
    }

    // Section padding
    section {
        padding: 100px 3.5rem 0px; // Set up to avoid nav overlap when linked
    }

    // Hero
    #hero #hero-content #hero-buttons {
        flex-direction: column;

        #login {
            margin: 0rem 0rem 1rem;
            width: 100%;
        }

        #register {
            width: 100%;
        }
    }

    // About
    #about {
        #about-cards {
            flex-direction: column;

            .about-card {
                width: 100%;

                &:not(.about-card:last-of-type) {
                    margin-bottom: 2rem;
                }
            }
        }

        #about-stats {
            flex-direction: column;

            #stats-content {
                width: 100%;
            }

            video {
                max-width: 100%;
                padding-top: 2rem;
            }
        }
    }

    // Prizes
    #prizes #prizes-card > .content .text .title {
        letter-spacing: 0.5rem;
    }
}

@media screen and (max-width: 900px) {
    // Variables
    :root {
        --body-font-size: 1rem;
    }

    // Typography
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.35rem;
    }

    // Post
    #post #prizes-ricky {
        width: 90%;
    }

    // About
    #about #about-content {
        p {
            font-size: 1em;
        }

        #about-buttons {
            flex-direction: column;
            width: 60%;

            a {
                margin-left: 0;
            }
        }
    }

    // Schedule
    #schedule {
        display: flex;
        flex-flow: column;

        #schedule-left .day {
            width: calc(50% - 0.75rem);

            &:first-of-type {
                margin-right: 1rem;
            }
        }

        #schedule-calendar {
            margin-top: 1rem;
            width: 100%;
        }
    }

    // FAQ
    #faq #faq-cards {
        margin-top: 20px;

        .card {
            .accordion-header {
                padding: 10px 20px;
            }

            .panel {
                padding: 20px 20px 10px;
            }
        }
    }

    // Prizes
    #prizes {
        $tape-offset: 12px;               // how far into the card is the tape placed?
        $overflow-size: 35px;             // how far does the outer card go into the section margins?
        $inner-card-overflow-size: 20px;  // how far does the inner card go into the outer card's margins?

        #prizes-card {
            padding: $overflow-size $overflow-size ($overflow-size + 40px);

            & > .content {
                margin-bottom: 30px;

                .graphic {
                    display: none;
                }

                .text {
                    row-gap: 15px;
                }
            }

            .tape {
                height: 12px;
                width: 50px;
    
                &.top-left {
                    left: $tape-offset;
                    top: $tape-offset;
                }
    
                &.top-right {
                    right: $tape-offset - 50px;
                    top: $tape-offset;
                }
    
                &.bottom-left {
                    left: $tape-offset;
                    bottom: $tape-offset - 12px;
                }
    
                &.bottom-right {
                    right: $tape-offset - 50px;
                    bottom: $tape-offset - 12px;
                }
            }

            #inner-prizes-card {
                margin-left: -$inner-card-overflow-size;
                padding: $inner-card-overflow-size;
                width: calc(100% + (2 * #{$inner-card-overflow-size}));

                .content {
                    flex-direction: column;
                    row-gap: 20px;
                }
            }

            #prizes-corner-text {
                font-size: 0.75rem;
                right: 20px;
            }
        }
    }

    // Sponsors
    #sponsors {
        #sponsor-btns {
            flex-flow: column;
            width: max-content;
            margin: auto;

            #prospectus {
                margin: 0rem 0rem 1rem;
                padding: 1rem 3rem;
            }
        }

        .logo-group {
            padding: 1rem 0rem;
        }
    }

    // Leadership
    #leadership #team {
        display: grid;
        grid-template-columns: 1fr 1fr;

        .leader .leader-role {
            font-size: 0.9rem;
        }
    }

    // Contact
    #contact {
        flex-direction: column;

        #contact-content {
            width: 100%;
            padding-right: 0px;
        }

        #contact-socials {
            margin: 2rem auto -2px;
            max-width: 75%;
            width: 75%;
            height: calc((100vw - 7rem) * 0.56); // should be the same as 75% of the current width
            // Essentially: (100vw - section padding to get 100% width) * 0.75 to get the 75% width * 0.75 for 75% of 75% width
        }
    }

    // Footer
    footer p {
        line-height: 2rem;
    }
}

@media screen and (max-width: 650px) {
    // About
    #about #stats-content #stats {
        flex-direction: column;

        div {
            padding: 0px 0px 20px;
        }
    }

    // Schedule
    #schedule #schedule-left .day {
        width: 100%;

        &:first-of-type {
            margin-right: 0rem;
        }
    }

    // Prizes
    #prizes #prizes-card {
        padding: 20px 20px 60px;

        #inner-prizes-card {
            margin-left: 0;
            width: 100%;
        }
    }

    // Leadership
    #leadership #team {
        display: grid;
        grid-template-columns: 1fr;
    }

    // Contact
    #contact #contact-socials {
        max-width: 100%;
        width: 100%;
        justify-content: flex-start;
        padding: 0;
        margin: 2rem 0;
        background-image: none;
        height: auto;

        #social-icons a i {
            font-size: 2rem;
        }
    }

    // Footer
    footer {
        flex-direction: column;

        #footer-right {
            text-align: left;
        }
    }
}