/* =========================================================
   CONTENT IN CONTEXT
   Main Stylesheet

   Used by:
   - index.php
   - library.php
   - post.php
   - menu.php
========================================================= */


/* =========================================================
   GENERAL / RESET
========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;

    background: #ffffff;
    color: #111111;

    font-family: Arial, Helvetica, sans-serif;

    overflow-x: hidden;
}

/* Hide hamburger while menu is open */
body.menu-open .menu-button {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.menu-button {
    position: fixed;

    top: 14px;
    right: 14px;

    width: 32px;
    height: 28px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    padding: 0;

    border: 0;
    background: transparent;

    cursor: pointer;

    z-index: 1000;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

img {
    max-width: 100%;
}

button {
    font: inherit;
}


/* =========================================================
   SHARED HANDWRITTEN FONT

   Caveat is loaded from Google Fonts in each page's <head>.
========================================================= */

.handwritten {
    font-family: "Caveat", cursive;
}


/* =========================================================
   HAMBURGER BUTTON
========================================================= */

.menu-button {
    position: fixed;

    top: 14px;
    right: 14px;

    width: 32px;
    height: 28px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    padding: 0;

    border: 0;
    background: transparent;

    cursor: pointer;

    z-index: 1000;
}

.menu-button span {
    display: block;

    width: 100%;
    height: 3px;

    background: #111111;

    border-radius: 3px;

    transition:
        transform 0.25s ease,
        opacity 0.25s ease;
}


/* =========================================================
   MENU OVERLAY
========================================================= */

.menu-overlay {
    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.15);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;

    z-index: 900;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}


/* =========================================================
   SIDE MENU
========================================================= */

.side-menu {
    position: fixed;

    top: 0;
    right: 0;

    width: 240px;
    height: 100vh;

    padding: 80px 35px;

    background: #ffffff;

    transform: translateX(100%);

    transition: transform 0.3s ease;

    box-shadow:
        -5px 0 20px
        rgba(0, 0, 0, 0.08);

    z-index: 950;
}

.side-menu.active {
    transform: translateX(0);
}


/* =========================================================
   MENU LINKS
========================================================= */

.side-menu a {
    display: block;

    margin-bottom: 20px;

    color: #111111;

    text-decoration: none;

    font-family: "Caveat", cursive;
    font-size: 30px;

    transition: opacity 0.2s ease;
}

.side-menu a:hover {
    opacity: 0.6;
}


/* =========================================================
   MENU CLOSE BUTTON
========================================================= */

.menu-close {
    position: absolute;

    top: 12px;
    right: 18px;

    padding: 0;

    border: 0;
    background: transparent;

    color: #111111;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 35px;
    line-height: 1;

    cursor: pointer;
}

body.menu-open {
    overflow: hidden;
}


/* =========================================================
   SHARED PAGE TITLE
========================================================= */

.site-title {
    margin: 0;

    color: #111111;

    font-family: "Caveat", cursive;
    font-weight: 500;

    text-align: center;
}


/* =========================================================
   SHARED LINES
========================================================= */

.header-line,
.footer-line {
    border: 0;
    border-top: 1px solid #999999;
}


/* =========================================================
   =========================================================
   HOME PAGE
   =========================================================
========================================================= */


/* =========================================================
   HOME PAGE WRAPPER
========================================================= */

.home-page {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
}


/* =========================================================
   HOME HEADER
========================================================= */

.home-header {
    padding-top: 76px;

    text-align: center;
}

.home-header .site-title {
    font-size: clamp(48px, 6vw, 72px);
    line-height: 1;
}

.home-header .header-line {
    width: min(610px, 61vw);

    margin: 40px auto 36px;
}


/* =========================================================
   HOME CAROUSEL SECTION
========================================================= */

.carousel-section {
    position: relative;

    width: 100%;

    overflow: hidden;
}


/* =========================================================
   CAROUSEL
========================================================= */

.carousel {
    display: flex;

    gap: 19px;

    overflow-x: auto;

    padding:
        0
        max(
            20px,
            calc((100vw - 806px) / 2)
        );

    scroll-behavior: smooth;

    scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
    display: none;
}


/* =========================================================
   POST CARDS
========================================================= */

.post-card {
    position: relative;

    flex:
        0
        0
        146px;

    height: 222px;

    overflow: hidden;

    background: #d5d5d5;

    color: #ffffff;

    text-decoration: none;

    cursor: pointer;
}


/* =========================================================
   POST CARD IMAGE
========================================================= */

.post-image {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    transition:
        transform 0.3s ease,
        filter 0.3s ease;
}


/* =========================================================
   POST CARD PLACEHOLDER
========================================================= */

.post-placeholder {
    position: absolute;

    inset: 0;

    background: #d5d5d5;
}


/* =========================================================
   POST CARD OVERLAY
========================================================= */

.post-overlay {
    position: absolute;

    inset: 0;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    padding: 15px;

    background: rgba(0, 0, 0, 0);

    opacity: 0;

    text-align: center;

    transition:
        opacity 0.25s ease,
        background 0.25s ease;
}

.post-title {
    margin: 0;

    font-family: "Caveat", cursive;
    font-size: 25px;
    font-weight: 500;
    line-height: 1.05;
}

.post-date {
    margin-top: 7px;

    font-family: "Caveat", cursive;
    font-size: 16px;
}


/* =========================================================
   POST CARD HOVER
========================================================= */

.post-card:hover .post-image {
    transform: scale(1.04);
}

.post-card:hover .post-overlay {
    opacity: 1;

    background: rgba(0, 0, 0, 0.48);
}


/* =========================================================
   CAROUSEL BUTTONS
========================================================= */

.carousel-button {
    position: absolute;

    top: 50%;

    transform: translateY(-50%);

    width: 50px;
    height: 70px;

    padding: 0;

    border: 0;

    background: rgba(255, 255, 255, 0.75);

    color: #111111;

    font-family: "Caveat", cursive;
    font-size: 45px;

    cursor: pointer;

    opacity: 0;

    transition:
        opacity 0.2s ease,
        background 0.2s ease;

    z-index: 10;
}

.carousel-section:hover .carousel-button {
    opacity: 1;
}

.carousel-button:hover {
    background: #ffffff;
}

.carousel-prev {
    left: 0;
}

.carousel-next {
    right: 0;
}


/* =========================================================
   HOME FOOTER
========================================================= */

.home-page .footer-line {
    width: min(610px, 61vw);

    margin: 39px auto 26px;
}

.site-footer {
    padding-bottom: 35px;

    text-align: center;

    font-family: "Caveat", cursive;
    font-size: 18px;
}


/* =========================================================
   NO POSTS
========================================================= */

.no-posts {
    width: 100%;

    padding: 70px 20px;

    text-align: center;

    font-family: "Caveat", cursive;
    font-size: 28px;
}


/* =========================================================
   =========================================================
   LIBRARY PAGE
   =========================================================
========================================================= */


/* =========================================================
   LIBRARY WRAPPER
========================================================= */

.library-wrapper {
    width:
        min(
            610px,
            calc(100% - 40px)
        );

    margin: 0 auto;

    padding:
        8px
        0
        70px;
}


/* =========================================================
   LIBRARY HEADER
========================================================= */

.library-header .site-title {
    margin:
        0
        0
        9px;

    font-size: 23px;
    line-height: 1.2;
}

.library-header .header-line {
    width: 100%;

    margin:
        0
        0
        25px;
}


/* =========================================================
   LIBRARY TREE
========================================================= */

.library {
    width: 180px;

    margin: 0 auto;

    font-family: "Caveat", cursive;
}


/* =========================================================
   LIBRARY YEAR
========================================================= */

.library-year {
    margin:
        20px
        0
        8px;

    font-size: 25px;
    font-weight: 500;
}


/* =========================================================
   LIBRARY MONTH
========================================================= */

.library-month {
    margin:
        5px
        0;

    font-size: 22px;
}


/* =========================================================
   POSTS UNDER MONTH
========================================================= */

.library-posts {
    margin:
        4px
        0
        7px;
}

.library-post {
    display: block;

    margin:
        3px
        0;

    color: #111111;

    text-decoration: none;

    font-size: 22px;
}

.library-post:hover {
    text-decoration: underline;
}


/* =========================================================
   =========================================================
   POST PAGE
   =========================================================
========================================================= */


/* =========================================================
   ARTICLE WRAPPER
========================================================= */

.article-wrapper {
    width:
        min(
            760px,
            calc(100% - 40px)
        );

    margin: 0 auto;

    padding:
        75px
        0
        60px;
}


/* =========================================================
   ARTICLE HEADER
========================================================= */

.article-header {
    text-align: center;
}

.article-title {
    margin:
        20px
        0
        10px;

    font-family: "Caveat", cursive;

    font-weight: 500;

    font-size:
        clamp(
            48px,
            7vw,
            74px
        );

    line-height: 1;
}

.article-date {
    margin-bottom: 28px;

    color: #555555;

    font-family: "Caveat", cursive;
    font-size: 20px;
}

.article-header .header-line {
    width: 75%;

    margin:
        0
        auto
        38px;
}


/* =========================================================
   POST HERO IMAGE
========================================================= */

.hero-image {
    display: block;

    width: 100%;
    max-height: 480px;

    margin-bottom: 42px;

    object-fit: cover;
}


/* =========================================================
   ARTICLE CONTENT
========================================================= */

.article-content {
    color: #111111;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 19px;
    line-height: 1.75;
}

.article-content p {
    margin:
        0
        0
        1.5em;
}


/* =========================================================
   ARTICLE HEADINGS
========================================================= */

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.6em;

    font-family: "Caveat", cursive;
    font-weight: 500;

    line-height: 1.1;
}

