:root {
  /* Carbonfox Background Colors */
  --bg-primary: #161616; /* bg1 - main background */
  --bg-secondary: #1c1c1c; /* bg2 - lighter bg for cards */
  --bg-tertiary: #262626; /* bg3 - even lighter for hover states */
  --bg-code: #0f0f0f; /* bg0 - darker bg for code blocks */
  --border: #393939; /* bg4 - border color */

  /* Carbonfox Text Colors */
  --text-primary: #f2f4f8; /* fg1 - default fg */
  --text-secondary: #dfdfe0; /* white.base - slightly dimmer */
  --text-muted: #c6c8cc; /* fg2 - muted text */

  /* Carbonfox Accent Colors */
  --accent-blue: #78a9ff; /* blue.bright - for links and buttons */
  --accent-green: #25be6a; /* green.base - for success states */
  --accent-purple: #be95ff; /* magenta.base - for special elements */
  --accent-cyan: #33b1ff; /* cyan.base - secondary accents */
  --accent-orange: #3ddbd9; /* orange.bright - highlights */
  --accent-pink: #ff7eb6; /* pink.base - special highlights */
  --accent-red: #ee5396; /* red.base - error states */

  /* Layout Variables (unchanged) */
  --radius: 4px;
  --radius-sm: 2px;
  --space-xs: 5px;
  --space-sm: 10px;
  --space-md: 15px;
  --space-lg: 20px;
  --space-xl: 25px;
  --space-2xl: 30px;

  --font-code: 0.8rem;
  --font-size: 0.95rem;

  @media only screen and (max-width: 800px) {
    --font-size: 0.85rem;
    --font-code: 0.75rem;
  }
}

* {
  margin: 0px;
  padding: 0px;
}

html,
body {
  width: 100vw;
  height: 100vh;
  font-family: "Inter", serif;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  overflow-x: hidden;

  @media only screen and (max-width: 800px) {
    width: 100%;
    height: 100%;
  }
}

div.center {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  
  @media only screen and (max-width: 800px) {
    padding: var(--space-md);
    padding-top: calc(48px + var(--space-md));
    box-sizing: border-box;
    height: 100vh;
    margin-top: 0;
  }
}

div.background {
  background-image: url("/img/background.jpg");
  background-position: center;
  filter: saturate(0%);
  position: absolute;
  height: 100%;
  width: 100%;
  z-index: 0;
  left: 0;
  top: 0;
}

div.container {
  box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  background-color: var(--bg-primary);
  border-radius: var(--radius);
  padding: var(--space-lg);
  z-index: 1;
  max-width: 90%;

  @media only screen and (max-width: 800px) {
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
  }
}

div.details {
  flex-direction: row;
  display: flex;

  & > img {
    width: 128px;
    height: 128px;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    pointer-events: none;
    border: 1px solid var(--border);
  }

  & > div.about {
    display: flex;
    margin-left: var(--space-lg);
    flex-direction: column;
    justify-content: center;

    & > h1 {
      color: var(--text-primary);
    }

    & > h2 {
      font-weight: 200;
      color: var(--text-muted);
    }
  }

  @media only screen and (max-width: 800px) {
    flex-direction: column;
    align-items: center;
  }
}

div.about {
  @media only screen and (max-width: 800px) {
    align-items: center;
    margin-top: var(--space-md);
    margin-left: 0px !important;
    width: 100%;

    & > h1 {
      @media only screen and (max-width: 475px) {
        font-size: 20px;
      }
    }

    & > h2 {
      @media only screen and (max-width: 475px) {
        font-size: 15px;
      }
    }
  }
}

