/* fonts */
@font-face {
  font-family: "MDL2";
  src: url("/assets/fonts/mdl2.woff2")format("woff2");
}

@font-face {
  font-family: "slboot";
  src: url("/assets/fonts/slboot.woff2")format("woff2");
}

@font-face {
  font-family: "msyhl";
  src: url("/assets/fonts/msyhl.woff2")format("woff2");
  font-display: swap;
}


/* scroll */
::-webkit-scrollbar {
  background-color: var(--fg-color);
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--text-color), transparent 80%);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: color-mix(in srgb, var(--text-color), transparent 60%);
}

::-webkit-scrollbar-thumb:active {
  background-color: color-mix(in srgb, var(--text-color), transparent 40%);
}


/* selection */
::selection {
  color: #fff;
  background-color: #aca680;
}


/* lenis */
html.lenis, html.lenis body {
  height: auto;
}
  
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}


/* -------------------- General Styles -------------------- */
* {
  word-wrap: break-word;
  box-sizing: border-box;
  font-family: 'slboot', 'MDL2', 'msyhl', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  transition: background-color 0.8s cubic-bezier(0.2, 0.6, 0.4, 1);
}

.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.center {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


.header {
  position: fixed;
  width: 100%;
  z-index: 1000;
}

.main {
  padding-top: 50px;
  flex: 1;
}


/* load screen */
#load {
  position: fixed;
  color: var(--text-color);
  background-color: var(--fg-color);
  transition: opacity 0.5s ease, background-color 0.5s ease;
  opacity: 1;
  pointer-events: none;
  z-index: 999;
}

#load.hidden {
  opacity: 0;
  pointer-events: none;
}


/* navbar */
.navbar {
  position: relative;
  top: -60px;
  height: 50px;
  background-color: var(--fg-color);
  box-shadow: var(--div-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
  transition: top 0.6s cubic-bezier(0.2, 0.6, 0.4, 1);
}

.navbar.show {
  top: 0;
}

.mobile-navbar {
  position: fixed;
  top: 0;
  left: -260px;
  width: 250px;
  height: 100vh;
  background-color: var(--fg-color);
  box-shadow: var(--div-shadow);
  transition: left 0.5s cubic-bezier(0.2, 0.6, 0.4, 1);
  overflow-y: auto;
  z-index: 1;
}

.mobile-navbar.show {
  left: 0;
}

.navbar_link,
.mobile-navbar_link {
  display: flex;
  align-items: center;
  user-select: none;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-navbar_link {
  flex-direction: column;
  padding-top: 64px;
  width: 100%;
}

.navbar_link p,
.mobile-navbar_link p {
  margin: 0;
  color: var(--text-color);
  transition: color 300ms ease, text-shadow 300ms ease, background-color 300ms ease;
}

.navbar_link p:hover,
.mobile-navbar_link p:hover {
  color: var(--swap-color);
  text-shadow: 4px 4px 4px var(--text-color);
  cursor: pointer;
}

.navbar_link p {
  padding: 8px 15px;
}

.mobile-navbar_link p {
  padding: 16px 0;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.mobile-navbar_link p:hover {
  background-color: color-mix(in srgb, var(--text-color), transparent 80%);
}

.navbar_link span,
.mobile-navbar_link span {
  vertical-align: middle;
  line-height: 1;
}

.navbar_link p#menu {
  display: none;
}

.navbar_logo {
  min-width: 162px;
  height: 48px;
  margin-right: 15px;
  padding: 0 10px;
  background: url('/assets/imgs/blog-ui/navtitle.jpg') center/cover no-repeat;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-5deg);
  transition: transform 1s ease;
}

.navbar_logo span {
  font-size: 26px;
  transition: opacity 0.3s ease;
}

.navbar_logo:hover {
  transform: rotate(5deg);
}

.navbar_button {
  width: 42px;
  height: 42px;
  margin: 2px 2px 0 0;
  padding: 0;
  background-color: transparent;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 300ms ease;
  outline: none;
}

.navbar_button span {
  margin-top: 2px;
  font-size: 18px;
  color: var(--text-color);
  transition: color 300ms ease, text-shadow 300ms ease;
}

.navbar_button:hover span {
  color: #fff;
  text-shadow: 4px 4px 4px rgba(0, 0, 0, 0.5);
}

.navbar_button:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

.navbar_button:active {
  transition: background-color 100ms ease;
  background-color: rgba(0, 0, 0, 0.4);
}

/* dropdown */
.dropdown {
  position: absolute;
  top: 90%;
  margin-left: 10px;
  padding: 10px 0;
  background-color: var(--div-color);
  box-shadow: var(--div-shadow);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease, transform 200ms ease;
}

.mobile-navbar .dropdown {
  margin-left: 0;
  width: 100%;
}

.dropdown::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 4px;
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent var(--div-color) transparent;
  z-index: -1;
}

