@font-face {
  font-family: "PP Talisman Narrow";
  src: url("/fonts/PPTalisman-Narrow-Bold.woff2") format("woff2");
  font-weight: bold;
  font-display: swap;
}

@font-face {
  font-family: "PP Object Sans";
  src: url("/fonts/PPObjectSans-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "PP Object Sans";
  src: url("/fonts/PPObjectSans-Bold.woff2") format("woff2");
  font-weight: bold;
  font-display: swap;
}

@font-face {
  font-family: "PP Object Sans";
  src: url("/fonts/PPObjectSans-Slanted.woff2") format("woff2");
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "PP Object Sans";
  src: url("/fonts/PPObjectSans-BoldSlanted.woff2") format("woff2");
  font-style: italic;
  font-weight: bold;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-display: swap;
  font-weight: bold;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Italic.woff2") format("woff2");
  font-display: swap;
  font-style: italic;
}

@font-face {
  font-family: "Merriweather";
  src: url("/fonts/Merriweather-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Merriweather";
  src: url("/fonts/Merriweather-Bold.woff2") format("woff2");
  font-display: swap;
  font-weight: bold;
}

@font-face {
  font-family: "Merriweather";
  src: url("/fonts/Merriweather-Bold.woff2") format("woff2");
  font-display: swap;
  font-weight: bold;
}

@font-face {
  font-family: "Merriweather";
  src: url("/fonts/Merriweather-Italic.woff2") format("woff2");
  font-display: swap;
  font-style: italic;
}

@font-face {
  font-family: "Merriweather";
  src: url("/fonts/Merriweather-BoldItalic.woff2") format("woff2");
  font-display: swap;
  font-style: italic;
  font-weight: bold;
}

:root {
  --color-white: #fff;
  --color-green: #008055;
  --color-black: #310200;
  --color-gray: #ca8e79;
  --color-steel: #f7d6ca;
  --color-silver: #ffe6db;
  --color-platinum: #fff6f3;
  --syntax-text: var(--color-black);
  --syntax-comment: #a14d2f;
  --syntax-keyword: #b31884;
  --syntax-property: #0062dc;
  --syntax-string: #008055;
  --syntax-punctuation: #984979;
}

:root {
  --font-fallback-main: system-ui, sans-serif;
  --font-fallback-mono:
    ui-monospace, "Cascadia Code", "SFMono-Regular", "Menlo", "Monaco",
    "Consolas", "Liberation Mono", "Courier New", monospace;
  --font-body: "PP Object Sans", var(--font-fallback-main);
  --font-cool: "PP Talisman Narrow", var(--font-fallback-main);
  /* --font-cool: var(--font-body); */
  --font-logo: "Ultra Hi-Gloss", var(--font-fallback-main);
  --font-mono: "JetBrains Mono", var(--font-fallback-mono);

  /*
   Fluid typography seems really cool, but it also kinda looks terrible unless
   you're adding in `round()` to prevent fractional pixels during resizing,
   which causes jumpy text. Maybe in the future I'll play with it more...

   https://modern-fluid-typography.vercel.app/
  */
  --font-size-h1: 4rem;
  --font-size-h2: 2.5rem;
  --font-size-h3: 2rem;
  --font-size-logo: 1.25rem;
  --font-size-base: 1.25rem;
  --font-size-small: 1rem;
  --font-size-code: round(calc(0.9 * var(--font-size-base)), 1px);

  --list-inset: 2rem;

  --rounded-none: 0px;
  --rounded-small: 3px;
  --rounded-medium: 8px;
  --rounded-large: 16px;
  --rounded-pill: 9999px;

  --width-copy: 45rem;
  --width-heading: 70rem;

  --link-underline-offset: calc(1em / 6);
  --link-underline-thickness: 1px;
  --link-underline-thickness-hover: calc(var(--link-underline-thickness) + 1px);
}

@media (width <= 50rem) {
  :root {
    --font-size-h1: round(2.5rem, 1px);
    --font-size-h2: round(2rem, 1px);
    --font-size-h3: round(1.5rem, 1px);
    --font-size-base: round(1.15rem, 1px);
    --font-size-logo: round(1.25rem, 1px);
    --font-size-small: round(1rem, 1px);

    --list-inset: 2rem;
  }
}

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

:root {
  /* https://dbushell.com/2024/11/05/webkit-font-smoothing/ */
  /* https://www.joshwcomeau.com/css/custom-css-reset/ */
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
  color-scheme: light;
  scrollbar-color: var(--color-green) var(--color-platinum);
  /* overscroll-behavior: none; */
  font-synthesis: none;
  background: var(--color-platinum);
  color: var(--color-black);
  padding: 0;
  margin: 0;
}

body {
  padding: 0;
  margin: 0;
  /**
   * Setting font size on body rather than html so that 1rem can refer to the
   * user's specified font size anywhere in my CSS, rather than 1.25 times that
   * value; but this way most things get bumped up a little bigger, for a
   * slightly comfier to read site (since this is a blog, after all)
   */
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100vh;
}

main {
  flex: auto;
}

a {
  color: var(--color-green);
  border-radius: var(--rounded-small);
  text-decoration-thickness: var(--link-underline-thickness);
  text-underline-offset: var(--link-underline-offset);
}

@media (hover) {
  a:hover {
    text-decoration-line: underline;
    --link-underline-thickness: var(--link-underline-thickness-hover);
    color: var(--color-black);
  }
}

:is(input, select, button, textarea) {
  font: inherit;
}

:is(h1, h2, h3, h4, h5, h6) {
  text-wrap: balance;
}

:is(h1, h2, h3) {
  line-height: 1.25;
}

.paragraph,
p {
  margin-block: 1.5rem;
}

h1 {
  font-size: var(--font-size-h1);
  font-family: var(--font-cool);
  letter-spacing: calc(1em / 32);
  /* https://bugs.webkit.org/show_bug.cgi?id=292563 */
  /* word-spacing: calc(1em / 16); */
  margin-block: 1.5rem;
}

h1::after {
  content: " ♣️";
  color: transparent;
  text-shadow: 0 0 0 var(--color-green);
  font-size: 0.5em;
  top: -0.35em;
  position: relative;
  vertical-align: text-bottom;
}

h2 {
  font-size: var(--font-size-h2);
  font-family: var(--font-cool);
  letter-spacing: calc(1em / 32);
  /* https://bugs.webkit.org/show_bug.cgi?id=292563 */
  /* word-spacing: calc(1em / 16); */
  margin-block: 4rem 0.5rem;
}

h2::before {
  content: "{ ";
  color: var(--color-green);
}

h2::after {
  content: " }";
  color: var(--color-green);
}

h3 {
  font-style: italic;
  font-family: inherit;
  font-size: var(--font-size-h3);
  margin-block: 4rem 0.5rem;
}

code,
pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-code);
  font-variant-ligatures: none;
  overflow-x: auto;
}

