/* ===== Note Styles — 迁移自 updn.pub ===== */

/* --- 置顶区域 --- */
.pinned-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

html[data-theme='dark'] .pinned-section {
  border-bottom-color: rgba(255,255,255,0.1);
}

.pinned-label {
  font-size: 0.9rem;
  color: #666;
  flex-shrink: 0;
  width: 60px;
  text-align: right;
  padding-right: 1rem;
  font-weight: bold;
}

html[data-theme='dark'] .pinned-label {
  color: #999;
}

.pinned-cards {
  display: flex;
  gap: 12px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.pinned-cards::-webkit-scrollbar {
  display: none;
}

.pinned-card {
  background: rgba(0,0,0,0.03);
  padding: 12px 16px;
  border-radius: 6px;
  min-width: 120px;
  max-width: 150px;
  flex-shrink: 0;
  transition: background 0.2s;
  color: var(--color-text) !important;
  text-decoration: none;
}

.pinned-card:hover {
  background: rgba(0,0,0,0.06);
  color: var(--color-text);
}

html[data-theme='dark'] .pinned-card {
  background: rgba(255,255,255,0.05);
}

html[data-theme='dark'] .pinned-card:hover {
  background: rgba(255,255,255,0.08);
}

.pinned-text {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pinned-arrow {
  font-size: 1.5rem;
  color: #ccc;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
}

.pinned-arrow:hover {
  color: #999;
}

html[data-theme='dark'] .pinned-arrow {
  color: #666;
}

/* --- 置顶页头部 --- */
.pinned-page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--content-width);
  margin: 0 auto 2rem;
}

.pinned-back {
  font-size: 1.5rem;
  color: #999;
  text-decoration: none;
  line-height: 1;
}

.pinned-back:hover {
  color: #666;
}

html[data-theme='dark'] .pinned-back {
  color: #666;
}

html[data-theme='dark'] .pinned-back:hover {
  color: #999;
}

.pinned-page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

/* --- 年份分组 --- */
.year-group {
  margin-bottom: 2rem;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

.year-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1rem;
}

/* --- 时间线 --- */
.note-timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.note-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}

.note-timeline-item:hover {
  opacity: 0.8;
}

.note-timeline-date {
  flex-shrink: 0;
  width: 60px;
  text-align: right;
  padding-right: 1rem;
}

.note-timeline-date.invisible {
  visibility: hidden;
}

.note-timeline-day {
  display: block;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  color: var(--color-text);
}

.note-timeline-month {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-top: 2px;
}

.note-timeline-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.note-timeline-text {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text);
  display: block;
  word-break: break-all;
}

.note-timeline-text.no-image {
  background: rgba(0,0,0,0.03);
  padding: 12px 16px;
  border-radius: 4px;
}

html[data-theme='dark'] .note-timeline-text.no-image {
  background: rgba(255,255,255,0.05);
}

.note-timeline-text.with-image {
  background: none;
  padding: 0;
}

/* --- 九宫格缩略图 --- */
.note-mosaic {
  display: grid;
  gap: 2px;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
}

.note-mosaic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1;
}

.mosaic-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.mosaic-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.mosaic-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic-3 img:first-child { grid-row: 1 / 3; }
.mosaic-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic-5 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.mosaic-6 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.mosaic-7 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.mosaic-8 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.mosaic-9 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }

/* --- 动态详情卡片（朋友圈风格）--- */
.note-card {
  max-width: 700px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 12px 0;
}

.note-layout {
  display: flex;
  flex-direction: row;
  gap: 12px;
}

.note-avatar {
  display: block;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  position: relative;
}

/* Avatar skeleton shimmer */
.note-avatar .avatar-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.note-avatar .avatar-skeleton.hidden {
  display: none;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

html[data-theme='dark'] .note-avatar .avatar-skeleton {
  background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
  background-size: 200% 100%;
}

/* Avatar image: hidden until loaded */
.note-avatar img.avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.note-avatar img.avatar-img.loaded {
  opacity: 1;
}

.note-avatar img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
}

.note-main {
  flex: 1;
  min-width: 0;
}

.note-header {
  margin-bottom: 4px;
}

.note-author {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: #576b95;
  text-decoration: none;
}

html[data-theme='dark'] .note-author {
  color: #7a9fd4;
}

.note-body {
  margin-bottom: 8px;
}

/* note 内容的 prose 样式覆盖：更紧凑 */
.note-body .prose {
  font-size: var(--font-size-base);
}

.note-body .prose p:first-child { margin-top: 0; }
.note-body .prose p:last-child { margin-bottom: 0; }

/* note 内图片 gallery */
.note-body .gallery {
  display: grid;
  gap: 4px;
  max-width: 100%;
  margin: 0.75rem 0;
}

.note-body .gallery-1 { grid-template-columns: 1fr; max-width: 100%; }
.note-body .gallery-2 { grid-template-columns: 1fr 1fr; }
.note-body .gallery-3 { grid-template-columns: 1fr 1fr 1fr; }

.note-body .gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s;
  margin: 0;
}

.note-body .gallery img:hover {
  transform: scale(1.02);
}

.note-body .gallery-1 img {
  aspect-ratio: auto;
  object-fit: contain;
  max-height: 500px;
}

/* note 内长链接换行 */
.note-body a {
  word-break: break-all;
  overflow-wrap: break-word;
}

.note-footer {
  height: var(--meta-row-height);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

a.note-time {
  font-size: var(--font-size-xs);
  color: #888 !important;
  text-decoration: none;
}

a.note-time:hover {
  text-decoration: underline;
}

.note-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.note-badge svg {
  width: 14px;
  height: 14px;
}

html[data-theme='dark'] .note-badge {
  color: #666;
}

/* --- Lightbox 灯箱 --- */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  z-index: 10001;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 32px;
  transition: background 0.3s;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,0.4);
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  background: rgba(0,0,0,0.5);
  padding: 5px 15px;
  border-radius: 20px;
}

.lightbox[data-single="true"] .lightbox-prev,
.lightbox[data-single="true"] .lightbox-next {
  display: none;
}

/* --- 响应式 --- */
@media (max-width: 640px) {
  .note-timeline-date { width: 50px; }
  .note-timeline-day { font-size: 1.5rem; }
  .note-mosaic { width: 100px !important; height: 100px !important; }

  /* 移动端评论区撑满宽度（对齐 updn.pub） */
  .note-main #comments-section {
    margin-left: -56px; /* 头像44px + gap12px */
    width: calc(100% + 56px);
  }

  .lightbox img { max-width: 95%; max-height: 80%; }
  .lightbox-close { top: 10px; right: 15px; font-size: 30px; }
  .lightbox-prev, .lightbox-next { display: none; }

  /* 移动端 footer 隐藏（对齐 updn.pub） */
  .note-detail-page .site-footer { display: none; }
}

@media (min-width: 641px) {
  .note-timeline-text { font-size: 1rem; }
  .note-mosaic { width: 200px !important; height: 200px !important; }
  .note-timeline-text.no-image { max-width: 600px; }
  .note-timeline-content { max-width: 600px; }
}
