@import "./variable.css";

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

* {
  box-sizing: border-box;
}

figure {
  margin-left: 0;
  margin-right: 0;
}

html,
body {
  background: var(--warpaper);
  background-color: var(--background);
  color: var(--textcolor);
  font-size: calc(var(--fontsize) * 1px);
  line-height: var(--line-height);
}

body::after {
  content: "";
  position: fixed;
  z-index: 5;
  pointer-events: none;
  width: 100%;
  height: 100%;
  background: var(--warpaper);
  left: 0;
  top: 0;
  bottom: 0;
  opacity: 0.18;
  -webkit-filter: blur(20px);
  filter: blur(20px);
}

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

a:hover {
  text-decoration: none;
}

/* .bg {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  width: 100%;
  height: 100%;
  background: var(--warpaper);
  left: 0;
  top: 0;
  bottom: 0;
} */

.wrapper {
  display: flex;
  width: 100%;
  height: 100%;
}

.side-bar {
  flex-basis: 230px;
  display: flex;
  flex-direction: column;

  position: relative;
  z-index: 1;

  background: var(--effect-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.3s ease-in-out;
}

.side-bar:hover {
  background: var(--background);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}


.side-bar .side-body {
  flex: 1;
  width: 100%;
  padding-bottom: 120px;
  overflow: auto;
}

.m-ctrl {
  display: none;
  visibility: hidden;
  width: 48px;
  height: 48px;
  font-size: 32px;
  position: relative;
  z-index: 1;
}

.m-open,
.m-close {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  transition: all 0.2s linear 0.1s;
  color: var(--nav-link-color);
}

.m-close {
  opacity: 0;
  z-index: -1;
}

.footer {
  width: 230px;
  padding: 16px;
  font-size: calc(10 / var(--fontsize)  * 1rem);
  color: grey;
  position: absolute;
  z-index: 1;
  left: 0;
  bottom: 0;
  background: linear-gradient(0deg, var(--background) 0%, rgba(0, 0, 0, 0) 100%);
  ;
  /* background: var(--background); */
  /* background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); */
}

.logo {
  min-height: 48px;
  padding: 14px 16px;
}

.logo h1 {
  font-size: 1.2rem;
  font-weight: bolder;
  margin: 0;
}

.logo h2 {
  font-size: 0.75rem;
  font-weight: normal;
  margin: 0;
}

.main {
  flex: 1;
  padding: 48px;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  /* background: rgba(0, 0, 0, 0.89); */
}

.container {
  width: 960px;
  margin: auto;
  max-width: 100%;
}

.main-nav {
  list-style: none;
  margin: 0;
  display: block;
  padding: 0;
}

.main-nav .nav-list-item {
  display: block;
}

.main-nav .nav-list-link {
  display: flex;
  padding: 8px 16px;
  align-items: center;
  color: var(--nav-link-color);
}

.main-nav .nav-list-link.active i {
  /* background: var(--primary-color); */
  background: var(--nav-active-color);
  color: #fff;
}

.main-nav .nav-list-link i {
  margin-right: 8px;
  width: 1.5rem;
  height: 1.5rem;
  line-height: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
}

.page-list {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto;
  grid-gap: 24px;
}

.page-list .article__body img {
  position: absolute;
  z-index: -2;
  object-fit: cover;
  object-position: left 0 top 0;
  left: 0;
  top: 0;
  opacity: 0.8;
  width: 100%;
  height: 100%;
  transition: opacity 0.2s ease-in-out;
}

.page-list .article:hover .article__body img {
  opacity: 1;
}

.page-list .article::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: -1;
  left: 0;
  top: 0;
  background: radial-gradient(circle, transparent 0%, var(--background) 80%);
}

/* 首页隐藏目录 */
.page-list .tocStart,
.page-list .tocEnd,
.page-list .tocStart+ul {
  display: none;
  visibility: hidden;
}

.article {
  border-radius: 24px;
  background: var(--background);
  padding: 18px;

  display: flex;
  flex-direction: column;

  /* min-height: 240px; */

  position: relative;
  z-index: 1;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.2s ease-in-out;
  aspect-ratio: inherit;
}

.article:not(.post) {
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--effect-bg);

}

.article:not(.post):hover {
  /* z-index: 6; */
  background: var(--background);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}

.article:not(.post) .article__body>p {
  color: var(--textcolor2);
}

/* 详情 */
.article.post {
  position: inherit;
  display: block;
  /* z-index: 6; */
}

.article.post .article__body {
  padding-right: 20rem;
}

/* toc 目录 */
.article.post .article__body .toc {
  position: -webkit-sticky;
  position: sticky;
  top: -50px;
  width: 20rem;
  max-height: 89vh;
  overflow: auto;
  margin-right: -20rem;
  margin-top: -16px;
  background: var(--background);
  float: right;
  padding-left: 16px;
  padding-top: 16px;
}

.article.post .article__body .toc ul {
  padding-left: 1.6rem;
}

.article.post .article__body .toc::before {
  content: "目录";
}

.article:not(.post):nth-child(1) {
  grid-column: 1 / 3;
  aspect-ratio: inherit;
  /* aspect-ratio: 2.05; */
}

