/* ==========================================================================

   skeleton.css · trackandreact.com

   骨架屏系统 — 所有组件的加载占位样式

   生成者：Crystal Yifei Liu · 2026-09-25

   依赖：tokens.css, animations.css

   核心原则：骨架屏布局必须与最终内容布局一致，不造成CLS

   ========================================================================== */



/* ==========================================================================

   一、骨架屏基础

   ========================================================================== */



.skeleton {

  background: linear-gradient(

    90deg,

    var(--skeleton-bg) 0%,

    var(--skeleton-shimmer) 50%,

    var(--skeleton-bg) 100%

  );

  background-size: 200% 100%;

  animation: skeletonShimmer var(--loading-shimmer) var(--ease-in-out) infinite;

  border-radius: var(--radius-sm);

  display: block;

}



.skeleton-text {

  height: 1em;

  margin-bottom: var(--space-2);

  border-radius: var(--radius-sm);

}



.skeleton-text:last-child {

  margin-bottom: 0;

  width: 60%;

}



.skeleton-title {

  height: 1.5em;

  width: 80%;

  margin-bottom: var(--space-3);

  border-radius: var(--radius-sm);

}



.skeleton-heading {

  height: 2em;

  width: 60%;

  margin-bottom: var(--space-4);

  border-radius: var(--radius-sm);

}



.skeleton-circle {

  border-radius: var(--radius-full);

}



.skeleton-rect {

  border-radius: var(--radius-md);

}



.skeleton-cover {

  aspect-ratio: 16 / 9;

  border-radius: var(--radius-lg);

  width: 100%;

}



/* ==========================================================================

   二、文章卡片骨架屏

   ========================================================================== */



.skeleton-article-card {

  display: block;

  background-color: var(--color-surface);

  border: 1px solid var(--color-border);

  border-radius: var(--radius-lg);

  overflow: hidden;

  container-type: inline-size;

  container-name: article-card;

}



.skeleton-article-card .skeleton-cover {

  border-radius: 0;

}



.skeleton-article-card .skeleton-body {

  padding: var(--space-5);

}



.skeleton-article-card .skeleton-title {

  height: 1.25em;

  width: 90%;

  margin-bottom: var(--space-3);

}



.skeleton-article-card .skeleton-summary {

  height: 0.875em;

  width: 100%;

  margin-bottom: var(--space-2);

}



.skeleton-article-card .skeleton-summary:last-of-type {

  width: 70%;

  margin-bottom: var(--space-4);

}



.skeleton-article-card .skeleton-meta {

  display: flex;

  align-items: center;

  gap: var(--space-3);

}



.skeleton-article-card .skeleton-meta-item {

  height: 0.75em;

  width: 60px;

  border-radius: var(--radius-sm);

}



@container article-card (max-width: 320px) {

  .skeleton-article-card .skeleton-summary {

    display: none;

  }

}



/* ==========================================================================

   三、文章正文骨架屏

   ========================================================================== */



.skeleton-article-body {

  max-width: var(--reading-max-width);

  margin: 0 auto;

  padding: var(--rhythm-loose) 0;

}



.skeleton-article-body .skeleton-h1 {

  height: 2.5em;

  width: 85%;

  margin-bottom: var(--rhythm-normal);

  border-radius: var(--radius-sm);

}



.skeleton-article-body .skeleton-meta-row {

  display: flex;

  align-items: center;

  gap: var(--space-4);

  margin-bottom: var(--rhythm-loose);

}



.skeleton-article-body .skeleton-avatar {

  width: 48px;

  height: 48px;

  border-radius: var(--radius-full);

  flex-shrink: 0;

}



.skeleton-article-body .skeleton-meta-text {

  height: 1em;

  width: 120px;

  border-radius: var(--radius-sm);

}



.skeleton-article-body .skeleton-paragraph {

  margin-bottom: var(--rhythm-normal);

}



.skeleton-article-body .skeleton-paragraph .skeleton-line {

  height: 1em;

  margin-bottom: var(--space-2);

  border-radius: var(--radius-sm);

}



.skeleton-article-body .skeleton-paragraph .skeleton-line:nth-child(1) { width: 100%; }

.skeleton-article-body .skeleton-paragraph .skeleton-line:nth-child(2) { width: 95%; }

.skeleton-article-body .skeleton-paragraph .skeleton-line:nth-child(3) { width: 98%; }

