/* 通用 */

/* 颜色 */
/* 深色模式支持 */
/* 媒体查询定义 */
:root {
  color-scheme: light dark;

  --background-color: rgb(180, 172, 201);
  --text-color: rgb(0, 0, 0);

  --border-color-hr: rgba(0, 0, 0, 0.3);
  --border-color-table: rgb(210, 188, 233);

  --text-color-link: rgb(83, 45, 187);
  --text-color-link-hover: rgb(73, 23, 167);

  --text-color-strong: rgb(59, 28, 109);

  --background-color-header-nav: white;
  --background-color-header-nav-hover: rgba(0, 0, 0, 0.11);

  --background-color-botton: rgba(141, 100, 194, 0.4);
  --background-color-botton-back: rgba(255, 255, 255, 0.8);

  --background-color-card-level1: rgba(255, 255, 255, 0.8);
  --background-color-block-tips: rgba(0, 0, 0, 0.1);
  --background-color-code: rgba(0, 0, 0, 0.1);

  --text-color-footer: rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background-color: rgb(37, 30, 53);
    --text-color: rgb(226, 212, 241);

    --border-color-hr: rgba(255, 255, 255, 0.3);
    --border-color-table: rgb(56, 40, 95);

    --text-color-link: rgb(156, 129, 231);
    --text-color-link-hover: rgb(172, 143, 253);

    --text-color-strong: rgb(145, 132, 175);

    --background-color-header-nav: black;
    --background-color-header-nav-hover: rgba(255, 255, 255, 0.123);

    --background-color-botton: rgba(58, 39, 82, 0.5);
    --background-color-botton-back: rgba(0, 0, 0, 0.7);

    --background-color-card-level1: rgba(0, 0, 0, 0.7);
    --background-color-block-tips: rgba(255, 255, 255, 0.1);
    --background-color-code: rgba(255, 255, 255, 0.1);

    --text-color-footer: rgba(255, 255, 255, 0.3);
  }
}

/* light-dark() */
@supports (color: light-dark(white, black)) {
  :root {
    --background-color: light-dark(rgb(180, 172, 201), rgb(37, 30, 53));
    --text-color: light-dark(rgb(0, 0, 0), rgb(226, 212, 241));

    --border-color-hr: light-dark(rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.3));
    --border-color-table: light-dark(rgb(210, 188, 233), rgb(56, 40, 95));

    --text-color-link: light-dark(rgb(83, 45, 187), rgb(156, 129, 231));
    --text-color-link-hover: light-dark(rgb(73, 23, 167), rgb(172, 143, 253));

    --text-color-strong: light-dark(rgb(59, 28, 109), rgb(145, 132, 175));

    --background-color-header-nav: light-dark(white, black);
    --background-color-header-nav-hover: light-dark(rgba(0, 0, 0, 0.11), rgba(255, 255, 255, 0.123));

    --background-color-botton: light-dark(rgba(141, 100, 194, 0.4), rgba(58, 39, 82, 0.5));
    --background-color-botton-back: light-dark(rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0.7));

    --background-color-card-level1: light-dark(rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0.7));
    --background-color-block-tips: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
    --background-color-code: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));

    --text-color-footer: light-dark(rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.3));
  }
}

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* 宽度与高度将包括内容, 内边距, 边框 */

/* HTML5 元素 */
header,
section,
footer,
aside,
nav,
main,
article,
figure {
  display: block;
}

body,
html {
  background-color: var(--background-color);
  color: var(--text-color);
  position: relative;
  margin: 0;
  padding: 0;
  top: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-color-strong);
}

h1 {
  font-size: 45px;
}

h2 {
  font-size: 40px;
}

h3 {
  font-size: 26px;
}

h4 {
  font-size: 20px;
}

h5 {
  font-size: 18px;
}

dt {
  color: var(--text-color-strong);
  font-size: larger;
  font-weight: 500;
  margin: 8px;
}

code {
  background-color: var(--background-color-code);
  font-family: Consolas, Monaco, monospace;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  vertical-align: middle;
  white-space: pre;
}

pre:has(code) {
  display: flex;
  margin: 8px 0;
  padding: 0;
  height: min-content;
}

pre > code {
  padding: 16px;
  display: block;
  flex: 1;
  height: 100%;
}

table,
th,
td {
  border-color: var(--border-color-table);
  border: 1px solid;
  margin: 0;
  padding: 7px;
  border-collapse: collapse;
}

table {
  width: 100%;
}

th {
  text-align: center;
}

.center {
  text-align: center;
}

.left {
  text-align: left;
}

a::before,
a::after {
  content: " ";
}

em,
strong{
  color: var(--text-color-strong);
}

hr {
  border-color: var(--border-color-hr);
}

/* 滚动条样式 */
aside::-webkit-scrollbar,
code::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

code::-webkit-scrollbar-track {
  background: var(--background-color-block-tips);
  border-radius: 4px;
}

aside::-webkit-scrollbar-thumb,
code::-webkit-scrollbar-thumb {
  background: var(--border-color-hr);
  border-radius: 4px;
}

