/* Shared channel tabs / tags filters (H5 + PC)
 *
 * Override on a parent (e.g. .post-static):
 *   --cf-accent  #ecd227
 *   --cf-ink     #0d0d0d
 *   --cf-muted   rgba(255, 255, 255, 0.55)
 *   --cf-text    #fff
 */

/* ========== Tabs ========== */
.channel-tabs {
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 12px;
}

.channel-tabs__list {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.channel-tabs__expand {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 0 0 auto;
  background: var(--cf-accent, #ecd227);
  color: var(--cf-ink, #0d0d0d);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.channel-tabs__expand[hidden] {
  display: none !important;
}

.channel-tabs__expand img {
  display: block;
  filter: brightness(0);
  transition: transform 0.2s ease;
}

.channel-tabs.is-expanded .channel-tabs__expand img {
  transform: rotate(180deg);
}

.channel-tab {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: 12px;
  color: var(--cf-muted, rgba(255, 255, 255, 0.55));
  font-weight: 400;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.channel-tab--active {
  color: var(--cf-accent, #ecd227);
  font-weight: 600;
}

.channel-tab--active::after {
  content: "";
  position: absolute;
  left: 50%;
  border-radius: 2px;
  background: var(--cf-accent, #ecd227);
  box-shadow: 0 0 10px 4px rgba(245, 225, 0, 0.55);
}

/* ========== Tags ========== */
.channel-tags {
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 12px;
}

.channel-tags__list {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.channel-tags__expand {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 0 0 auto;
  background: var(--cf-accent, #ecd227);
  color: var(--cf-ink, #0d0d0d);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.channel-tags__expand[hidden] {
  display: none !important;
}

.channel-tags__expand img {
  display: block;
  filter: brightness(0);
  transition: transform 0.2s ease;
}

.channel-tags.is-expanded .channel-tags__expand img {
  transform: rotate(180deg);
}

/* ==========================================================================
   H5
   ========================================================================== */
@media (max-width: 768px) {
  .channel-tab {
    padding: 5px 8px;
    font-size: 14px;
    line-height: 20px;
  }

  .channel-tab--active {
    font-weight: 400;
  }

  .channel-tab--active::after {
    bottom: 2px;
    width: 16px;
    height: 2px;
    margin-left: -8px;
  }

  /* Tabs / Tags: 单行裁切 + 展开收起，禁止横向滚动；H5 展开按钮仅图标 */
  .channel-tabs,
  .channel-tags {
    position: relative;
    gap: 0;
    align-items: flex-start;
  }

  .channel-tags {
    align-items: center;
  }

  .channel-tabs__list {
    overflow: hidden;
    max-height: 30px;
  }

  .channel-tags__list {
    overflow: hidden;
    max-height: 26px; /* 4 + 18 + 4 */
    gap: 8px;
    align-items: center;
  }

  .channel-tag,
  .tag-link.channel-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 4px 10px;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--cf-muted, rgba(255, 255, 255, 0.55));
    font-size: 12px;
    line-height: 18px;
    font-weight: 400;
    gap: 10px;
    text-decoration: none;
  }

  .channel-tag:hover,
  .tag-link.channel-tag:hover {
    border: 0;
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.75);
  }

  .channel-tag.is-active,
  .tag-link.channel-tag.is-active {
    border: 0;
    outline: none;
    background: var(--cf-accent, #ecd227);
    color: var(--cf-ink, #0d0d0d);
  }

  .channel-tabs.has-tabs-overflow .channel-tabs__list,
  .channel-tags.has-tags-overflow .channel-tags__list {
    padding-right: 32px;
  }

  .channel-tags.has-tags-overflow:not(.is-expanded) .channel-tags__list {
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 88%, transparent 100%);
  }

  .channel-tabs.is-expanded .channel-tabs__list,
  .channel-tags.is-expanded .channel-tags__list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }

  /* H5 展开：与未展开标签间距一致（8px） */
  .channel-tags.is-expanded {
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    align-content: flex-start;
    gap: 8px;
  }

  .channel-tags.is-expanded .channel-tags__list {
    display: contents;
  }

  .channel-tabs__expand,
  .channel-tags__expand {
    position: absolute;
    right: 0;
    top: 3px;
    width: 24px;
    height: 24px;
    padding: 4px;
    border-radius: 6px;
    outline: none;
    box-shadow: none;
  }

  .channel-tags__expand {
    top: 1px;
  }

  .channel-tabs__expand-label,
  .channel-tags__expand-label {
    display: none !important;
  }

  .channel-tabs__expand img,
  .channel-tags__expand img {
    width: 16px;
    height: 16px;
    transform: rotate(-90deg);
  }

  .channel-tabs.is-expanded .channel-tabs__expand {
    position: static;
    margin-top: 8px;
    box-shadow: none;
  }

  .channel-tabs.is-expanded .channel-tabs__expand img {
    transform: rotate(180deg);
  }

  /* H5 tabs 展开 */
  .channel-tabs.is-expanded {
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    align-content: flex-start;
  }

  .channel-tabs.is-expanded .channel-tabs__list {
    display: contents;
  }

  .channel-tabs.is-expanded .channel-tabs__expand {
    margin-top: 0;
  }

  .channel-tags.is-expanded .channel-tags__expand {
    position: static;
    margin: 0;
    width: 44px;
    min-width: 44px;
    height: auto;
    padding: 5px 4px;
    border-radius: 6px;
    gap: 0;
    justify-content: flex-start;
    box-shadow: none;
  }

  .channel-tags.is-expanded .channel-tags__expand-label {
    display: inline !important;
    color: var(--cf-ink, #0d0d0d);
    font-size: 10px;
    line-height: 16px;
    font-weight: 400;
  }

  .channel-tags.is-expanded .channel-tags__expand img {
    width: 16px;
    height: 16px;
    transform: rotate(180deg);
  }
}

/* ==========================================================================
   PC
   ========================================================================== */
@media (min-width: 769px) {
  .channel-tab {
    padding: 12px 24px;
    font-size: 18px;
    line-height: 24px;
  }

  .channel-tab--active::after {
    width: 18px;
    height: 4px;
    margin-left: -9px;
    bottom: 8px;
  }

  .channel-tabs {
    justify-content: space-between;
    align-items: flex-start;
  }

  .channel-tabs__list {
    gap: 0;
    max-height: 48px;
    overflow: hidden;
  }

  .channel-tabs.is-expanded .channel-tabs__list {
    max-height: none;
  }

  .channel-tabs__expand {
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 16px;
    line-height: 22px;
  }

  .channel-tabs__expand-label {
    display: inline;
    color: var(--cf-ink, #0d0d0d);
  }

  .channel-tabs__expand img {
    width: 12px;
    height: 12px;
  }

  /* PC tabs 展开：与标签一致，换行流 + 间距 */
  .channel-tabs.is-expanded {
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    align-content: flex-start;
    gap: 0 0;
    row-gap: 0;
  }

  .channel-tabs.is-expanded .channel-tabs__list {
    display: contents;
    max-height: none;
  }

  .channel-tabs.is-expanded .channel-tabs__expand {
    position: static;
    margin: 0;
    flex: 0 0 auto;
  }

  .channel-tags {
    justify-content: space-between;
    align-items: center;
  }

  .channel-tags__list {
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    max-height: 36px; /* 6 + 24 + 6 */
    overflow: hidden;
  }

  .channel-tag,
  .tag-link.channel-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 6px 18px;
    border: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    outline: 1px solid rgba(255, 255, 255, 0.1);
    outline-offset: -1px;
    color: var(--cf-muted, rgba(255, 255, 255, 0.55));
    font-size: 18px;
    line-height: 24px;
    font-weight: 400;
    gap: 10px;
    text-decoration: none;
  }

  .channel-tag:hover,
  .tag-link.channel-tag:hover {
    border: 0;
    background: rgba(255, 255, 255, 0.08);
    outline-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.75);
  }

  .channel-tag.is-active,
  .tag-link.channel-tag.is-active {
    border: 0;
    background: var(--cf-accent, #ecd227);
    outline-color: var(--cf-accent, #ecd227);
    color: var(--cf-ink, #0d0d0d);
  }

  .channel-tags__expand {
    min-width: 72px;
    height: auto;
    padding: 7px 10px;
    border-radius: 9px;
    outline: 1px solid #fff;
    outline-offset: -1px;
    font-size: 16px;
    line-height: 22px;
    gap: 2px;
  }

  .channel-tags__expand-label {
    display: inline;
    color: var(--cf-ink, #0d0d0d);
  }

  .channel-tags__expand img {
    width: 12px;
    height: 12px;
  }

  /* PC 展开：与未展开标签间距一致（12px） */
  .channel-tags.is-expanded {
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    align-content: flex-start;
    gap: 12px;
  }

  .channel-tags.is-expanded .channel-tags__list {
    display: contents;
    max-height: none;
  }

  .channel-tags.is-expanded .channel-tags__expand {
    position: static;
    margin: 0;
    flex: 0 0 auto;
  }

  .channel-tags.is-expanded .channel-tags__expand img {
    transform: rotate(180deg);
  }
}
