---
---
/*!
 * chriscummins.cc style sheet
 * Copyright {{ site.copyright.year }} {{ site.copyright.owner }}.
 * Licensed under {{ site.copyright.license }}.
 */
@import 'bootstrap-variables';

/*
 * TODO(cec): Use CSS custom properties to enable dynamically switching between
 * light and dark mode. See:
 *
 * https://developer.mozilla.org/en-US/docs/Web/CSS/--*
 * https://medium.com/@jonas_duri/enable-dark-mode-with-css-variables-and-javascript-today-66cedd3d7845
 */

/* Light mode: */
$color-background: #fff;
$color-background-code: #393939;
$color-text-code: #d6d6af;
$color-text: #000;
$color-title-text: #333;
$color-link: #c7254e;
$color-highlight: #e60000;
$color-subtle: #777;
$color-button: #0b60fe;

/* Dark mode: */
$dm-color-background: #191919;
$dm-color-background-code: #282828;
$dm-color-text-code: #d6d6af;
$dm-color-text: #bfbfbf;
$dm-color-title-text: #777;
$dm-color-link: #dd6e8a;
$dm-color-highlight: #c7254e;
$dm-color-subtle: #777;
// $dm-color-button: #dd6e8a;
$dm-color-button: #799bdb;


// font awesome icons
$fa-github: '\f09b';
$fa-file-pdf-o: '\f1c1';

$jumbotron-min-height: {{ site.jumbotron_min_height | append: 'px' }};
$jumbotron-max-height: {{ site.jumbotron_max_height | append: 'px' }};
$jumbotron-content-gap: {{ site.jumbotron_content_gap | append: 'px' }};

@mixin transition-duration($duration) {
    -webkit-transition-duration: $duration; /* iOS Safari */
       -moz-transition-duration: $duration; /* Firefox */
            transition-duration: $duration;
}

@mixin border-radius($radius) {
    -webkit-border-radius: $radius;
            border-radius: $radius;
          background-clip: padding-box;  /* stops bg color from leaking outside the border */
}

@mixin noselect {
    cursor: default;
    -webkit-touch-callout: none; /* iOS Safari */
      -webkit-user-select: none; /* Safari */
       -khtml-user-select: none; /* Konqueror HTML */
         -moz-user-select: none; /* Firefox */
          -ms-user-select: none; /* Internet Explorer/Edge */
              user-select: none; /* Chrome and Opera */
}

@mixin decorated {
    // underline hover effect based on post by @tobiasahlin:
    // http://tobiasahlin.com/blog/css-trick-animating-link-underlines/
    //
    & {
        position: relative;
        color: $color-text;
        @media (prefers-color-scheme: dark) { color: $dm-color-text; }
        text-decoration: none;
        border-bottom: 1px solid $color-text;
        @media (prefers-color-scheme: dark) { border-bottom: 1px solid $dm-color-text; }
        @include transition-duration(.2s);

        &:not(.btn).undecorated {
            border-bottom: none;
        }

        &:not(.undecorated):before {
            content: "";
            position: absolute;
            width: 100%;
            height: 2px;
            bottom: -2px;
            left: 0;
            background-color: $color-highlight;
            @media (prefers-color-scheme: dark) { background-color: $dm-color-highlight; }
            visibility: hidden;
            -webkit-transform: scaleX(0);
                    transform: scaleX(0);

            -webkit-transition: all 0.3s ease-in-out 0s;
                    transition: all 0.3s ease-in-out 0s;
        }
        &:not(.undecorated):hover:before {
            visibility: visible;
            -webkit-transform: scaleX(1);
                    transform: scaleX(1);
        }
    }
}

@mixin subtle {
    & {
        vertical-align: middle;
        line-height: 24px;
        font-weight: 400;
        color: $color-subtle;
        @media (prefers-color-scheme: dark) { color: $dm-color-subtle; }
        font-size: 14px;
    }
}

@import 'banner';
@import 'jumbotron';
@import 'around-the-web';

.subtle {
    @include subtle;
}

.noselect {
    @include noselect;
}

html {
    // bare minimum site width:
    min-width: 320px;
}

/* container which holds the left and right columns */
.container-fluid {
    max-width: 1300px;

    width: 98%;
    @media (min-width: $screen-sm-min) {
        width: 95%;
    }
    @media (min-width: $screen-md-min) {
        width: 90%;
    }
}

a {
    color: $color-link;
    @media (prefers-color-scheme: dark) { color: $dm-color-link; }
    text-decoration: underline;

    &:hover, &:active {
        color: $color-highlight;
        @media (prefers-color-scheme: dark) { color: $dm-color-highlight; }
    }
}

a.btn {
    text-decoration: none;
}

