/**
 * 拾光主题 · 分类页样式
 * 卡片样式已在 cards.css
 */

/* ============================================================
   页面容器
   ============================================================ */

.sg-cat-page{
  position: relative;
  z-index: 1;
  padding-bottom: 100px;
}

/* ============================================================
   Hero
   ============================================================ */

.sg-cat-hero-wrap{ padding: 40px 0 0; }

.sg-cat-hero{
  position: relative;
  padding: 48px 52px 44px;
  border-radius: 32px;
  background: var(--sg-brand);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(59, 91, 253, .26);
}

.sg-cat-hero::before{
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, .28), transparent 45%),
    radial-gradient(circle at 90% 90%, rgba(255, 255, 255, .1), transparent 50%);
  pointer-events: none;
}

.sg-cat-hero::after{
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(circle at 20% 30%, black, transparent 75%);
  mask-image: radial-gradient(circle at 20% 30%, black, transparent 75%);
  pointer-events: none;
}

.sg-cat-hero-inner{
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 60px;
  align-items: center;
  margin-bottom: 36px;
}

.sg-cat-hero-content{ min-width: 0; }

.sg-cat-hero-label{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  letter-spacing: .04em;
  background: rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 100px;
  margin-bottom: 22px;
  text-transform: uppercase;
}

.sg-cat-hero-title{
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -.038em;
  color: #fff;
  line-height: 1.02;
  margin-bottom: 16px;
}

.sg-cat-hero-desc{
  font-size: 15.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .82);
  max-width: 560px;
}

/* 右侧装饰 */
.sg-cat-hero-deco{
  position: relative;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sg-cat-deco-ring{
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .32);
  box-shadow:
    inset 0 0 30px rgba(255, 255, 255, .15),
    0 0 40px rgba(255, 255, 255, .1);
}

.sg-cat-deco-ring::before{
  content: '';
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
}

.sg-cat-deco-ring::after{
  content: '';
  position: absolute;
  inset: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .15);
}

.sg-cat-deco-center{
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .2);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .5),
    0 12px 32px rgba(0, 0, 0, .2);
}

.sg-cat-deco-dot{
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .75);
  box-shadow: 0 0 12px rgba(255, 255, 255, .8);
}

.sg-cat-deco-dot.d1{ top: 12px; left: 50%; margin-left: -4px; animation: sg-pulse 2s ease-in-out infinite; }
.sg-cat-deco-dot.d2{ bottom: 12px; left: 50%; margin-left: -4px; animation: sg-pulse 2s ease-in-out infinite .5s; }
.sg-cat-deco-dot.d3{ left: 12px; top: 50%; margin-top: -4px; animation: sg-pulse 2s ease-in-out infinite 1s; }
.sg-cat-deco-dot.d4{ right: 12px; top: 50%; margin-top: -4px; animation: sg-pulse 2s ease-in-out infinite 1.5s; }

@keyframes sg-pulse{
  0%, 100% { opacity: .4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.35); }
}

/* 统计条 */
.sg-cat-hero-stats{
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, .16);
}

.sg-cat-stat{
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.sg-cat-stat-num{
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: #fff;
  line-height: 1;
}

.sg-cat-stat-label{
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, .72);
  letter-spacing: .01em;
}

/* ============================================================
   工具条
   ============================================================ */

.sg-cat-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 36px 0 24px;
  gap: 16px;
  position: relative;
  z-index: 20;
}

.sg-cat-result-count{
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sg-text-3);
  letter-spacing: .01em;
}

.sg-cat-toolbar-actions{
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 排序下拉 */
.sg-sort-wrap{
  position: relative;
  z-index: 30;
}

.sg-sort-btn{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sg-text-2);
  background: rgba(255, 255, 255, .75);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--sg-glass-border);
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--sg-dur-base) var(--sg-ease);
  box-shadow: var(--sg-shadow-sm);
}

.sg-sort-btn:hover{
  color: var(--sg-text);
  box-shadow: var(--sg-shadow-md);
}

.sg-sort-btn svg{
  transition: transform var(--sg-dur-base) var(--sg-ease);
}

.sg-sort-wrap.open .sg-sort-btn svg{
  transform: rotate(180deg);
}

.sg-sort-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 6px;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(40px);
  backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 16px;
  box-shadow: 0 20px 52px rgba(0, 0, 0, .12), 0 4px 12px rgba(0, 0, 0, .05);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all var(--sg-dur-base) var(--sg-ease);
  z-index: 100;
}

