/* ===================
   ===================
    Mobile (Default)
   =================== 
   =================== */
/* ===== Color Theme ===== */
:root {
/* Weird naming convention since primary is used the least, but the names fit for the rest */
    /* Dark */
    --primary-color: hsl(248, 39%, 29%);
    --secondary-color: hsl(34, 44%, 69%);
    --accent-color: hsl(195, 53%, 79%);
    --text-color: hsla(348 33 97 / 0.89);
    --background-color: hsl(210 50 13);
    .theme-icon {
        filter: invert(70%);
    }
}

/* Light */
body.light {
    --primary-color: hsl(296, 39%, 31%);
    --secondary-color: hsl(341, 66%, 67%);
    --accent-color: hsl(165, 70%, 46%);
    --text-color: hsl(0, 0%, 0%); 
    --background-color: hsl(15, 15%, 99%);
    .theme-icon {
        filter: invert(0);
    }
}

/* Loud */
body.neon {
    --primary-color: silver;
    --secondary-color: purple;
    --accent-color: lightgreen;
    --text-color: darkslateblue;
    --background-color: magenta;
    .theme-icon {
        filter: invert(0);
    }
}

body.milk {
    --primary-color: hsl(336, 17%, 19%);
    --secondary-color: hsl(98, 64%, 83%);
    --accent-color: hsl(244, 70%, 60%);
    --text-color: hsl(0, 17%, 98%);
    --background-color: hsl(231, 30%, 74%);
    .theme-icon {
        filter: invert(0);
    }
}

body.colorblind {
    --primary-color: hsl(327 45 44);
    --secondary-color: hsl(41 100 45);
    --accent-color: hsl(26 100 42);
    --text-color: white;
    --backgroundcolor: hsl(202 100 35);
    .theme-icon {
        filter: invert(90%);
    }
}

/* ===================
    Element Selectors
   =================== */
*:focus-visible {
    outline: 3px solid var(--accent-color);
}

html {
    font-size: 16px;
}

body {
    font-family: monospace, Consolas, Monaco, 'Courier New', monospace;
    background-color: var(--background-color);
}

footer {
    position: sticky;
    background-color: var(--primary-color);
    min-height: 15vh;
    padding-block-start: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;

    .footer-links {
        display: flex;
        gap: 1rem;
        justify-content: space-between;
    }
}

article {
    color: var(--text-color);
    & > div {
        padding-block-end: 1rem;
    }
}

a, a:visited {
    color: var(--accent-color);
}

a:hover {
    color: var(--secondary-color);
    filter: brightness(110%);
    transition: color 300ms ease-out;
}

abbr {
  font-style: italic;
  color: var(--secondary-color);
}

h1, h2, h3, h4, h5, h6  {
    color: var(--secondary-color);
}

p {
    color: var(--text-color);
}

ul {
    padding-inline-start: 0;
}


/* ===================
        ID selectors
   =================== */
#posts {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-top: 1rem;
    > * {
        max-width: 1200px;
    }
}

#nav-menu {
    padding: 2rem 4rem;

    .nav-list {
        display: flex;
        flex-wrap: wrap;
        gap: 1.8rem;
        list-style-type: none;
        justify-content: center;
        align-content: space-between;
        overflow: visible;
        li {
            min-width: 0;
            gap: 1rem;
        }
    }

    .theme-menu-toggle {
        position: absolute;
        top: 1rem;
        right: 1rem;
        aspect-ratio: 1;
    }

    /* Blur background when theme menu open */
    .menu-bg-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100;
        background: rgb(0 0 0 / 0.3);
        backdrop-filter: blur(0.3rem);
    }
}


/* ===================
    Class Selectors
   =================== */
.theme-popup-menu {
    position: fixed;
    background-color: var(--accent-color);
    color: var(--primary-color);
    outline: 4px solid var(--primary-color);

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 2rem 2rem 2rem;

    z-index: 100;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* transition: transform 1000ms; */

    li {
        list-style: none;
        width: 100%;
        color: var(--background-color);
        background-color: var(--accent-color);
        filter: brightness(110%);
        text-align: center;
        margin: 0.4rem 1rem;
        padding: 0.2rem;
        outline: 1px solid var(--primary-color);
        box-shadow: 2px 0px 8px 0px;

        &:hover {
            outline: 5px solid var(--primary-color);
            color: var(--secondary-color);
        }

        &:active {
            scale: 0.96;
        }
    }

    .theme-popup-close {
        cursor: pointer;
        position: absolute;
        padding: 0.5rem 1rem 0.9rem 1rem;
        top: 1%;
        right: -1%;
    }
}

