@import 'variables.css';
@import 'reset.css';

/* #region html and body */
html.is_dark img,
html.is_dark [style*='background-image:'] {
  opacity: var(--opacity);
  transition: opacity var(--transition-duration);
}
html.is_dark img:hover,
html.is_dark [style*='background-image:']:hover {
  opacity: 1;
}
/* #endregion */

/* #region Common */
.flex_center {
  display: flex;
  align-items: center;
}
[class^='czs-'] {
  display: inline-block;
  background-position: center center;
  background-repeat: no-repeat;
  width: 2rem;
  height: 2rem;
  background-size: 20px;
}
.list_style_none {
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: var(--line-height);
}
.list_style_none li {
  margin: 0;
}
/* #endregion */

/* #region Aside */
aside {
  position: absolute;
  width: var(--width-toc);
  padding-top: var(--height-header);
  top: 0;
  left: calc(50% - 40rem);
}
.aside_card {
  display: flow-root;
  background-color: var(--color-background-aside);
  border-radius: 1rem;
  padding: 0 2rem 1rem;
}
aside h1 {
  text-align: center;
  font-size: 20px;
  font-weight: normal;
}
aside h1 a {
  color: var(--color-text);
}
aside h1 a:hover {
  text-decoration: none;
}
aside .description {
  font-size: 14px;
  color: var(--color-text-muted);
}
aside .social {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 1rem -0.5rem;
}
aside .menu {
  font-size: 14px;
  margin: 2rem -1rem 0;
}
aside .menu a {
  line-height: 2rem;
  padding: 0 1rem;
  color: var(--color-text-muted);
  border-radius: 0.5rem;
}
aside .menu a.active {
  background-color: var(--color-background);
}
aside .menu a:hover {
  color: var(--color-text);
  text-decoration: none;
  background-color: var(--color-background-faded);
}
aside .menu a [class^='czs-'] {
  margin: 0 0.5rem 0 -0.5rem;
}
.toc {
  padding: 1rem 0 1rem 1rem;
  font-size: 14px;
  line-height: var(--line-height-small);
  width: 15rem;
  max-height: 100vh;
  overflow-y: auto;
}
.toc_fixed {
  position: fixed;
  top: 0;
}
.toc ol {
  margin: 0;
  list-style: none;
  padding-left: 1rem;
}
.toc a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.toc a:hover {
  color: var(--color-text);
  text-decoration: none;
}
.toc a.active {
  color: var(--color-primary);
}
/* #endregion */

/* #region toggle_dark */
.toggle_dark {
  cursor: pointer;
}
.toggle_dark [class^='czs-moon'] {
  margin-left: -0.75rem;
}
.toggle_dark .czs-sun-l,
.toggle_dark .czs-moon {
  display: none;
}
.is_dark .toggle_dark .czs-sun-l,
.is_dark .toggle_dark .czs-moon {
  display: inline-block;
}
.is_dark .toggle_dark .czs-sun,
.is_dark .toggle_dark .czs-moon-l {
  display: none;
}
/* #endregion */

/* #region Posts */
.main_posts h1 {
  margin-top: 0;
  font-size: 24px;
}
.main_posts h1 a {
  color: var(--color-text);
}
.main_posts p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.main_posts_meta {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  margin-top: 0.5rem;
}
.main_posts_meta a {
  color: var(--color-text-muted);
}
.main_posts_cover {
  float: right;
  width: 12rem;
  height: 9rem;
  background-size: cover;
  background-position: center center;
  margin-left: 0.5rem;
}
.main_posts li {
  display: flow-root;
  overflow: hidden;
  margin-top: 3rem;
}
.main_posts li:first-child {
  margin-top: 2rem;
}
/* #endregion */

/* #region Main */
.main {
  display: flow-root;
  overflow: hidden;
  margin: var(--height-header) auto 0;
  padding: 0 1rem;
  width: 44rem;
  word-wrap: break-word;
}
.main > h1:first-child,
.main article > h1:first-child {
  text-align: center;
  margin-top: 1rem;
}

.main_post_meta {
  margin-bottom: 2rem;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  text-align: center;
}

.anchor {
  opacity: 0;
  color: var(--color-text-muted);
  font-weight: normal;
  margin-left: 0.5em;
}
.anchor:hover {
  color: var(--color-primary);
  text-decoration: none;
}
h1:hover .anchor,
h2:hover .anchor,
h3:hover .anchor,
h4:hover .anchor,
h5:hover .anchor,
h6:hover .anchor {
  opacity: 1;
}

.table_wrapper {
  display: block;
  overflow-x: auto;
}

article.loading {
  min-height: calc(100vh - var(--height-header));
  display: flex;
  justify-content: center;
  align-items: center;
}
/* #endregion */

/* #region Tags */
.main_tags {
  margin: 0.5rem -1rem 0;
}
.main_tags a {
  color: var(--color-text);
}
.main_tags li {
  display: inline-block;
  margin: 0.5rem 1rem 0;
}
/* #endregion */

/* #region Archives */
.main_archives {
  padding: 0;
  list-style: none;
}
.main_archives time {
  float: left;
  font-size: 12px;
  line-height: 20px;
}
.main_archives time + div {
  margin-left: 5.5rem;
}
.main_archives a {
  color: var(--color-text);
}
/* #endregion */

/* #region Footer */
footer {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  padding: 3rem 0;
}
/* #endregion */

/* #region Mobile */
@media screen and (min-width: 1376px) {
  .show_on_mobile {
    display: none;
  }
}
@media screen and (max-width: 1375px) {
  .hide_on_mobile {
    display: none;
  }
  .aside_button_open {
    position: absolute;
    top: 0.5rem;
    left: calc(50vw - 21.5rem);
  }
  .aside_button_close {
    position: absolute;
    top: 0;
    left: 0;
  }
  .aside_button_text {
    position: absolute;
    top: 0;
    left: calc(50vw - 20rem);
    line-height: 2rem;
    padding: 0 0.5rem;
    margin: 0.5rem;
    color: var(--color-text-muted);
  }
  .aside_button_text:hover {
    text-decoration: none;
  }
  .show_aside aside {
    display: block;
    padding-top: 0;
    top: 0.5rem;
    left: calc(50vw - 21.5rem);
  }
  .show_aside .aside_card {
    box-shadow: var(--box-shadow);
  }
  .show_aside .toc {
    display: none;
  }
}

@media screen and (max-width: 44rem) {
  .main {
    width: 100vw;
  }
  .aside_button_open {
    left: 0.5rem;
  }
  .aside_button_text {
    left: 2rem;
  }
  .show_aside aside {
    left: 0.5rem;
  }
  .main_posts li {
    margin-top: 2rem;
  }
  .main_posts h1 {
    font-size: 20px;
  }
  .main_posts_cover {
    width: 96px;
    height: 96px;
  }
  .main_posts p {
    -webkit-line-clamp: 2;
  }
  .anchor {
    opacity: 1;
  }
  pre[class*='language-'] {
    margin-left: -1rem !important;
    margin-right: -1rem !important;
  }
  li pre[class*='language-'],
  blockquote pre[class*='language-'] {
    margin-left: 0 !important;
  }
}
/* #endregion */

/* #region Print */
@media print {
  aside,
  .prev_next,
  .tools,
  .gitalk-container,
  footer,
  .show_on_mobile {
    display: none;
  }
  .main {
    margin: 0 auto !important;
  }
  .main article a[href]::after {
    content: ' (' attr(href) ') ';
  }
}
/* #endregion */
