/* Define global color variables */
:root {
  --color-background-light: #ffffff;
  --color-text-light: #000000;
  --color-background-dark: #191c1c;
  --color-text-dark: #ffffff;
  --color-highlight: #1da08c;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body {
    background-color: var(--color-background-dark);
    color: var(--color-text-dark);
  }

  blockquote {
    background: var(--color-background-dark);
  }

  a {
    color: var(--color-highlight);
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: Palatino;
  }

  header {
    background: var(--color-background-dark);
    padding-bottom: 0.5em;
    border-bottom: 2px dotted var(--color-highlight);

  }

  .article-meta, .menu a {
    background: var(--color-background-dark);
    color: white;
  }

  .article-meta, .menu h1 {
    font-size: 9pt;
  }

  table {
    margin: auto;
    border-top: 1px solid #666;
    border-bottom: 1px solid #666;
  }

  table thead th {
    border-bottom: 1px solid #666;
  }

  th, td {
    padding: 5px;
  }

  tr:nth-child(even) {
    background: #666
  }

}


/* Light mode */
@media (prefers-color-scheme: light) {
  blockquote {
    background: #f9f9f9;
  }

  a {
    color: #613DC1;
  }

  header {
    background: #613DC1;
  }

  .article-meta, .menu a {
    background: #E8DBC5;
    color: #000;
  }

  table {
    margin: auto;
    border-top: 1px solid #666;
    border-bottom: 1px solid #666;
  }

  table thead th {
    border-bottom: 1px solid #ddd;
  }

  th, td {
    padding: 5px;
  }

  tr:nth-child(even) {
    background: #eee
  }

}


/* Site Name Header */
.site-name {
  text-align: left;
  margin: 2rem 0 1rem 0;
}

.site-name h1 {
  font-size: 3em;
  font-weight: bold;
  margin: 0;
  line-height: 1.2;
}

@media (prefers-color-scheme: dark) {
  .site-name h1 {
    color: var(--color-highlight);
  }
}

@media (prefers-color-scheme: light) {
  .site-name h1 {
    color: #613DC1;
  }
}


body {
  max-width: 800px;
  margin: auto;
  padding: .2em;
  line-height: 1.5em;
}

h1 {
  line-height: 1.5em;
}

/* Table of Contents, if wanted

Add to yaml:

output:
  blogdown::html_page:
    toc: true

    */


#TableOfContents, #TOC {
  border: 1px solid #eee;
  border-radius: 5px;
}

/* Header and Footer */
.menu li {
  display: inline-block;
  font-family: monospace;
}

.article-meta, .menu a {
  text-decoration: none;
  padding: 5px;
  border-radius: 5px;
  border-style: dotted;
  border-width: 1px;
  margin: 20px 0px 20px 0px;
}

.terms {
  font-size: .9em;
}

.menu, .article-meta, footer {
  text-align: center;
}

/* Post Image */
.post-image {
  margin: 2rem auto;
  text-align: center;
}

.post-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.post-image .image-caption {
  margin-top: 0.5rem;
  font-size: 0.9em;
  font-style: italic;
  opacity: 0.8;
}

.title {
  font-size: 1.1em;
}

footer a {
  text-decoration: none;
}

.pull-left {
  float: left
}

