/* ==========================================================================
   首页 / 列表页 / 单页 —— 两栏版式
   左列：头像 + 站名 → 栏目 → 搜索 → 页面 → 分割线 → 备案号
   右列：正文（首页是时间轴列表，列表页是搜索框 + 列表，单页是文章）
   列表按 cai.im 实测值：行距 30px、标题 15px/500、日期与摘要 13.125px，
   悬停时当前条浮起浅灰圆角块并放大 102%、其余淡到 50%，未滚进视口的条目虚化。
   post.css 先加载，这里只做两栏骨架与列表排版。
   ========================================================================== */

.home-page {
  background: #fff;
  -webkit-tap-highlight-color: transparent;
}

/* --------------------------------------------------------------------------
   两栏骨架
   -------------------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  gap: 4.5rem;
  max-width: 62rem;
  margin: 0 auto;
  padding: 5.5rem 1.5rem 7rem;
  align-items: start;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.75rem;
    padding: 3.5rem 1.25rem 4rem;
  }
}

/* --------------------------------------------------------------------------
   左列
   -------------------------------------------------------------------------- */
.side {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  /* 桌面端跟随滚动，长列表读到底也能随时切栏目 */
  position: sticky;
  top: 4rem;
}

@media (max-width: 900px) {
  .side {
    position: static;
    gap: 1.25rem;
  }

  /* 窄屏下左列不再竖着排一长串，改成横向排，避免把正文挤到首屏之外 */
  .side-group {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 0.375rem 1.125rem !important;
  }
}

.side-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.side-avatar {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  object-fit: cover;
  background: #f2f2f2;
}

.side-name {
  color: var(--neutral-900);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.side-brand:hover .side-name {
  color: var(--accent-color-darker);
}

/* 栏目 / 搜索 / 页面：一行一个，靠行间距分组 */
.side-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6875rem;
}

/*
  导航条目：默认灰字，悬停时变深并从左侧划出一条下划线。
  下划线用背景渐变做，不占布局，所以不会把文字挤动。
*/
.side-link {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
  color: var(--mist-500);
  font-size: 0.875rem;
  line-height: 1.3;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: color 0.18s ease, background-size 0.24s ease;
}

.side-link:hover {
  color: var(--neutral-900);
  background-size: 100% 1px;
}

/* 当前所在栏目 / 页面：保持深色 + 下划线一直显示 */
.side-link.is-current {
  color: var(--neutral-900);
  background-size: 100% 1px;
}

.side-link:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
  border-radius: 2px;
}

.side-rule {
  margin: 0.25rem 0 0;
  border: 0;
  border-top: 1px solid #eff0f1;
}

.side-icp {
  color: #a8b2b5;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 0.16s ease;
}

.side-icp:hover {
  color: var(--mist-500);
}

/* --------------------------------------------------------------------------
   右列
   -------------------------------------------------------------------------- */
.main {
  min-width: 0;
}

.home-flash {
  margin: 0 0 2rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: #f2f7f8;
  color: var(--accent-color-darker);
  font-size: 0.875rem;
}

