/* --- Basic styles and Google Lato/Vazir Fonts import --- */
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Vazirmatn:wght@100..900&display=swap');



/* --- Global Resets & Body Styles --- */
* {
    /* Ensures padding and border are included in the element's total width and height */
    box-sizing: border-box;
}

body {
    font-family: "Lato", "Vazirmatn", sans-serif;
    margin: 0;
    background-color: rgb(30, 33, 39);
    color: rgb(171, 178, 191);
    /* TODO: Check for good unit */
    line-height: 1.5;
}

/* To prevent scrolling when the menu is open */
body.menu-open {
    overflow: hidden;
}

/* --- Responsive Images & Code Blocks --- */
img,
pre,
code,
video {
    /* Prevents images and code blocks from overflowing their container */
    max-width: 100%;
}

pre {
    /* Adds a scrollbar if code is too wide */
    overflow-x: auto;
    /* Allows long lines of code to wrap */
    white-space: pre-wrap;
    /* Breaks long words if necessary */
    word-wrap: break-word;
    padding: 1rem;
    border-radius: 8px;
}

/* --- Style for the header/navigation bar --- */
.navbar {
    background-color: rgb(55, 60, 67);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* TODO: Check for better units */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: #ffffff;
    text-decoration: none;
    z-index: 1001;
    /* Ensure logo is above the mobile menu background */
}

/* --- MOBILE NAVIGATION STYLES (Mobile First) --- */

#menu-toggle {
    display: none;
}

.menu-icon {
    cursor: pointer;
    display: flex;
    /* This will be changed to 'none' on desktop */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    padding: 4px;
    z-index: 2000;
    position: relative;
}

.menu-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: rgb(255, 255, 255);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* This is the SINGLE navigation list, styled for mobile by default */
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;

    /* Full-screen overlay styles for mobile */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(40, 44, 52, 0.85);
    -webkit-backdrop-filter: blur(5px);
    /* For safari on IOS */
    backdrop-filter: blur(5px);

    /* Center items vertically and horizontally */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    /* Hide the menu by default */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-100%);
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out, visibility 0.4s;
}

.nav-menu li {
    margin: 20px 0;
}

.nav-menu li a {
    color: #fff;
    text-decoration: none;
    font-size: 2rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

.nav-menu li a:hover {
    color: #87cfff;
}

/* Show the menu when the checkbox is checked */
#menu-toggle:checked~.nav-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* Animate the hamburger icon to an 'X' */
#menu-toggle:checked+.menu-icon span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

#menu-toggle:checked+.menu-icon span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

#menu-toggle:checked+.menu-icon span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}


/* --- Main content styling --- */
.content {
    width: 90%;
    /* Use percentage for responsiveness */
    /* max-width: 800px; */
    /* But set a max-width for large screens */
    margin: 2rem auto;
    /* Vertical margin and horizontal auto for centering */
    display: flex;
    flex-direction: column;
}

/* Spacing between direct children of .content */
.content>*+* {
    margin-top: 1.5rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: rgb(209, 154, 102);
    /* User's specified heading color */
    text-align: center;
    /* More reliable than align-self for this layout */
}

p {
    direction: ltr;
    /* User's specified text direction */
}

/* --- Fix for images wrapped in paragraph tags --- */
/* Target a paragraph that only contains an image */
p>img:only-child {
    margin: 0;
    padding: 0;
}

/* Target a paragraph that only contains a link, which only contains an image */
p>a:only-child>img:only-child {
    margin: 0;
    padding: 0;
}

/* Experimental, makes the wrapping <p> tag have no layout effect */
p:has(> img:only-child) {
    display: contents;
}

/* --- DESKTOP NAVIGATION STYLES (using Media Query) --- */

/* Applies these styles for screens 768px wide or wider */
@media (min-width: 768px) {

    /* Hide the hamburger menu icon on desktop */
    .menu-icon {
        display: none;
    }

    /* --- Override the mobile styles for .nav-menu --- */
    .nav-menu {
        /* Reset positioning to be part of the navbar flow */
        position: static;
        transform: none;
        visibility: visible;
        opacity: 1;

        /* Layout for horizontal navigation */
        flex-direction: row;
        justify-content: flex-end;
        /* Align to the right */
        gap: 2rem;
        /* Spacing between links */

        /* Remove full-screen overlay styles */
        width: auto;
        height: auto;
        background-color: transparent;
        -webkit-backdrop-filter: none;
        /* For safari on IOS */
        backdrop-filter: none;
    }

    .nav-menu li {
        margin: 0;
        /* Remove vertical margin */
    }

    .nav-menu li a {
        color: #abb2bf;
        font-size: 1rem;
        /* Smaller font for desktop nav */
        font-weight: 400;
        /* Regular font weight */
    }

    .nav-menu li a:hover {
        color: #61afef;
        /* A common highlight color from dark themes */
    }

    main {
        padding: 9rem;
    }
}

a {
    color: #61afef;
    /* A pleasant blue that complements your color scheme */
    text-decoration: none;
    transition: color 0.2s ease, border-bottom 0.2s ease;
    border-bottom: 1px solid rgba(97, 175, 239, 0.3);
    padding-bottom: 1px;
}

a:hover {
    color: #87cfff;
    /* Lighter blue for hover */
    border-bottom-color: #87cfff;
}

.nav-menu li a {
    color: #abb2bf;
    font-size: 1rem;
    font-weight: 400;
    text-decoration: none;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-menu li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #61afef;
    transition: width 0.3s ease;
}

.nav-menu li a:hover {
    color: #61afef;
}

.nav-menu li a:hover::after {
    width: 100%;
}


footer a,
.secondary-link {
    color: #5c6370;
    border-bottom: 1px dotted #5c6370;
}

footer a:hover,
.secondary-link:hover {
    color: #61afef;
    border-bottom-style: solid;
}

a.button {
    display: inline-block;
    background-color: #61afef;
    color: #282c34 !important;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.2s ease;
    border: none;
}

a.button:hover {
    background-color: #87cfff;
    color: #282c34;
    border: none;
}