@import url('https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css');
@import '/static/css/base.css';

/** TODO: <img> lazy loading */

body {
  --main-width: 80%;
  --side-display: flex;
  --blog-background: white;
  --main-content-offset: 3px;
  background-color: var(--blog-background);
  color: black;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

@media (max-width: 1000px) {
  body {
    --main-width: 100%;
    --side-display: none;
    --main-content-offset: 0px;
    padding-left: 1em;
  }
}

@media (max-width: 650px) {
  .blog-nav-item-command {
    display: none;
  }
}

.blog-main-content,
.blog-sidebar-content {
  margin: 0;
  padding: 0;
}

.blog-title-container {
  margin-bottom: 0.3em;
  text-wrap-mode: nowrap;
}

.blog-title {
  font-size: 1.5em;
  color: #1d5685;
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Oxygen,
    Ubuntu,
    Cantarell,
    'Open Sans',
    'Helvetica Neue',
    sans-serif;
}

.blog-subtitle {
  font-size: 0.7em;
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Oxygen,
    Ubuntu,
    Cantarell,
    'Open Sans',
    'Helvetica Neue',
    sans-serif;
}

.blog-hitokoto {
  font-style: italic;
  text-wrap-mode: nowrap;
}

.blog-nav {
  width: calc(var(--main-width) - 1em + var(--main-content-offset));
}

.blog-nav ul {
  list-style-type: none;
  padding: 0;
  display: flex;
}

.blog-nav-links-item {
  margin-right: 2em;
  font-size: 1.1em;
}

.blog-nav-links-item-last {
  flex-grow: 1;
  font-size: 1.1em;
}

.blog-nav-item-command {
  position: relative;
}

.blog-nav-command {
  outline: none;
  border-radius: 4px;
  background-color: var(--blog-background);
  color: black;
  width: 10em;
  border: 1px solid lightgray;
  transition: width 0.5s cubic-bezier(0, 1.04, 0.96, 0.98);
  height: 100%;
}
.blog-nav-command:focus,
.blog-nav-command:hover {
  width: 20em;
}

.blog-nav-command-dropdown {
  position: absolute;
  width: 100%;
  height: 20em;
  z-index: 999;
  border: 1px solid lightgray;
  border-radius: 4px;
  background-color: var(--blog-background);
  color: black;
  margin-top: 0.5em;
}
.blog-nav-command-dropdown-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow-y: scroll;
  -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}
.blog-nav-command-dropdown-container::-webkit-scrollbar {
  display: none; /* Hide scrollbar for WebKit browsers */
}

.blog-nav-links-item-a {
  text-wrap-mode: nowrap;
  text-decoration: none;
  color: black;
  position: relative;
}

.blog-nav-links-item-a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background-color: gray;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease-out;
}

.blog-nav-links-item-a:focus::after,
.blog-nav-links-item-a:hover::after {
  transform: scaleX(1);
}

.blog-page {
  display: flex;
  height: calc(
    100vh - 200px
  ); /* Adjust height to fill the page minus header and footer */
}