.section-label {
  margin: 0 0 1.75rem;
  color: #a8b2b5;
  font-family: var(--font-stylish);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.main-head {
  margin-bottom: 2rem;
}

.main-title {
  margin: 0;
  color: var(--neutral-900);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}

.main-sub {
  margin: 0.4375rem 0 0;
  color: var(--mist-500);
  font-size: 0.875rem;
  line-height: 1.5;
}

.list-count {
  margin: 1rem 0 0;
  color: #a8b2b5;
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   文章列表：时间轴 + 参考站的悬停手感

   1. 时间轴 —— 左侧一条 1px 竖线，每条一个圆点，点与点之间用一小段线连起来，
      最后一条不画尾巴，所以线永远收在最后一个点下沿。
   2. 悬停 —— 当前条浮起浅灰圆角块并放大到 102%，其余条目通过 --hover-opacity
      淡到 50%。用 :has() 判定，只有指针真的落在某一条上才压暗整列。
   3. 入场 —— 参考站把 blur / 位移 / 缩放绑在滚动上（animation-timeline: view()）：
      条目还没完全进视口时是 blur(10px) + 下沉 20px + 缩到 90%，滚进来才归位。
      不支持 view() 的浏览器整块跳过，条目照常全部可见。

   两个自定义属性都注册成 <number>，否则既不能与动画插值，也不能做 transition。
   -------------------------------------------------------------------------- */
@property --reveal {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}

@property --hover-opacity {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

.story-list {
  --tl-gap: 2rem; /* 行距 30px */
  --tl-pad: 2.25rem; /* 内容相对竖线的缩进：要留够位置，悬停色块放大后才不压到圆点 */
  display: flex;
  flex-direction: column;
  gap: var(--tl-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-item {
  position: relative;
  display: block;
  padding-left: var(--tl-pad);
  /* 两种透明度相乘：滚动入场的进度 × 悬停时的压暗。
     入场留 35% 的地板，不然模糊还没看清就先透明没了 */
  opacity: calc((0.35 + 0.65 * var(--reveal)) * var(--hover-opacity));
  transition: --hover-opacity 0.3s ease;
}

/* 竖线：从本条的圆点连到下一条的圆点 */
.story-item::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 6px;
  z-index: 0;
  width: 1px;
  height: calc(100% + var(--tl-gap));
  background: #ecedef;
}

.story-item:last-child::after {
  display: none;
}

/* 圆点：对齐日期那一行（12.19px × 1.35 行高 ≈ 16.5px → 中心 8.2px） */
.story-item::before {
  content: "";
  position: absolute;
  top: 4.7px;
  left: 3px;
  z-index: 1;
  width: 7px;
  height: 7px;
  border: 1px solid #d8dde0;
  border-radius: 9999px;
  background: #fff;
  transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.story-item:hover::before {
  border-color: var(--accent-color);
  background: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(82, 130, 146, 0.14);
}

/* 近 3 天发布的：红点。悬停时也保持红色，只把光环换掉 */
.story-item.is-fresh::before {
  border-color: #e5484d;
  background: #e5484d;
}

.story-item.is-fresh:hover::before {
  border-color: #e5484d;
  background: #e5484d;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.14);
}

/* 悬停时整列压暗，只有指针所在那条保持全亮 —— 参考站就是这个手感 */
@media (hover: hover) {
  .story-list:has(.story-item:hover) .story-item:not(:hover) {
    --hover-opacity: 0.5;
  }
}

/* 负外边距把点击 / 悬停热区撑大，但视觉位置不变；
   左侧只收 0.75rem（右侧 1rem），好让悬停色块放大 2% 后仍停在竖线右边 */
.story-link {
  display: block;
  padding: 0.75rem 1rem 0.75rem 0.75rem;
  margin: -0.75rem -1rem -0.75rem -0.75rem;
  border-radius: 0.75rem;
  text-decoration: none;
  transition: background-color 0.3s ease, scale 0.3s ease;
}

@media (hover: hover) {
  .story-link:hover {
    background: #f4f5f6;
    scale: 1.02;
  }
}

/* 日期单独占一行，和时间轴的圆点同处一条水平线 */
.story-date {
  display: block;
  color: #a8b2b5;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  transition: color 0.3s ease;
}

.story-title {
  display: block;
  margin-top: 0.1875rem;
  color: #262626;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: break-word;
  transition: color 0.3s ease;
}

.story-item:hover .story-title {
  color: #000;
}


.story-item:hover .story-date {
  color: var(--mist-500);
}

.story-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
  margin-top: 0.125rem;
  color: var(--mist-500);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* 空态没有点，也不留缩进 */
.story-empty {
  padding-left: 0;
  color: var(--mist-500);
  font-size: 0.9375rem;
}

.story-empty::before,
.story-empty::after {
  display: none;
}

/* 滚动驱动的入场：只给支持 view() 的浏览器，且尊重「减少动态效果」 */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .story-item {
      --reveal-blur: 10px;
      --reveal-shift: 20px;
      --reveal-scale: 0.9;
      will-change: opacity, transform, filter;
      animation: story-reveal linear both;
      animation-timeline: view();
      /* 从刚露头到「进来 8rem」这段走完，值跟参考站一致；
         页面底部留了 7rem 内边距 + 分页，最后几条也能彻底清晰 */
      animation-range: entry 0% entry 8rem;
      transform: translateY(calc((1 - var(--reveal)) * var(--reveal-shift)))
        scale(calc(var(--reveal-scale) + (1 - var(--reveal-scale)) * var(--reveal)));
      filter: blur(calc((1 - var(--reveal)) * var(--reveal-blur)));
    }

    @keyframes story-reveal {
      from {
        --reveal: 0;
      }

      to {
        --reveal: 1;
      }
    }
  }
}

/* --------------------------------------------------------------------------
   分页
   -------------------------------------------------------------------------- */
.home-pager {
  display: flex;
  align-items: center;
  gap: 1.125rem;
  margin-top: 3rem;
  font-size: 0.8125rem;
}

.home-pager a {
  color: var(--mist-500);
  text-decoration: none;
  transition: color 0.16s ease;
}

.home-pager a:hover {
  color: var(--neutral-900);
}

.pager-count {
  color: #a8b2b5;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   自动加载：滚到这里就去取下一页
   -------------------------------------------------------------------------- */
.feed-sentinel {
  display: flex;
  justify-content: center;
  min-height: 1.5rem;
  padding: 1.5rem 0 0.25rem;
}

.feed-spinner {
  color: #a8b2b5;
  font-size: 0.8125rem;
}

.feed-sentinel.is-end {
  min-height: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   搜索框
   -------------------------------------------------------------------------- */
.search-form {
  margin-bottom: 2.25rem;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 3rem;
  padding: 0 0.375rem 0 0.875rem;
  border: 1px solid #e8e8ea;
  border-radius: 0.75rem;
  background: #fcfcfd;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.search-field:focus-within {
  border-color: var(--accent-color);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(82, 130, 146, 0.12);
}

.search-icon {
  flex: none;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: #a8b2b5;
  stroke-width: 1.6;
  stroke-linecap: round;
  transition: stroke 0.16s ease;
}

.search-field:focus-within .search-icon {
  stroke: var(--accent-color);
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--neutral-900);
  font: inherit;
  font-size: 0.9375rem;
  outline: none;
}

/* iOS Safari：输入框字号 <16px 聚焦时会自动放大整个页面，触屏下固定 16px 挡掉 */
@media (hover: none) and (pointer: coarse) {
  .search-field input {
    font-size: 16px;
  }
}

.search-field input::placeholder {
  color: #b4bcc0;
}

/* 去掉 Chrome 给 type=search 的原生清除按钮，避免和右侧按钮挤在一起 */
.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-field button {
  flex: none;
  height: 2.25rem;
  padding: 0 1.0625rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--accent-color);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.16s ease;
}

.search-field button:hover {
  background: var(--accent-color-darker);
}

/* 未输关键词时的搜索页：不显示标题，搜索框整体下移，下面跟一句引导 */
.main.is-search-idle .search-form {
  margin-top: clamp(3.5rem, 14vh, 8rem);
  margin-bottom: 0;
}

.search-hint {
  margin: 1.5rem 0 0;
  color: var(--mist-500);
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: center;
}

/* --------------------------------------------------------------------------
   单页正文
   -------------------------------------------------------------------------- */
.page-body .main-title {
  margin-bottom: 0.5rem;
}
/* --------------------------------------------------------------------------
   底部 Listening（最近 10 条文章音乐）
   与 cai.im 逐项对齐：标题全大写/加宽字距/半透明灰；条目按内容宽度流式换行，
   30px 圆角封面 + 歌名 15px/500 + 歌手 13px/浅灰，整行一个省略号；
   悬停时条目 scale(1.02)，浅色底块由脚本滑动跟随（整组共用一个指示块）。
   -------------------------------------------------------------------------- */
.listening {
  display: flex;
  flex-direction: column;
  gap: 2rem; /* 标题与列表间距 30px，与参考站一致 */
  margin-top: 4.5rem;
}

.listening-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.listening-label {
  margin: 0;
  color: color-mix(in srgb, var(--mist-500) 50%, transparent);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.listening-list {
  position: relative;
  z-index: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

/* 共享悬停底块：绝对定位，由 listening.js 移到当前条目下方 */
.listening-indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 0;
  height: 0;
  border-radius: 0.375rem;
  background-color: oklch(96.3% 0.002 197.1);
  opacity: 0;
  pointer-events: none;
  will-change: transform, width, height, opacity;
  transition:
    transform 0.48s cubic-bezier(0.25, 1.22, 0.45, 1.04),
    width 0.4s cubic-bezier(0.25, 1, 0.3, 1),
    height 0.4s cubic-bezier(0.25, 1, 0.3, 1),
    opacity 0.25s ease-out;
}

.listening-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  /* 负外边距抵消内边距，文字视觉上仍与标题左对齐，悬停底块却比文字大一圈 */
  padding: 0.75rem 1.25rem;
  margin: -0.75rem -1.25rem;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.listening-item:hover {
  transform: scale(1.02);
}

.listening-art {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 0.25rem;
  object-fit: cover;
  overflow: hidden;
  background-color: oklch(96.3% 0.002 197.1);
}

.listening-art.is-empty {
  display: block;
}

.listening-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.listening-title {
  color: #262626;
  font-weight: 500;
  transition: color 0.3s ease;
}

.listening-item:hover .listening-title {
  color: #000;
}

.listening-artist {
  margin-left: 0.5rem;
  color: #a3a3a3;
  font-size: 0.875rem;
  font-weight: 400;
}

/* 窄屏：行距略收紧，条目依旧按内容宽度换行 */
@media (max-width: 560px) {
  .listening {
    gap: 1.25rem;
    margin-top: 3rem;
  }

  .listening-list {
    gap: 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   我的歌单页：条目复用首页 Listening 的样式，只是换成整页列表、多一个时长
   -------------------------------------------------------------------------- */
.playlist-tracks {
  margin-top: 2.5rem;
}

.playlist-tracks .listening-list {
  gap: 1.75rem 2rem;
}

.listening-duration {
  margin-left: 0.5rem;
  color: #c2c2c2;
  font-size: 0.875rem;
  font-weight: 400;
}

@media (max-width: 560px) {
  .playlist-tracks {
    margin-top: 1.75rem;
  }
}