.article-content h1 {
    font-size: 44px;
}

.article-content h2 {
    font-size: 38px;
}

.article-content h3 {
    font-size: 32px;
}

.article-content h4 {
    font-size: 28px;
}

.article-content h5 {
    font-size: 24px;
}

.article-content h6 {
    font-size: 21px;
}


/* =========================================================
   ARTICLE LINKS
========================================================= */

.article-content a {
    color: #111111;

    text-decoration-thickness: 1px;

    text-underline-offset: 3px;
}

.article-content a:hover {
    opacity: 0.65;
}


/* =========================================================
   ARTICLE IMAGES
========================================================= */

.article-content img {
    display: block;

    width: 100%;
    height: auto;

    margin:
        35px
        auto;
}


/* =========================================================
   ARTICLE LISTS
========================================================= */

.article-content ul,
.article-content ol {
    margin:
        1em
        0
        1.7em
        1.5em;
}

.article-content li {
    margin-bottom: 0.5em;
}


/* =========================================================
   BLOCKQUOTES
========================================================= */

.article-content blockquote {
    margin:
        35px
        0;

    padding:
        8px
        0
        8px
        25px;

    border-left:
        2px solid
        #999999;

    color: #444444;

    font-style: italic;
}


/* =========================================================
   INLINE CODE
========================================================= */