.article:nth-child(10) {
  grid-column: 2 / 4;
  aspect-ratio: inherit;
  /* aspect-ratio:2.05; */
}

.page-list .article__title {
  line-height: 2.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

}

.article .article__title {
  margin: 0 0 0.8rem;
  font-size: 1.87rem;
  font-weight: bolder;
}

.article .metadata+.metadata {
  margin-top: 0.4rem;
}

.article .article__body {
  flex: 1;
}

.article:not(.post) .article__body {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  word-break: break-all;
  overflow: hidden;
}

.article .article__body p {
  margin-top: 0;
}

.article__body img {
  display: block;
  max-width: 100%;
}

.article .article__footer {
  display: flex;
  align-items: center;
}

.article .article__link,
.article__tags__link {
  padding: 4px 16px;
  display: inline-block;
  font-size: 0.75rem;
  text-align: center;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  color: var(--meta-color);
}

.article .article__link:hover,
.article__tags__link:hover {
  color: var(--primary-color);
}

.article__tags__link+.article__tags__link {
  margin-left: 8px;
}

.article .article__link::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  pointer-events: auto;
  content: "";
  background-color: rgba(0, 0, 0, 0);
}

.article .article__title__link {
  color: var(--textcolor);
}

.article .article__date {
  font-size: calc(14 / var(--fontsize)  * 1rem);;
  color: var(--meta-color);
}

.article .article__footer .article__date {
  flex: 1;
}

.pagination {
  display: flex;
  margin-top: 24px;
  background: var(--background);
  padding: 18px;
  border-radius: 24px;
  justify-content: space-around;
}

.pagination .pagination__link+.pagination__link {
  margin-left: 16px;
}

.archive {
  background: var(--background);
  padding: 18px;
  border-radius: 24px;
}

.archive__list {
  list-style: none;
  margin: 0;
  padding: 12px 2rem;
}

.archive__list+.archive__list {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.archive__list__item__text+.archive__list__item__link {
  margin-left: 1rem;
}

.archive__list__item__text {
  color: grey;
}

hr {
  margin-top: 20px;
  margin-bottom: 20px;
  border: 0;
  border-top: 1px solid var(--border-color);
  width: 100%;
}

.page {
  background: var(--background);
  padding: 18px 24px;
  border-radius: 24px;
}

.tags-page {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto;
  grid-gap: 16px;
}

.tags__link {
  padding: 8px 16px;
  background: var(--background);
  border-radius: 16px;
}

.tags__link:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #232323;
    --textcolor: #fafafa;
    --nav-link-color: #fff;
    --meta-color: #ccc;
    --border-color: rgba(255, 255, 255, 0.2);
    --effect-bg: rgba(0, 0, 0, 0.3);
    --textcolor2:rgba(255,255,255,0.5);
  }
}

@media screen and (min-width: 1441px) {
  :root {
    --fontsize: 18;
    --line-height: 2;
  }

  .container {
    width: 1600px;
  }

  .page-list {
    grid-template-columns: repeat(4, 1fr);
  }

  .article:nth-child(10) {
    grid-column: 3 / 5;
  }
}

@media screen and (min-width: 1200px) and (max-width: 1440px) {
  :root {
    --fontsize: 16;
    --line-height: 1.8;
  }

  .container {
    width: 1200px;
  }

}

@media screen and (min-width: 641px) and (max-width: 960px) {
  :root {
    --fontsize: 12px;
  }

  .side-bar {
    flex-basis: 240px;
    padding-bottom: 90px;
    overflow: auto;
  }

  .footer {
    width: 240px;
  }

  .page-list {
    grid-template-columns: repeat(2, 1fr);
  }



  .article:nth-child(10) {
    grid-column: 1 / 3;
  }

  .article.post .article__body {
    padding-right: 15rem;
  }

  .article.post .article__body .toc {
    width: 15rem;
    margin-right: -15rem;
  }
}

@media screen and (max-width: 640px) {
  :root {
    --fontsize: 12;
  }

  .wrapper {
    display: block;
  }

  .logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .logo h1 {
    margin-bottom: 0;
  }

  .side-bar {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 10;
  }

  .main {
    min-height: 100vh;
    padding: 90px 16px 16px;
  }

  .main-nav {
    height: 0;
    overflow: hidden;
    transition: all 0.2s linear;
  }

  .main-nav .nav-list-link {
    justify-content: center;
  }

  .m-ctrl {
    display: block;
    visibility: visible;
  }

  :target .main-nav {
    height: 100vh;
  }

  :target .m-open {
    opacity: 0;
    z-index: -1;
  }

  :target .m-close {
    opacity: 1;
    z-index: 1;
  }

  .side-bar .side-body {
    padding-bottom: 0;
  }

  .footer {
    position: static;
    width: 100%;
  }


  .page-list {
    grid-template-columns: 1fr;
  }

  .article:not(.post) {
    aspect-ratio: inherit;
  }

  .article:not(.post):nth-child(1) {
    grid-column: auto;
  }

  .article:nth-child(10) {
    grid-column: auto;
  }

  .article.post .article__body {
    padding-right: 0;
  }

  .article.post .article__body .toc {
    display: none;
    visibility: hidden;
  }

  .tags-page {
    grid-template-columns: repeat(2, 1fr);
  }
}