/* We tell the browser to use a dark color scheme if the user has their system in
   dark mode */


@import url("stylesheets/highlight.css");
@import url("stylesheets/mathfont.css");


:root {
    color-scheme: light dark;
    --purple-light: purple;
    --purple-dark: darkorchid;
}

@font-face{
    font-family: "MonaspaceKrypton";
    src:

        local("Monaspace Krypton NF Regular"),
        url('assets/fonts/MonaspaceKryptonVar.woff2') format('woff2');
        url('assets/fonts/MonaspaceKryptonVar.woff') format('woff'),
    
}



@font-face{
    font-family: "Lexend_";
    src:
        local("Lexend Regular"),
        url('assets/fonts/Lexend-Regular.woff2') format('woff2');
    font-weight: normal;
}

@font-face{
    font-family: "Lexend_";
    src:
        local("Lexend Bold"),
        url('assets/fonts/Lexend-Bold.woff2') format('woff2');
    font-weight: bold;
}


body::before {
    content: "";
    position: fixed;
    width: 500%;
    height: 500%;
    top: -200%;
    left: -200%;
    z-index: -1;
    background: url("assets/img/bkg.gif") repeat center;
    image-rendering: pixelated;
    background-size: 5%;
    transform: rotate(45deg); /* css rotate background image, css background rotate */
}

body {
    /* We make sure the page will always be centered and adapt well to mobile
       screens */
    max-width: max(700px, 70vw);
    margin: auto;
    padding: 40px;
    font-size: 1.1em;

    font-family:
        Lexend,
        "Lexend_",
        system-ui,
        -apple-system,
        Roboto,
        sans-serif;

    display: flex;
    flex-direction: column;
    gap: 20px;
}

section.header {
    width: calc(max(700px, 70vw) - 1em);
}

body.post{
    max-width: min(900px, 70vw);
}

math {
    font-family:
        "NewComputerModern10";
}

section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


* {
    padding: 0;
    margin: 0;
}

hr {
    margin: 10px 0px;
    border: none;
    outline: none;
    width: 100%;
    border-bottom: 1px dashed black;
}
section.footnotes > hr {
    display: none;
}

a,
a:visited {
    color: light-dark(var(--purple-light), var(--purple-dark));
}

mark {
    background-color: light-dark(var(--purple-light), var(--purple-dark));
    color: black;
}

/* Make every header, that is not directly followed by another header, have a
   padding */
h1:not(:first-child),
h2:not(:first-child),
h3:not(:first-child),
h4:not(:first-child),
h5:not(:first-child) {
    padding-top: 30px;
}

ul, ol {
    display: flex;
    flex-direction: column;
    list-style-position: inside;
}

code {
    font-family:
        "MonaspaceKrypton", ui-monospace, "Cascadia Code", "Source Code Pro",
        Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

:not(pre) > code {
    padding: 2px 4px;
}

article, section { 
    border: 1px solid rgba(0, 0, 0, 0.4);
    background-color: rgba(0, 0, 0, 0.1);

    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

table {
    margin-top: 10px;
    margin-bottom: 10px;
    border-collapse: collapse;
    overflow: hidden;
}

th,
td {
    border: 1px solid rgba(0, 0, 0, 0.4);
    background-color: rgba(0, 0, 0, 0.1);
    padding: 8px;
}

div.feed_contents {
    display: grid;
    grid-template-columns: 30% 70%;
    /* This is the magic template-rows that makes it work, I have no clue how */
    grid-template-rows: auto 1fr auto;
    column-gap: 50px;
    row-gap: 3em;
    align-items: flex-start;
}

.aboutme {
    grid-column: 1;
    grid-row-start: 1;
    grid-row-end: 1;
}
.avatar {
    max-width: 50%;
    border-radius: 100%;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid light-dark(var(--purple-light), var(--purple-dark));
}

.footer {
    grid-column: 1;
    grid-row-start: 2;
    grid-row-end: 2;
    margin-bottom: auto;
}

.credits {
    font-size: 0.8em;
    h3 {
        font-size: 1.5em;
        text-align: center;
    }
}


.posts {
    grid-column: 2;
    grid-row-start: 1;
    grid-row-end: 3;
}


.post-info {
    font-family: "MonaspaceKrypton", "Adwaita Mono", monospace;
    opacity: 0.8;
}

.tags {
    max-width: 50%;
    line-height: 1.5em;
}

.tag {
    border: 1px solid black;

    background-color: white;
    color: black;

    width: min-content;
    padding: 1px 6px;
}

.creation-date {
    padding: 1px 6px;
}

.tag::before {
    content: "#";
    opacity: 0.6;
    margin-right: 5px;
}

pre:has(code),
article,
section,
body.post > p,
a.homelink,
th,
td {
    background-color: rgba(255, 255, 255, 0.8);
}
pre:has(code),
article,
section:not(.footnotes),
body.post > p,
a.homelink {
    border: 1em outset rgba(255, 255, 255, 0.5);
    padding: 1em;
}

pre:has(code),
article,
section,
body.post > p,
th,
td {
    color: black;
}
/* If the system is in dark mode, then we'll  adjust the site's colors for it */
@media (prefers-color-scheme: dark) {
    :not(pre) > code {
        color: white;
        background-color: rgba(0, 0, 0, 0.8);
    }

    pre:has(code),
    article,
    section,
    body.post > p,
    a.homelink,
    th,
    td {
        background-color: rgba(0, 0, 0, 0.8);
    }
    pre:has(code),
    article,
    section:not(.footnotes),
    body.post > p,
    a.homelink
    {
        border: 1em outset rgba(0, 0, 0, 0.5);
        padding: 1em;
    }

    pre:has(code),
    article,
    section,
    body.post > p,
    th,
    td {
        color: white;
    }
}

.admonition {
	
	background-color: hsla(var(--tint), 50%, 50%, 40%);
	border-left: 4px solid hsla(var(--tint), 50%, 50%, 100%);
	padding-left: 4px;

	/* different types of admonition*/
	&.caution {
		--tint: 0;
	}
	&.important {
		--tint: 270;
	}
	&.tip {
		--tint: 119;
	}
	&.warning {
		--tint: 55;
	}
	&.note {
		--tint: 205;
	}
}

/* "Hover to reveal" type spoilers. */
span.spoiler {
	background-color: grey;
	color: grey;
	&:hover {
		color: inherit;
		background-color: inherit;
	}
}

img {
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
}

img.emoji {
    display: inline;
    height: 1em;
    padding: 0px;
    margin: 0px;
}

img.eighteightthirtyone {
    width: 88px;
    height: 31px;
    image-rendering: pixelated;
    margin-left: 0;
    margin-right: 0;
    transition: 0.3s;
    border: 1px solid light-dark(var(--purple-light), var(--purple-dark));
}
img.eighteightthirtyone:hover {
    scale: 2;
}

/* Overrides for small screens */
@media screen and (max-width:850px) {
   div.feed_contents {
        grid-template-columns: 100%;
   }
   body {
        max-width: 100vw;
        padding: 5vw;
   }
   p, li {
        max-width: 90vw;
        overflow-x: scroll;
        overflow-y: clip;
   }
   section.header {
        width: auto;
   }
   .aboutme {
       grid-row: 1;
       .avatar {
           margin-left: auto;
           margin-right: auto;
       }
    }
    .posts {
        grid-column: 1;
        grid-row: 2;
    }
    .footer {
        grid-row: 3;
    }
}