ul.socials {
  display: flex;
  list-style: none;
  margin-top: var(--space-md);
  width: 100%;

  & > li {
    display: inline-block;
    margin-right: var(--space-sm);

    & > a {
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: var(--bg-secondary);
      border: 1px solid var(--border);
      text-decoration: none;
      border-radius: var(--radius-sm);
      color: var(--text-secondary);
      width: 32px;
      height: 32px;
      transition: all 0.2s ease;

      & > img {
        width: 16px;
        transition: filter 0s;
      }

      &:hover {
        background-color: var(--bg-tertiary);
        border-color: var(--accent-blue);
        color: var(--accent-blue);
      }

      &:hover > img {
        filter: brightness(0) saturate(100%) invert(70%) sepia(37%) saturate(4975%) hue-rotate(200deg) brightness(106%) contrast(101%);
      }
    }
  }

  @media only screen and (max-width: 800px) {
    flex-direction: column;
    margin-top: var(--space-md) !important;

    & > li {
      margin-right: 0px;

      &:not(:last-child) {
        margin-bottom: var(--space-sm);
      }

      & > a {
        width: 100%;
        height: 48px;
      }
    }
  }
}

span.label {
  display: none;

  @media only screen and (max-width: 800px) {
    display: inline-block;
    margin-left: 8px;
  }
}

div.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-primary);
  box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--border);
  position: fixed;
  height: 48px;
  width: 100%;
  z-index: 1000;
  left: 0;
  top: 0;

  & > div.left {
    margin-left: var(--space-sm);

    & > h1 {
      font-size: 20px;

      & > a {
        text-decoration: none;
        color: var(--text-primary);
      }
    }
  }

  & > div.right {
    margin-right: var(--space-sm);

    & > ul.pages {
      margin-left: 0px;
      list-style: none;
      display: flex;

      & > li:not(:last-child) {
        margin-right: var(--space-sm);
      }

      & > li > a {
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--bg-secondary);
        border: 1px solid var(--border);
        font-size: 0.9rem;
        text-decoration: none;
        border-radius: var(--radius-sm);
        color: var(--text-secondary);
        width: 72px;
        height: 32px;
        transition: all 0.2s ease;

        &:hover {
          background-color: var(--bg-tertiary);
          border-color: var(--accent-blue);
          color: var(--accent-blue);
        }

        @media only screen and (max-width: 475px) {
          font-size: 12px;
          height: 28px;
          width: 64px;
        }
      }
    }
  }
}

div.content {
  justify-content: center;
  margin-top: 64px;
  display: grid;
  padding-top: var(--space-lg);

  & > section {
    width: 48rem;

    &:not(:last-child) {
      margin-bottom: var(--space-2xl);
    }

    & > h1 {
      margin-bottom: var(--space-sm);
      color: var(--text-primary);
    }

    & > ul.posts {
      list-style: none;

      & > li:not(:last-child) {
        margin-bottom: var(--space-lg);
      }

      & > li:last-child {
        margin-bottom: var(--space-2xl);
      }

      & > li > a {
        display: flex;
        flex-direction: column;
        text-decoration: none;
        background-color: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        color: var(--text-primary);
        padding: var(--space-lg);
        transition: all 0.2s ease;

        &:hover {
          background-color: var(--bg-tertiary);
          border-color: var(--accent-blue);
          transform: translateY(-1px);
        }

        & > div.metadata {
          display: flex;
          flex-direction: row;
          justify-content: space-between;
          margin-bottom: var(--space-xs);

          & > h1 {
            font-size: 1.25rem;
            color: var(--text-primary);
          }

          & > p {
            padding: 0px var(--space-xs) 0px var(--space-xs);
            background-color: var(--bg-primary);
            border: 1px solid var(--border);
            justify-content: center;
            align-items: center;
            border-radius: var(--radius);
            font-size: 0.75rem;
            max-height: 23px;
            display: flex;
            color: var(--text-muted);

            & > img {
              margin-right: var(--space-xs);
              height: 12px;
            }
          }
        }

        & > p {
          color: var(--text-muted);
          font-size: var(--font-size);
        }

        @media only screen and (max-width: 800px) {
          padding: var(--space-sm) !important;

          & > div.metadata > h1 {
            font-size: 16px !important;
          }

          & > p {
            font-size: 12px;
          }
        }
      }
    }
  }

  & > div.metadata {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-sm);
    margin-bottom: 0px;

    & > h1 {
      color: var(--text-primary);
    }

    & > div {
      justify-content: space-between;
      margin-top: var(--space-xs);
      display: flex;

      & > p {
        color: var(--text-muted);
        font-size: var(--font-size);
      }
    }
  }

  @media only screen and (max-width: 800px) {
    margin-left: var(--space-md);
    margin-right: var(--space-md);
    margin-top: 48px;
    padding-top: var(--space-md);
    display: block;
    max-width: calc(100vw - 2 * var(--space-md));

    & > section {
      max-width: 100%;
      width: 100%;
    }

    & > div.metadata {
      & > div > p:first-child {
        font-size: 12px;
      }

      & > div > p:last-child {
        display: none;
      }

      & > h1 {
        font-size: 24px;
      }
    }
  }
}

