/* ==========================================================================
   我的家用NAS设置日记 — 样式
   --------------------------------------------------------------------------
   观感沿用 nanoblog 原来的 Next 主题（hexo-theme-next 风格）：
   浅灰底 + 768px 正文栏 + 细线链接 + 标题悬停展开下划线。
   改颜色直接改下面的变量即可。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 变量 / 基础
   -------------------------------------------------------------------------- */

:root {
  --page-bg: #f5f5f5;
  --body-bg: #fff;
  --text: #555;
  --text-strong: #222;
  --text-faint: #999;
  --text-fade: #ccc;
  --line: #eee;
  --link-line: #ccc;
  --hover-bg: #e1e1e1;
  --tag-bg: #f5f5f5;
  --tag-hover: #ccc;
  --code-bg: #f6f8fa;
  --side-bg: #222;
  --side-text: #999;
  --side-accent: #87daff;

  --font-sans: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", Tahoma,
    "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
  --font-mono: mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

html {
  background-color: var(--page-bg);
  font-size: 14px;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--body-bg);
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: 0.01rem;
  line-height: 1.75em;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #262a30;
  color: #fff;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
dl,
dd,
p {
  margin: 0;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  border: 0;
}

svg {
  fill: currentColor;
  display: inline-block;
  stroke-width: 0;
  width: 14px;
  height: 14px;
}

/* 链接：默认带一条浅灰下划线，悬停变深 —— Next 主题的标志性细节 */
a {
  color: var(--text-strong);
  border-bottom: 1px solid var(--link-line);
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

a:hover {
  text-decoration: none;
  border-bottom-color: var(--text-strong);
}

:focus-visible {
  outline: 1px dashed var(--text-strong);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.fn__clear::before,
.fn__clear::after {
  display: table;
  content: "";
}

.fn__clear::after {
  clear: both;
}

.fn__left {
  float: left;
}

.fn__right {
  float: right;
}

.ft__fade {
  color: rgba(0, 0, 0, 0.38);
}

.ft__13 {
  font-size: 13px;
}

.wrapper {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

.main {
  position: relative;
  transition: all 0.2s ease-in-out;
}

.main > .wrapper {
  opacity: 0;
  animation: downBig 0.8s forwards;
}

.boot {
  padding: 80px 0;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

.noscript {
  padding: 40px 0;
}

@keyframes downBig {
  0% {
    transform: translateY(-80px);
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

@keyframes down {
  0% {
    transform: translateY(-40px);
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

@keyframes downHalf {
  0% {
    transform: translateY(-10px);
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

@keyframes up {
  0% {
    transform: translateY(40px);
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

@keyframes logoLine {
  0% {
    width: 0;
  }
  100% {
    width: 70%;
  }
}

@keyframes logoLineHover {
  0% {
    width: 70%;
  }
  100% {
    width: 0;
  }
}

/* --------------------------------------------------------------------------
   2. 页头
   -------------------------------------------------------------------------- */

.header {
  background: var(--page-bg);
  margin-bottom: 80px;
  padding: 40px 0 20px;
}

.header__logo {
  position: relative;
  float: left;
  margin-bottom: 20px;
  border-bottom-width: 0;
  color: var(--text-strong);
  font-size: 22px;
  font-weight: bolder;
}

.header__logo:hover {
  border-bottom-width: 0;
}

.header__logo div {
  opacity: 0;
  animation: downHalf 0.4s 0.8s forwards;
}

/* 标题上下两条线，悬停时收起 */
.header__logo::before,
.header__logo::after {
  content: "";
  position: absolute;
  height: 2px;
  background-color: var(--text-strong);
  left: 15%;
  top: -10px;
  animation: logoLine 0.8s forwards;
}

.header__logo::after {
  top: auto;
  left: auto;
  right: 15%;
  bottom: -10px;
}

.header__logo:hover::before,
.header__logo:hover::after {
  animation: logoLineHover 0.8s forwards;
}

.header nav {
  float: right;
  opacity: 0;
  animation: down 0.8s forwards;
}

.header nav a {
  padding: 5px 8px;
  margin-left: 5px;
  border: none;
  transition-property: background;
  color: var(--text-strong);
}

.header nav a:hover {
  background-color: var(--hover-bg);
}

.header nav a svg {
  vertical-align: -2px;
  color: var(--text);
  margin-right: 3px;
}

.header nav a.is-active {
  background-color: var(--hover-bg);
}

/* 移动端汉堡按钮（Next 主题同款三条线） */
.sidebar {
  position: fixed;
  bottom: 64px;
  right: 50px;
  width: 15px;
  height: 15px;
  padding: 5px;
  background-color: var(--side-bg);
  line-height: 0;
  cursor: pointer;
  z-index: 10;
  border: none;
}

.sidebar[hidden] {
  display: none;
}

.sidebar--header {
  display: none;
  position: inherit;
  float: right;
  padding: 5px;
  background-color: transparent;
  transform: scale(1.5);
}

.sidebar--header .sidebar__line {
  background-color: var(--text);
}

.sidebar__line {
  position: relative;
  display: block;
  height: 2px;
  width: 100%;
  margin-top: 4px;
  background-color: #fff;
  transition: all 0.2s ease-in-out;
}

.sidebar__line:first-child {
  margin-top: 0;
}

.sidebar:hover .sidebar__line--first {
  width: 50%;
  transform: rotateZ(-45deg);
  top: 3px;
}

.sidebar:hover .sidebar__line--middle {
  width: 90%;
}

.sidebar:hover .sidebar__line--last {
  width: 50%;
  transform: rotateZ(45deg);
  top: -3px;
}

.sidebar--active .sidebar__line--first,
.sidebar--active:hover .sidebar__line--first {
  width: 100%;
  transform: rotateZ(-45deg);
  top: 6px;
}

.sidebar--active .sidebar__line--middle,
.sidebar--active:hover .sidebar__line--middle {
  opacity: 0;
}

.sidebar--active .sidebar__line--last,
.sidebar--active:hover .sidebar__line--last {
  width: 100%;
  transform: rotateZ(45deg);
  top: -6px;
}

.top__btn {
  position: fixed;
  bottom: -25px;
  right: 50px;
  width: 15px;
  height: 15px;
  padding: 5px;
  background-color: var(--side-bg);
  line-height: 0;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: all 0.2s ease-in-out;
  border: none;
}

.top__btn--show {
  bottom: 64px;
  opacity: 1;
}

.top__btn svg {
  color: #fff;
}

/* --------------------------------------------------------------------------
   3. 文章列表
   -------------------------------------------------------------------------- */

.article__item {
  margin-bottom: 80px;
}

.article__header {
  margin-bottom: 10px;
  line-height: 32px;
}

.article__title {
  position: relative;
  color: var(--text);
  border-bottom: none;
  font-size: 28px;
  line-height: 1.2;
}

/* 标题悬停：底部 2px 黑线从中间展开 */
.article__title::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: #000;
  visibility: hidden;
  transform: scaleX(0);
  transition-duration: 0.2s;
  transition-timing-function: ease-in-out;
  transition-delay: 0s;
}

.article__title:hover::before {
  visibility: visible;
  transform: scaleX(1);
}

.article__meta {
  margin: 5px 0 20px;
  color: var(--text-faint);
  font-size: 12px;
}

.article__meta a {
  color: var(--text-faint);
  border-bottom: none;
}

.article__meta a:hover {
  color: var(--text);
}

.article__footer {
  margin-top: 20px;
}

.article__read {
  padding: 0;
  color: #666;
  font-size: 16px;
  border-bottom: 2px solid #666;
  transition: all 0.2s ease-in-out;
}

.article__read:hover {
  color: var(--text-strong);
}

/* 文章正文排版（原来的 vditor-reset） */
.vditor-reset {
  overflow: auto;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  word-wrap: break-word;
  word-break: break-word;
  font-variant-ligatures: no-common-ligatures;
}

.vditor-reset h1,
.vditor-reset h2,
.vditor-reset h3,
.vditor-reset h4,
.vditor-reset h5,
.vditor-reset h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.vditor-reset h1 {
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--line);
  font-size: 1.7em;
}

.vditor-reset h2 {
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--line);
  font-size: 1.5em;
}

.vditor-reset h3 {
  font-size: 1.25em;
}

.vditor-reset h4 {
  font-size: 1em;
}

.vditor-reset p {
  margin-top: 0;
  margin-bottom: 16px;
}

.vditor-reset ul,
.vditor-reset ol {
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 2em;
}

.vditor-reset ul {
  list-style-type: disc;
}

.vditor-reset ul ul {
  list-style-type: circle;
}

.vditor-reset ul ul ul {
  list-style-type: square;
}

.vditor-reset li + li {
  margin-top: 0.25em;
}

.vditor-reset blockquote {
  margin: 0 0 16px;
  padding: 0 1em;
  border-left: 0.25em solid #ddd;
  color: #777;
}

.vditor-reset blockquote p {
  margin: 0;
}

.vditor-reset hr {
  height: 2px;
  margin: 24px 0;
  padding: 0;
  border: 0;
  background-color: #e7e7e7;
}

.vditor-reset img {
  max-width: 100%;
}

.vditor-reset img.emoji {
  max-width: 20px;
  vertical-align: sub;
}

.vditor-reset code:not(.hljs) {
  margin: 0;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  background-color: rgba(27, 31, 35, 0.05);
  font-family: var(--font-mono);
  font-size: 85%;
  white-space: pre-wrap;
  word-break: break-word;
}

.vditor-reset pre {
  position: relative;
  margin: 0 0 16px;
  border-radius: 3px;
  background-color: var(--code-bg);
  overflow: auto;
}

.vditor-reset pre > code {
  display: block;
  margin: 0;
  padding: 12px 14px;
  background: none;
  color: #24292e;
  font-family: var(--font-mono);
  font-size: 85%;
  line-height: 1.6;
  white-space: pre;
  overflow: auto;
  word-break: initial;
  word-wrap: normal;
}

.code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  border: 1px solid #d1d5da;
  border-radius: 3px;
  background-color: #fff;
  color: #586069;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.vditor-reset pre:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}

.code-copy:hover {
  color: var(--text-strong);
}

.vditor-reset table {
  display: block;
  width: 100%;
  margin-bottom: 16px;
  border-collapse: collapse;
  border-spacing: 0;
  overflow: auto;
}

.vditor-reset table tr {
  border-top: 1px solid #c6cbd1;
  background-color: #fff;
}

.vditor-reset table th,
.vditor-reset table td {
  padding: 6px 13px;
  border: 1px solid #dfe2e5;
  word-break: normal;
}

.vditor-reset table th {
  font-weight: 600;
}

.vditor-reset table tbody tr:nth-child(2n) {
  background-color: var(--code-bg);
}

.vditor-reset p:last-child,
.vditor-reset blockquote:last-child,
.vditor-reset pre:last-child,
.vditor-reset ul:last-child,
.vditor-reset ol:last-child,
.vditor-reset hr:last-child {
  margin-bottom: 0;
}

/* 正文里的链接沿用主题的细线风格 */
.vditor-reset a {
  color: var(--text-strong);
}

/* --------------------------------------------------------------------------
   4. 文章页
   -------------------------------------------------------------------------- */

.article__header--center {
  text-align: center;
}

.article__header--center h2 {
  font-size: 28px;
  line-height: 1.3;
  color: var(--text);
}

.article__header--center .article__meta {
  margin: 10px 0 40px;
}

.article__item > .vditor-reset {
  margin-bottom: 40px;
}

.article__neighbor {
  margin-top: 80px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.article__neighbor a {
  color: var(--text);
  border-bottom: 0;
}

.article__neighbor a:hover {
  color: var(--text-strong);
}

.article__neighbor svg {
  vertical-align: -2px;
}

/* 右侧目录面板（Next 主题的 side） */
.side {
  position: fixed;
  top: 0;
  bottom: 0;
  right: -320px;
  width: 320px;
  padding: 20px;
  background-color: var(--side-bg);
  box-shadow: inset 0 2px 6px #000;
  color: var(--side-text);
  font-size: 13px;
  text-align: center;
  box-sizing: border-box;
  overflow: auto;
  z-index: 20;
  transition: all 0.2s ease-in-out;
}

.side--active {
  right: 0;
}

.side::-webkit-scrollbar {
  display: none;
}

.side a {
  color: var(--side-text);
  border-bottom-color: #555;
}

.side a:hover {
  color: #eee;
}

.side__title {
  margin-top: 24px;
  color: #f5f5f5;
  text-align: left;
}

.toc {
  margin-top: 10px;
  font-size: 14px;
  text-align: left;
}

.toc li {
  list-style: none;
  line-height: 24px;
}

.toc a {
  display: block;
  padding: 2px 0;
  border-bottom: none;
  color: var(--side-text);
}

.toc a:hover {
  color: #eee;
}

.toc .toc__h2 {
  padding-left: 0;
}

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

.toc__item--active a,
.toc__item--active a:hover {
  color: var(--side-accent);
}

.side__empty {
  margin-top: 10px;
  color: #666;
  text-align: left;
}

/* --------------------------------------------------------------------------
   5. 归档 / 标签 / 404
   -------------------------------------------------------------------------- */

.page {
  position: relative;
}

.page::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 16px;
  width: 4px;
  height: 100%;
  background-color: var(--page-bg);
}

.page__title {
  position: relative;
  margin-bottom: 40px;
  padding-left: 40px;
  font-size: 1.5em;
  font-weight: 600;
}

.page__title::before {
  content: "";
  position: absolute;
  top: 7px;
  left: -8px;
  width: 10px;
  height: 10px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.5;
}

.page__year {
  position: relative;
  padding: 20px 0 0 40px;
  color: var(--text-faint);
  font-size: 20px;
  font-weight: normal;
}

.page__item {
  position: relative;
  display: block;
  padding: 20px 0 20px 40px;
  border-bottom: 1px dashed #ccc;
  color: #666;
  transition: all 0.2s ease-in-out;
}

.page__item::before {
  content: "";
  position: absolute;
  top: 29px;
  left: -6px;
  width: 6px;
  height: 6px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #bbb;
  opacity: 0.5;
}

.page__item:hover {
  color: var(--text-strong);
  border-bottom-color: #999;
}

#tags {
  padding-bottom: 20px;
}

.tag {
  display: inline-block;
  margin-right: 10px;
  margin-bottom: 10px;
  padding: 1px 5px;
  background: var(--tag-bg);
  border-bottom: none;
  color: var(--text);
  font-size: 13px;
  line-height: initial;
}

.tag:hover {
  background: var(--tag-hover);
  border-bottom: none;
}

.tag__level1 {
  font-size: 14px;
}

.tag__level2 {
  font-size: 18px;
}

.tag__level3 {
  font-size: 22px;
}

.tag__level4 {
  font-size: 26px;
}

.notfound {
  padding: 60px 0 100px;
  text-align: center;
}

.notfound__code {
  color: var(--text-fade);
  font-size: 64px;
  font-weight: bolder;
  line-height: 1;
}

.notfound h1 {
  margin: 16px 0 8px;
  color: var(--text-strong);
  font-size: 22px;
  font-weight: 600;
}

.notfound p {
  color: var(--text-faint);
  font-size: 14px;
}

.notfound .button {
  display: inline-block;
  margin-top: 20px;
  padding: 5px 14px;
  border: 1px solid var(--link-line);
  color: var(--text-strong);
  font-size: 14px;
}

.notfound .button:hover {
  border-color: var(--text-strong);
}

.error-panel {
  padding: 40px 0;
}

.error-panel h1 {
  margin-bottom: 10px;
  font-size: 20px;
}

.error-panel p {
  margin-bottom: 12px;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   6. 页尾
   -------------------------------------------------------------------------- */

.footer {
  margin-top: 80px;
  padding: 40px 0;
  background: var(--page-bg);
  color: #666;
  line-height: 24px;
  font-size: 13px;
}

.footer .wrapper {
  opacity: 0;
  animation: up 0.8s forwards;
}

.footer a {
  color: #666;
  border-bottom-color: #bbb;
}

.footer a:hover {
  color: var(--text-strong);
  border-bottom-color: var(--text-strong);
}

.footer .fn__clear + .fn__clear {
  margin-top: 6px;
  color: #999;
}

/* --------------------------------------------------------------------------
   7. 响应式
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .header {
    padding: 20px 0 0;
    margin-bottom: 20px;
  }

  .header__logo {
    font-size: 20px;
  }

  .header .sidebar--header {
    display: block;
  }

  .header nav {
    display: none;
    float: none;
    clear: both;
    width: 100%;
    margin-top: 23px;
    border-top: 1px solid #ddd;
    transition: all 0.2s ease-in-out;
  }

  .header nav a {
    display: block;
    margin-left: 0;
    padding: 8px;
  }

  .header--nav-open nav {
    display: block;
  }

  .article__item {
    margin-bottom: 50px;
  }

  .article__title,
  .article__header--center h2 {
    font-size: 18px;
  }

  .article__header--center .article__meta {
    margin: 8px 0 24px;
  }

  .article__neighbor {
    margin-top: 40px;
  }

  .footer {
    margin-top: 20px;
    padding: 20px 0;
  }

  .footer .fn__right {
    float: none;
  }

  .sidebar,
  .top__btn {
    right: 20px;
  }

  .side {
    width: 100%;
    right: -100%;
  }

  .page__item {
    padding: 10px 0 10px 40px;
  }

  .page__title {
    margin-bottom: 20px;
  }
}

@media (max-width: 520px) {
  .vditor-reset pre > code {
    font-size: 12px;
  }

  .code-copy {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  html,
  body {
    background: #fff;
  }

  .header nav,
  .sidebar,
  .side,
  .top__btn,
  .code-copy,
  .article__neighbor,
  .article__footer {
    display: none !important;
  }

  .header {
    margin-bottom: 20px;
    padding: 0;
  }

  .article__item {
    margin-bottom: 0;
  }
}
