/* ==========================================================
   雨夜博客 · 主题
   深蓝夜色 + 粉色/青色高光，衬线感阅读排版
   ========================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  /* 背景色放在 html 上：body 一旦是不透明底色，就会盖住 z-index 为负的背景照片 */
  background: #080b12;
}

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: #e6edf5;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 16.5px;
  line-height: 1.75;
  overflow-x: hidden;
}

/* 背景照片（每次刷新随机一张，路径由页面内联脚本写进 --bg-src） */
.bg-photo {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background-image: var(--bg-src, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.03);
  filter: saturate(0.9) contrast(1.02);
  animation: bg-in 0.9s ease both;
}

/* 压暗层：保证正文可读 */
.bg-shade {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 11, 18, 0.58), rgba(8, 11, 18, 0.76) 45%, rgba(8, 11, 18, 0.9)),
    radial-gradient(75% 60% at 50% 0%, rgba(8, 11, 18, 0.2), rgba(8, 11, 18, 0.6));
}

@keyframes bg-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 雨丝 Canvas：叠在照片之上、正文之下 */
.atmo {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* 背景光晕（叠加在照片之上，给画面补粉/青两色） */
.rain-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(70% 50% at 78% 8%, rgba(255, 122, 190, 0.16), transparent 62%),
    radial-gradient(60% 45% at 12% 22%, rgba(118, 209, 255, 0.14), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(90, 130, 200, 0.14), transparent 65%),
    linear-gradient(180deg, rgba(8, 11, 18, 0.1), rgba(8, 11, 18, 0.24) 55%, rgba(8, 11, 18, 0.4));
}

/* ---------------- 顶部 ---------------- */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 24px 14px;
}

.logo {
  color: #f4fbff;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-shadow: 0 0 22px rgba(151, 222, 255, 0.28);
}

.nav {
  display: flex;
  gap: 16px;
  font-size: 0.9rem;
}

.nav a {
  color: rgba(230, 237, 245, 0.62);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a.on {
  color: #fff;
}

.nav a.on {
  color: #ffc4e6;
}

/* ---------------- 容器 ---------------- */

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 24px 80px;
}

.hero {
  padding: 26px 0 6px;
}

.eyebrow {
  margin: 0 0 10px;
  color: rgba(255, 196, 230, 0.78);
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.9rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.hero-desc {
  margin: 14px 0 0;
  color: rgba(230, 237, 245, 0.66);
  font-size: 1rem;
}

.rule {
  height: 1px;
  margin: 30px 0;
  border: 0;
  background: linear-gradient(90deg, rgba(222, 241, 250, 0.26), transparent);
}

/* ---------------- 文章列表 ---------------- */

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

.card {
  border-bottom: 1px solid rgba(222, 241, 250, 0.1);
}

.card-link {
  display: block;
  padding: 20px 4px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease;
}

.card-link:hover {
  transform: translateX(3px);
}

.card-link:hover h2 {
  color: #ffc4e6;
}

.card h2 {
  margin: 6px 0 6px;
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.45;
  transition: color 0.18s ease;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: rgba(230, 237, 245, 0.46);
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  color: rgba(118, 209, 255, 0.85);
}

.summary {
  margin: 0;
  color: rgba(230, 237, 245, 0.6);
  font-size: 0.94rem;
}

.empty {
  padding: 34px 0;
  color: rgba(230, 237, 245, 0.55);
}

.empty code,
.prose code,
.summary code {
  padding: 1px 6px;
  border: 1px solid rgba(222, 241, 250, 0.16);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.86em;
}

/* ---------------- 首页照片条 ---------------- */

.strip {
  margin-top: 44px;
}

.strip h3 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(230, 237, 245, 0.7);
}

.strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.strip-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(222, 241, 250, 0.14);
  border-radius: 8px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.strip-grid a:hover img {
  transform: scale(1.03);
  border-color: rgba(255, 196, 230, 0.6);
}

/* ---------------- 文章正文 ---------------- */

.post {
  padding-top: 14px;
}

.post h1 {
  margin: 10px 0 26px;
  font-size: clamp(1.7rem, 4.6vw, 2.35rem);
  line-height: 1.3;
}