:not(pre) > code {
  font-size: 0.9em;
  font-weight: bold;
}

main details {
  margin: 1.5rem 0;
  padding-inline: 1rem;
  background: var(--color-white);
  border: 1px solid var(--color-steel);
  border-radius: var(--rounded-large);
}

main details + details {
  margin-top: calc(-1.5rem - 1px);
}

main summary {
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
  padding-block: 0.5rem;
}

@media (hover) {
  main summary:hover:not(:active)::marker {
    color: var(--color-black);
  }
}

main summary:hover:active::marker {
  color: var(--color-black);
}

main details:has(> summary:focus-visible) {
  box-shadow: none;
  outline: 3px solid;
  outline-offset: -1px;
  /* border-radius: var(--rounded-small); */
}

main details summary:focus-visible {
  outline: none;
}

main details[open] > summary {
  margin-bottom: -1rem;
}

.spoiler {
  padding-inline: 0.25ch;
  background-color: var(--color-black);
  color: transparent;
  cursor: default;
}

@media (hover) {
  .spoiler:hover:where(:not(:focus)) {
    opacity: 0.8;
  }
}

.spoiler:focus {
  color: var(--color-platinum);
}

.spoiler:focus-visible {
  outline: 3px solid var(--color-black);
  outline-offset: 2px;
}

