/* ===========================================================
   松鼠 · 树洞
   cyber-cute：粉紫青渐变 / 玻璃拟态 / 圆角 / 微光
   配色集中在 :root，改一行就能换整个站的气质
   =========================================================== */

:root {
  --pink: #ff4d9d;
  --violet: #a855f7;
  --cyan: #22d3ee;
  --grad: linear-gradient(115deg, var(--pink) 0%, var(--violet) 52%, var(--cyan) 100%);

  --bg: #fff7fc;
  --bg-2: #f6f1ff;
  --surface: rgba(255, 255, 255, .66);
  --surface-solid: #ffffff;
  --text: #241430;
  --muted: #7b6289;
  --line: rgba(168, 85, 247, .16);
  --glow: rgba(255, 77, 157, .18);

  --code-bg: #150d20;
  --code-fg: #f3e9ff;
  --code-border: rgba(168, 85, 247, .28);

  --wrap: 720px;
  --radius: 18px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg: #0d0714;
  --bg-2: #150c1f;
  --surface: rgba(34, 18, 48, .58);
  --surface-solid: #1a0f26;
  --text: #f4ecff;
  --muted: #b9a3cc;
  --line: rgba(190, 140, 230, .18);
  --glow: rgba(255, 77, 157, .22);
  --code-bg: #100818;
  --code-fg: #f3e9ff;
  --code-border: rgba(190, 140, 230, .22);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 背景的两团光 */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  pointer-events: none;
  z-index: -1;
}
body::before {
  top: -26vmax;
  left: -18vmax;
  background: radial-gradient(circle, rgba(255, 77, 157, .55), transparent 62%);
}
body::after {
  right: -20vmax;
  bottom: -30vmax;
  background: radial-gradient(circle, rgba(139, 92, 246, .5), transparent 62%);
}
html[data-theme="dark"] body::before,
html[data-theme="dark"] body::after { opacity: .38; }

::selection { background: var(--pink); color: #fff; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.5rem;
}

a {
  color: inherit;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: color .18s ease, text-decoration-color .18s ease;
}
a:hover { color: var(--pink); text-decoration-color: var(--pink); }

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------------- 顶栏 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 66px;
}

.brand {
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -.02em;
  text-decoration: none;
  white-space: nowrap;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.brand:hover { filter: brightness(1.1); }
.brand .dot { opacity: .85; }

.nav {
  margin-left: auto;
  display: flex;
  gap: 1.2rem;
  font-size: .875rem;
}
.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: .2rem 0;
  position: relative;
  transition: color .18s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--pink); font-weight: 600; }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: .1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .18s, border-color .18s, transform .18s;
}
.theme-toggle:hover {
  color: var(--pink);
  border-color: var(--pink);
  transform: rotate(-12deg);
}
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------------- 主体 ---------------- */
main.wrap {
  flex: 1 0 auto;
  padding: 3.25rem 1.5rem 4.5rem;
}

.hero { margin: 0 0 2.75rem; }
.hero h1 {
  margin: 0 0 .75rem;
  font-size: clamp(2.3rem, 6.4vw, 3.15rem);
  line-height: 1.15;
  letter-spacing: -.04em;
  font-weight: 850;
  background: var(--grad);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: shimmer 9s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero .lead {
  margin: 0;
  max-width: 33em;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.4rem;
}
.chip {
  font-size: .78125rem;
  line-height: 1;
  padding: .45rem .8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    var(--grad) border-box;
  color: var(--muted);
  white-space: nowrap;
}

.page-title {
  font-size: 1.65rem;
  letter-spacing: -.03em;
  margin: 0 0 1.75rem;
  font-weight: 800;
}
.page-title::before {
  content: "";
  display: inline-block;
  width: .55rem;
  height: .55rem;
  margin-right: .55rem;
  border-radius: 50%;
  background: var(--grad);
  vertical-align: .1em;
}

.muted { color: var(--muted); font-size: .9375rem; }

/* ---------------- 文章列表 ---------------- */
.post-list { display: grid; gap: 1rem; }

.post-card {
  position: relative;
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 77, 157, .35);
  box-shadow: 0 10px 34px -12px var(--glow);
}
.post-card::before {
  content: "";
  position: absolute;
  left: 1.6rem;
  right: 1.6rem;
  top: 0;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--grad);
  opacity: 0;
  transition: opacity .2s ease;
}
.post-card:hover::before { opacity: 1; }

.post-card .meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: .55rem;
}
.post-card h2 {
  margin: 0 0 .55rem;
  font-size: 1.28rem;
  line-height: 1.45;
  letter-spacing: -.02em;
  font-weight: 700;
}
.post-card h2 a { text-decoration: none; }
.post-card h2 a:hover { color: var(--pink); }
.post-card .excerpt {
  margin: 0 0 .95rem;
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.7;
}

.sep { opacity: .4; }

/* ---------------- 标签 ---------------- */
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .18rem .65rem;
  font-size: .75rem;
  color: var(--pink);
  background: rgba(255, 77, 157, .08);
  border: 1px solid rgba(255, 77, 157, .16);
  border-radius: 999px;
  text-decoration: none;
  transition: all .18s ease;
}
.tag:hover {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
}
.tag span { font-size: .7rem; opacity: .8; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: .65rem; }
.tag-cloud .tag-lg {
  padding: .55rem 1rem;
  font-size: .875rem;
}