section.article {
  & pre {
    border-radius: var(--radius);
    margin: var(--space-sm) 0px var(--space-sm) 0px;
    border: 1px solid var(--border);
    overflow-x: overlay;
    background: var(--bg-code);
    padding: var(--space-sm);
    font-weight: 100;
    width: 100%;

    &::-webkit-scrollbar {
      height: 8px;
    }

    &::-webkit-scrollbar-track {
      background-color: var(--bg-primary);
      border-top: 1px solid var(--border);
      border-radius: 0px 0px var(--radius) var(--radius);
    }

    &::-webkit-scrollbar-thumb {
      background-color: var(--border);
    }

    & > code {
      padding: 0px !important;
      font-size: var(--font-code);
      white-space: unset;
      border: none;
    }

    @media only screen and (max-width: 800px) {
      width: auto;
    }
  }

  & > hr {
    border: 1px solid var(--border);
  }

  & code {
    background: var(--bg-code);
    padding: 0px var(--space-xs) 0px var(--space-xs);
    border: 1px solid var(--border);
    font-family: "Berkeley Mono", monospace;
    border-radius: var(--radius);
    font-size: var(--font-code);
    white-space: nowrap;
    font-weight: 100;
    color: var(--text-secondary);
  }

  & h1,
  & h2,
  & h3,
  & h4,
  & h5,
  & h6 {
    margin: var(--space-xl) 0px var(--space-sm) 0px;
    align-items: center;
    display: flex;
    color: var(--text-primary);
  }

  & p,
  & ol,
  & ul {
    margin: var(--space-sm) 0px var(--space-sm) 0px;
    font-size: var(--font-size);
  }

  & mark {
    background: var(--accent-orange);
    color: var(--bg-primary);
    padding: 0px 2px 0px 2px;
  }

  & a {
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
    color: var(--accent-blue);
    transition: text-decoration-color 0.25s ease-out;

    &:hover {
      text-decoration-color: var(--accent-blue);
    }
  }

  & table {
    border: 1px solid var(--border);
    background-color: var(--bg-tertiary);
    border-radius: var(--radius);
    margin: var(--space-sm) 0px var(--space-sm) 0px;
    border-spacing: 0px;
    width: 100%;

    & th {
      background-color: var(--border);
      padding: var(--space-xs) 0px var(--space-xs) 0px;
      border: none;
      color: var(--text-primary);
    }

    & td {
      padding: 8px var(--space-sm) 8px var(--space-sm);
      border-bottom: 1px solid var(--border);

      &:not(:last-child) {
        border-right: 1px solid var(--border);
      }
    }

    & tr:nth-child(even) td {
      background-color: var(--bg-secondary);
    }

    & tr:last-child td {
      border-bottom: none !important;
    }
  }

  & img {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 100%;
  }

  & figure {
    text-align: center;
  }

  & figcaption {
    color: var(--text-muted);
    text-align: center;
  }

  & ol,
  & ul {
    margin-left: 2rem;
  }

  & blockquote {
    border-left: 2px solid var(--accent-blue);
    background-color: var(--bg-code);
    padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--space-sm);

    & p {
      margin: 0px;
    }
  }

  & > p.copyright {
    border-top: 1px solid rgba(194, 200, 204, 0.1);
    color: rgba(194, 200, 204, 0.4);
    padding-top: 8px;
    font-size: 10px;

    & > a {
      color: var(--text-muted);
      text-decoration: none;
    }
  }
}