.skeleton-article-body .skeleton-paragraph .skeleton-line:nth-child(4) { width: 60%; }



.skeleton-article-body .skeleton-h2 {

  height: 1.75em;

  width: 50%;

  margin-top: var(--rhythm-loose);

  margin-bottom: var(--rhythm-normal);

  border-radius: var(--radius-sm);

}



.skeleton-article-body .skeleton-image {

  aspect-ratio: 16 / 9;

  width: 100%;

  margin: var(--rhythm-loose) 0;

  border-radius: var(--radius-lg);

}



/* ==========================================================================

   四、聚合页列表骨架屏

   ========================================================================== */



.skeleton-article-list {

  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));

  gap: var(--space-5);

  container-type: inline-size;

  container-name: article-list;

}



@container article-list (max-width: 640px) {

  .skeleton-article-list {

    grid-template-columns: 1fr;

  }

}



@container article-list (min-width: 960px) {

  .skeleton-article-list {

    grid-template-columns: repeat(3, 1fr);

  }

}



/* ==========================================================================

   五、侧边栏 Quick Picks 骨架屏

   ========================================================================== */



.skeleton-sidebar {

  padding: var(--space-5);

  background-color: var(--color-surface);

  border: 1px solid var(--color-border);

  border-radius: var(--radius-lg);

}



.skeleton-sidebar .skeleton-widget-title {

  height: 1em;

  width: 100px;

  margin-bottom: var(--space-4);

  border-radius: var(--radius-sm);

}



.skeleton-quick-pick {

  display: flex;

  align-items: center;

  justify-content: space-between;

  padding: var(--space-2) 0;

  border-bottom: 1px solid var(--color-border);

}



.skeleton-quick-pick:last-child {

  border-bottom: none;

}



.skeleton-quick-pick .skeleton-pick-title {

  height: 0.875em;

  width: 60%;

  border-radius: var(--radius-sm);

}



.skeleton-quick-pick .skeleton-pick-score {

  height: 0.875em;

  width: 40px;

  border-radius: var(--radius-sm);

}



/* ==========================================================================

   六、对比表格骨架屏

   ========================================================================== */



.skeleton-table {

  width: 100%;

  border-collapse: collapse;

  border: 1px solid var(--color-border);

  border-radius: var(--radius-md);

  overflow: hidden;

}



.skeleton-table th,

.skeleton-table td {

  padding: var(--space-3) var(--space-4);

  border-bottom: 1px solid var(--color-border);

}



.skeleton-table th {

  background-color: var(--color-neutral-100);

}



.skeleton-table th .skeleton-th {

  height: 1em;

  width: 70%;

  border-radius: var(--radius-sm);

}



.skeleton-table td .skeleton-td {

  height: 0.875em;

  width: 90%;

  border-radius: var(--radius-sm);

}



.skeleton-table tr:last-child td {

  border-bottom: none;

}



/* ==========================================================================

   七、评论区骨架屏

   ========================================================================== */



.skeleton-reviews {

  margin-top: var(--rhythm-loose);

  padding-top: var(--rhythm-loose);

  border-top: 1px solid var(--color-border);

}



.skeleton-reviews .skeleton-reviews-title {

  height: 1.5em;

  width: 200px;

  margin-bottom: var(--rhythm-normal);

  border-radius: var(--radius-sm);

}



.skeleton-review-card {

  display: flex;

  gap: var(--space-4);

  padding: var(--space-5);

  background-color: var(--color-surface);

  border: 1px solid var(--color-border);

  border-radius: var(--radius-lg);

  margin-bottom: var(--space-4);

}



.skeleton-review-card .skeleton-review-avatar {

  width: 48px;

  height: 48px;

  border-radius: var(--radius-full);

  flex-shrink: 0;

}



.skeleton-review-card .skeleton-review-body {

  flex: 1;

  min-width: 0;

}



.skeleton-review-card .skeleton-review-header {

  display: flex;

  gap: var(--space-3);

  margin-bottom: var(--space-2);

}



.skeleton-review-card .skeleton-review-name {

  height: 1em;

  width: 100px;

  border-radius: var(--radius-sm);

}



.skeleton-review-card .skeleton-review-stars {

  height: 1em;

  width: 80px;

  border-radius: var(--radius-sm);

}



.skeleton-review-card .skeleton-review-text {

  height: 0.875em;

  width: 100%;

  margin-bottom: var(--space-2);

  border-radius: var(--radius-sm);

}



