/*
 * SPDX-FileCopyrightText: 2022 Dominic Martinez <dom@dominicm.dev>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

:root {
  /* Use system default fonts */
  --sans-font: sans-serif;
  --mono-font: monospace;

  /* Tooltips */
  --tooltip-bg: #f0e9d0;

  /* Taken from the Monokai Pro theme */
  --syntax-bg: #2d2a2e;
  --syntax-fg: #fcfcfa;
  --syntax-gray: #727072;
  --syntax-yellow: #ffd866;
  --syntax-violet: #ab9df2;
  --syntax-magenta: #ff6188;
  --syntax-blue: #78dce8;
  --syntax-green: #a9dc76;
}

/* Global styles
 * Some styles inspired by Josh Comeau's CSS reset:
 * https://www.joshwcomeau.com/css/custom-css-reset/
 */

* {
  margin: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

a {
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: wavy underline var(--accent);
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin: 10px 0 15px 0;
}

/* Header */
body > header {
  background-color: inherit;
  border: none;
  grid-column: 2;
  padding: 0;
}

header > nav {
  display: flex;
  align-items: center;
}

nav > #nav-link-container {
  display: flex;
  align-items: center;
  overflow-x: auto;
}

nav:nth-child(2) {
  grid-column-start: 2;
}

nav > #home-link {
  padding-left: 0;
  margin-left: 0;
  height: auto;
  flex-shrink: 0;
}

nav > #home-link > img {
  width: 40px;
}

header > nav a,
header > nav a:visited {
  border: none;
  font-size: 1.25rem;
  text-decoration: solid underline;
  white-space: nowrap;
  padding: 0.1rem 0.3rem;
}

/* Home page */
.home h1 {
  margin-bottom: 10px;
}

.home .post-type-header {
  margin-top: 2.5rem;
}

.home a {
  font-size: 1.4rem;
}

.home p,
.collection p {
  margin-top: 0;
  margin-bottom: 5px;
}

#home-intro {
  font-size: 1.5rem;
  line-height: 1.1;
}

p.post-type-description {
  color: var(--text-light);
}

p.post-summary {
  font-style: italic;
  color: var(--text-light);
}

.collection > .post-link {
  margin-top: 1.5rem;
  font-weight: normal;
  display: flex;
  align-items: center;
}

.collection > .post-link:first-child {
  margin-top: 1rem;
}

.collection > .post-link > a {
  font-size: 1.5rem;
}

.collection > .post-link > img {
  display: inline-block;
  height: 2rem;
  padding-right: 7px;
}

footer {
  font-style: italic;
}

#collection-title {
  margin-bottom: 1rem;
}

p.thought-stage {
  font-size: 1rem;
  font-style: italic;
  margin: 5px 0 0 0;
  color: var(--text-light);
}

/* About page */
#about ul {
  padding: 0;
}

#about li {
  list-style-type: none;
}

/* Posts */

/* Reduce margin of adjacent headers */
main.post > h2 + h3,
main.post > h3 + h4,
main.post > h4 + h5 {
  margin-top: 10px;
}

/* Support callout boxes */
aside.inline {
  float: none;
  width: 100%;
  margin: 1.5rem 0;
}

aside > *:first-child {
  margin-top: 10px;
}

hr {
  margin: 2rem auto;
}

/* Mermaid diagram styling */
#mermaid-svg {
  margin: auto;
  border-radius: 2px;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  #mermaid-svg {
    /* Yes this is horrific, but somehow mermaid doesn't support proper dynamic styling
     * https://github.com/mermaid-js/mermaid/issues/2644
     * I hate the JS ecosystem man... */
    filter: invert(0.95);
  }
}

/* Syntax Highlighting */
pre code,
pre code * {
  font-family: monospace, monospace;
  color: var(--syntax-fg);
}

code.inline-code {
  background-color: var(--syntax-bg);
  color: var(--syntax-fg);
  border-radius: 3px;
  padding: 0px 3px;
}

pre {
  background-color: var(--syntax-bg);
  padding: 15px;
  border-radius: 5px;
}

.syntax-string,
.syntax-doc-comment {
  color: var(--syntax-yellow);
}

.syntax-keyword,
.syntax-special,
.syntax-attribute,
.syntax-operator {
  color: var(--syntax-magenta);
  font-weight: bold;
}

.syntax-constant {
  color: var(--syntax-violet);
}

.syntax-type {
  color: var(--syntax-blue);
}

.syntax-comment {
  color: var(--syntax-gray);
}

.syntax-function {
  color: var(--syntax-green);
}

.language-scheme .syntax-open,
.language-scheme .syntax-close {
  color: var(--syntax-magenta);
}
