/* ==========================================================================
   模块 01 · Home  —  独立样式，全部作用域限定在 .home 根节点内
   参考：https://antfu.me/   自定义实现，不复制参考站源码与素材
   ========================================================================== */

/* Inter 自托管：一个可变字体文件覆盖 100–900 全部字重，只含拉丁子集。
   中文不在这个文件里，靠字体栈后面的系统中文字体接住。 */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/inter-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/inter-italic.woff2") format("woff2");
}

.home {
  --col: 656px;
  --pad-x: 28px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.68, 0.21, 1);
}

/* --- 主题色 ------------------------------------------------------------- */
[data-theme="light"] .home {
  --bg: #ffffff;
  --ink: #0d0d0d;
  --ink-soft: #4d4d4d;
  --ink-mute: #8c8c8c;
  --rule: rgba(0, 0, 0, 0.16);
  --rule-soft: rgba(0, 0, 0, 0.1);
  --sel: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .home {
  --bg: #050505;
  --ink: #f4f4f4;
  --ink-soft: #c2c2c2;
  --ink-mute: #8a8a8a;
  --rule: rgba(255, 255, 255, 0.2);
  --rule-soft: rgba(255, 255, 255, 0.1);
  --sel: rgba(255, 255, 255, 0.18);
}

html {
  background: #ffffff;
}
[data-theme="dark"] {
  background: #050505;
}

body.home {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
  overflow-x: hidden;
}

.home ::selection {
  background: var(--sel);
}

.home-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --- 背景点阵 ----------------------------------------------------------- */
.home-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

/* --- 顶部 --------------------------------------------------------------- */
.home-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 84px;
  padding: 0 var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.home-head > * {
  pointer-events: auto;
}

.home-mark {
  display: block;
  width: 32px;
  height: 32px;
  margin-left: -3px;
  color: var(--ink);
  transition: transform 0.5s var(--ease), opacity 0.3s;
  opacity: 0.85;
}
.home-mark svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
  overflow: visible;
}
.home-mark:hover {
  opacity: 1;
  transform: rotate(45deg);
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 15px;
}

.home-nav a,
.home-nav button {
  color: var(--ink);
  opacity: 0.58;
  text-decoration: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.home-nav a:hover,
.home-nav button:hover {
  opacity: 1;
}

.home-nav a:focus-visible,
.home-nav button:focus-visible,
.home-body a:focus-visible {
  opacity: 1;
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}

.home-nav .nav-text {
  position: relative;
  padding-bottom: 2px;
}
.home-nav .nav-text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.home-nav .nav-text:hover::after {
  transform: scaleX(1);
}

.home-nav .nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.home-theme svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}

/* 选择器需要压过 .home-nav .nav-icon svg 的 display */
.home-nav .home-theme .ic-moon {
  display: none;
}
[data-theme="dark"] .home-nav .home-theme .ic-sun {
  display: none;
}
[data-theme="dark"] .home-nav .home-theme .ic-moon {
  display: block;
}

/* --- 正文 --------------------------------------------------------------- */
.home-main {
  position: relative;
  z-index: 1;
  max-width: calc(var(--col) + var(--pad-x) * 2);
  margin: 0 auto;
  padding: calc(84px + 52px) var(--pad-x) 40px;
}

.home-body {
  max-width: var(--col);
  margin: 0 auto;
}

.home-name {
  font-size: 36px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.015em;
  color: var(--ink);
  margin: 0 0 30px;
}

.home-body p {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.9;
  text-wrap: pretty;
}

.home-body .lede {
  color: var(--ink);
  font-size: 17px;
  margin-bottom: 22px;
}

.home-body a.ilink {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: border-color 0.25s var(--ease), opacity 0.25s var(--ease);
}

.home-body a.ilink:hover {
  border-bottom-color: var(--ink);
}

.home hr {
  width: 48px;
  height: 0;
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 40px auto;
}