code {
    color: $color-text;
    @media (prefers-color-scheme: dark) { color: $dm-color-text; }
    background: none;
}


#col-right {
    // hidden on small screens:
    display: none;

    @include banner;

    // the right column uses Bootstrap's affix plugin so that it scrolls with
    // the page. When the column is 'fixed' (scrolling), it has class .affix;
    // when it is not fixed, it has class .affix-top.
    > div {
        padding-left: 20px;
        border-left: 1px solid #666;
        padding-bottom: .1em;

        .banner {
            padding: 0 0 .2em 0;
            margin-bottom: .6em;
            background: transparent;

            background-color: $color-background;
            @media (prefers-color-scheme: dark) { background-color: $dm-color-background; }

            h1 {
                margin-bottom: .2em;
                font-size: 19px;
            }
            p {
                font-size: 13px;
            }

            @media (min-width: $screen-md-min) {
                h1 { font-size: 24px; }
                p { font-size: 15px; }
            }
            @media (min-width: $screen-lg-min) {
                h1 { font-size: 28px; }
                p { font-size: 18px; }
            }
        }

        .banner, #about, .around-the-web {
            transition: .3s;
            position: relative;
        }
    }
    > div:not(.affix) {
        .banner {
            opacity: 0;
            top: -20px;
        }

        #about, .around-the-web {
            top: -60px;
        }
    }
    > div.affix {
        top: $jumbotron-content-gap;
        // banner fades in
        .banner {
            opacity: 1;
            top: 0;
        }

        #about, .around-the-web {
            opacity: 1;
            top: 0;
        }
    }

    #about {
        color: $color-text;
        @media (prefers-color-scheme: dark) { color: $dm-color-text; }
        font-size: 16px;
        font-weight: 300;
        margin: 1em 0;
    }
}

// Top of screen navigation
.cec-navbar-container {
    height: 59px;
    margin-left: -30px;  // left offset to hide the indented carets
    margin-bottom: 1.5em;
}
.cec-navbar {
    padding-left: 30px;  // counter left offset
    height: 59px;
    background-color: $color-background;
    @media (prefers-color-scheme: dark) { background-color: $dm-color-background; }
    opacity: 0.95;
    top: 0;
    z-index: 10;
}

// when the screen size is larger than the threshold, we show the right column,
// and hide the 'around-the-web' links on the left side:
@media (min-width: $screen-sm-min) {
    #col-left {
        // breathing room between left and right columns
        padding-right: 30px;
        // hide the left side links
        .around-the-web { display: none; }
    }
    #col-right {
        display: unset;
    }
}
@media (min-width: $screen-md-min) {
    #col-left {
        padding-right: 50px;
    }
}

.justify {
    text-align: justify;
}

.post {
    > p, > li {
        text-align: justify;
    }
}

.content {
    font-size: 18px;

    h1, h2, h3, h4, h5, h6 {
        font-size: 20px;
        font-weight: 700;
        margin-top: 2em;
        margin-bottom: .8em;

        &:first-child {
            // No need for vspace on the first title in the content block.
            margin-top: 0;
        }
    }

    p, li {
        color: $color-text;
        @media (prefers-color-scheme: dark) { color: $dm-color-text; }
        line-height: 1.45em;
    }

    p {
        margin: 0 0 1em 0;
    }

    ol li {
        padding-left: .4em;
    }

    img {
        max-width: 100%;
        padding: .3em 0 1em 0;
    }
}

// Images with "invertible" class will be inverted in dark mode.
// Use this for diagrams and drawings with white backgrounds. For 
// photos this will look super weight.
img.invertible {
    @media (prefers-color-scheme: dark) { filter: invert(0.9); }
}

a.decorated {
    @include decorated;
}

/* lists of pages */
.big-list {
    > ul {
        vertical-align: middle;
        padding: 0;
        font-size: 18px;
        line-height: 24px;
        margin: 0;

        li {
            list-style-type: none;
            margin-bottom: .8em;

            &.has-caret {
                list-style-position: outside;
                // text-indent: -.5em;
                // padding-left: 1em;

                > a {
                    margin-left: -.3em;
                }
            }
            &.has-caret:before {
                display: inline-block;
                width: 1em;
                margin-left: -1em;
                font-family: 'FontAwesome';
                content: '\f105';
                padding: 0;
            }
            &.has-caret.has-caret-down:before {
                content: '\f107';
            }

            > a {
                @include decorated;
            }

            // limit the bottom whitespace on collapse contents
            &:last-child .collapse-content {
                padding-bottom: 0em;
            }
        }
    }

    .collapsing {
        @include transition-duration(height .25s ease);
    }
    .collapse-content {
        font-size: 14px;
        text-indent: 0;
        // breathing room around collapse content. note that margin causes a
        // janky stuttering effect on chrome, so we use padding instead.
        margin: 0;
        padding: .5em 0 1em 0;

        p:last-child {
            margin-bottom: 0
        }

        .btn-row {
            margin-bottom: 0;
            text-align: left;

            .btn-primary {
                margin-left: 0;
                font-size: 12px;
                @media (min-width: $screen-sm-min) { font-size: 14px; }
            }
        }

        table tr td { padding-bottom: 0; }

        .collapse-split-container {
            .left {
                margin-bottom: 1.5em;
                max-width: 150px;
            }

            @media (min-width: $screen-sm-min) {
                display: flex;

                .left {
                    margin-right: 1.5em;
                    margin-bottom: 0em;
                }
                > div:first-child {
                    flex: 0 0 30%;
                }
                > div:last-child {
                    flex: 1;
                }
            }
        }
    }
}

