:root {
    font-family: Arial, "Helvetica Neue", sans-serif;
    font-size: 16px; /* base font size */
}

body {
    padding: 0px;
    margin: 0px;
}

/* Base container styles */
.container {
    width: 100%;
    padding: 0 1rem;  /* gives breathing room on mobile */
    margin: 0 auto;   /* centers the container */
    box-sizing: border-box;
}

/* Make the contents just slightly narrower than the top link bar */
.contents {
    padding: 0 0.5rem;
    /* It's widely recommended to hyphenate text when justified */
    text-align: justify;
    hyphens: auto;
}

.copyright {
    text-align: center;
    font-size: 0.85rem;
    color: #555;
    margin: 18px;
    max-width: 95%;
}

/* Increase the font size for regular text a little bit */
:where(p, li) {
    font-size: 1.0625rem;
}

/* Top bar container */
.top_bar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center; /* Vertically center items */

    padding-top: 8px;
    padding-bottom: 8px;
    border-bottom: 3px double #555;
}

.top_bar .pgw a {
    font-family: monospace;
    font-size: 1.125rem;
    font-weight: bold;
    text-decoration: none;
    color: #000;
}

/* Make nav a flex container too */
.top_bar nav {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

/* Top navigation links */
.top_bar nav a {
    font-size: 1.125rem;
    font-weight: bold;
    text-decoration: none;
    color: #000;
}

.top_bar nav a:hover {
    text-decoration: underline;
}

.top_bar a:visited {
    color: #000;
}

/* Title and date block container */
.page_title {
    margin-top: 2.125rem;
    margin-bottom: 1.5rem;
}

h1 {
    text-align: center;
    text-wrap: balance; /* avoid very short second line */
    margin-bottom: 0px;
}

.post_date {
    text-align: center;
    margin-top: 0.5rem;
    color: #777
}

.index_h2 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 1.15rem;
}

/* Post links on the index page */
.post_link {
    margin-left: 20px;
    margin-top: 8px;
    margin-bottom: 8px;

    /* Use flexbox for layout */
    display: flex;
    /* Align items horizontally */
    justify-content: space-between;
    /* Ensures items are on the same line */
    flex-wrap: nowrap;
}

.post_link .title {
    text-align: left;
    color: #0000EE;
    text-decoration: none;
}

.post_link .title:hover {
    text-decoration: underline;
}

.post_link .title:visited {
    color: #0000EE;
}

.post_link .date {
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    white-space: nowrap;
}

a:visited {
    color: #0000EE;
}

.cover_image {
    float: left;
    margin: 0 18px 10px 0;
    padding: 15px;  /* creates the grey space */
    background-color: #EEE;  /* makes the padding grey */
    border: 1px solid #BBB;  /* thin outer border */
}

.cover_image img {
    display: block;
    max-width: 280px;
    padding: 3px;
}

hr {
    border-top: 1px solid #CCC;
}

p {
    line-height: 1.3;
}

p code {
    font-family: 'DejaVu Sans Mono', 'Lucida Console', monospace;

    background: #EEE;
    padding-left: 1px;
    padding-right: 1px;
}

pre code {
    display: block;
    max-width: 100%;   /* never wider than 90% of container */
    margin: 0 auto;   /* center the block */
    overflow-x: scroll;

    font-family: 'DejaVu Sans Mono', 'Lucida Console', monospace;
    /*font-family: 'Courier New', Courier, monospace;*/

    color: #000;
    background: #EEE;
    border: 1px solid #222;
    padding: 8px;
}

li {
    text-align: left;
}

li > p:first-child {
    margin-top: 4px;
    margin-bottom: 4px;
}

li > p:last-child {
    margin-bottom: 4px;
}

blockquote {
    /*
    move below any left-floated elements that come before it,
    rather than trying to wrap around them.
    This avoids overlapping with the cover image.
    */
    clear: left;

    display: block;
    max-width: 90%;   /* never wider than 90% of container */
    margin: 16px auto;   /* center the block */

    background: #DDD;
    border-left: 4px solid #999;
    padding: 8px;
}

figure img {
    max-width: 95%;   /* never wider than 90% of container */
    max-height: 500px;  /* limit image height as well */
    width: auto;      /* maintain aspect ratio */
    height: auto;     /* maintain aspect ratio */
    display: block;   /* images are inline by default, block helps with centering */
    margin: 0 auto;   /* centers the image */
}

figure figcaption {
    text-align: center;
    margin-top: 6px;
}

/* On larger screens at least this size, limit the page width */
@media (min-width: 1000px) {
    .container {
        max-width: 820px;
    }
}

/* For mobile devices */
@media only screen and (max-device-width: 480px) {
    :root {
        /* Increase the base font size */
        font-size: 32px;

        /* Don't auto-adjust font sizes on mobile */
        /*text-size-adjust: none;*/
    }

    .top_bar {
        display: flex;
        flex-direction: column;
        padding-top: 0.8rem;
        padding-bottom: 0.8rem;
        gap: 0.45rem;
        border-bottom: 4px double #555;
    }

    .top_bar .pgw a {
        font-size: 2.25rem;
    }

    /* Make nav a flex container too */
    .top_bar nav {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    /* Top navigation links */
    .top_bar nav a {
        font-size: 1.5rem;
    }

    h1 {
        font-size: 2.25rem;
    }

    .post_date {
        font-size: 0.7rem;
    }

    /* Make the copyright notice a bit smaller on mobile */
    .copyright {
        font-size: 0.75rem;
    }

    /*
    Remove the max image height on mobile.
    Only use the relative max-width
    */
    figure img {
        max-height: unset;
    }
}