.mobile-navbar .dropdown::after {
  left: 50%;
}

.dropdown_trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.mobile-navbar .dropdown_trigger {
  width: 100%;
}

.dropdown_link {
  display: flex;
  flex-direction: column;
}

.dropdown_link p {
  padding: 14px 20px;
  white-space: nowrap;
}

.mobile-navbar .dropdown_link p {
  padding: 16px 0;
}

.dropdown_link p:hover {
  background-color: color-mix(in srgb, var(--text-color), transparent 80%);
  color: var(--swap-color);
}

p#other::after {
  content: "\e011";
  position: relative;
  display: inline-flex;
  font-size: 10px;
  margin-left: 4px;
  transition: transform 0.3s ease;
}

p#other:hover::after {
  transform: rotate(180deg) translateY(2px);
}

.navbar.show .dropdown_trigger:hover .dropdown,
.mobile-navbar.show .dropdown_trigger:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}


/* Search Bar */
.search-bar {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.search-bar input{
  color: #333;
  font-size: 16px;
  background-color: var(--div-color);
  border: 1px solid var(--fg-color);
  outline: none;
  width: 70%;
  padding: 12px;
}

.search-bar input::placeholder{
  font-size: 16px;
  text-align: center;
  transition: transform 500ms;
}

.search-bar input:focus::placeholder{
  transform: translateX(calc(-50% + 70px));
}

/* Tag Buttons */
.tag-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px;
}

.tag-button {
  padding: 8px 12px;
  background-color: var(--div-color);
  border: 1px solid #d7d2b4;
  text-decoration: none;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
}

.tag-button:hover {
  background-color: var(--fg-color);
}

.tag-button.active {
  background-color: var(--fg-color);
}

/* Post Cards */
.card-container {
  margin: 0px auto 80px auto;
  max-width: 1400px;
  gap: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  height: 280px;
  min-width: calc(50% - 40px);
  background-color: var(--div-color);
  border: 1px solid var(--fg-color);
  display: flex;
  flex-direction: column;
  transition: box-shadow 200ms, transform 200ms;
}

.card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  transform: scale(1.02);
}

.card:hover .card_main {
  height: 100%;
}

.card_main,
.card_info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.card_main {
  height: 70%;
  background-size: cover;
  background-position: center;
  background-color: rgba(0, 0, 0, 0.5);
  background-blend-mode: overlay;
  transition: all 500ms ease;
} 

.card_title {
  font-size: clamp(1rem, 4vw, 2rem);
  font-weight: bold;
}

.card_subtitle {
  font-size: 16px;
}

.card_title,
.card_subtitle {
  margin: 12px 0;
  color: #fff;
}

.card_info {
  height: 30%;
}

.card_info p {
  margin: 4px;
}

.card_info span {
  vertical-align: 3px;
}

.card_tag {
  color: inherit;
  text-decoration: none;
  vertical-align: 2px;
  transition: all 200ms ease;
}

.card_tag:hover {
  color: #555;
  text-shadow: 4px 4px 4px rgba(0, 0, 0, 0.5);
}


/* Post */
.post {
  color: #333;
  align-items: center;
}

.post-meta {
  height: 200px;
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  user-select: none;
}

.post-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(2px) brightness(0.6);
  pointer-events: none;
}

.post-info {
  color: #fff;
  position: absolute;
}

.post-meta h1 {
  margin: 0px;
  font-size: 32px;
}

.post-detail {
  align-items: center;
  place-content: center;
  user-select: none;
}

.post-detail span {
  vertical-align: -3px;
}

.post-detail a {
  color: #fff;
  text-decoration: none;
  font-size: 16px;
}

.post-content {
  position: relative;
  margin: 0px auto 80px auto;
  width: 900px;
  padding: 20px;
}

.post-content p {
  line-height: 1.5em;
}

.post-content a {
  color: #888;
}

