/* LazyBones 主页共享样式 — index.html / posts.html */

:root {
  --bg: #f7f8f7;
  --card: #ffffff;
  --ink: #191c19;
  --muted: #6b726b;
  --accent: #16a34a;
  --accent-ink: #0d7a38;
  --accent-soft: #e8f7ee;
  --border: #e5e7e4;
  --shadow: 0 1px 2px rgba(20, 30, 20, .04), 0 8px 24px rgba(20, 30, 20, .05);
  --shadow-hover: 0 2px 4px rgba(20, 30, 20, .06), 0 16px 40px rgba(22, 163, 74, .10);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas,
          'Sarasa Mono SC', 'Microsoft YaHei', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f0d;
    --card: #151815;
    --ink: #e7eae7;
    --muted: #9aa39a;
    --accent: #4ade80;
    --accent-ink: #4ade80;
    --accent-soft: #14301e;
    --border: #262a26;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 40px rgba(74, 222, 128, .08);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  transition: background .3s, color .3s;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* ===== 顶部导航 ===== */
.site-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 40px;
  animation: heroIn .5s ease-out both;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color .25s, border-color .25s, background .25s;
}
.site-nav a:hover { color: var(--accent-ink); }
.site-nav a.active {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* ===== 进场与滚动动效 ===== */
@keyframes heroIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero { animation: heroIn .7s ease-out both; }

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ===== Hero ===== */
.hero-top {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
  transition: transform .35s ease;
}
.avatar:hover { transform: rotate(-6deg) scale(1.05); }

.hero-name {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.hero-pills {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.pill {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--card);
}
.pill.accent {
  color: var(--accent-ink);
  border-color: transparent;
  background: var(--accent-soft);
  font-weight: 600;
}

.hero-bio {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 22px;
}
.hero-bio b { color: var(--ink); font-weight: 600; }

.socials { display: flex; flex-wrap: wrap; gap: 10px; }

.social {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  transition: transform .2s ease, border-color .25s, color .25s, box-shadow .25s;
}
.social:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-hover);
}
.social .arrow { font-size: 12px; opacity: .55; transition: transform .2s, opacity .2s; }
.social:hover .arrow { transform: translate(1px, -1px); opacity: 1; }

/* ===== 通用区块 ===== */
section { margin-top: 44px; }

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid > * { min-width: 0; }   /* 关键：禁止长内容把 1fr 列撑宽（1fr 最小尺寸默认是内容宽） */
@media (max-width: 560px) { .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .3s ease, border-color .25s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

/* ===== 实时动态（状态 / 音乐 双卡） ===== */
.live-card {
  display: flex;
  gap: 14px;
  align-items: center;
  height: 100px;
}

.live-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.live-icon svg { width: 22px; height: 22px; }

.live-dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: #b7bcb7;
  transition: background .3s;
}
.live-dot.on {
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50%      { box-shadow: 0 0 0 7px transparent; }
}

.live-body { flex: 1; min-width: 0; }

.live-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.live-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  height: 22px;
  overflow: hidden;
  white-space: nowrap;
}

/* eq 图标不缩；文字占剩余宽度并可滚动 */
.live-title .eq { flex-shrink: 0; }
.live-title .lt,
.live-title #music-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
#music-name .roll {
  display: inline-block;
  will-change: transform;
}
#music-name.scrolling .roll {
  animation: nameRoll 11s linear infinite alternate;
}
#music-name.scrolling:hover .roll { animation-play-state: paused; }
@keyframes nameRoll {
  from { transform: translateX(0); }
  to   { transform: translateX(var(--shift, -40px)); }
}

.live-sub {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-title a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
  transition: color .25s, border-color .25s;
}
.live-title a:hover {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}

/* 音乐封面（黑胶唱片：圆形 + 播放时缓转） */
.live-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--card);
}
.live-cover.spin { animation: vinylSpin 8s linear infinite; }
@keyframes vinylSpin {
  to { transform: rotate(360deg); }
}

/* 音乐均衡器小动画 */
.eq {
  display: inline-flex;
  gap: 2.5px;
  align-items: flex-end;
  height: 14px;
}
.eq i {
  width: 3px;
  height: 30%;
  background: var(--accent-ink);
  border-radius: 1.5px;
}
.eq.playing i { animation: eqBounce 1.1s ease-in-out infinite; }
.eq.playing i:nth-child(2) { animation-delay: .25s; }
.eq.playing i:nth-child(3) { animation-delay: .5s; }
@keyframes eqBounce {
  0%, 100% { height: 25%; }
  50%      { height: 100%; }
}

/* ===== 项目 ===== */
.proj-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.proj-name { font-size: 15px; font-weight: 700; line-height: 1.4; }

