/* CSS Variables */
:root {
    /* Colors */
    --color-primary: hsl(0, 0%, 0%); /* Black */
    --color-secondary: hsl(0, 0%, 100%); /* White */
    --color-accent: hsl(0, 100%, 50%); /* Red */
    --color-light-primary: hsla(0, 0%, 0%, 18%); /* Light Black */
    --color-text: hsl(0, 0%, 20%); /* Text Color */
    --color-bg: hsl(0, 0%, 95%); /* Background Color */
    --color-link: hsl(0, 100%, 40%); /* Link Color */

    /* Container Width */
    --container-width-lg: 74%; /* Large Container Width */
    --container-width-md: 88%; /* Medium Container Width */

    /* Form Width */
    --form-width: 40%; /* Form Width */

    /* Border Radius */
    --border-radius-1: 0.3rem;
    --border-radius-2: 0.5rem;
    --border-radius-3: 0.8rem;
    --border-radius-4: 2rem;
    --border-radius-5: 5rem;

    /* Transition */
    --transition: all 300ms ease;

    /* Red Variants */
    --color-red-light:#be2935;
    --color-red-dark: #a71f23;

    /* Black Variants */
    --color-black-light: hsl(0, 0%, 20%);
    --color-black-dark: hsl(0, 0%, 10%);
}

/*====GENERAL=====*/

/* Reset Styles */
* {
    margin: 0;
    padding: 0;
    outline: 0;
    border: 0;
    appearance: 0;
    list-style: none;
    text-decoration: none;
    box-sizing: border-box;
}

/* General Styles */
body {
    font-family: 'Montserrat', sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    overflow-x: hidden;
    font-size: 0.9rem;
    transition: var(--transition);
}

h1, h2, h3, h4, h5 {
    color: var(--color-primary);
    line-height: 1.3;
}

h1 {
    font-size: 3rem;
    margin: 1rem 0;
}

h2 {
    font-size: 1.7rem;
    margin: 1rem 0;
}

h3 {
    font-size: 1.1rem;
    margin: 0.8rem 0 0.5rem;
}

h4 {
    font-size: 1rem;
}

img {
    display: block;
    width: 100%;
    object-fit: cover;
}

a {
    color: var(--color-primary);
    transition: var(--transition);
}

/* Container */
.container {
    width: var(--container-width-lg);
    max-width: 1800px;
    margin-inline: auto;
}

section{
    margin-top: 3rem;
    width: 100vw;
}

/* add to posts on index if there's no featured post. eg search results */
.section__extra-margin{
    margin-top: 7rem;
}
nav{
    background: var(--color-red-dark);
    width: 100vw;
    position: fixed;
    top:0;
    z-index: 10;
    box-shadow: 0 1rem 1rem rgba(0, 0, 0, 0.2);
    height: 4.5rem;
}
/* Styles for the signup form */
.form__section-container form{
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form__section-container .form__control.inline{
    flex-direction: row;
    align-items: center;
}
.form__section-container .form__control{
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}


.form__section-container input, .form__section-container textarea, .form__section-container select {
    padding:0.8rem 1.4rem;
    background-color: var(--color-secondary);
    border-radius: var(--border-radius-2);
    resize: none;
    color: var(--color-light-primary);
}

.nav__container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

nav button {
    display: none;
}

.nav__logo {
    font-weight: 700; /* Increased font weight */
    font-size: 1.5rem; /* Increased font size */
    color: var(--color-secondary);
    font-family: 'Arial Black', sans-serif; /* Modern font */
}

.avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    overflow: hidden;
    color: var(--color-bg);
}

.nav__items {
    display: flex;
    align-items: center;
    gap: 5rem; /* Increased spacing */
}

.nav__items li a:hover {
    /* background: var(--color-red-light); */
    color: var(--color-red-light);
    visibility: visible;
    opacity: 1;
}

.nav__items li a {
    color: var(--color-secondary); /* White text */
}

.nav__profile {
    position: relative;
    cursor: pointer;
}