.sg-sort-wrap.open .sg-sort-menu{
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sg-sort-item{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border: none;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--sg-text);
  cursor: pointer;
  background: transparent;
  transition: background var(--sg-dur-fast) var(--sg-ease);
  text-align: left;
}

.sg-sort-item:hover{
  background: rgba(0, 0, 0, .045);
}

.sg-sort-item svg{
  opacity: 0;
  transition: opacity var(--sg-dur-fast) var(--sg-ease);
  color: var(--sg-accent);
}

.sg-sort-item.active{
  color: var(--sg-accent);
  font-weight: 600;
}

.sg-sort-item.active svg{
  opacity: 1;
}

/* 视图切换 */
.sg-view-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sg-text);
  background: rgba(255, 255, 255, .75);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--sg-glass-border);
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--sg-dur-base) var(--sg-ease);
  box-shadow: var(--sg-shadow-sm);
  position: relative;
  overflow: hidden;
}

.sg-view-btn::before{
  content: '';
  position: absolute;
  inset: 0;
  background: var(--sg-brand);
  opacity: 0;
  transition: opacity var(--sg-dur-base) var(--sg-ease);
  border-radius: inherit;
}

.sg-view-btn:hover{
  box-shadow: var(--sg-shadow-md);
}

.sg-view-btn:active{
  transform: scale(.97);
}

.sg-view-btn.switching{
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(59, 91, 253, .32);
}

.sg-view-btn.switching::before{
  opacity: 1;
}

.sg-view-icon{
  position: relative;
  z-index: 1;
  width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sg-accent);
  transition: color var(--sg-dur-base) var(--sg-ease);
}

.sg-view-label{
  position: relative;
  z-index: 1;
  transition: color var(--sg-dur-base) var(--sg-ease);
}

.sg-view-btn.switching .sg-view-icon{
  color: #fff;
}

/* ============================================================
   视图
   ============================================================ */

.sg-cat-view{
  position: relative;
  z-index: 1;
}

/* 贴图分类：瀑布流 4 列 */
.sg-cat-masonry{
  column-count: 4;
}

/* 非贴图分类：文章卡片 2 列网格 */
.sg-cat-article-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 20px;
}

/* ★ 网格里 .sg-article-card 覆盖为纵向布局 */
.sg-cat-article-grid .sg-article-card{
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--sg-r-md);
}

.sg-cat-article-grid .sg-article-thumb{
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 0;
}

.sg-cat-article-grid .sg-article-body{
  padding: 16px 18px 18px;
}

.sg-cat-article-grid .sg-article-title{
  font-size: 15.5px;
  -webkit-line-clamp: 2;
}

.sg-cat-article-grid .sg-article-excerpt{
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  white-space: normal;
  margin-top: 6px;
}

.sg-cat-article-grid .sg-article-arrow{
  display: none;
}

/* ============================================================
   分页
   ============================================================ */

.sg-cat-pagination-wrap{
  padding-top: 40px;
  display: flex;
  justify-content: center;
}

.sg-cat-pagination{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.sg-page-item{
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, .75);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--sg-glass-border);
  border-radius: 12px;
  color: var(--sg-text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: all var(--sg-dur-base) var(--sg-ease);
  box-shadow: var(--sg-shadow-sm);
}

.sg-page-item:hover{
  color: var(--sg-text);
  box-shadow: var(--sg-shadow-md);
  border-color: rgba(10, 132, 255, .2);
}

.sg-page-item.active{
  color: #fff;
  background: var(--sg-brand);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(59, 91, 253, .32);
}

.sg-page-item.active:hover{ color: #fff; }

.sg-page-item.disabled{
  opacity: .4;
  pointer-events: none;
}

.sg-page-ellipsis{
  min-width: 28px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sg-text-3);
  font-size: 13.5px;
  font-weight: 600;
  user-select: none;
}

/* PC 隐藏加载更多 */
.sg-cat-load-more-wrap{ display: none; }

/* ============================================================
   加载更多
   ============================================================ */

.sg-cat-load-more{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 30px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--sg-text);
  background: var(--sg-glass-bg-strong);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  border: 1px solid var(--sg-glass-border);
  border-radius: 100px;
  cursor: pointer;
  box-shadow: var(--sg-shadow-sm);
  transition: all var(--sg-dur-base) var(--sg-ease);
}