.prose {
  color: rgba(232, 240, 248, 0.88);
  font-size: 1.02rem;
}

.prose p {
  margin: 0 0 1.25em;
}

.prose h2 {
  margin: 2em 0 0.7em;
  font-size: 1.35rem;
}

.prose h3 {
  margin: 1.7em 0 0.6em;
  font-size: 1.12rem;
}

.prose a {
  color: #9ddcff;
  text-decoration: none;
  border-bottom: 1px solid rgba(157, 220, 255, 0.36);
}

.prose a:hover {
  border-bottom-color: #ffc4e6;
  color: #ffd9ee;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6em auto;
  border: 1px solid rgba(222, 241, 250, 0.14);
  border-radius: 10px;
}

.prose ul,
.prose ol {
  margin: 0 0 1.25em;
  padding-left: 1.4em;
}

.prose li {
  margin: 0.35em 0;
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 2px 0 2px 18px;
  border-left: 2px solid rgba(255, 196, 230, 0.55);
  color: rgba(230, 237, 245, 0.72);
}

.prose pre {
  margin: 1.5em 0;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid rgba(222, 241, 250, 0.14);
  border-radius: 10px;
  background: rgba(8, 14, 22, 0.86);
  font-size: 0.86rem;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

.prose hr {
  height: 1px;
  margin: 2.2em 0;
  border: 0;
  background: rgba(222, 241, 250, 0.16);
}

/* ---------------- 翻页 / 返回 ---------------- */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid rgba(222, 241, 250, 0.12);
  font-size: 0.92rem;
}

.pager a {
  max-width: 46%;
  color: rgba(230, 237, 245, 0.75);
  text-decoration: none;
}

.pager a:hover {
  color: #ffc4e6;
}

.back {
  margin-top: 18px;
  font-size: 0.92rem;
}

.back a {
  color: rgba(230, 237, 245, 0.6);
  text-decoration: none;
}

.back a:hover {
  color: #fff;
}

/* ---------------- 相册：瀑布流，图片保持原始比例等比缩小 ---------------- */

.gallery {
  column-width: 220px;
  column-gap: 14px;
}

.shot {
  margin: 0 0 16px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

.shot-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(222, 241, 250, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  cursor: zoom-in;
  overflow: hidden;
  transition: border-color 0.22s ease, transform 0.22s ease;
}

.shot-btn:hover {
  border-color: rgba(255, 196, 230, 0.6);
  transform: translateY(-2px);
}

.shot-btn img {
  display: block;
  width: 100%;
  height: auto; /* 等比缩放，不裁切、不拉伸 */
}

.shot figcaption {
  margin-top: 8px;
  color: rgba(230, 237, 245, 0.5);
  font-size: 0.8rem;
  word-break: break-all;
}

.shot-actions {
  display: flex;
  gap: 8px;
  margin: 6px 0 0;
  font-size: 0.78rem;
}

.shot-actions a {
  color: rgba(230, 237, 245, 0.55);
  text-decoration: none;
}

.shot-actions a:hover {
  color: #ffc4e6;
}

/* 放大层：看原图 + 下载 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  gap: 12px;
  padding: 20px 20px 26px;
  background: rgba(4, 7, 11, 0.92);
  backdrop-filter: blur(6px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(230, 237, 245, 0.7);
  font-size: 0.86rem;
}

.lightbox-bar a,
.lightbox-bar button {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(10, 16, 24, 0.6);
  color: #fff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.lightbox-bar a:hover,
.lightbox-bar button:hover {
  border-color: rgba(255, 196, 230, 0.7);
}

.lightbox-body {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.lightbox img {
  max-width: 96vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

.lightbox-tip {
  color: rgba(230, 237, 245, 0.45);
  font-size: 0.78rem;
  text-align: center;
}

/* ---------------- 页脚 ---------------- */

.site-foot {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 24px 46px;
  color: rgba(230, 237, 245, 0.42);
  font-size: 0.82rem;
}

.site-foot a {
  color: rgba(230, 237, 245, 0.6);
  text-decoration: none;
}

.site-foot a:hover {
  color: #fff;
}

.dot {
  opacity: 0.5;
}

/* ---------------- 移动端 ---------------- */

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .wrap {
    padding: 6px 18px 60px;
  }

  .site-head {
    padding: 20px 18px 10px;
  }

  .gallery {
    column-width: 150px;
    column-gap: 10px;
  }

  .shot {
    margin-bottom: 12px;
  }
}