/* --- 四个入口（Blog / Projects / Photos / Music）------------------------- */
.home-sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 26px;
  margin: 46px 0 0;
}

.sec {
  display: block;
  border-top: 1px solid var(--rule);
  padding-top: 13px;
  text-decoration: none;
  transition: border-color 0.25s var(--ease);
}

.sec:hover {
  border-top-color: var(--ink);
}

.sec__num {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 12px;
  transition: color 0.25s var(--ease);
}

.sec__title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin-bottom: 5px;
}

.sec__desc {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.01em;
  line-height: 1.7;
  color: var(--ink-mute);
  transition: color 0.25s var(--ease);
}

.sec:hover .sec__num,
.sec:hover .sec__desc {
  color: var(--ink-soft);
}

.mini {
  margin-bottom: 10px !important;
  font-size: 15px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 16px !important;
}

.socials a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  opacity: 0.78;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.socials a svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
  flex: none;
}

.socials a span {
  position: relative;
}
.socials a span::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.socials a:hover {
  opacity: 1;
  transform: translateY(-1px);
}
.socials a:hover span::after {
  transform: scaleX(1);
}

.mail {
  font-size: 15px;
  margin-bottom: 0 !important;
}

.mail a {
  font-family: var(--font-mono);
  font-size: 14.5px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: border-color 0.25s, opacity 0.25s;
}
.mail a:hover {
  border-bottom-color: var(--ink);
}

.tail {
  font-size: 15px;
  color: var(--ink-mute) !important;
  margin-top: 34px !important;
}

.home-foot {
  max-width: var(--col);
  margin: 40px auto 0;
  padding-top: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.dot-sep {
  opacity: 0.55;
}

/* --- 入场 --------------------------------------------------------------- */
@keyframes home-rise {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.home [data-enter] {
  animation: home-rise 0.85s var(--ease) both;
}
.home [data-enter]:nth-child(1) { animation-delay: 0.04s; }
.home [data-enter]:nth-child(2) { animation-delay: 0.1s; }
.home [data-enter]:nth-child(3) { animation-delay: 0.16s; }
.home [data-enter]:nth-child(4) { animation-delay: 0.22s; }
.home [data-enter]:nth-child(5) { animation-delay: 0.28s; }
.home [data-enter]:nth-child(6) { animation-delay: 0.33s; }
.home [data-enter]:nth-child(7) { animation-delay: 0.38s; }
.home [data-enter]:nth-child(8) { animation-delay: 0.43s; }
.home [data-enter]:nth-child(9) { animation-delay: 0.47s; }
.home [data-enter]:nth-child(10) { animation-delay: 0.51s; }
.home [data-enter]:nth-child(11) { animation-delay: 0.56s; }
.home-foot[data-enter] { animation-delay: 0.62s; }

/* --- 响应式 ------------------------------------------------------------- */
@media (max-width: 720px) {
  .home {
    --pad-x: 22px;
  }
  .home-head {
    height: 72px;
  }
  .home-main {
    padding-top: calc(72px + 40px);
  }
  .home-name {
    font-size: 30px;
    margin-bottom: 24px;
  }
  .home-body p {
    font-size: 15.5px;
    line-height: 1.88;
  }
  .home-nav {
    gap: 17px;
    font-size: 14px;
  }
  .nav-hide-sm {
    display: none !important;
  }
  .home hr {
    margin: 32px auto;
  }
  .home-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 18px;
    margin: 38px 0 0;
  }
  .home-body .tail {
    margin-top: 28px !important;
  }
  .socials {
    gap: 9px 14px;
  }
  .socials a {
    font-size: 14.5px;
    gap: 6px;
  }
  .socials a svg {
    width: 15px;
    height: 15px;
  }
}

@media (max-width: 380px) {
  .home-nav .nav-text:first-child {
    display: none;
  }
}

/* --- 无障碍 ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .home [data-enter] {
    animation: none;
  }
  .home * {
    transition-duration: 0.01ms !important;
  }
}