.article-content code {
    padding:
        2px
        5px;

    background: #eeeeee;

    border-radius: 3px;

    font-family:
        "Courier New",
        monospace;

    font-size: 0.9em;
}


/* =========================================================
   CODE BLOCKS
========================================================= */

.article-content pre {
    overflow-x: auto;

    margin:
        30px
        0;

    padding: 18px;

    background: #eeeeee;

    line-height: 1.5;
}

.article-content pre code {
    padding: 0;

    background: transparent;
}


/* =========================================================
   ARTICLE HORIZONTAL RULE
========================================================= */

.article-content hr {
    width: 50%;

    margin:
        45px
        auto;

    border: 0;

    border-top:
        1px solid
        #999999;
}


/* =========================================================
   ARTICLE FOOTER
========================================================= */

.article-wrapper > .footer-line {
    width: 75%;

    margin:
        50px
        auto
        25px;
}


/* =========================================================
   BACK LINK
========================================================= */

.back-link {
    position: fixed;

    top: 15px;
    left: 18px;

    color: #111111;

    text-decoration: none;

    font-family: "Caveat", cursive;
    font-size: 23px;

    z-index: 100;
}

.back-link:hover {
    text-decoration: underline;
}


/* =========================================================
   =========================================================
   TABLET
   =========================================================
========================================================= */

@media (max-width: 700px) {

    /* -----------------------------------------------------
       HOME
    ----------------------------------------------------- */

    .home-header {
        padding-top: 85px;
    }

    .home-header .header-line,
    .home-page .footer-line {
        width: 72%;
    }

    .carousel {
        gap: 15px;

        padding-left: 20px;
        padding-right: 20px;
    }

    .post-card {
        flex-basis: 145px;
    }

    .carousel-button {
        display: none;
    }


    /* -----------------------------------------------------
       ARTICLE
    ----------------------------------------------------- */

    .article-wrapper {
        width:
            calc(100% - 34px);

        padding-top: 80px;
    }

    .article-title {
        font-size:
            clamp(
                44px,
                14vw,
                60px
            );
    }

    .article-content {
        font-size: 18px;

        line-height: 1.7;
    }

    .hero-image {
        max-height: 350px;
    }

    .article-header .header-line,
    .article-wrapper > .footer-line {
        width: 85%;
    }

}


/* =========================================================
   =========================================================
   MOBILE
   =========================================================
========================================================= */

@media (max-width: 600px) {

    /* -----------------------------------------------------
       MENU
    ----------------------------------------------------- */

    .side-menu {
        width: min(240px, 80vw);
    }


    /* -----------------------------------------------------
       LIBRARY
    ----------------------------------------------------- */

    .library-wrapper {
        width:
            calc(100% - 35px);
    }

    .library {
        width: 170px;
    }

}


/* =========================================================
   TOUCH DEVICES

   Since phones don't really have "hover", keep post
   information visible.
========================================================= */

@media (hover: none) {

    .post-overlay {
        justify-content: flex-end;

        opacity: 1;

        background:
            linear-gradient(
                transparent,
                rgba(0, 0, 0, 0.65)
            );
    }

    .post-title {
        font-size: 21px;
    }

    .post-date {
        font-size: 14px;
    }

}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    .side-menu,
    .menu-overlay,
    .post-image,
    .post-overlay,
    .carousel {
        transition: none;
        scroll-behavior: auto;
    }

}