/*****************************************************************************/
/* The Basics
/*****************************************************************************/

/* Global Reset */
*
{
    margin: 0;
    padding: 0;
    border: 0;
}

/* Convenience */
.right
{
    float: right;
}
.left
{
    float: left;
}
.text-center
{
    text-align: center;
}
.center
{
    display: block;
    margin: 0 auto;
}
.clear
{
    clear: both;
    width: 0;
    height: 0;
}

body
{
    height: 100%;
    color: #333;
    background-color: #fff;
    font-size: 18px;
    /* WordPress system font stack: https://bitsofco.de/the-new-system-font-stack/ */
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen-Sans,
        Ubuntu,
        Cantarell,
        Helvetica,
        sans-serif;
}

body#dark
{
    color: #fff;
    background-color: #000;
}

h1
{
    font-size: 250%;
}
h2
{
    font-size: 200%;
}
h3
{
    font-size: 160%;
}
h4
{
    font-size: 130%;
}
h5, h6
{
    font-size: 100%;
}
h6
{
    font-weight: normal;
    font-style: italic;
}
h1, h2, h3, h4, h5, h6
{
    line-height: 1.1em;
    margin-bottom: 8px;
}

sup, sub
{
    /* Prevent sub/superscripts from altering the line spacing */
    line-height: 1em;
}

p, pre, ul, ol, hr, blockquote
{
    margin-bottom: 1em;
}
ul ul, ul ol, ol ul, ol ol
{
    /* Without this, items with nested sub-items have extra margin, since they are <li> containing <ul> or <ol> */
    margin-bottom: 0em;
}

.text-light
{
    color: #999;
}
body#dark .text-light
{
    color: #aaa;
}

a
{
    color: #406fcd;
    text-decoration: none;
}
body#dark a
{
    color: #759ef0;
}
a:hover
{
    text-decoration: underline;
}
a:visited
{
}
a img
{
    text-decoration: none;
}

ul, ol
{
    margin-left: 2em;
}

blockquote
{
    padding: 0 0 0 14px;
    border-left: 8px solid #ddd;
}
body#dark blockquote
{
    border-color: #888;
}

hr
{
    height: 4px;
    width: 33%;
    margin-left: auto; /* center it without removing top/bottom margin */
    margin-right: auto;
    background: #ddd;
}
body#dark hr
{
    background-color: #888;
}

.pagelist
{
    list-style-type: none;
    margin-bottom: 2em;
    margin-left: 0;
}
.pagelist .page-date
{
    /*
     Should be 0.8em, but this works around a bug in Safari where the font size
     of the .page-date affects size of a.extra.
     */
    font-size: 14px;
    text-transform: uppercase;
    font-weight: bold;
    display: block;
    color: #999;
}

body#dark .pagelist .page-date
{
    color: #aaa;
}

mark
{
    color: #333;
    background-color: #ffff99;
}
body#dark mark
{
    color: #fff;
    background-color: #8a8a0f;
}

figcaption, .caption
{
    font-size: 90%;
    color: #999;
    font-style: italic;
}
body#dark figcaption, body#dark .caption
{
    color: #aaa;
}


/*****************************************************************************/
/* Site
/*****************************************************************************/

.wrap
{
    text-align: left;
    width: 640px;
    margin: auto;
    line-height: 1.5em;
}

.wrap-wide
{
    width: 960px;
}

/* for images that stick out from the text */
.extrawide
{
    margin-left: -280px;
    max-width: 1200px;
}

/* Non-wide images won't exceed the text width, even if we shrink text width further */
img:not(.gallery-img):not(.pswp__img):not(.extrawide), video, iframe
{
    max-width: 100%;
}
img:not(.gallery-img):not(.pswp__img):not(.extrawide), video
{
    height: auto;
}

.subtitle, .date
{
    font-size: 1.4em;
    font-weight: 300; /* SF UI Light, Helvetica Neue Light */
    margin-bottom: 0.4em;
}
.date
{
    font-size: 1.2em;
    font-style: italic;
}