/* ================= 动态流（朋友圈式） ================= */

.feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.moment {
  border: 1px solid rgba(222, 241, 250, 0.14);
  border-radius: 14px;
  background: rgba(10, 16, 24, 0.55);
  padding: 18px 20px 16px;
  backdrop-filter: blur(4px);
}

.moment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.76rem;
  color: rgba(230, 237, 245, 0.5);
}

.cat {
  padding: 1px 9px;
  border: 1px solid rgba(222, 241, 250, 0.24);
  border-radius: 999px;
  font-size: 0.72rem;
  color: rgba(230, 237, 245, 0.7);
}

.cat-study {
  color: #9ddcff;
  border-color: rgba(118, 209, 255, 0.5);
}

.cat-life {
  color: #ffc4e6;
  border-color: rgba(255, 196, 230, 0.5);
}

.moment h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  line-height: 1.45;
}

.moment h2 a {
  color: inherit;
  text-decoration: none;
}

.moment h2 a:hover {
  color: #ffc4e6;
}

.moment-text {
  margin: 0 0 12px;
  color: rgba(232, 240, 248, 0.78);
  white-space: pre-wrap;
}

.moment-images {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.moment-images.cols-1 {
  grid-template-columns: 1fr;
}

.moment-images.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.moment-images.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.m-img {
  padding: 0;
  border: 1px solid rgba(222, 241, 250, 0.12);
  border-radius: 10px;
  background: #0a1018;
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.m-img:hover {
  border-color: rgba(255, 196, 230, 0.55);
  transform: translateY(-1px);
}

.m-img img {
  display: block;
  width: 100%;
  height: auto;
}

.moment-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: rgba(230, 237, 245, 0.55);
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(222, 241, 250, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.like-btn:hover {
  border-color: rgba(255, 196, 230, 0.6);
  color: #fff;
}

.like-btn.on {
  border-color: rgba(255, 120, 180, 0.7);
  color: #ffc4e6;
}

.like-btn .heart {
  font-size: 1rem;
  line-height: 1;
}

.like-btn.pulse {
  animation: like-pulse 0.3s ease;
}

@keyframes like-pulse {
  50% {
    transform: scale(1.08);
  }
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 26px 0 0;
}

.more {
  color: rgba(230, 237, 245, 0.65);
  text-decoration: none;
  font-size: 0.88rem;
}

.more:hover {
  color: #ffc4e6;
}

/* ================= 留言板 ================= */

.msg-form {
  border: 1px solid rgba(222, 241, 250, 0.14);
  border-radius: 14px;
  background: rgba(10, 16, 24, 0.55);
  padding: 18px;
  margin-bottom: 26px;
}

.msg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.msg-form input,
.msg-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(222, 241, 250, 0.2);
  border-radius: 8px;
  background: rgba(8, 11, 18, 0.7);
  color: #e6edf5;
  font: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.msg-form input:focus,
.msg-form textarea:focus {
  outline: none;
  border-color: rgba(255, 196, 230, 0.6);
}

.counter {
  flex: none;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  color: rgba(230, 237, 245, 0.42);
}

.msg-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.msg-actions .primary {
  padding: 9px 22px;
  border: 1px solid rgba(255, 196, 230, 0.5);
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 122, 190, 0.28), rgba(118, 209, 255, 0.24));
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.msg-actions .primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.msg-list {
  display: flex;
  flex-direction: column;
}

.msg-item {
  border-top: 1px solid rgba(222, 241, 250, 0.1);
  padding: 14px 2px;
}

.msg-item header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.msg-name {
  font-weight: 600;
  color: rgba(232, 240, 248, 0.9);
}

.msg-item time {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.74rem;
  color: rgba(230, 237, 245, 0.42);
}

.msg-item p {
  margin: 0;
  color: rgba(232, 240, 248, 0.78);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .moment-images.cols-3 {
    grid-template-columns: 1fr 1fr;
  }

  .moment {
    padding: 15px 15px 13px;
  }
}