/* We tell the browser to use a dark color scheme if the user has their system in
   dark mode */
:root {
    color-scheme: light dark;

    --bg-color: light-dark(white, #1c1b21);
    --fg-color: light-dark(black, #fbfbfe);
    --accent: light-dark(mediumvioletred, #ffcc00);
}

body {
    /* We make sure the page will always be centered and adapt well to mobile
       screens */
    max-width: 1200px;
    margin: auto;
    padding: 40px;
    font-size: 1.3em;
    color: var(--fg-color);
    background-color: var(--bg-color);
    font-family: monospace;

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

body.post {
    max-width: 800px;
}

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 light-dark(black, white);
}

a,
a:visited {
    /* color: light-dark(mediumvioletred, hotpink); */
    color: light-dark(mediumvioletred, #ffcc00);
}

.buttons a {
    text-decoration: none;
}

mark {
    background-color: light-dark(mediumvioletred, #ffcc00);
    color: var(--fg-color);
}

/* 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 {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

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

pre:has(code) {
    border: 1px solid rgba(0, 0, 0, 0.4);
    background-color: rgba(0, 0, 0, 0.1);

    padding: 12px;
    color: black;
    overflow-x: scroll;
}

article {
    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;
}

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

    font-size: 0.9em;
}

.tag {
    border: 1px solid light-dark(black, white);

    /* background-color: white; */
    /* color: black; */

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

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

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

/* 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,
    th,
    td {
        border: 1px solid rgba(255, 255, 255, 0.2);
        background-color: rgba(0, 0, 0, 0.4);
        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;
	}
}


main {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 30px;
    align-items: start;
}

@media(max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }
}

p {
    line-height: 130%;
}

.updated-date {
    font-size: .75em;
}

img {
    max-width: 100%;
    max-height: 100%;
}

img + em {
    font-size: .75em;
}

.buttons img {
    transition: 0.1s all ease-out;
}

.buttons img:hover {
    scale: 2;
    transform: translateY(-8px);
}

blockquote {
    padding-left: 1em;
    border-left: 5px solid var(--accent);
    opacity: 80%;
}

blockquote p:not(:first-child) {
    margin-top: 1em;
}

sup[id^=fnref] {
    vertical-align: baseline;
    font-size: 100%;
    line-height: inherit;
    position: static;
}

sup[id^=fnref]::before {
    content: "[";
}

sup[id^=fnref]::after {
    content: "]";
}

img#logo {
    width: 120px;
    margin-bottom: 10px;
}

math.tml-display {
    margin-top: 8px;
    margin-bottom: 8px;
}

/* SVG hackery */
.diagram {
    display: flex;
    justify-content: center;
}

svg {
    background-color: var(--bg-color);
}

path, rect {
    fill: var(--fg-color);
}

.buttons img {
    image-rendering: pixelated;
}