.colorbg
{
    background-color: #3daae7; /* fallback */
    background-image: -webkit-linear-gradient(90deg, #0dc77f, #3daae7);
    background-image:    -moz-linear-gradient(90deg, #0dc77f, #3daae7);
    background-image:      -o-linear-gradient(90deg, #0dc77f, #3daae7);
    background-image:         linear-gradient(90deg, #0dc77f, #3daae7);
}
body#dark .colorbg
{
    background: #000;
}

.nav-padder
{
    height: 80px;
}

.page-title
{
    /* For some reason, the descender on 'g' in Blog gets clipped */
    padding-bottom: 8px;
}
.page-title > a, body#dark .page-title > a
{
    text-decoration: none;
    color: white;
}

.gradient-text {
    background-image: -webkit-linear-gradient(0deg, #0dc77f, #3daae7);
    color: white; /* fallback */
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
}
body#dark .gradient-text
{
    background: none;
    -webkit-text-fill-color: unset;
    -webkit-background-clip: unset;
}

.invert *, .invert a:hover, .invert a:active
{
    color: #fff;
}
/* Dark mode .invert should have no effect, so put the color back */
body#dark .invert *, body#dark .invert a:hover, body#dark .invert a:active
{
    color: #fff;
}

.content-top
{
    margin-top: 30px;
    margin-bottom: 1em;
}
.content-bottom
{
    margin-bottom: 30px;
}
body#dark .content-top
{
    /* Reduce padding because there's no header color, so it looks weird */
    margin-top: 0;
}

code, .fake-code
{
    font-family: Menlo, "DejaVu Sans Mono", Consolas, "Liberation Mono", monospace;
    font-size: 90%;

    /* Computers are terrible http://stackoverflow.com/a/248013 */
    white-space: pre-wrap;       /* Since CSS 2.1 */
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
    overflow-wrap: break-word;   /* CSS3 name for word-wrap */
}
pre code, .fake-code
{
    display: block;
}

/*****************************************************************************/
/* Nav
/*****************************************************************************/

header h1
{
    font-weight: normal;
    margin: 0px;
    text-decoration: none;
    display: inline-block;

    font-size: 150%;
}
header a, header a:hover
{
    text-decoration: none;
}
header div
{
    margin-left: -7px; /* compensate for a.extra's 8px padding */
    margin-right: -7px;
}

/* Nav buttons in the header */
header a.extra
{
    border-color: transparent;
}
header a.extra:hover, header a.selected
{
    border-color: #fff;
}
header a.extra:active
{
    background-color: #fff;
    color: #3daae7;
}
/* Dark mode */
body#dark header a.extra
{
    border-color: #000;
}
body#dark header a.extra:hover, body#dark header a.selected
{
    border-color: #fff;
}
body#dark header a.extra:active
{
    background-color: #fff;
    color: #000;
}

/* Nav buttons anywhere else */
a.extra
{
    text-transform: uppercase;
    font-weight: bold;
    font-size: 14px;
    text-decoration: none;
    padding: 5px 8px;

    border: 1px solid #406fcd;
    border-radius: 5px;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
a.extra:hover
{
    border-color: #406fcd;
}
a.extra:active
{
    background-color: #406fcd;
    color: #fff;
}
/* Dark mode */
body#dark a.extra
{
    border-color: #759ef0;
}
body#dark a.extra:hover
{
    border-color: #759ef0;
}
body#dark a.extra:active
{
    background-color: #759ef0;
    color: #000;
}

header
{
    position: absolute;
    width: 100%;
    padding: 0px;
    padding-top: 25px;
    padding-bottom: 40px;
}

footer
{
    font-size: 80%;
    padding-bottom: 40px;
    overflow: hidden;
}
footer p
{
    text-align: center;
    color: #999;
}
body#dark footer p
{
    color: #aaa;
}

header
{
    opacity: 0.7;
    transition: opacity 0.5s;
}
header:hover, footer:hover, nav:hover
{
    opacity: 1.0;
}

/*****************************************************************************/
/* Homepage
/*****************************************************************************/

.social-wrap
{
    width: calc(50% - 2 * 10px); /* account for padding */
    float: left;
    padding: 10px 10px 10px 10px;
    display: block;
    border-radius: 5px;

    transition: background-color 0.15s;
}
.social-wrap:hover
{
    background-color: #ddd;
}
body#dark .social-wrap:hover
{
    background-color: #888;
}
a.social-wrap, a.social-wrap:hover
{
    text-decoration: none;
}
.social-wrap div
{
    line-height: 100%;
    background-size: contain;
    background-position: left;
    background-repeat: no-repeat;
    padding-left: 48px; /* 40 + 8 */
    color: #333;
}
body#dark .social-wrap div
{
    color: #fff;
}
/* Smaller subtitle */
.social-wrap div span
{
    font-weight: normal;
    font-size: 75%;
}
#twitter-icon
{
    background-image: url("/assets/home/icon-twitter.svg");
}
#email-icon
{
    background-image: url("/assets/home/icon-email.svg");
}
#github-icon
{
    background-image: url("/assets/home/icon-github.svg");
}
#linkedin-icon
{
    background-image: url("/assets/home/icon-linkedin.svg");
}
#yelp-icon
{
    background-image: url("/assets/home/icon-yelp.svg");
}

/*****************************************************************************/
/* Gallery
/*****************************************************************************/
.my-gallery figure
{
    float: left;
    width: 180px;
    height: 180px;
    margin: 0 12px 12px 0;

    /* centering */
    position: relative;
}

.my-gallery figure img
{
    /* centering */
    left: 50%;
    margin: 0;
    margin-right: -50%;
    position: absolute;
    top: 50%;
    transform: perspective(1px) translate(-50%, -50%);

    /* show a gray square before the thumbnail is loaded */
    background: rgba(128, 128, 128, 0.3);
}

.my-gallery figcaption
{
    display: none;
}

/*****************************************************************************/
/* Smaller screens
/*****************************************************************************/
@media only screen and (max-width: 1200px)
{
.extrawide
{
    margin-left: calc(-1 * (100vw - 640px) / 2);
    max-width: 100vw;
}
img.extrawide, video.extrawide
{
    height: auto;
}
iframe.extrawide
{
    /* Assume all iframes are 16:9 videos, lol */
    height: calc(9 / 16 * 100vw);
}
}

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

.wrap-wide
{
    width: auto;
    padding-left: 20px;
    padding-right: 20px;
}

}

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

body
{
    -webkit-text-size-adjust: none; /* for iOS 4 and under */
}

.wrap
{
    width: auto;
    padding-left: 20px;
    padding-right: 20px;
}
.extrawide
{
    margin-left: -20px;
}

.mobile-hide
{
    display: none;
}

}

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

.title
{
    display: block;
}

header
{
    padding-top: 15px;
    padding-bottom: 25px;
}
header h1
{
    margin-bottom: 5px;
    font-size: 130%;
}
header *.right
{
    float: none;
}

.nav-padder
{
    height: 88px;
}
.content-top
{
    margin-top: 20px;
}
.content-bottom
{
    margin-bottom: 20px;
}
body#dark .content-top
{
    margin-top: 0;
}

.social-wrap
{
    width: auto;
    float: none;
}

body
{
    font-size: 16px;
}
header
{
    /* Nav should remain the same size */
    font-size: 18px;
}
a.extra
{
    font-size: 14px;
}
h1
{
    font-size: 180%;
}
h2
{
    font-size: 160%;
}
h3
{
    font-size: 140%;
}
h4
{
    font-size: 120%;
}
h5, h6
{
    font-size: 100%;
}

.my-gallery figure
{
    margin: 0 8px 8px 0;
    width: calc((100% - 3 * 8px) / 4 - 2px);

    /* A scam to make the width and height equal */
    height: 0;
    padding-top: calc((100% - 3 * 8px) / 4 - 2px);

    overflow: hidden;

    /* img and figure will have the same visible region, so we apply background to the figure instead */
    background: rgba(128, 128, 128, 0.3);
}

.my-gallery figure img
{
    max-width: none;
    background: none;
}
.my-gallery figure img.vertical, .my-gallery figure img.square
{
    max-width: 100%;
    height: auto;
}
.my-gallery figure img.horizontal
{
    width: auto;
    max-height: 100%;
}

}