.sg-cat-load-more:hover{
  transform: translateY(-2px);
  box-shadow: var(--sg-shadow-md);
  border-color: rgba(10, 132, 255, .28);
  color: var(--sg-accent);
}

.sg-cat-load-more:active{ transform: scale(.97); }
.sg-cat-load-more.loading{ opacity: .7; pointer-events: none; }
.sg-cat-load-more.loading svg{ animation: sg-cat-spin 1s linear infinite; }

@keyframes sg-cat-spin{ to { transform: rotate(360deg); } }

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 1180px){
  .sg-cat-masonry{ column-count: 3; }
  .sg-cat-hero{ padding: 40px 40px 36px; }
  .sg-cat-hero-inner{ grid-template-columns: 1fr 220px; gap: 40px; }
  .sg-cat-hero-title{ font-size: 44px; }
}

@media (max-width: 900px){
  .sg-cat-hero-inner{ grid-template-columns: 1fr; gap: 0; }
  .sg-cat-hero-deco{ display: none; }
  .sg-cat-hero{ padding: 32px 32px 28px; border-radius: 24px; }
  .sg-cat-hero-title{ font-size: 36px; }
  .sg-cat-hero-desc{ font-size: 14px; }
  .sg-cat-hero-stats{ grid-template-columns: repeat(3, 1fr); gap: 14px; padding-top: 24px; }
  .sg-cat-stat{ flex-direction: column; gap: 4px; align-items: flex-start; }
  .sg-cat-stat-num{ font-size: 24px; }
  .sg-cat-stat-label{ font-size: 11px; }

  .sg-cat-masonry{ column-count: 2; column-gap: 14px; }
  .sg-cat-masonry > .sg-card{ margin-bottom: 14px; }

  .sg-cat-article-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px){

  .sg-cat-page{
    padding-bottom: calc(64px + 40px + env(safe-area-inset-bottom, 0px));
  }

  .sg-cat-hero-wrap{ padding: 20px 0 0; }

  .sg-cat-hero{
    padding: 22px 22px 20px;
    border-radius: 22px;
    box-shadow: 0 12px 32px rgba(59, 91, 253, .24);
  }

  .sg-cat-hero-label{
    padding: 4px 10px;
    font-size: 10px;
    margin-bottom: 14px;
  }

  .sg-cat-hero-title{
    font-size: 26px;
    letter-spacing: -.028em;
    line-height: 1.1;
    margin-bottom: 8px;
  }

  .sg-cat-hero-desc{
    font-size: 12.5px;
    line-height: 1.55;
  }

  .sg-cat-hero-inner{ margin-bottom: 0; }

  .sg-cat-hero-stats{
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .16);
  }

  .sg-cat-stat{ flex-direction: column; align-items: flex-start; gap: 3px; }
  .sg-cat-stat-num{ font-size: 20px; }
  .sg-cat-stat-label{ font-size: 10px; }

  .sg-cat-toolbar{ padding: 20px 0 14px; }
  .sg-cat-result-count{ font-size: 12px; }

  .sg-sort-btn,
  .sg-view-btn{ padding: 7px 12px; font-size: 12.5px; }

  .sg-view-label{ display: none; }
  .sg-view-btn{ padding: 7px 10px; }

  .sg-cat-masonry{ column-count: 2; column-gap: 10px; }
  .sg-cat-masonry > .sg-card{ margin-bottom: 10px; }

  .sg-cat-article-grid{
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sg-cat-article-grid .sg-article-card{
    flex-direction: row;
    padding: 14px 16px;
    gap: 14px;
    border-radius: 16px;
  }

  .sg-cat-article-grid .sg-article-thumb{
    width: 76px;
    aspect-ratio: 4 / 3;
    border-radius: 11px;
    flex-shrink: 0;
  }

  .sg-cat-article-grid .sg-article-body{ padding: 0; }
  .sg-cat-article-grid .sg-article-title{ font-size: 14px; margin-bottom: 4px; }
  .sg-cat-article-grid .sg-article-excerpt{ display: none; }

  /* 分页 / 加载更多切换 */
  .sg-cat-pagination{ display: none; }

  .sg-cat-load-more-wrap{
    display: flex;
    justify-content: center;
    padding-top: 24px;
  }

  .sg-cat-pagination-wrap{ padding-top: 24px; }
}

@media (max-width: 480px){
  .sg-cat-hero{ padding: 18px 18px 16px; }
  .sg-cat-hero-title{ font-size: 22px; }
  .sg-cat-stat-num{ font-size: 18px; }
}