/*
 * Comic Shanns v2 Font
 * Copyright (c) Shannon Miwa
 * Licensed under MIT License
 * https://github.com/shannpersand/comic-shanns
 */
@font-face {
  font-family: "Comic Shanns";
  src: url("/assets/fonts/comic shanns 2.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin-block-end: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

body {
  line-height: 1.5;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

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

input,
button,
textarea,
select {
  font: inherit;
}

textarea:not([rows]) {
  min-height: 10em;
}

:target {
  scroll-margin-block: 3ex;
}

:root {
  /* Solararized colors */
  --base03: #002b36;
  --base02: #073642;
  --base01: #586e75;
  --base00: #657b83;
  --base0: #839496;
  --base1: #93a1a1;
  --base2: #eee8d5;
  --base3: #fdf6e3;

  --yellow: #b58900;
  --orange: #cb4b16;
  --red: #dc322f;
  --magenta: #d33682;
  --violet: #6c71c4;
  --blue: #268bd2;
  --cyan: #2aa198;
  --green: #859900;

  --fg: var(--base00);
  --bg: var(--base3);
  --hl: var(--base2);
  --emph: var(--base01);
  --comment: var(--base1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: var(--base0);
    --bg: var(--base03);
    --hl: var(--base02);
    --emph: var(--base1);
    --comment: var(--base01);
  }
}

:root {
  --font-size: 112.5%;
}

@media (min-width: 40rem) {
  :root {
    --font-size: 125%;
  }
}

html {
  color-scheme: light dark;
  background-color: var(--bg);
  color: var(--fg);
  font-size: var(--font-size);

  font-family: "Comic Shanns", ui-monospace, "SF Mono", SFMono-Regular, Menlo,
    Consolas, "Liberation Mono", monospace;
  font-weight: 400;

  line-height: 1.5;
  padding: 1ch;
}

body {
  font-size: 1rem;
  max-width: 64ch;
  margin: 0 auto;
  padding: 2rem 2ch 2rem 4ch;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

h1,
h2,
h3 {
  color: light-dark(var(--cyan), var(--yellow));
  font-size: 1rem;
  font-weight: inherit;
}

header > p {
  color: var(--comment);
}

body > header {
  margin-bottom: 4rem;
}

dl.metadata {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0 1ch;

  dt {
    grid-column: 1;
  }

  dd {
    grid-column: 2;
    margin-left: 0;
  }

  &.subtle {
    margin-top: 0;
    color: var(--comment);
    font-weight: lighter;
  }
}

blockquote {
  margin-left: 2ch;

  &::before {
    content: ">\ ";
    position: absolute;
    margin-left: -2ch;
  }
}

ul {
  margin-left: 0;
  padding-left: 2ch;
}

ul li {
  list-style-type: none;
}

ul li::before {
  content: "-";
  position: absolute;
  margin-left: -2ch;
}

.poems-list li::before {
  content: none;
}

/* Markdown-style decorations for member pages only (not links or poems) */
article:not(.links):not(.poems):not(.books) h1::before {
  content: "#\ ";
  position: absolute;
  margin-left: -2ch;
}

article main h2::before {
  content: "##\ ";
  position: absolute;
  margin-left: -3ch;
}

article main h3::before {
  content: "###\ ";
  position: absolute;
  margin-left: -4ch;
}

/* SPACING */

article {
  margin-top: 4rem;
}

/* Breathing room for headings within content */
article main h2 {
  margin-top: 3rem;
  margin-bottom: 1rem;
}

article main h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

/* WORD WRAPPING */

/* Prevent horizontal page scroll */
body {
  overflow-x: hidden;
}

/* Code blocks - scroll horizontally */
pre,
code {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

pre {
  padding: 1rem;
  border-radius: 4px;
}

/* Inline code - wrap */
p code,
li code {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Long links and text - wrap */
a,
p,
li {
  overflow-wrap: break-word;
  word-break: break-word;
  /* or for more aggressive breaking: word-break: break-all; */
}

/* Images and other media */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* Tables */
table {
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

/* Blog entries */
article.entry {
  header p {
    color: var(--comment);
    margin-top: 0;
  }

  header h1 {
    margin-bottom: 0;
  }
}

/* Ornaments for different post kinds (ONLY on collection pages - links, not spans) */

/* Poems - asterism for date links (untitled only) */
.poems:not(:has(h1)):not(:has(h2)) a.post-date::before {
  content: "⁂\ ";
  color: var(--comment);
  position: absolute;
  margin-left: -2ch;
}

/* Links - up-right arrow for external link */
.links h1::before {
  content: "↗\ ";
  color: var(--comment);
  position: absolute;
  margin-left: -2ch;
}

/* Books - section mark for title */
.books h1::before {
  content: "§\ ";
  color: var(--comment);
  position: absolute;
  margin-left: -2ch;
}

/* Posts/Thoughts - infinity on date */
.posts a.post-date::before,
.takes a.post-date::before {
  content: "∞\ ";
  color: var(--comment);
  position: absolute;
  margin-left: -2ch;
}

/* Posts list */
#posts_list {
  padding-left: 0;
}

#posts_list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
}

#posts_list li::before {
  content: none;
}

#posts_list a {
  order: 1;
}

#posts_list li::after {
  content: "";
  order: 2;
  border-bottom: 1px dotted var(--comment);
  margin: 0 1ch;
  margin-bottom: 0.25em;
}

#posts_list span {
  order: 3;
  color: var(--comment);
}

.site-nav {
  color: var(--comment);
}

/* Horizontal rule */
hr {
  border: none;
  text-align: left;
  color: var(--comment);
  margin: 2rem 0;
}

hr::before {
  content: "~ ~ ~ ~ ~";
}

/* Post footer */
hr.post-footer-rule {
  margin: 2rem 0;
}

.post-footer {
  color: var(--comment);
}

.post-footer p {
  margin-top: 0;
}

/* Poetry: Minimalist, stark presentation */
article.poems {
  /* Remove all markdown-style decorations from content */
  main h1::before,
  main h2::before,
  main h3::before {
    content: none;
  }

  /* Asterism on title if titled */
  h1::before {
    content: "⁂\ ";
    color: var(--comment);
    position: absolute;
    margin-left: -2ch;
  }

  /* Asterism on date if untitled */
  &:not(:has(h1)) span.post-date::before {
    content: "⁂\ ";
    color: var(--comment);
    position: absolute;
    margin-left: -2ch;
  }

  /* Breathing room for poetry */
  main {
    line-height: 1.6;
    margin-top: 2rem;
  }

  /* Section spacing */
  h2 {
    margin-top: 3rem;
    margin-bottom: 1rem;
  }

  /* Focus on the words */
  main > p {
    margin-bottom: 1.5rem;
  }
}