.home-header {
    margin-bottom: 2rem;
}

.home-intro > p {
    margin: 1.5rem 0rem;
}

.home-post {
    margin-top: 4rem;

    .home-latest-post-header {
        margin-bottom: 2.5rem;
    }
    .post-cover-img {
        margin-top: 1rem;
    }
}

.post-index {
    --toast-color: var(--primary-color);

    color: hsl(from var(--toast-color) h s l);
    background-color: hsl(from var(--toast-color) h s 35%);
    box-shadow: 0 12px 12px -6px hsl(from var(--toast-color) h s l / 0.65);
    border: 2px solid hsl(from var(--toast-color) h s 50%);

    border-radius: 8px;
    padding: 8px 16px;
}

.post-show-back {
    margin-top: 4rem;
}

.post-cover-img {
    margin-bottom: 1rem;
    outline: 2px solid var(--primary-color);
}

.post-form {
    color: var(--text-color);
    & > div {
        margin: 1rem;
    }
}

.post-popover {
    margin-top: 1rem;
    position: absolute;
    z-index: 200;
    width: 65vw;
}

.subcategory-list {
    display: flex;
    justify-content: center;
    gap: 2rem;
    list-style-type: none;
    overflow: visible;
    border-bottom: 16px solid var(--primary-color);

    li a {
        text-decoration: none;
    }
}

.theme-icon:hover {
    filter: brightness(150%);
    border-block-start: 1px solid transparent;
    border-block-end: 1px solid transparent;
    background: radial-gradient(var(--secondary-color), transparent);
    border-radius: 70%;
    opacity: 80%;
}

.updates-page {
    section {
        border: 2px solid var(--primary-color);
        background-color: hsl(from var(--background-color) h s 15%);
        padding: 1rem;
        margin: 0.5rem 3rem;
        display: flex;
        gap: 1rem;
    }
}

.yield-content {
    padding: 1rem;
    border-top: 2px solid var(--primary-color);
    &::after {
        content: "";
        display: block;
        padding-bottom: 70vh;
    }
}


/* ===================
   ===================
        Tablet
   =================== 
   =================== */
@media screen and (min-width: 768px) {
    body {
        font-size: 1.125rem /* 18px */;
    }

    #nav-menu {
        margin-inline: 0;
        justify-content: space-between;
    }

    .yield-content {
        padding-inline: 5rem;
    }

    .post-popover {
        width: 45vw;
    }
}

/* ===================
   ===================
        Desktop
   =================== 
   =================== */
@media screen and (min-width: 1024px) {  
    
    main::after {
        padding-bottom: 100vh;
    }

    body {
        /* padding-inline: 12rem; */
        font-size: 1.25rem /* 20px */;
    }

    footer {
        width: auto;
    }

    #nav-menu {
        .nav-list {
            gap: 3rem;
        }
    }

    .yield-content {
        padding-inline: 10rem;
    }
}

/* ===================
   ===================
    Custom Classes
   =================== 
   =================== */
.debug {
    outline: 2px solid red;
}

.capitalize {
    text-transform: capitalize;
}

.lowercase {
    text-transform: lowercase;
}

.uppercase {
    text-transform: uppercase;
}

.underline {
    text-decoration: underline;
}

.italy {
    font-style: italic;
}

.bold {
    font-weight: 600;
}

.center {
    text-align: center;
}

.small-text {
    font-size: 0.85rem;
}

.v-small-text {
    font-size: 0.4rem;
}

.no-underline {
    text-decoration: none;
}

.hidden {
    display: none !important;
}

.text-color {
    color: var(--text-color);
}

.flex {
    display: flex;
    gap: var(--gap, 1rem);
}

.prose > * + * {
    margin-block-start: var(--prose-flow, 1.5em);
}

.p-1 {
    padding: 1rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

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