.nav__profile ul {
    position: absolute;
    top: 140%;
    right: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-primary); /* Black background */
    visibility: hidden;
    opacity: 0;
    transition: var(--transition);
}

.nav__profile ul li a {
    padding: 1rem;
    background: var(--color-primary); /* Black background */
    color: var(--color-secondary); /* White text */
    display: block;
    width: 100%;
}

.nav__profile ul li a:hover {
    background: var(--color-secondary); /* White background on hover */
    color: var(--color-primary); /* Black text on hover */
}

.nav__profile ul li a {
    padding: 1rem;
    background: var(--color-primary); /* Black background */
    color: var(--color-secondary); /* White text */
    display: block;
    width: 100%;
}

.nav__profile ul li a:last-child {
    background: var(--color-primary);
    color: var(--color-bg);
}

.nav__profile:hover > ul {
    visibility: visible;
    opacity: 1;
}

/* Category */
.category__button {
    background: var(--color-red-dark);
    color: var(--color-bg);
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-2);
    font-weight: 600;
    font-size: 0.8rem;
    text-align: center;
}

.category__button:hover {
    background: var(--color-red-light);
}

/* GENERAL POST */
.post__thumbnail {
    border-radius: var(--border-radius-5) 0;
    border: 1rem solid var(--color-black-light);
    overflow: hidden;
    margin-bottom: 1.6rem;
}

.post:hover .post__thumbnail img {
    filter: saturate(0);
    transition: filter 500ms ease;
}

.post__author {
    display: flex;
    gap: 1rem;
    margin-top: 1.2rem;
}

.post__author-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    overflow: hidden;
}

/* Featured Section */
.featured{
    margin-top: 8rem;
}
.featured__container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.featured .post__thumbnail {
    height: fit-content;
}

/* posts Section */
.posts__container{
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5rem;
    margin-bottom: 5rem;
}

/* Category Buttons */
.category__buttons{
    padding:4rem 0;
    border-top: 2px solid var(--color-red-dark);
    border-bottom: 2px solid var(--color-red-dark);
}

.category__buttons-container{
    width: fit-content;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;

}

/* Footer */
footer{
    background: var(--color-black-light);
    padding: 5rem 0 0;
    box-sizing: inset 0 1.5rem rgba(54, 6, 6, 0.2);
}

.footer__socials{
    margin-inline: auto;
    width: fit-content;
    margin-bottom: 5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.2rem;
}

.footer__socials a{
    background: var(--color-red-dark);
    color: beige;
    border-radius: 50%;
    width: 2.3rem;
    height: 2.3rem;
    display: flex;
    align-items: center;
    justify-content: center;

}

.footer__socials a:hover{
    background: var(--color-red-light);
}