.skeleton-review-card .skeleton-review-text:last-of-type {

  width: 70%;

}



/* ==========================================================================

   八、封面图骨架屏

   ========================================================================== */



.skeleton-cover-container {

  aspect-ratio: 16 / 9;

  width: 100%;

  border-radius: var(--radius-lg);

  overflow: hidden;

  position: relative;

  background: linear-gradient(

    135deg,

    var(--color-neutral-100) 0%,

    var(--color-neutral-200) 50%,

    var(--color-neutral-100) 100%

  );

  background-size: 200% 200%;

  animation: skeletonShimmer var(--loading-shimmer) var(--ease-in-out) infinite;

}



.skeleton-cover-container .skeleton-cover-logo {

  position: absolute;

  top: 50%;

  left: 50%;

  transform: translate(-50%, -50%);

  width: 60px;

  height: 60px;

  border-radius: var(--radius-md);

  background-color: var(--color-neutral-300);

  opacity: 0.5;

}



/* ==========================================================================

   九、作者资历卡骨架屏

   ========================================================================== */



.skeleton-author-card {

  display: flex;

  align-items: center;

  gap: var(--space-4);

  padding: var(--space-4);

  background-color: var(--color-surface);

  border: 1px solid var(--color-border);

  border-radius: var(--radius-md);

  margin-bottom: var(--rhythm-normal);

}



.skeleton-author-card .skeleton-author-avatar {

  width: 48px;

  height: 48px;

  border-radius: var(--radius-full);

  flex-shrink: 0;

}



.skeleton-author-card .skeleton-author-info {

  flex: 1;

  min-width: 0;

}



.skeleton-author-card .skeleton-author-name {

  height: 1em;

  width: 120px;

  margin-bottom: var(--space-2);

  border-radius: var(--radius-sm);

}



.skeleton-author-card .skeleton-author-bio {

  height: 0.875em;

  width: 80%;

  border-radius: var(--radius-sm);

}



/* ==========================================================================

   十、文末推荐区块骨架屏

   ========================================================================== */



.skeleton-recommend {

  padding: var(--space-6);

  background-color: var(--color-surface);

  border: 1px solid var(--color-border);

  border-radius: var(--radius-lg);

  margin: var(--rhythm-loose) 0;

}



.skeleton-recommend .skeleton-recommend-title {

  height: 1.25em;

  width: 200px;

  margin-bottom: var(--rhythm-normal);

  border-radius: var(--radius-sm);

}



.skeleton-recommend .skeleton-recommend-item {

  height: 2.5em;

  width: 100%;

  margin-bottom: var(--space-2);

  border-radius: var(--radius-md);

}



/* ==========================================================================

   十一、导航栏骨架屏（用于首屏加载）

   ========================================================================== */



.skeleton-nav {

  height: 64px;

  background-color: var(--color-surface);

  border-bottom: 1px solid var(--color-border);

  display: flex;

  align-items: center;

  padding: 0 var(--gutter);

}



.skeleton-nav .skeleton-nav-logo {

  height: 1.5em;

  width: 120px;

  border-radius: var(--radius-sm);

}



.skeleton-nav .skeleton-nav-links {

  display: flex;

  gap: var(--space-4);

  margin-left: auto;

}



.skeleton-nav .skeleton-nav-link {

  height: 1em;

  width: 60px;

  border-radius: var(--radius-sm);

}



/* ==========================================================================

   十二、Hero区骨架屏（首页）

   ========================================================================== */



.skeleton-hero {

  padding: var(--rhythm-breath) 0;

  text-align: center;

}



.skeleton-hero .skeleton-hero-title {

  height: 3em;

  width: 80%;

  max-width: 800px;

  margin: 0 auto var(--rhythm-normal);

  border-radius: var(--radius-md);

}



.skeleton-hero .skeleton-hero-subtitle {

  height: 1.5em;

  width: 60%;

  max-width: 600px;

  margin: 0 auto var(--rhythm-loose);

  border-radius: var(--radius-sm);

}



.skeleton-hero .skeleton-hero-cta {

  height: 3em;

  width: 200px;

  margin: 0 auto;

  border-radius: var(--radius-md);

}



/* ==========================================================================

   十三、聚合页头部骨架屏

   ========================================================================== */



.skeleton-aggregation-header {

  padding: var(--rhythm-loose) 0;

}