.proj-badge {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.proj-desc { font-size: 13px; color: var(--muted); }
.proj-desc code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ===== 设备 ===== */
.device { display: flex; gap: 14px; align-items: center; }

.device-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.device-icon svg { width: 22px; height: 22px; }

.device-name { font-size: 14px; font-weight: 600; }
.device-desc { font-size: 12px; color: var(--muted); }

/* ===== 碎碎念 ===== */
.page-head { animation: heroIn .7s ease-out both; }
.page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.page-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-sub a { color: var(--accent-ink); text-decoration: none; }
.page-sub a:hover { text-decoration: underline; }

.post-list { display: grid; gap: 12px; margin-top: 24px; }

.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: border-color .25s, transform .2s ease, box-shadow .3s ease;
}
.post:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.post-text {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.post-text a { color: var(--accent-ink); text-decoration: none; }
.post-text a:hover { text-decoration: underline; }

/* 富文本元素 */
.post-text code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 1px 6px;
  border-radius: 5px;
}
.post-text pre {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 8px 0 0;
  white-space: pre;
}
.post-text pre code { background: none; padding: 0; }
.post-text blockquote {
  border-left: 3px solid var(--accent);
  margin: 8px 0 0;
  padding: 2px 12px;
  color: var(--muted);
}
.post-text .spoiler {
  background: var(--muted);
  color: transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: background .3s, color .3s;
}
.post-text .spoiler.show {
  background: var(--accent-soft);
  color: inherit;
}

.post-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

/* 碎碎念配图：紧凑缩略图（固定高度、宽度自适应），点击放大看原图 */
.post-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.post-images img {
  width: auto;
  height: auto;
  max-height: 180px;
  max-width: 100%;
  border-radius: 12px;
  display: block;
  background: var(--accent-soft);
  cursor: zoom-in;
  transition: filter .3s ease;
}
.post-images img:hover { filter: brightness(1.04); }

@media (max-width: 560px) {
  .post-images img { max-height: 140px; }
}

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  cursor: zoom-out;
}
.lightbox.show { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}

/* 帖子头部：微博式 头像+名字+时间 */
.post-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.post-head img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
}
.post-author {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.post-head .post-time { margin-left: auto; margin-top: 0; }

/* reactions */
.post-reactions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.reaction {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.pager button {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: border-color .25s, color .25s, transform .2s;
}
.pager button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-1px);
}
.pager button:disabled { opacity: .35; cursor: default; }

.pager .page-info {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ===== 关于页 ===== */
.about-p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}
.about-p:last-child { margin-bottom: 0; }
.about-p b { color: var(--ink); font-weight: 600; }

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

.tag {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: default;
  transition: border-color .25s, color .25s, transform .2s, background .25s;
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* 关于本站的“技术栈”条目 */
.stack-item { display: flex; gap: 14px; align-items: flex-start; }
.stack-item + .stack-item { margin-top: 14px; }

.stack-cmd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 3px 9px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.stack-body { font-size: 13px; color: var(--muted); }
.stack-body b { color: var(--ink); font-weight: 600; }

/* ===== 主页小部件 ===== */
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px) { .grid.cols-4 { grid-template-columns: 1fr; } }

.widget {
  height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 14px 10px;
}

.widget-num {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.widget-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-top: 5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Hero 轮换标语 */
#rotator {
  display: inline-block;
  transition: opacity .3s ease;
  color: var(--ink);
  font-weight: 600;
}
#rotator.rot-out { opacity: 0; }

/* ===== 页脚 ===== */
footer {
  margin-top: 56px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.footer-quote {
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 14px;
}
.footer-quote span { color: var(--accent-ink); }

/* 备案：一行水平排列，严格同一基线 */
.beian {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.beian a {
  color: var(--muted);
  text-decoration: none;
  transition: color .25s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  line-height: 1;
  white-space: nowrap;
}
.beian a:hover { color: var(--accent-ink); }
.beian img { width: 14px; height: 14px; display: block; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.toast.show { opacity: .92; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .hero-name { font-size: 26px; }
}

/* ===== 手机端细节适配 ===== */
@media (max-width: 560px) {
  .wrap { padding: 24px 14px 40px; }
  .site-nav { margin-bottom: 28px; }
  .hero-top { gap: 14px; }
  .hero-bio { font-size: 14px; }
  section { margin-top: 36px; }
  .card { padding: 16px; border-radius: 14px; }
  /* 触控目标不小于 38px */
  .social { padding: 9px 16px; min-height: 38px; align-items: center; }
  .live-icon { width: 38px; height: 38px; }
  .page-title { font-size: 23px; }
  /* 防止任何意外横向溢出 */
  body { overflow-x: clip; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