.footer__container{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

footer h4{
    color: var(--color-bg);
    margin-bottom: 0.6rem;
}

footer ul li{
    padding: 0.4rem 0;


}

footer ul a{
    color: var(--color-bg);
    opacity: 0.75;

}

footer ul a:hover{
    letter-spacing: 0.2rem;
    opacity:1;
}

.footer__copyright{
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 4rem;
    border-top: 2px solid var(--color-red-dark);
    color: var(--color-bg);

}

/* SEARCH */
.search__bar{
    margin-top: 7rem;
}

.search__bar-container{
    position: relative;
    width: 30rem;
    background: var(--color-black-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius-2);
    color: var(--color-bg);
}

.search__bar-container > div{
    width: 100%;
    display: flex;
    align-items: center;
}
.search__bar input{
    background : transparent;
    margin-left: 0.7rem;
    padding: 0.3rem 0;
    width: 100%;
}

.search__bar input::placeholder{
    color:var(--color-bg);
    opacity: 0.75;
}

/* Button */
.btn{
    display: inline-block;
    width:fit-content;
    padding:0.6rem 1.2rem;
    background-color: var(--color-red-dark);
    border-radius: var(--border-radius-2);
    cursor: pointer;
    transition: var(--transition);
    color: var(--color-bg);

}

.btn.sm{
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn:hover{
    background: var(--color-secondary);
    color: var(--color-primary)
}

.btn.danger{
    background: var(--color-accent);
}

.btn:hover{
    background-color: var(--color-red-light);
}

/* SINGLE POST */
.singlepost{
    margin: 6rem 0 2rem;
}
.singlepost__container{
    width: var(--form-width);
    background: var(--color-secondary);
    padding: 1rem 2rem 3rem;
}

.singlepost__thumbnail{
    margin: 1.5rem 0 1rem;
}

.singlepost__container p{
    margin-top: 1rem;
    line-height: 1.7;
}

/* Category Posts */
.category__title{
    height: 15rem;
    margin-top: 5rem;
    background: var(--color-red-dark);
    place-items: center;
    display: grid;
    color: var(--color-secondary);
}

/* Other Pages */
.empty__page{
    height: 70vh;
    display: grid;
    place-content: center;
}

/* General Form Styles */
.form__section{
    display: grid;
    place-items: center;
    /* height: 100vh; */
    padding-top: 4.5rem;
    padding-bottom: 4.5rem;
}

.form__section-container{
    width:var(--form-width);
}

.alert__message{
    padding: 0.8rem 1.4rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius-2);
}

.alert__message.error{
    background: var(--color-red-light);
    color: var(--color-red-dark);
    opacity: 0.75;
}

.alert__message.success{
    background: greenyellow;
    color: green;
    opacity: 0.75;
}

.alert__message.lg{
    text-align: center;
}
.form__section-container form{
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* form{
    display: flex;
    flex-direction: column;
    gap:1rem;
} */
.form__section-container .form__control{
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form__section-container input, .form__section-container textarea, .form__section-container select {
    padding:0.8rem 1.4rem;
    background-color: var(--color-secondary);
    border-radius: var(--border-radius-2);
    resize: none;
    color: var(--color-primary);
}

.form__section small{
    margin-top: 1rem;
    font-display: block;

}
.form__section small a{
    color: var(--color-red-dark);

}


/* Dashboard */
.dashboard{
    margin-top: 6rem;
}

.sidebar__toggle{
    display: none;
}

.dashboard__container{
    display: grid;
    grid-template-columns: 14rem auto;
    gap: 1rem;
    background: var(--color-secondary);
    padding: 2rem;
    margin-bottom: 5rem;
}

.dashboard aside a{
    background: var(--color-red-dark);
    color: var(--color-secondary);
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1.6rem;
}

.dashboard aside h5{
    color: var(--color-secondary);
}

.dashboard aside ul li:not(:last-child) a{
    border-bottom: 1px solid var(--color-red-light);
}

.dashboard aside a:hover{
    background: var(--color-red-light);
}

.dashboard aside a.active{
    background-color: var(--color-red-light);
}

.dashboard main{
    margin-left: 1.5rem;

}

.dashboard main h2{
    margin: 0 0 2rem 0;
    line-height: 1;
}

.dashboard main table{
    width: 100%;
    text-align: left;
}

.dashboard main table th{
    background: var(--color-red-dark);
    padding: 0.8rem;
    color: var(--color-secondary);
}

.dashboard main table td{
    padding: 0.8rem;
    border-bottom: 1px solid var(--color-red-dark);
}

.dashboard main table tr:hover td{
    background: var(--color-light-primary);
    color: var(--color-red-dark);
    cursor: default;
    transition: var(--transition);
}
/* media queries (medium devices) */
@media screen and (max-width:1024px){
    /* ==GENERAL== */
    .container{
        width: var(--container-width-md);
    }

    h2{
        font-size: 1.6rem;
    }
    h3{
        font-size: 1.2rem;
    }
    h5{
        font-size: 0.8rem;
    }

    /* ==NAV== */
    nav button{
        display:inline-block;
        font-size: 1.5rem;
        background: transparent;
        color: var(--color-bg);
        cursor: pointer;
    }

    nav button#close__nav-btn{
        display: none;
    }
    .nav__container{
        position: relative;
    }
    .nav__items{
        position: absolute;
        flex-direction: column;
        top:100%;
        right:0;
        width: 12rem;
        align-items: flex-start;
        justify-content: center;
        gap:0;
        display:none;
    }

    .nav__items li{
        width: 100%;
        height: 4.5rem;
        display: flex;
        align-items: center;
        box-shadow: -2rem 2rem 6rem rgba(58, 58, 58, 0.7);
        background: var(--color-primary);
        border-top: 1px solid var(--color-primary);
        animation: animateDropdown 400ms 0s ease forwards;
        opacity: 0;
        transform-origin: top;
    }

    .nav__items li:nth-child(2){
        animation-delay: 200ms;
    }

    .nav__items li:nth-child(3){
        animation-delay: 400ms;
    }
    .nav__items li:nth-child(4){
        animation-delay: 600ms;
    }
    .nav__items li:nth-child(5){
        animation-delay: 800ms;
    }
 
    /* nav dropdown animation */
    @keyframes animateDropdown {
        0%{
            transform: rotateX('90deg');
        }
        100%{
            transform: rotateX('0deg');
            opacity: 1;
        }
    }

    .nav__items li a{
        border-radius: 0;
        width: 100px;
        height: 100;
        background: var(--color-primary);
        padding:0 2rem;
        align-items: center;
    }

    .nav__profile ul{
        top:100%;
        width: 100;
    }

    .nav__profile .avatar{
        margin-left: 2rem;
        border:0;
        
    }

    .featured__container{
        gap: 3rem;
    }

    .posts__container{
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }

    .footer__container{
        grid-template-columns: 1fr 1fr;
    }

    /* Blog */
    .search__bar-container{
        width:60%;
    }

     /* General Form */
     .form__section-container{
        padding: 3rem;
     }

     /* dashboard */
     .dashboard__container{
        grid-template-columns: 4.3rem auto;
        padding: 0;
        background: transparent;
     }

     .dashboard aside{
        background: var(--color-bg);
     }

     .dashboard aside h5{
        display: none;
     }

     .dashboard main table thead{
        display: none;

     }

     .dashboardmain table tr{
        display: flex;
        flex-direction: column;
     }

     .dashboard main table tr:nth-child(even){
        background: var(--color-light-primary);
     }
     .dashboardmain table tr:hover td{
        background: transparent;
     }
}

/* Media Queried for small devices */
@media screen and (max-width:600px){
    section{
        margin-top: 2rem;
    }
    h1{
        font-size: 2rem;
    }

    .featured{
        margin-top: 6rem;
    }

    .featured__container{
        grid-template-columns: 1fr;
        gap: 0;
    }
    .posts__container{
        grid-template-columns: 1fr;
    }
    
    .category__buttons-container{
        grid-template-columns: 1fr 1fr;
    }

    .footer__container{
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
  /* Blog */
  .search__bar-container{
    width:var(--container-width-md);
}
    /* SINGLE POST */
    .singlepost__container{
        background-color: transparent;
        padding: 0;
    }

     /* General Form */
     .form__section-container{
        padding: 0;
     }

     /* dashboard */
     .dashboard{
        margin-top: 5rem;
     }

     .dashboard__container{
        grid-template-columns: 1fr;
        gap: 0;
     }

     .dashboard main{
        margin: 0;
     }

     .dashboard main h2{
        margin-top: 1rem;
     }

     .dashboard aside{
        position: fixed;
        box-shadow: 2rem 0 4rem rgba(0, 0, 0, 0.4);
        left:-100%;
        height: 100vh;
        transition: var(--transition);
        background: var(--color-primary);
     }

     .dashboard .sidebar__toggle{
        display: inline-block;
        background: var(--color-red-dark);
        color: var(--color-bg);
        position: fixed;
        right: 0;
        bottom: 4rem;
        z-index: 1;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50% 0 0 50%;
        font-size: 1.3rem;
        cursor: pointer;
        box-shadow: -1rem 0 2rem rgba(0, 0, 0, 0.4);
     }

     .dashboard aside a h5{
        display: inline-block;
     }

     #hide__sidebar-btn{
        display: none;
     }


}
