/* @templates — 首页组件样式 */

.page-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 快捷导航图标 */
.nav-icons {
  display: flex;
  align-items: flex-start;
  padding: 18px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
}

.nav-icons__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 110px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.nav-icons__item:hover {
  opacity: 0.8;
}

.nav-icons__icon {
  width: 38px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icons__icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.nav-icons__label {
  font-size: 14px;
  line-height: 24px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

/* 热门城市 */
.city-filter {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-height: 92px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.city-filter__heading {
  display: none;
}

.city-filter__body {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  max-width: 1106px;
  min-height: 68px;
  margin: 0 auto;
}

.city-filter__label {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 102px;
  height: 24px;
  font-size: 14px;
  font-weight: 700;
  line-height: 24px;
  color: var(--text-secondary);
}

.city-filter__city {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 102px;
  height: 24px;
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  color: #292929;
  cursor: pointer;
  transition: color 0.2s, font-weight 0.2s;
}

.city-filter__city:hover {
  color: var(--primary);
}

.city-filter__city.is-active {
  color: var(--primary);
  font-weight: 600;
}

.city-filter__empty {
  font-size: 14px;
  line-height: 22px;
  color: #8c8c8c;
}

.card-grid__empty {
  grid-column: 1 / -1;
  margin: 24px 0;
  text-align: center;
  font-size: 14px;
  line-height: 22px;
  color: #8c8c8c;
}

.city-filter__more-wrap {
  display: none;
  flex-basis: 100%;
  justify-content: center;
  margin-top: 12px;
}

.city-filter__more-wrap.is-visible {
  display: flex;
}

.city-filter__more {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 114px;
  height: 32px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid var(--primary);
  border-radius: 32px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.04);
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.city-filter__more:hover {
  background: rgba(236, 72, 153, 0.05);
}

.city-filter__more-icon {
  display: block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.city-filter__more-text {
  flex: 1;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}

.city-filter__more-text::before {
  content: none;
}

/* H5 区块标题 */
.section-header-h5 {
  display: none;
}

/* 列表广告横幅 */
.list-banner {
  display: none;
}

/* 排序标签 */
.sort-tabs {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
}

.sort-tabs__list {
  display: flex;
  padding: 0 12px;
}

.sort-tabs__item {
  position: relative;
  padding: 13px 16px;
  font-size: 14px;
  line-height: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.sort-tabs__item:hover {
  color: var(--primary);
}

.sort-tabs__item--active {
  color: var(--text-secondary);
  font-weight: 500;
}

.sort-tabs__item--active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 6px;
  right: 6px;
  height: 2px;
  background: var(--primary);
}

/* 内容卡片网格 — 3 列 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.content-card {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 176px;
}

a.content-card {
  text-decoration: none;
  color: inherit;
}

article.content-card:not(.content-card--ad):not(.content-card--merchant),
a.content-card:not(.content-card--ad):not(.content-card--merchant) {
  cursor: pointer;
}

.content-card__body {
  flex: 1;
  min-width: 0;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.content-card__title {
  font-size: 16px;
  line-height: 24px;
  color: var(--text-primary);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
}

.content-card__meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.content-card__meta-item img {
  width: 15px;
  height: 12px;
}

.content-card__desc {
  font-size: 14px;
  line-height: 24px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.content-card__location {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 14px;
  line-height: 24px;
  color: var(--primary);
}

.content-card__location img {
  width: 14px;
  height: 14px;
}

.content-card__thumb {
  width: 114px;
  flex-shrink: 0;
  padding: 12px 12px 12px 0;
}

.content-card__thumb img {
  width: 114px;
  height: 152px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #d1d5db;
}

/* 电报推广广告 */
.content-card--ad .content-card__body {
  padding-top: 32px;
}

.content-card--ad .content-card__ad-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.content-card--ad .content-card__ad-tag {
  padding: 2px 8px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 11.2px;
}

.content-card--ad .content-card__ad-name {
  color: var(--primary);
  font-size: 14px;
}

.content-card--ad .content-card__thumb {
  width: 190px;
}

.content-card--ad .content-card__thumb img {
  width: 190px;
}

/* 商家广告卡片 */
.content-card--merchant {
  height: 176px;
}

.content-card--merchant .content-card__body {
  padding: 12px;
  gap: 0;
  justify-content: space-between;
}

.content-card--merchant .content-card__title {
  margin-bottom: 15px;
}

.content-card--merchant .content-card__desc {
  flex: none;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 48px; /* 2 × 24px line-height */
}

.content-card--merchant .content-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.content-card--merchant .content-card__location {
  margin-top: 0;
  min-width: 0;
}

.content-card--merchant .content-card__merchant-tag {
  flex-shrink: 0;
  padding: 5px 8px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 11.2px;
  line-height: 13.5px;
}

.content-card--merchant .content-card__thumb {
  width: 190px;
  padding: 12px 12px 12px 0;
}

.content-card--merchant .content-card__thumb img {
  width: 190px;
  height: 152px;
}

/* ===== H5: index-h5.css ===== */

/* @templates — H5 首页适配 */

@media (max-width: 767px) {
  body {
    background: var(--bg-h5);
  }

  .page-main {
    padding: 0;
  }

  .container.page-content {
    max-width: none;
    padding: 0;
    gap: 0;
  }

  /* 快捷导航 4×2 */
  .nav-icons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 0;
  }

  .nav-icons__item {
    min-width: 0;
    padding: 8px;
    gap: 8px;
  }

  .nav-icons__icon {
    width: 38px;
    height: 38px;
  }

  .nav-icons__icon img {
    width: 34px;
    height: 34px;
  }

  .nav-icons__label {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-title);
    white-space: normal;
  }

  /* 热门城市 */
  .city-filter {
    min-height: 0;
    padding: 16px;
    margin-top: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--bg-card);
    gap: 12px;
  }

  .city-filter__heading {
    display: block;
    align-self: stretch;
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-title);
  }

  .city-filter__body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 8px;
    max-width: none;
    min-height: 0;
    margin: 0;
  }

  .city-filter__label {
    display: none;
  }

  .city-filter__city {
    width: auto;
    height: auto;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e5e5e5;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    color: #292929;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, font-weight 0.2s;
  }

  .city-filter__city--pc-only {
    display: none;
  }

  .city-filter__city:hover {
    background: #e5e5e5;
    color: #292929;
  }

  .city-filter__city.is-active {
    background: var(--tag-bg);
    color: var(--tag-red);
    font-weight: 500;
  }

  .city-filter__city.is-active:hover {
    background: var(--tag-bg);
    color: var(--tag-red);
  }

  .city-filter__more-wrap {
    display: none;
    margin: 0;
  }

  .city-filter__more-wrap.is-visible {
    display: contents;
  }

  .city-filter__more {
    width: auto;
    height: auto;
    margin: 0;
    padding: 6px 12px;
    border: none;
    border-radius: 999px;
    box-shadow: none;
    background: var(--tag-bg);
    color: var(--tag-red);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    gap: 0;
  }

  .city-filter__more:hover {
    background: var(--tag-bg);
  }

  .city-filter__more-icon {
    display: none;
  }

  .city-filter__more-text {
    flex: none;
    text-align: left;
  }

  .city-filter__more-text::before {
    content: "+ ";
  }

  /* 列表区 */
  .page-section {
    gap: 0;
    background: var(--bg-h5);
  }

  .section-header-h5 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-h5);
  }

  .section-header-h5__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-title);
  }

  .section-header-h5__filter-wrap {
    position: relative;
  }

  .section-header-h5__filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--tag-bg);
    border: none;
    border-radius: 999px;
    font-size: 13px;
    color: var(--tag-red);
    cursor: pointer;
    font-family: inherit;
  }

  .section-header-h5__filter-arrow {
    font-size: 10px;
    line-height: 1;
  }

  .section-header-h5__filter[aria-expanded="true"] .section-header-h5__filter-arrow {
    transform: rotate(180deg);
  }

  .section-header-h5__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    width: 80px;
    padding-top: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    box-shadow:
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 6px 16px rgba(0, 0, 0, 0.08),
      0 9px 28px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
  }

  .section-header-h5__dropdown[hidden] {
    display: none;
  }

  .section-header-h5__dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: none;
    background: transparent;
    font-size: 12px;
    line-height: 16.5px;
    color: #4b5563;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
  }

  .section-header-h5__dropdown-item:hover,
  .section-header-h5__dropdown-item.is-active {
    background: rgba(236, 72, 153, 0.06);
    color: var(--primary);
  }

  .sort-tabs {
    display: none;
  }

  /* 卡片列表 */
  .card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 16px 16px;
    background: var(--bg-h5);
  }

  .content-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    min-height: 0;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .content-card__thumb {
    order: -1;
    width: 96px;
    padding: 0;
  }

  .content-card__thumb img {
    width: 96px;
    height: 128px;
    border-radius: 8px;
  }

  .content-card__body {
    padding: 0;
    gap: 6px;
  }

  .content-card__title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-title);
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .content-card__meta {
    justify-content: space-between;
    width: 100%;
    color: var(--text-placeholder);
    font-size: 12px;
  }

  .content-card__meta-item img {
    display: none;
  }

  .content-card__meta-item:last-child {
    margin-left: auto;
  }

  .content-card__meta-item:last-child span::after {
    content: "浏览";
  }

  .content-card__desc {
    font-size: 13px;
    line-height: 1.5;
    -webkit-line-clamp: 2;
  }

  .content-card__location {
    margin-top: 0;
    font-size: 12px;
    font-weight: 500;
    gap: 4px;
  }

  .content-card__location img {
    display: none;
  }

  .content-card__location span::before {
    content: "📍 ";
  }

  /* 广告 / 商家卡片 H5 */
  .content-card--ad,
  .content-card--merchant {
    height: auto;
  }

  .content-card--ad .content-card__body,
  .content-card--merchant .content-card__body {
    padding: 0;
  }

  .content-card--ad .content-card__thumb,
  .content-card--merchant .content-card__thumb {
    width: 96px;
  }

  .content-card--ad .content-card__thumb img,
  .content-card--merchant .content-card__thumb img {
    width: 96px;
    height: 128px;
  }

  /* 横幅广告 */
  .list-banner {
    display: block;
    position: relative;
    width: 100%;
    border-radius: 9px;
    overflow: hidden;
  }

  .list-banner__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 343 / 143;
    object-fit: cover;
  }

  .list-banner__dots {
    position: absolute;
    right: 12px;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .list-banner__dot {
    width: 4px;
    height: 4px;
    border-radius: 3px;
    background: var(--primary);
    opacity: 0.5;
  }

  .list-banner__dot--active {
    width: 8px;
    opacity: 1;
  }

  /* 底部 */
  .site-footer {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  }
}