main :is(blockquote, ul, ol, dl, p) {
  margin-block: 1.5rem;
}

main :is(ul, ol) {
  padding-left: var(--list-inset);
  list-style-type: disc;
}

main ol {
  padding-left: 3rem;
}

main :is(ul, ol) :is(ul, ol) {
  margin-block: 0;
}

main {
  flex: auto;
  min-height: 50vh;
  padding-bottom: 3rem;
}

canvas,
img,
video {
  display: block;
  border-radius: var(--rounded-large);
}

.border {
  border-radius: 0;
  background: var(--color-white);
  padding: 1px;
  border: 1px solid var(--color-steel);
}

.frame {
  background: var(--color-white);
  padding: 8px;
  border-radius: var(--rounded-large);
  border: 1px solid var(--color-steel);
}

.sharp {
  border-radius: 0;
}

.playdate {
  filter: contrast(80%) brightness(80%);
}

.tcg {
  /* Source from the Grand Archive index */
  /* https://index.gatcg.com/edition/alice-golden-queen-dtr */
  border-radius: 4.75% / 3.5%;
}

.max-content {
  max-width: max-content;
}

article header :is(h1, h2, h3) {
  margin-bottom: 0;
}

article header small {
  font-style: normal;
  font-weight: normal;
  font-size: var(--font-size-small);
  vertical-align: middle;
}

:focus-visible {
  box-shadow: 0 0 0 2px var(--color-platinum);
  outline: 3px solid currentColor;
  outline-offset: 2px;
  text-decoration-line: none;
}

.flex {
  display: flex;
}

.flex-auto {
  flex: auto;
}

.inline-flex {
  display: inline-flex;
}

.flex-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.text-center {
  text-align: center;
}

.photo-wrap {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  gap: 1rem;
  justify-content: flex-start;
  align-items: flex-start;
}

.photo-wrap > * {
  margin: 0;
}

.photo-grid {
  display: grid;
  gap: 1rem;
  justify-content: flex-start;
}

.photo-grid > * {
  margin: 0;
}