.skeleton-aggregation-header .skeleton-breadcrumb {

  height: 1em;

  width: 300px;

  margin-bottom: var(--rhythm-normal);

  border-radius: var(--radius-sm);

}



.skeleton-aggregation-header .skeleton-h1 {

  height: 2.5em;

  width: 60%;

  margin-bottom: var(--rhythm-normal);

  border-radius: var(--radius-sm);

}



.skeleton-aggregation-header .skeleton-trust-bar {

  display: flex;

  gap: var(--space-4);

  margin-bottom: var(--rhythm-loose);

}



.skeleton-aggregation-header .skeleton-trust-item {

  height: 1em;

  width: 120px;

  border-radius: var(--radius-sm);

}



.skeleton-aggregation-header .skeleton-intro {

  height: 1em;

  width: 100%;

  margin-bottom: var(--space-2);

  border-radius: var(--radius-sm);

}



.skeleton-aggregation-header .skeleton-intro:last-of-type {

  width: 70%;

}



/* ==========================================================================

   十四、L3页面骨架屏

   ========================================================================== */



.skeleton-l3 {

  max-width: var(--reading-max-width);

  margin: 0 auto;

  padding: var(--rhythm-loose) 0;

}



.skeleton-l3 .skeleton-l3-badge {

  height: 1.5em;

  width: 100px;

  margin-bottom: var(--rhythm-normal);

  border-radius: var(--radius-full);

}



.skeleton-l3 .skeleton-l3-title {

  height: 2.5em;

  width: 85%;

  margin-bottom: var(--rhythm-normal);

  border-radius: var(--radius-sm);

}



.skeleton-l3 .skeleton-l3-framework {

  height: 6em;

  width: 100%;

  margin: var(--rhythm-loose) 0;

  border-radius: var(--radius-lg);

}



.skeleton-l3 .skeleton-l3-paragraph {

  height: 1em;

  width: 100%;

  margin-bottom: var(--space-2);

  border-radius: var(--radius-sm);

}



.skeleton-l3 .skeleton-l3-paragraph:last-of-type {

  width: 60%;

}



/* ==========================================================================

   十五、加载状态文案

   ========================================================================== */



.skeleton-loading-text {

  text-align: center;

  padding: var(--rhythm-loose) 0;

  color: var(--color-text-tertiary);

  font-size: var(--text-sm);

}



.skeleton-loading-text::after {

  content: '';

  display: inline-block;

  width: 12px;

  height: 12px;

  margin-left: var(--space-2);

  border: 2px solid var(--color-neutral-300);

  border-top-color: var(--color-primary-500);

  border-radius: var(--radius-full);

  animation: spin 0.8s linear infinite;

  vertical-align: middle;

}



/* ==========================================================================

   十六、移动端骨架屏简化

   ========================================================================== */



@media (max-width: 768px) {

  .skeleton-article-body .skeleton-paragraph .skeleton-line:nth-child(3) {

    display: none;

  }



  .skeleton-hero .skeleton-hero-title {

    height: 2em;

    width: 90%;

  }



  .skeleton-article-list {

    grid-template-columns: 1fr;

  }



  .skeleton-article-card .skeleton-summary:last-of-type {

    display: none;

  }



  .skeleton-table {

    font-size: var(--text-xs);

  }

}



/* ==========================================================================

   十七、减少动效偏好

   ========================================================================== */



@media (prefers-reduced-motion: reduce) {

  .skeleton,

  .skeleton-cover-container {

    animation: none;

    background: var(--skeleton-bg);

  }



  .skeleton-loading-text::after {

    animation: none;

  }

}



/* ==========================================================================

   十八、骨架屏与内容过渡

   ========================================================================== */



/* 内容加载完成后，骨架屏平滑淡出 */

.skeleton-container {

  position: relative;

}



.skeleton-container .skeleton-overlay {

  position: absolute;

  inset: 0;

  transition: opacity var(--duration-slow) var(--ease-out);

}



.skeleton-container.loaded .skeleton-overlay {

  opacity: 0;

  pointer-events: none;

}



.skeleton-container .skeleton-content {

  opacity: 0;

  transition: opacity var(--duration-slow) var(--ease-out);

}



.skeleton-container.loaded .skeleton-content {

  opacity: 1;

}



/* ==========================================================================

   skeleton.css 结束

   ========================================================================== */