:root {
  color-scheme: light dark;
  --base-spacing: 4px;

  --blue: #14213D;
  --yellow: #FCA311;
  --gray: #E5E5E5;
  --white: #fff;
  --black: #000;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: light-dark(white, #020202);
  color: light-dark(black, white);
}

nav {
  padding: 48px;
  background: var(--blue);
  color: var(--white);
  margin-bottom: 24px;
}

a {
  color: var(--yellow);

  &:hover {
    font-weight: bold;
  }
}

nav {
  a {
    color: var(--yellow);
    font-size: large;
  }
}

a.underline {
  text-decoration: none;
  position: relative;
  font-weight: bold;

  &::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    bottom: 0;
    left: 0;
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
  }

  &:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
  }
}

.flex {
  display: flex;

  &.column {
    flex-direction: column;
  }

  &.center {
    justify-content: center;
    align-items: center;
  }

  &.gap-8 {
    gap: 8px;
  }

  &.gap-16 {
    gap: 16px;
  }

  & .grow {
    flex-grow: 1;
  }
}

.flex {
  display: flex;

  &.column {
    flex-direction: column;
  }

  &.center {
    justify-content: center;
    align-items: center;
  }

  &.gap-8 {
    gap: 8px;
  }

  &.gap-16 {
    gap: 16px;
  }

  .grow {
    flex-grow: 1;
  }
}

.blog-post {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px;

  header {
    margin-bottom: 48px;
  }

  h1 {
    margin-bottom: 12px;
  }

  time,
  .author {
    color: #666;
    display: inline-block;
    margin-right: 24px;
  }
}

/* Markdown styling */
.markdown-body {
  color: light-dark(#24292e, var(--gray));
  line-height: 1.6;

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
  }

  h1 {
    font-size: 2em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
  }

  h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
  }

  p {
    margin-top: 0;
    margin-bottom: 16px;
  }

  code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: light-dark(rgba(27, 31, 35, 0.05), rgba(0, 0, 0, 0.05));
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  }

  pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: light-dark(#f6f8fa, #424242);
    border-radius: 3px;

    code {
      padding: 0;
      margin: 0;
      font-size: inherit;
      background-color: transparent;
      border: 0;
    }
  }

  blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
    margin: 0 0 16px 0;
  }

  ul,
  ol {
    padding-left: 2em;
    margin-top: 0;
    margin-bottom: 16px;
  }

  img {
    max-width: 100%;
    box-sizing: border-box;
  }

  a {
    color: #0366d6;
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-top: 0;
    margin-bottom: 16px;
    width: 100%;
    overflow: auto;

    th {
      font-weight: 600;
    }

    th,
    td {
      padding: 6px 13px;
      border: 1px solid #dfe2e5;
    }
  }
}

/* Post list styles */
.post-list {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.post-preview {
  padding: 1.5rem;
  border-radius: 4px;
  background-color: light-dark(var(--white), #1e1e1e);
  box-shadow: 0 1px 3px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3));
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.3));
  }

  .post-title {
    margin-top: 0;
    margin-bottom: 0.5rem;

    a {
      color: light-dark(var(--blue), var(--yellow));
      text-decoration: none;

      &:hover {
        color: light-dark(var(--yellow), var(--white));
        text-decoration: none;
      }
    }
  }

  .post-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 24px;
    color: light-dark(#666, #aaa);

    .post-author,
    .post-date {
      display: inline-block;
    }
  }

  .post-excerpt {
    color: light-dark(#333, #ddd);
    line-height: 1.6;
    margin-bottom: 1rem;

    img {
      width: -moz-available;
      width: -webkit-fill-available;
      width: stretch;
    }
  }

  .read-more {
    display: inline-block;
    font-weight: 500;

    &:hover {
      text-decoration: underline;
    }
  }
}

.giscus-frame, .giscus {
  max-width: 800px;
  margin: 24px auto;
  padding: 0 12px;
  display: block;
}

/* For smaller screens */
@media (max-width: 768px) {
  .giscus-frame {
    margin: 1rem auto;
    padding: 0 0.5rem;
  }
}

footer {
  margin: 64px;
}