.cv {
    > h1 {
        > a.expand-all {
            @include subtle;
        }
    }

    table {
        margin-left: .5em;
        margin-bottom: .5em;
        tr {
            td {
                padding-bottom: .7em;

                &:first-child {
                    // first column formatting
                    font-size: 14px;
                    color: $color-subtle;
                    @media (prefers-color-scheme: dark) { color: $dm-color-subtle; }
                    text-align: right;
                    padding-right: 1em;
                }
            }
        }
    }

    table.table-progress {
        tr {
            td {
                padding-bottom: .3em;

                .progress {
                    margin-bottom: 0 !important;
                    height: 5px;

                    background-color: #eaeaea;
                    @media (prefers-color-scheme: dark) { background-color: #333; }
                    -webkit-box-shadow: none;
                    box-shadow: none;

                    .progress-bar {
                        background-color: $color-link;
                        @media (prefers-color-scheme: dark) { background-color: $dm-color-link; }
                    }
                }
            }

            td:first-child {
                min-width: 95px;
                color: $color-text;
                @media (prefers-color-scheme: dark) { color: $dm-color-text; }
            }

            td:last-child {
                width: 100%;
            }
        }
    }
}

// hang left and hang right. These should be used in pairs. On large screens,
// only hang-right is visible. On small screens, only hang left.
.hang-right {
    @include subtle;
    @include noselect;

    display: none;
    float: right;
    padding-left: 15px;
    margin-left: 15px;
}
.hang-left {
    @include subtle;
    @include noselect;

    &:before {
        content: "\A";
        white-space: pre;
    }
}
@media (min-width: $screen-sm-min) {
    .hang-left { display: none; }
    .hang-right { display: unset; }
}

#footer {
    margin-top: 1em;
    margin-bottom: 2.5em;

    #copyright {
        text-align: center;
        font-size: 13px;
        font-weight: 300;
        color: $color-subtle;
        @media (prefers-color-scheme: dark) { color: $dm-color-subtle; }

        // No color highlight for the "build <hash>" link in the footer.
        a {
            color: $color-subtle;
            @media (prefers-color-scheme: dark) { color: $dm-color-subtle; }
        }
    }
}

.btn-row {
    margin-bottom: 1.5em;
    text-align: center;

    ul {
        padding: 0;
        list-style-type: none;

        li {
            display: inline;
            line-height: 3.3em;
        }
    }

    @media (min-width: $screen-sm-min) {
        text-align: left;
    }

    .btn-primary {
        @include border-radius(12px);

        font-size: 16px;

        background-color: $color-background;

        color: $color-button;
        border-color: $color-button;
        border: solid 2px $color-button;

        @include transition-duration(.15s);

        @media (prefers-color-scheme: dark) { 
            color: $dm-color-button; 
            border-color: $dm-color-button;
            background-color: $dm-color-background;
        }

        min-width: 130px;

        @media (min-width: $screen-md-min) {
            min-width: 150px;
            margin-right: .3em;
        }

        &:hover {
            background-color: #eee;
            @media (prefers-color-scheme: dark) { background-color: #444; }
        }
        &:active {
            background-color: #eee;
            border-color: $color-button;
            color: $color-button;
            @media (prefers-color-scheme: dark) { 
                background-color: #444;
                border-color: $dm-color-button;
                color: $dm-color-button; 
            }
        }

        i {
            margin-left: 5px;
        }
    }

    .btn-github {
        @extend .btn-primary;
        &:after {
            font-family: 'FontAwesome';
            content: ' '$fa-github;
        }
    }

    .btn-pdf {
        @extend .btn-primary;
        &:after {
            font-family: 'FontAwesome';
            content: ' '$fa-file-pdf-o;
        }
    }
}

// Thumbnail gallery
.demos {
    .demo {
        display: inline-block;
        width: 160px;
        vertical-align: top;
        margin-bottom: 0;

        .image {
            overflow: hidden;
            border: solid 1px $color-text;
            padding: 0;

            img {
                width: 100%;
                height: 158px;  // = width - 2*1px border
                // height: 160px;
                padding: 0;
                @include transition-duration(.3s);

                &:hover {
                    opacity: .75;
                }
            }
        }

        p {
            text-align: center;
            margin: .3em 0;
            width: 160px;
            color: $color-text;
            @media (prefers-color-scheme: dark) { color: $dm-color-text; }
            @include transition-duration(.3s);
        }

        a:hover {
            p {
                color: $color-highlight;
                @media (prefers-color-scheme: dark) { color: $dm-color-highlight; }
            }
        }
    }
}

// paper
.paper {
    min-width: 200px;
    width: 60%;

    img {
        padding: 0;
        border: solid 1px #aaa;
        -webkit-box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.75);
           -moz-box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.75);
                box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.75);
    }

    p {
        padding-top: .8em;
        font-size: 14px;
        margin-bottom: 2em;
    }
}

