.kg-width-full img,
.kg-width-wide img {
  /* for gscan to pass */
  -ignore: me;
}

/* General */
:root {
  color-scheme: light dark;

  --accent: var(--ghost-accent-color);
  --accent-l1: oklch(from var(--accent) calc(l + 0.2) c h);
  --accent-l2: oklch(from var(--accent) calc(l + 0.4) c h);
  --accent-d1: oklch(from var(--accent) calc(l - 0.2) c h);
  --accent-d2: oklch(from var(--accent) calc(l - 0.4) c h);

  --text-color: light-dark(#333333, #e4e4e4);
  --light-text: light-dark(#777777, #aaaaaa);
  --background-color: light-dark(#ffffff, #202124);
  --light-background: light-dark(#f2f2f2, #303134);
  --accent-text: light-dark(var(--accent), var(--accent-l2));
  --accent-text-secondary: light-dark(var(--accent-d1), var(--accent));
  --default-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Open Sans", "Helvetica Neue", sans-serif;
  --font-family: var(--gh-font-body, var(--default-font));
  --heading-font: var(--gh-font-heading, , var(--default-font));

  --base-font-size: 1.6rem;
  --font-scale: 1.2;

  --font-size-xs: calc(var(--base-font-size) / var(--font-scale));
  --font-size-sm: calc(var(--font-size-xs) * var(--font-scale));
  --font-size-md: calc(var(--font-size-sm) * var(--font-scale));
  --font-size-lg: calc(var(--font-size-md) * var(--font-scale));
  --font-size-xl: calc(var(--font-size-lg) * var(--font-scale));
  --font-size-2xl: calc(var(--font-size-xl) * var(--font-scale));
  --font-size-3xl: calc(var(--font-size-2xl) * var(--font-scale));
  --bold: 600;

  --line-height-tight: 1.2;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.7;
  --line-height-loose: 2;

  /* Code block colors */
  --code-background: light-dark(var(--accent-l2), #3a3a3a);
}

[data-color-scheme="light"] {
  color-scheme: light;
}

[data-color-scheme="dark"] {
  color-scheme: dark;
}

html {
  font-size: 62.5%;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-family);
  font-size: var(--base-font-size);
  line-height: var(--line-height-relaxed);
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}


h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--heading-font);
  font-weight: 700;
  margin-top: 0;
  color: var(--text-color);
}

a {
  color: var(--accent-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-text);
}

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

.content {
  max-width: 1200px;
  width: 90%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;

  .site__header {
    margin: 1.5rem 0;

    .site__header__content {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .site__header__title {
      font-size: var(--font-size-lg);
      font-weight: 700;
      font-family: var(--heading-font);
      color: var(--text-color);
    }

    .site__header__nav {
      display: flex;
      list-style: none;
      padding: 0;
      margin: 0;
      gap: 1em;

      .nav-current a {
        color: var(--accent-text);
        font-weight: var(--bold);
      }
    }
  }

  .site__main {
    flex-grow: 1;

    .site__content {
      max-width: 600px;
      width: 90%;
      margin: 3rem auto;
    }
  }

  .site__footer {
    background-color: var(--light-background);
    padding: 4rem 0;
    margin-top: 5rem;

    .site__footer__content {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
    }

    .copyright {
      margin-bottom: 1.5rem;
    }

    .subscribe {
      display: flex;
      gap: 12px;
      font-size: var(--font-size-xs);
      a {
        display: block;
      }
    }
  }
}

/* Post Feed */
.posts {
  .post__item-link {
    display: flex;

    .post__item-header {
      flex-grow: 1;
    }

    .post__item-meta {
      padding-top: 3px;

      .post__item-date {
        color: var(--light-text);
        font-size: var(--font-size-xs);
      }
    }
  }
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;

  .pagination__item {
    padding: 0.8rem 1.6rem;
    border-radius: 5px;
    background-color: var(--accent-text);
    color: var(--background-color);
    font-weight: var(--bold);
  }

  .pagination__info {
    margin: 0 2rem;
    color: var(--light-text);
  }
}

.post {
  .post__header {
    margin: 0 0 1em;
    padding-bottom: 1em;
    border-bottom: 2px solid var(--accent-text);

    .post__title {
      margin: 0;
    }

    .post__meta {
      color: var(--light-text);
    }
  }

  .post__content {
    font-size: var(--base-font-size);
    line-height: var(--line-height-normal);

    p {
      margin: 0 0 2rem;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      margin: 3rem 0 1.5rem;
    }

    img {
      border-radius: 5px;
      margin: 2.5rem 0;
    }

    pre {
      font-size: calc(var(--font-size-xs) * 1.05);
      border-radius: 6px;
      border-top: 4px solid var(--accent);

      code {
        padding: 0;
        border-radius: 0;
        background: inherit;
        color: inherit;
      }
    }

    code {
      font-size: calc(var(--font-size-xs) * 1.05);
      background: var(--code-background);
      padding: 2px 6px;
      border-radius: 6px;
    }
  }

  &.tag-links {
    ul {
      list-style: none;
      padding: 0;
      li {
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 12px 16px;
        background: var(--light-background);
      }
    }

    a {
      font-weight: 600;
      text-decoration: underline;
    }
  }
}

/* Error Pages */
.error {
  .error__container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 70vh;
    text-align: center;
  }

  .error__message {
    max-width: 500px;
  }

  .error__code {
    font-size: 12rem;
    margin: 0;
    color: var(--accent-text);
    line-height: 1;
  }

  .error__description {
    font-size: var(--font-size-lg);
    margin: 1rem 0 3rem;
  }

  .error__link {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: var(--accent-text);
    color: var(--background-color);
    border-radius: 5px;
    font-weight: 600;
  }
}

@media (max-width: 768px) {
  html {
    /* Adjust the base font size for medium screens */
    font-size: 55%;
  }
}

@media (max-width: 576px) {
  .content {
    max-width: 600px;
    width: 90%;
    margin: 1rem auto;
    padding: 0;
  }



  .site__footer__content {
    flex-direction: column;
    text-align: center;
  }

  .site__footer__nav {
    justify-content: center;
    margin-top: 1.5rem;
  }

  .site__footer__nav a {
    margin: 0 1rem;
  }
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--font-size-md);
  line-height: 1;
  padding: 0.5rem;
  border-radius: 50%;
  color: var(--text-color);
  background-color: transparent;
  transition: background-color 0.2s ease;

  &:hover {
    background-color: var(--light-background);
  }
}