.pull-right {
  float: right
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Adjust background at your leisure! */
header {
  position: relative;
  width: 100%;
  height: 1.2rem;
  font-size: 1rem;
}

header ul,
header ol {
  margin: 0;
  padding: 0;
  list-style: none
}

header nav {
  padding: 0 0.5rem
}

header a {
  color: #fff;
  line-height: 1.2rem;
  padding: 0 0.5rem
}

header a:hover,
header .current a {
  color: #fff
}

/* Code Boxes */
pre {
  border: 0px solid var(--color-highlight);
  padding-left: 1em;
  overflow-x: auto;
}

pre code {
  background: none;
}

code {
  background-color: light-dark(#D6D6D6, #888);
  border-radius: 3px;
  padding: 0.3em;
  overflow-x: auto;
}

/* Images, tables, misc. */
img, iframe, video {
  max-width: 100%;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

main {
  hyphens: auto;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7em;
  hyphens: auto;
  display: block;
  font-size: 1.1em;
}

main a {
  font-weight: bold;
}

blockquote {

  border-left: 5px solid #ccc;
  padding: 3px 1em 3px;
}

.content-wrapper {
  padding: 0px 12px 0px 12px;
}

#foxy {
  min-width: 40px;
  float: right;
  padding: 10px;
  display: block;
}


#table-of-contents {}

/* Small devices, phones */
@media only screen and (min-width : 480px) {
  #foxy {
    min-width: 40px;
    float: center;
    padding: 10px 10px 10px 20px;
    display: block;
  }

}

/* Apply specific styles on large screens */
@media screen and (min-width: 768px) {
  #table-of-contents {
    position: fixed;
    /* Fixed positioning, making it float on the page */
    top: 50%;
    /* Top margin at 50% */
    right: 15px;
    /* Right margin at 15px, placing it on the right side */
    transform: translateY(-50%);
    /* Use transform to vertically center */
    background-color: #f0f0f0;
    /* Set background color */
    padding: 10px;
    /* Add some padding to increase readability */
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    /* Add shadow effect */
    width: 250px;
    /* Set width */
    max-height: 70vh;
    /* Set maximum height to 70% of the viewport */
    overflow-y: auto;
    /* Add vertical scrollbar */
  }
}

/* OWN STUFF */


.highlight,
pre.chroma {
  position: relative;
  border-radius: 10px;
  padding-top: 1.2rem;
  /* space for title bar */
  overflow: visible;

  /* window feel */
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.25),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.highlight>*,
pre.chroma>* {
  overflow-x: auto;
  overflow-y: visible;
}

/* ---- Title bar ------------------------------------------- */

.highlight::after,
pre.chroma::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1.2rem;
  z-index: 1;

  background: linear-gradient(to bottom,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.02));

  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.highlight>*,
pre.chroma>* {
  overflow-x: auto;
  overflow-y: visible;
}

/* ---- macOS traffic-light buttons ------------------------- */

.highlight::before,
pre.chroma::before {
  content: "";
  position: absolute;
  top: 0.3rem;
  left: 0.6rem;
  z-index: 1;

  width: 10px;
  height: 10px;
  border-radius: 50%;

  background: #ff5f56;
  box-shadow:
    18px 0 0 #ffbd2e,
    36px 0 0 #27c93f;

  pointer-events: none;
}

/* ---- Prevent layout conflicts ---------------------------- */

pre.chroma {
  margin: 0;
}

/* Remove background duplication if theme sets it twice */
pre.chroma code {
  display: block;
  padding: 1rem;
  background: none;
}

/* ---- Line numbers (if enabled) --------------------------- */

.chroma table {
  margin: 0;
}

.chroma .lnt {
  padding-right: 0.75rem;
  opacity: 0.6;
}

/* ---- Inline code remains untouched ----------------------- */

:not(pre)>code {
  border-radius: 4px;
}

pre,
code {
  font-family: "DejaVu Sans Mono";
  margin: 0;
}

pre.chroma {
  scrollbar-gutter: stable both-edges;
}

pre,
pre code {
  white-space: pre;
}

.chroma table {
  display: block;
}


.gallery {
  column-count: 3;
  column-gap: 1rem;
}

@media (max-width: 900px) {
  .gallery {
    column-count: 2;
  }
}

@media (max-width: 500px) {
  .gallery {
    column-count: 1;
  }
}

.gallery a {
  display: block;
  break-inside: avoid;
  margin-bottom: 1rem;
}

.gallery img {
  width: 100%;
  height: auto;
  display: block;
}