@media (width >= 30rem) {
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (width >= 50rem) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.layout-wrap2col {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (width <= 50rem) {
  .layout-wrap2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (width <= 30rem) {
  .layout-wrap2col {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.layout-col2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (width <= 30rem) {
  .layout-col2 {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.layout-col3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

@media (width <= 50rem) {
  .layout-col3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (width <= 30rem) {
  .layout-col3 {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.gap1 {
  gap: 0.25rem;
}

.gap2 {
  gap: 0.5rem;
}

.gap3 {
  gap: 1rem;
}

.clearfix {
  clear: both;
}

/* Non-integer display scales fuck this up. It looks like this is a violation of
the spec, but Firefox and Chrome both do it. I haven't checked in Safari. Maybe
I should file a bug later. */
@media not (1dppx < resolution < 2dppx) {
  .pixelated {
    image-rendering: pixelated;
  }
}

::marker {
  color: var(--color-green);
}

.arrow {
  font-size: 1.25em;
  color: var(--color-green);
  margin-inline: 0.25em;
}

ol > li::marker {
  font-weight: bold;
}

dl > dt {
  font-weight: bold;
}

dl > dd {
  margin: 0;
}

dl > :is(dd + dt, dt + dt) {
  margin-top: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

.inline-img {
  display: inline-block;
  vertical-align: middle;
}

.print-only {
  display: none;
}

[data-media="print"] {
  display: hidden;
}

pre:has(> code) {
  overflow-x: auto;
  margin-block: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--color-steel);
  background-color: var(--color-white);
  border-radius: var(--rounded-large);
}

/* Reset color for nested scripts */
.token.script {
  color: var(--syntax-default);
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--syntax-comment);
  font-style: italic;
}

.token.punctuation {
  color: var(--syntax-punctuation);
}

.token.attr-value,
.token.selector,
.token.string,
.token.char,
.token.boolean,
.token.number,
.token.regex,
/* .token.builtin, */
.token.inserted {
  color: var(--syntax-string);
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: var(--syntax-punctuation);
}

.token.atrule,
.token.function,
.token.class-name {
  color: var(--syntax-property);
}

.token.tag,
.token.tag > .token.class-name {
  color: var(--syntax-keyword);
}

.token.keyword {
  color: var(--syntax-keyword);
  font-weight: bold;
}

.language-css .token.property,
.token.attr-name,
/* .token.property, */
.token.variable,
.token.constant,
.token.symbol,
.token.deleted,
.token.important {
  color: var(--syntax-property);
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

.avatar {
  --avatar-size: 200px;
  --avatar-padding: 0px;
  float: right;
  margin: 1rem;
  margin-right: 0;
  margin-top: 0;
  padding: var(--avatar-padding);
  display: flex;
  position: relative;

  border-radius: var(--rounded-pill);
  width: var(--avatar-size);
  height: var(--avatar-size);
  background-color: var(--color-steel);
  border: 0;
  box-sizing: content-box;
}

@media (width <= 50rem) {
  .avatar {
    --avatar-size: 100px;
  }
}

.header {
  box-sizing: border-box;
  background: var(--color-platinum);
  color: var(--color-green);
  width: 100%;
  border-bottom: 1px solid var(--color-steel);
  box-shadow: 0 1px 0 0 var(--color-platinum);
}

.header-content {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
  max-width: var(--width-heading);
  margin-inline: auto;
}

.logo {
  display: grid;
  align-items: center;
}

.logo svg {
  width: auto;
  height: calc(2rem - 6px);
  fill: currentColor;
}

.decoration {
  color: inherit;
}

.logo a {
  pointer-events: initial;
  border: 0;
  margin-left: -4px;
  padding: 0 4px;
  line-height: 1;
  font-size: calc(2rem + 4px);
  border-radius: var(--rounded-medium);
  text-decoration-line: none;
  width: 100%;
}

.logo a:hover {
  color: var(--color-black);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (width <= 40rem) {
  .logo svg {
    height: initial;
    width: 100%;
  }
  .logo a {
    font-size: calc(2rem + 5vw);
  }

  .logo-container {
    justify-content: center;
  }
}

@media (width >= 40rem) {
  .header-content {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* .fancy-divider {
  border-top: 1px solid var(--color-steel);
} */

.footer {
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  border-top: 1px solid var(--color-steel);

  padding: 1rem;
}

.footer > * {
  margin-inline: auto;
}

.nav {
  max-width: var(--width-heading);
  display: flex;
  align-items: center;
}

.nav .button {
  width: 100%;
  pointer-events: initial;
}

.nav menu {
  font-size: var(--font-size-small);
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 0.5rem;
  width: 100%;
  max-width: var(--width-heading);
}

@media (width <= 60rem) {
  .nav a {
    text-align: center;
  }

  .nav menu {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 0;
  }
}

article.page {
  > header,
  > section,
  > footer {
    max-width: var(--width-heading);
    margin-inline: auto;
    padding-inline: 1rem;

    p,
    ul,
    ol,
    dl,
    figcaption,
    details {
      max-width: var(--width-copy);
    }
  }

  > header {
    > h1 {
      margin-top: 1.5rem;
    }

    > small {
      display: block;
      margin-block: 0.5rem 1.5rem;
      font-style: italic;
    }
  }

  > :is(section, header, footer) {
    video,
    img {
      max-width: 100%;
      height: auto;
      display: block;
    }

    p:has(img, video) {
      max-width: var(--width-heading);
      display: flex;
    }

    hr {
      border: 0;
      margin-block: 1.5rem;
      margin-inline: auto;
      color: inherit;
      width: 100%;

      border-top: 1px solid var(--color-steel);
    }

    :where(.paragraph),
    blockquote,
    ul,
    ol,
    dl,
    p,
    figure {
      margin: 1.5rem 0;
    }

    figure {
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    figcaption {
      margin-top: -0.5rem;
      font-size: var(--font-size-small);
      text-wrap: balance;
      font-style: italic;
    }

    blockquote,
    aside {
      padding: 0 1.5rem;
      border: 1px solid var(--color-steel);
      border-radius: var(--rounded-large);
      background: var(--color-white);
      max-width: max-content;

      h3 {
        margin-top: 1.5rem;
      }
    }

    blockquote {
      font-style: italic;
    }
  }
}

.card {
  margin-block: 1.5rem;
  padding: 1.5rem;

  background: var(--color-white);
  border: 1px solid var(--color-steel);
  border-radius: var(--rounded-large);

  > :first-child {
    margin-top: 0;
  }

  > header > :is(h1, h2, h3) {
    margin-top: 0;
  }

  > :last-child {
    margin-bottom: 0;
  }

  + .card {
    margin-top: -0.5rem;
  }
}

ul.card {
  display: block;
  list-style-type: none;
  max-width: initial;
  padding: 0.5rem 1rem;

  > li {
    a {
      display: block;
      padding-block: 0.5rem;

      &:not(:hover) {
        text-decoration-line: none;
      }

      &:focus-visible {
        outline-offset: 4px;
      }
    }
    + li {
      border-top: 1px solid var(--color-steel);
    }
  }
}

.button,
button {
  font: inherit;
  text-align: center;
  justify-content: center;
  align-items: center;
  display: inline-flex;
  font-weight: bold;
  padding: 0.25rem 1rem;
  border-radius: var(--rounded-pill);
  text-decoration-line: none;
  text-decoration-thickness: var(--link-underline-thickness);

  color: var(--color-platinum);
  background: var(--color-green);
  border: 1px solid transparent;
}

@media (hover) {
  .button:hover,
  button:hover {
    text-decoration-line: none;
    background: var(--color-black);
    color: var(--color-platinum);
  }
}

.button:active,
button:active {
  scale: 95%;
}

.button:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-green);
  outline-offset: 2px;
}

label:has(> input[type="checkbox"]:first-child) {
  --_bg: var(--color-green);

  &:has(:checked) {
    --_bg: var(--color-green);
  }

  user-select: none;
  display: flex;
  gap: 0.5rem;

  input[type="checkbox"] {
    box-sizing: border-box;
    flex: none;
    color: inherit;
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--_bg);
    background: var(--color-white);
    margin: 0;
    margin-top: 4px;
    border-radius: var(--rounded-small);

    &:checked {
      --_blur: 0.5px;
      --_size: 2px;
      --_start: calc(50% - 0.5 * var(--_size));
      --_end: calc(var(--_start) + var(--_size));
      --_fg: var(--color-platinum);
      border-color: var(--_bg);
      background-color: var(--_bg);
      background-image:
        linear-gradient(
          45deg,
          transparent,
          transparent calc(var(--_start) - var(--_blur)),
          var(--_fg) var(--_start),
          var(--_fg) var(--_end),
          transparent calc(var(--_end) + var(--_blur)),
          transparent
        ),
        linear-gradient(
          -45deg,
          transparent,
          transparent calc(var(--_start) - var(--_blur)),
          var(--_fg) var(--_start),
          var(--_fg) var(--_end),
          transparent calc(var(--_end) + var(--_blur)),
          transparent
        );
      box-shadow: inset 0 0 0 4px var(--_bg);
    }

    &:focus-visible {
      outline-offset: 2px;
      outline-width: 2px;
    }
  }

  @media (hover) {
    &:hover {
      text-decoration-line: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 3px;
      text-decoration-style: dotted;
      text-underline-position: under;
    }
  }
}

.crime-frame {
  overflow: hidden;
  position: relative;
  display: flex;
}

.crime-frame :is(details, summary) {
  all: initial;
  display: block;
  font: inherit;
}

.crime-frame > * {
  max-width: initial !important;
  width: 100% !important;
}