aside::-webkit-scrollbar-thumb:hover,
code::-webkit-scrollbar-thumb:hover {
  background: var(--background-color-header-nav-hover);
}

aside::-webkit-scrollbar-thumb:active,
code::-webkit-scrollbar-thumb:active {
  background: var(--border-color-table);
}

/* 链接 */
a,
summary {
  color: var(--text-color-link);
  text-decoration: none;
  cursor: pointer;
}

a:hover,
summary:hover {
  color: var(--text-color-link-hover);
  text-decoration: underline;
}

/* 外部链接图标 */
a[download]::before,
a[target="_blank"]::after{
  content: " ";
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
  background-color: currentColor;
}

a[target="_blank"]::after {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") no-repeat center;
  mask-size: contain;
}

a[download]::before {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E") no-repeat center;
  mask-size: contain;
}

/* 置顶水平导航栏 */
:root {
  /* 定义导航栏高度变量 */
  --header-height: clamp(40px, 8vh, 100vh);
}

html {
  scroll-padding-top: calc(var(--header-height) + 20px);
}

header,
nav.header-nav {
  width: 100%;
  margin: 0;
  float: none;
  z-index: 1000;
}

header {
  position: fixed;
  height: var(--header-height);
  top: 0;
}

nav.header-nav {
  background-color: var(--background-color-header-nav);
  height: 100%;
}

nav.header-nav img {
  height: 100%;
  width: auto;
}

nav.header-nav strong,
nav.header-nav p {
  display: flex;
  margin: 0 10px;
  padding: 0;
  height: 50%;
  align-items: center;
}

nav.header-nav {
  position: absolute;
  overflow: hidden;
  float: left;

  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.158);
}

nav.header-nav li,
nav.header-nav div,
nav.header-nav ul,
nav.header-nav a {
  height: 100%;
  float: left;
}

nav.header-nav ul {
  margin: 0;
  padding: 0 1em;
  position: relative;

  list-style-type: none;
}

nav.header-nav li>a,
#about-host {
  display: flex;
  /* padding: 25px 1em 24px 1em; */
  padding-left: 1em;
  padding-right: 1em;
  line-height: 60px;

  align-items: center;
  text-align: center;
}

#about-host {
  float: right;
}

nav.header-nav li>a:hover,
#about-host:hover {
  background-color: var(--background-color-header-nav-hover);
}

/* 主要内容区域添加顶部边距, 避免被导航栏遮挡 */
main {
  margin-top: calc(var(--header-height) + 20px);
}

/* 按钮 */
.botton {
  background-color: var(--background-color-botton);
  display: block;
  margin: 20px;
  padding: 7px;

  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.back {
  background-color: var(--background-color-botton-back);
  position: sticky;
  width: 150px;
  top: calc(var(--header-height) + 20px);
}

/* 侧边栏导航 */
.with-sidebar {
  padding-right: 0;
}

aside.sidebar-nav {
  background-color: var(--background-color-card-level1);
  display: block;
  position: sticky;
  top: calc(var(--header-height) + 20px);
  float: right;
  margin: 0 20px;
  padding: 20px;
  width: auto;
  min-width: 200px;
  z-index: 990;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-height) - 20px - 20px);

  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

aside.sidebar-nav ul {
  padding: 0 0 0 30px;
}

@media screen and (max-width: 800px) {
  .with-sidebar {
    padding-right: 0;
  }

  aside.sidebar-nav {
    background-color: var(--background-color-card-level1);
    display: block;
    position: relative;
    top: var(--header-height);
    float: none;
    width: 85%;
    max-width: 1000px;
    padding: 30px;
    margin: 20px auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

/* 卡片 */
.card-1,
.card-2,
.card-3,
.card-4 {
  padding: 30px;
  max-width: 1000px;

  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-1,
.card-2 {
  background-color: var(--background-color-card-level1);
}

.card-3,
.card-4 {
  background-color: var(--background-color-botton);
}

.card-1 {
  width: 85%;
  margin: 20px auto;
}

.card-2-parent,
.card-4-parent {
  width: 85%;
  gap: 20px;
  /* 设置两个卡片之间的间距 */
  display: flex;
  /* 将容器设置为Flex布局 */
  margin: 40px auto;
  max-width: 1000px;
}

.card-2-parent {
  flex-direction: row;
}

.card-4-parent {
  flex-direction: column;
}

/* 移动端适配 */
@media screen and (max-width: 800px) {
  .card-2-parent {
    flex-direction: column;
  }
}

.card-2,
.card-3 {
  display: block;
  flex: 1;
}

/* 浮动卡片 */
.floating {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.floating:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.floating:active {
  transform: translateY(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* 块引用 */
blockquote, 
.block-tips {
  display: block;
  background-color: var(--background-color-block-tips);
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2);
  padding: 16px 20px;
  margin: 6px 0;
}

blockquote {
  border-left: 8px solid var(--border-color-hr);
}

.block-tips {
  border-left: 8px solid var(--border-color-table);
}

/* 页脚 */
/* footer, footer a {color: light-dark(rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.3));} */
footer {
  margin: 20px
}

footer,
footer a {
  color: var(--text-color-footer);
}