/*  
	Barebones Redux by Nev.
    Proudly remade by utilising CSS nesting.
*/
.example::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.example {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

* {
    box-sizing: border-box;
    scrollbar-width: none;
}

html {
    background: url(https://files.catbox.moe/wtfid5.gif);
    background-repeat: repeat;
    scrollbar-width: none;
}

/* 
	For measurements, I use em instead of px. With em, the website scales with font size.
	You're free to change it to other measurements. It's only a matter of preference.
*/
body {
    font-size: 0.875em;
    font-family: Arial, Helvetica, sans-serif;
}

/* 
	Variables to make changing bg colour, border colour + shadow colour, 
   	and border radius easier.
*/
:root {
    --div-background-colour: #f5f5f5;
    --div-border-colour:#4c0000;
    --div-shadow-colour: #ea0909;
    --radius: 5px;
}

/* 
	Wrapper uses grid to 'map' the areas.
	You may change margin, gap, and em values.
*/
.wrapper {
    display: grid;
    margin: 0 20%;
    grid-template-areas:
        "header  header  header  "
        "sidebar main    main    "
        ".       footer  footer  ";

    grid-template-rows: 3em 1fr;
    grid-template-columns: 10em 1fr;
    gap: 1.5em;
}

.sidebar {
    grid-area: sidebar;
    align-self: start;
    display: flex;
    flex-direction: column;
    
    /* overflow: auto; */ /* <-- Uncomment to make sidebar scrollable */
    max-height: 70em;

    gap: 1em; /* Gap between items inside sidebar: nav, img, .box, etc etc */
    position: sticky;
    top: 1em; /* "Padding" for the sidebar. Visible when scrolling down */

    > img {
        max-width: 100%;
    }
}

nav {
    display: inline-block;
    height: fit-content;
    width: 100%;
    background: white;

    a {
        display: block;
        color: tomato;
        padding: 0.25em 0.25em 0.25em 0;
        margin-left: 0.75em;
    }

    h3 {
        text-align: center;
        color: white;
        margin: 0.25em 0;
        background:  #c41309;

        &:first-of-type {
            margin-top: 0;
        }

    }

    textarea {
        width: 100%;
        resize: vertical;
    }

	> p {
		text-align: center;
	}
}

.box {
    width: 100%;
    background: white;
    padding: 0.25em;

    h2 {
        margin: 0.25em 0;
    }

    /* This is Descriptive List <dl>. */
    dl {
        dt {
            font-weight: bold;
        }

        dd {
            margin-left: 1em;
        }
    }

}

header {
    grid-area: header;
    width: 100%;
    h1 {
        margin: 0.75em 0;
        color: white;
        -webkit-text-stroke: 8px #ea0909;
        paint-order: stroke fill;

        font-style: italic;
    }
}

main {
    grid-area: main;

    display: flex;
    flex-direction: column;
    gap: 1em;
}

.row {
    display: flex;
    flex-direction: row;
    gap: 1em;
}

/* Posts */
.content {
    padding: 0.5em;

    background: var(--div-background-colour);
    border: 4px solid var(--div-border-colour);
    box-shadow: 5px 5px 0px 0px var(--div-shadow-colour);
    border-radius: var(--radius);

    h1 {
        background: #c41309;
        border-radius: 50%;
        width: fit-content;
    }

    img {
        width: 100%;
        height: auto;
    }

    a {
        color:  #c41309;
    }
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 200px));
    gap: 0.5em;
    justify-items: center;
    align-items: center;
    justify-content: space-evenly;
}

footer {
    grid-area: footer;
    border-radius: var(--radius);
    background: var(--div-background-colour);
    border: 4px solid var(--div-border-colour);
    box-shadow: 5px 5px 0px 0px var(--div-shadow-colour);
    text-align: center;
}


/* Below are CSS rules for mobile, or any devices whose width are under 700px */
@media only screen and (max-width: 700px) {
	.wrapper {
	  grid-template:
		"header"
		"sidebar"
		"main"
		"footer";

		margin: 0;
	}

	.sidebar {
		position: static;
		max-height: 15em;
		overflow: auto;
		width: 100%;

		/* This automatically scales the width of any image on sidebar by 50%.
		   Images inside <nav> and box div don't count. 
		   Margin is used to centre the image */
		> img {
			margin: 0 auto;
			max-width: 50%;
		}
	}

	main {
		width: 100%;
	}

	.content, footer {
		box-shadow: 0px 5px 0px 0px var(--div-shadow-colour);
	}

	.row {
		flex-direction: column;
	}

	.image-grid {
		grid-template-columns: repeat(2, 1fr);
		img {
			max-width: 100%;
		}
	}
  }