.post-content p img {
  display: block;
  max-width: 100%;
  margin: 20px auto;
  box-shadow: var(--div-shadow);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.post-content p img:hover {
  transform: scale(0.92);
}


/* toc */
.toc {
  position: fixed;
  bottom: 140px;
  right: 0;
  width: 300px;
  height: 60%;
  padding: 10px;
  background-color: var(--div-color);
  z-index: 10;
  transform: translateX(100%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toc::before {
  content: "\e15c";
  position: absolute;
  bottom: 0;
  left: -40px;
  width: 40px;
  height: 40px;
  background-color: inherit;
  color: #000;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--div-shadow);
}

.toc:hover {
  box-shadow: var(--div-shadow);
  transform: translateX(0);
}

.toc ul {
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
}

.toc ul li {
  margin-bottom: 8px;
}

.toc ul ul {
  padding-left: 16px;
}

.toc ul li a {
  display: block;
  color: #333;
  text-decoration: none;
  padding: 4px 0;
}

.toc ul li a:hover {
  color: var(--fg-color);
}

.toc a.active {
  color: var(--accent-color);
  font-weight: 600;
}

.toc li.active a {
  color: var(--accent-color);
}

.toc li.active ul {
  opacity: 1;
}



.highlight {
  background-color: var(--fg-color);
  padding: 15px;
  font-family: Consolas, 'Courier New', monospace;
  overflow-x: auto;
}


/* Blockquote */
blockquote {
  background: url('/assets/imgs/blog-ui/blockquote.jpg') repeat;
  background-size: 32px 32px;
  border-left: 3px solid var(--fg-color);
  margin: 12px 0;
  overflow: auto;
  padding: 0 15px;
}

blockquote footer{
  margin: 12px 0;
  text-align: right;
}

/* Comment */
.comment {
  margin-top: 100px;
  border-top: #333 1px solid;
}


/* Footer */
.footer {
  position: relative;
  height: 50px;
  bottom: 0;
  width: 100%;
  box-shadow: var(--div-shadow);
  background-color: var(--fg-color);
  color: var(--text-color);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.footer span {    
  vertical-align: -3px;
}

.footer span a {
  color: #808080;
  text-decoration: none;
  margin: 0 5px;
}

/* Back to top */
#back2top {
  position: fixed;
  right: 0;
  height: 40px;
  bottom: 80px;
  padding: 0 14px;
  text-decoration: none;
  transform: translateX(calc(100% + 60px));
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#back2top::before {
  content: "\e752";
  position: absolute;
  bottom: 0;
  left: -40px;
  width: 40px;
  height: 40px;
  font-size: 14px;
}

#back2top, #back2top::before {
  color: var(--text-color);
  background-color: var(--div-color);
  box-shadow: var(--div-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

#back2top.show {
  transform: translateX(calc(100%));
}

#back2top.show:hover {
  transform: translateX(0);
}


.friends-link {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  /* 补全父容器宽度，避免换行异常 */
  width: 100%;
  box-sizing: border-box;
}

.friend-item {
  display: flex;
  height: auto;
  border: 1px solid #ccc;
  width: 100%;
  text-decoration: none;
  background: url(/assets/imgs/blog-ui/blockquote.jpg) repeat;
  background-size: 32px 32px;
  box-shadow: var(--div-shadow);
  transition: box-shadow 0.3s ease; /* 补全ease缓动，动画更丝滑 */
  /* 补全盒模型，避免边框撑大宽度 */
  box-sizing: border-box;
  /* 增加内边距，避免内容贴边 */
  padding: 8px;
  /* 防止背景重复时的偏移问题 */
  background-position: 0 0;
}

.friend-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.friend-item:hover img {
  transform: scale(1.4) rotate(0deg);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.friend-item:hover .friend-info {
  margin-left: 36px;
}

.friend-item img {
  height: 100px;
  width: 100px; /* 补全宽度，避免图片拉伸变形 */
  object-fit: cover; /* 保持图片比例，防止变形 */
  border: 1px solid #ccc;
  transform: scale(1.2) rotate(-5deg);
  background: url(/assets/imgs/blog-ui/blockquote.jpg) repeat;
  background-size: 32px 32px;
  transition: transform 0.5s ease, box-shadow 0.5s ease;
  box-shadow: var(--div-shadow);
  /* 防止图片溢出 */
  flex-shrink: 0;
  background-position: 0 0;
}

.friend-info {
  color: #000;
  margin-left: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: margin-left 0.5s ease;
  /* 补全行高，提升文字可读性 */
  line-height: 1.5;
}

.friend-info span {
  font-size: 2em;
  font-weight: bold;
  /* 限制文字换行，避免布局错乱 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-info p {
  margin: 0;
  /* 调整字体大小，增强层级感 */
  font-size: 1em;
  color: #666; /* 轻微降色，突出标题 */
}


/* Mobile Styles */
@media (max-width: 1000px) {
    .search-bar input{
        width: 100%;
    }

    .card-container {
      margin: 20px;
    }
    
    .card {
        width: 100%;
    }

    .post-content {
        width: 90%;
    }
}

@media (max-width: 800px) {
  .navbar_link p {
    display: none;
  }

  .mobile-navbar {
    display: block;
  }

  .navbar_link p#menu {
    display: block;
  }

  .friend-info span {
    font-size: 1.5em;
  }

  .friend-item img {
    height: 80px;
    width: 80px;
  }

  .friends-link {
    gap: 20px;
  }
}