.blog-main {
  border: 1px solid lightgray;
  position: relative;
  border-radius: 4px;
  padding: 0.5em 1em 0;
  margin-right: 1em;
  width: var(--main-width);
  box-sizing: border-box;
  line-height: 1em;
  overflow-y: scroll;
  -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.blog-main::-webkit-scrollbar {
  display: none; /* Hide scrollbar for WebKit browsers */
}

.blog-side {
  display: var(--side-display);
  flex-direction: column;
  width: calc(100% - var(--main-width));
}

.blog-sidebar {
  position: relative;
  border: 1px solid lightgray;
  border-radius: 4px;
  padding: 0.5em 1em 0;
  margin-bottom: 1em;
  width: 100%;
  height: 40%; /* Fill the height of the parent */
  box-sizing: border-box;
  overflow-y: scroll;
  -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.blog-sidebar::-webkit-scrollbar {
  display: none; /* Hide scrollbar for WebKit browsers */
}

.blog-contacts {
  display: flex;
  flex-direction: row;
  margin-top: 0.5em;
  margin-left: 0.2em;
}

.blog-contacts img {
  width: 2em;
  margin-right: 0.5em;
  filter: opacity(0.5) grayscale(1);
}

.blog-footer {
  margin-top: 0.1em;
  color: gray;
  text-wrap-mode: nowrap;
  width: calc(var(--main-width) - 1em + var(--main-content-offset));
}

.loading-icon,
.loading-icon-failure {
  --loading-icon-scale: 1.5;
  position: absolute;
  display: block;
  top: 50%;
  /** This is bullshit */
  left: calc(50% - 45px * var(--loading-icon-scale));
  scale: var(--loading-icon-scale);
  width: 0px;
  height: 0px;
}

.loading-icon::after,
.loading-icon-failure::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  background-color: transparent;
  box-shadow:
    15px 0 0 0 rgba(0, 0, 0, 0.2),
    30px 0 0 0 rgba(0, 0, 0, 0.2),
    45px 0 0 0 rgba(0, 0, 0, 0.2),
    60px 0 0 0 rgba(0, 0, 0, 0.2);
  animation: flash-dots 1.2s infinite;
}

.loading-icon-failure::after {
  animation: flash-dots-failure 1.2s forwards;
}

@keyframes flash-dots {
  0%,
  18%,
  100% {
    box-shadow:
      15px 0 0 0 rgba(0, 0, 0, 0.2),
      30px 0 0 0 rgba(0, 0, 0, 0.2),
      45px 0 0 0 rgba(0, 0, 0, 0.2),
      60px 0 0 0 rgba(0, 0, 0, 0.2);
  }
  22%,
  30% {
    box-shadow:
      15px 0 0 0 black,
      30px 0 0 0 rgba(0, 0, 0, 0.2),
      45px 0 0 0 rgba(0, 0, 0, 0.2),
      60px 0 0 0 rgba(0, 0, 0, 0.2);
  }
  34%,
  42% {
    box-shadow:
      15px 0 0 0 rgba(0, 0, 0, 0.2),
      30px 0 0 0 black,
      45px 0 0 0 rgba(0, 0, 0, 0.2),
      60px 0 0 0 rgba(0, 0, 0, 0.2);
  }
  46%,
  54% {
    box-shadow:
      15px 0 0 0 rgba(0, 0, 0, 0.2),
      30px 0 0 0 rgba(0, 0, 0, 0.2),
      45px 0 0 0 black,
      60px 0 0 0 rgba(0, 0, 0, 0.2);
  }
  58%,
  66% {
    box-shadow:
      15px 0 0 0 rgba(0, 0, 0, 0.2),
      30px 0 0 0 rgba(0, 0, 0, 0.2),
      45px 0 0 0 rgba(0, 0, 0, 0.2),
      60px 0 0 0 black;
  }
}

@keyframes flash-dots-failure {
  0% {
    box-shadow:
      15px 0 0 0 rgba(0, 0, 0, 0.2),
      30px 0 0 0 rgba(0, 0, 0, 0.2),
      45px 0 0 0 rgba(0, 0, 0, 0.2),
      60px 0 0 0 rgba(0, 0, 0, 0.2);
  }
  18% {
    box-shadow:
      15px 0 0 0 #c21c2c,
      30px 0 0 0 rgba(0, 0, 0, 0.2),
      45px 0 0 0 rgba(0, 0, 0, 0.2),
      60px 0 0 0 rgba(0, 0, 0, 0.2);
  }
  42% {
    box-shadow:
      15px 0 0 0 #c21c2c,
      30px 0 0 0 #c21c2c,
      45px 0 0 0 rgba(0, 0, 0, 0.2),
      60px 0 0 0 rgba(0, 0, 0, 0.2);
  }
  54% {
    box-shadow:
      15px 0 0 0 #c21c2c,
      30px 0 0 0 #c21c2c,
      45px 0 0 0 #c21c2c,
      60px 0 0 0 rgba(0, 0, 0, 0.2);
  }
  100% {
    box-shadow:
      15px 0 0 0 #c21c2c,
      30px 0 0 0 #c21c2c,
      45px 0 0 0 #c21c2c,
      60px 0 0 0 #c21c2c;
  }
}

/** Dark mode */

@media (prefers-color-scheme: dark) {
  body {
    --blog-background: rgb(24, 24, 24);
    filter: invert(1) hue-rotate(180deg);
    background-color: var(--blog-background);
    color: black;
  }
  img,
  video {
    filter: invert(1) hue-rotate(180deg);
  }
  .blog-nav-command {
    background-color: var(--blog-background);
    border: 1px solid #2c2c2c;
    filter: invert(1) hue-rotate(180deg);
    color: white;
  }
  .blog-nav-command-dropdown {
    background-color: var(--blog-background);
    border: 1px solid #2c2c2c;
    filter: invert(1) hue-rotate(180deg);
  }
  .blog-nav-command-dropdown-container {
    filter: invert(1) hue-rotate(180deg);
  }
}