// full-width embedded video wrapper
.video-wrapper-16-9 {
        margin: 1em 0;
        position: relative;
        padding-bottom: 56.25%; // 16:9 aspect ratio
        padding-top: 25px;
        height: 0;

        iframe {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
        }
}

// blog navigation
.blognav {
    margin-top: 1em;
    list-style-type: none;
    padding-left: 0;

    li {
        display: inline;

        a {
            @include decorated;
            display: inline;
            padding: 2px 0;
        }

        // &.blognav-next {
        //     float: left;
        // }
        &.blognav-prev {
            float: right;
        }
    }
}

// text selection highlighting:
::selection {
  background-color: #f98484;
}

.parallax-window {
    background: transparent;
    width: 100%;
}

.bg {
    background-color: $color-background;
    padding-top: $jumbotron-content-gap;
    @media (prefers-color-scheme: dark) { background-color: $dm-color-background; }
}

body {
    color: $color-title-text;
    @media (prefers-color-scheme: dark) { color: $dm-color-title-text; }
}


pre {
    background-color: $color-background-code;
    color: $color-text-code;
    @media (prefers-color-scheme: dark) { 
        background-color: $dm-color-background-code;
        color: $dm-color-text-code; 
    }
    border: $color-subtle;
    font-size: 16px;
}




// Art
$column-count: 3;

.gallery {
    -webkit-column-count: $column-count;
    -moz-column-count: $column-count;
    column-count: $column-count;
    -webkit-column-width: 100% / $column-count;
    -moz-column-width: 100% / $column-count;
    column-width: 100% / $column-count;

    .pics {
        margin: .3em 0 1em 0;
        -webkit-transition: all 350ms ease;
        transition: all 350ms ease;
    }

    .animation {
        -webkit-transform: scale(1);
        -ms-transform: scale(1);
        transform: scale(1);
    }

    @media (max-width: $screen-sm-min) {
        -webkit-column-count: 1;
        -moz-column-count: 1;
        column-count: 1;
        -webkit-column-width: 100%;
        -moz-column-width: 100%;
        column-width: 100%;
    }

    img {
        cursor: pointer;
        transition: 0.3s;
        padding: 0;

        &:hover {
            opacity: 0.7;
            cursor: zoom-in;
        }

        @media (max-width: $screen-sm-min) {
            display: block;
            margin-left: auto;
            margin-right: auto;
        }
    }
}

@media (max-width: $screen-md-min) {
  .btn.filter {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
}


// Modal
.modal {
    display: none; // Hidden by default
    position: fixed; // Stay in place
    z-index: 5; // Sit on top
    padding-top: 100px; // Location of the box
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; // Enable scroll if needed
    background-color: rgb(0,0,0); // Fallback color
    background-color: rgba(0,0,0,0.9); // Black w/ opacity

    &:hover {
        cursor: zoom-out;
    }

    img {
        padding: 0;
        max-height: 1000px;
        width: auto;
        height: auto;

        &:hover {
            cursor: pointer;
        }
    }

    #modal-caption {
        margin: auto;
        display: block;
        max-width: 95%;
        text-align: center;
        color: #ccc;
        padding: 10px 0;
        height: 150px;
    }

    .modal-content, a {
        margin: auto;
        display: block;
        height: auto;

        @media only screen and (max-width: 700px){
           width: 100%;
        }
    }

    .modal-content, #modal-caption {
        animation-name: zoom;
        animation-duration: 0.6s;
    }
}

blockquote {
    @media (prefers-color-scheme: dark) { border-color: $dm-color-subtle; }
}

@keyframes zoom {
  from {transform:scale(0);}
  to {transform:scale(1);}
}