/* ---------------- 文章页 ---------------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--grad);
  z-index: 60;
  transition: width .1s linear;
}

.post-header { margin-bottom: 2rem; }
.post-header h1 {
  margin: 0 0 .8rem;
  font-size: clamp(1.8rem, 4.6vw, 2.3rem);
  line-height: 1.28;
  letter-spacing: -.035em;
  font-weight: 800;
}
.post-header .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}

.toc {
  margin: 0 0 2.25rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .875rem;
  position: relative;
}
.toc::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--grad);
}
.toc-title {
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
}
.toc ul { margin: 0; padding: 0; list-style: none; }
.toc li { line-height: 1.95; }
.toc .toc-h3 { padding-left: 1rem; font-size: .8125rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--pink); }

.post-body { font-size: 1.03125rem; }
.post-body > *:first-child { margin-top: 0; }

.post-body h2,
.post-body h3,
.post-body h4 {
  scroll-margin-top: 86px;
  letter-spacing: -.025em;
  line-height: 1.4;
}
.post-body h2 {
  margin: 2.7rem 0 .9rem;
  font-size: 1.4375rem;
  font-weight: 750;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.post-body h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2.6rem;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}
.post-body h3 { margin: 2rem 0 .65rem; font-size: 1.1875rem; font-weight: 700; }
.post-body h4 { margin: 1.6rem 0 .5rem; font-size: 1.0625rem; font-weight: 700; }

.post-body p { margin: 0 0 1.15rem; }

.post-body ul,
.post-body ol { margin: 0 0 1.15rem; padding-left: 1.35rem; }
.post-body li { margin: .38rem 0; }
.post-body li::marker { color: var(--pink); }
.post-body li > ul,
.post-body li > ol { margin: .35rem 0; }

.post-body a {
  color: var(--pink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-body strong { font-weight: 700; }

.post-body blockquote {
  position: relative;
  margin: 1.6rem 0;
  padding: .85rem 1.1rem .85rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(90deg, rgba(255, 77, 157, .08), transparent 80%);
  color: var(--muted);
}
.post-body blockquote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--grad);
}
.post-body blockquote p:last-child { margin-bottom: 0; }

.post-body hr {
  margin: 2.6rem 0;
  border: 0;
  height: 1px;
  background: var(--grad);
  opacity: .35;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px -18px rgba(139, 92, 246, .5);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: .86em;
  padding: .12em .42em;
  border-radius: 6px;
  background: rgba(255, 77, 157, .1);
  color: #c0266d;
  border: 1px solid rgba(255, 77, 157, .15);
}
html[data-theme="dark"] .post-body code { color: #ff9ecf; }

.post-body pre {
  margin: 1.5rem 0;
  padding: 1.05rem 1.15rem;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.68;
  box-shadow: 0 16px 40px -24px rgba(10, 0, 20, .8);
  -webkit-overflow-scrolling: touch;
}
.post-body pre code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: .8125rem;
}

.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  border-radius: var(--radius);
  overflow: hidden;
}
.post-body th,
.post-body td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.post-body th {
  background: linear-gradient(90deg, rgba(255, 77, 157, .1), rgba(34, 211, 238, .1));
  font-weight: 700;
  font-size: .8125rem;
  white-space: nowrap;
}
.post-body tr:last-child td { border-bottom: 0; }

.post-footer {
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  margin-top: 1.6rem;
}
.post-nav a {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  font-size: .9375rem;
  line-height: 1.5;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.post-nav a:hover {
  border-color: rgba(255, 77, 157, .4);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -14px var(--glow);
}
.post-nav a span { font-size: .72rem; color: var(--muted); }
.post-nav .next { text-align: right; }

/* ---------------- 归档 ---------------- */
.year-block { margin-bottom: 2.2rem; }
.year-block h2 {
  margin: 0 0 .7rem;
  font-size: 1.4rem;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
ul.archive { list-style: none; margin: 0; padding: 0; }
ul.archive li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: .55rem .2rem;
  border-bottom: 1px dashed var(--line);
  transition: padding-left .18s ease;
}
ul.archive li:hover { padding-left: .5rem; }
ul.archive time {
  flex: none;
  color: var(--muted);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
ul.archive a { text-decoration: none; }
ul.archive a:hover { color: var(--pink); }

/* ---------------- 搜索 ---------------- */
#search-input {
  width: 100%;
  padding: .9rem 1.1rem;
  font: inherit;
  font-size: .9375rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
#search-input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 77, 157, .12);
}
#search-input::placeholder { color: var(--muted); }
#search-results { margin-top: 1rem; }
mark {
  background: rgba(255, 77, 157, .22);
  color: inherit;
  border-radius: 3px;
  padding: 0 .1em;
}

/* ---------------- 404 ---------------- */
.notfound { text-align: center; padding: 4.5rem 0; }
.notfound h1 {
  font-size: 5rem;
  margin: 0 0 .4rem;
  letter-spacing: -.06em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.notfound p { color: var(--muted); }

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.7rem 0 2.4rem;
  font-size: .8125rem;
  color: var(--muted);
}
.site-footer p { margin: .25rem 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--pink); }

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--pink), var(--violet));
  border-radius: 999px;
  border: 3px solid var(--bg);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 1.15rem; }
  main.wrap { padding: 2.25rem 1.15rem 3.25rem; }
  .header-inner { height: 58px; gap: .4rem; }
  .nav { gap: .85rem; font-size: .8125rem; }
  .nav a:nth-child(3) { display: none; }
  .hero { margin-bottom: 2.1rem; }
  .hero h1 { font-size: 2.2rem; }
  .post-card { padding: 1.25rem 1.2rem; }
  .post-card::before { left: 1.2rem; right: 1.2rem; }
  .post-card h2 { font-size: 1.15rem; }
  .post-header h1 { font-size: 1.7rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .post-body { font-size: 1rem; }
  .post-body pre {
    border-radius: 14px;
    margin-left: -.4rem;
    margin-right: -.4rem;
  }
  body::before, body::after { filter: blur(70px); opacity: .38; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
