/* ==========================================================================
   resources.css — Resources 列表页 / 文章详情页
   前缀：rs-
   依赖：tokens.css（变量 / 排版 / 按钮）、products.css（面包屑 / cat-hero / qa）
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 容器与栅格安全网
   -------------------------------------------------------------------------- */

/* 详情页与页脚容器在 992–1239px 视口需要多 24px 内边距，
   否则 g-lg-5 的负边距会把内容推出视口（同 product-single / projects 的处理）。 */
@media (min-width: 992px) and (max-width: 1239px) {
  .rs-page > .cat-hero > .container,
  .rs-page > .section > .container,
  .rs-page > .cta > .container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

.rs-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   2. 列表页首屏补充
   -------------------------------------------------------------------------- */

.rs-page .cat-hero__title {
  max-width: 26ch;
}

.rs-single .rs-hero__title {
  max-width: 30ch;
}

.rs-hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.rs-tag {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.rs-tag:hover,
.rs-tag:focus-visible {
  border-color: var(--orange);
  color: var(--orange-dark);
}

.rs-hero__lead {
  max-width: 62ch;
  margin-top: 16px;
}

.rs-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.rs-hero__meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rs-hero__meta dd {
  margin: 2px 0 0;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
}

.rs-hero__media {
  margin: 0;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--bg);
}

.rs-hero__media img {
  width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   3. 列表头：筛选条 + 结果行
   -------------------------------------------------------------------------- */

.rs-list-title {
  margin-bottom: 20px;
}

.rs-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.rs-filter__label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rs-filter__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.rs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.rs-chip:hover,
.rs-chip:focus-visible {
  border-color: var(--navy);
  color: var(--navy);
}

.rs-chip.is-active {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--on-dark);
}

.rs-chip__count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.rs-chip.is-active .rs-chip__count {
  color: var(--on-dark-muted);
}

.rs-result {
  margin: 16px 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.rs-result a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rs-empty {
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--text);
}

.rs-empty a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   4. 文章卡片网格
   -------------------------------------------------------------------------- */

.rs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.rs-card {
  display: flex;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.rs-card:hover,
.rs-card:focus-within {
  border-color: rgba(21, 40, 61, 0.28);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.rs-card__link {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  padding: 20px;
}

.rs-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--bg);
}

.rs-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.rs-card:hover .rs-card__media img {
  transform: scale(1.03);
}

/* 无特色图时的占位：标题首字母 + 工程网格底纹，避免出现灰块 */
.rs-card__media--note {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(90deg, rgba(21, 40, 61, 0.06) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(0deg, rgba(21, 40, 61, 0.06) 0 1px, transparent 1px 24px),
    var(--bg);
}

.rs-card__mark {
  color: var(--navy);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  opacity: 0.35;
}

.rs-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.rs-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.rs-card__tag {
  color: var(--orange-dark);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rs-card__read {
  position: relative;
  padding-left: 12px;
}

.rs-card__read::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
}

.rs-card__title {
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.rs-card__excerpt {
  display: block;
  margin-bottom: 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.rs-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.rs-card__more svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s var(--ease);
}

.rs-card:hover .rs-card__more svg {
  transform: translateX(3px);
}

/* 头条卡片：桌面横排占两列 */
.rs-card--featured {
  grid-column: span 2;
}

.rs-card--featured .rs-card__link {
  flex-direction: row;
  gap: 28px;
  padding: 24px;
}

.rs-card--featured .rs-card__media {
  flex: 0 0 44%;
  max-width: 44%;
  aspect-ratio: 4 / 3;
  margin-bottom: 0;
}

.rs-card--featured .rs-card__title {
  font-size: 24px;
  line-height: 1.24;
}

.rs-card--featured .rs-card__excerpt {
  font-size: 15px;
}

.rs-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* --------------------------------------------------------------------------
   5. 内容支柱（这个栏目写什么）
   -------------------------------------------------------------------------- */

.rs-pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.rs-pillar {
  min-width: 0;
  padding: 28px 24px;
  background: var(--white);
}

.rs-pillar__num {
  display: block;
  margin-bottom: 14px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.rs-pillar__label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rs-pillar__title {
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 19px;
  line-height: 1.3;
}

.rs-pillar__text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.62;
}

/* --------------------------------------------------------------------------
   6. 型材族入口
   -------------------------------------------------------------------------- */

.rs-families {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.rs-family a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.rs-family a:hover,
.rs-family a:focus-visible {
  border-color: var(--navy);
  background: rgba(21, 40, 61, 0.03);
}

.rs-family__name {
  min-width: 0;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.rs-family__count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   7. 详情页：正文 + 目录
   -------------------------------------------------------------------------- */

.rs-article {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* 没有 h2 的文章不出目录：正文占主列，右列用询价卡填空白
   （否则 prose 会落在 232px 的第一列里，正文被挤成一条窄栏）
   主列用 fit-content 跟着 prose 的实际宽度收，避免正文与卡片之间空出一大块 */
.rs-article--no-toc {
  grid-template-columns: fit-content(660px) 340px;
  gap: 40px;
  justify-content: start;
}

.rs-article--no-toc .rs-prose {
  max-width: 100%;
}

.rs-side-cta {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--navy);
  border-radius: var(--r-md);
  background: var(--bg);
}

.rs-side-cta__label {
  color: var(--navy);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.rs-side-cta__text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.rs-side-cta .btn {
  width: 100%;
  justify-content: center;
}

.rs-side-cta__link {
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rs-side-cta__link:hover {
  color: var(--orange-dark);
}

.rs-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
}

.rs-toc__title {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rs-toc__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: rs-toc;
}

.rs-toc__list li {
  counter-increment: rs-toc;
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
}

.rs-toc__list li::before {
  content: counter(rs-toc, decimal-leading-zero);
  margin-right: 8px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 700;
}

.rs-toc__list a {
  color: var(--text);
  text-decoration: none;
}

.rs-toc__list a:hover,
.rs-toc__list a:focus-visible {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rs-toc__ask {
  display: block;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.rs-toc__ask:hover {
  color: var(--orange-dark);
}

/* 正文排版：宽屏下控制在 ~72 字符，长文不横跳 */
.rs-prose {
  min-width: 0;
  max-width: 74ch;
  color: var(--text);
  font-size: 16px;
  line-height: 1.78;
}

.rs-prose > * + * {
  margin-top: 20px;
}

.rs-prose p {
  margin: 0;
}

.rs-prose > p + p {
  margin-top: 18px;
}

.rs-prose h2 {
  margin-top: 44px;
  margin-bottom: 16px;
  padding-top: 4px;
  color: var(--navy);
  font-size: 26px;
  line-height: 1.24;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.rs-prose h3 {
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--navy);
  font-size: 20px;
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.rs-prose h4 {
  margin-top: 24px;
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 17px;
}

.rs-prose h2 + p,
.rs-prose h3 + p,
.rs-prose h4 + p {
  margin-top: 0;
}

.rs-prose ul,
.rs-prose ol {
  margin: 18px 0;
  padding-left: 22px;
}

.rs-prose ul {
  list-style: none;
  padding-left: 0;
}

.rs-prose ul > li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
}

.rs-prose ul > li::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
}

.rs-prose ol {
  list-style: decimal;
}

.rs-prose ol > li {
  margin-bottom: 10px;
  padding-left: 4px;
}

.rs-prose ol > li::marker {
  color: var(--orange-dark);
  font-weight: 700;
}

.rs-prose a {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: rgba(21, 40, 61, 0.3);
  text-underline-offset: 3px;
}

.rs-prose a:hover,
.rs-prose a:focus-visible {
  text-decoration-color: var(--orange);
  color: var(--orange-dark);
}

.rs-prose strong {
  color: var(--navy);
  font-weight: 700;
}

.rs-prose blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--orange);
  color: var(--navy-soft);
  font-size: 17px;
  line-height: 1.6;
}

.rs-prose blockquote p {
  margin: 0;
}

.rs-prose img {
  width: 100%;
  height: auto;
  margin: 24px 0;
  border-radius: var(--r-md);
}

.rs-prose figure {
  margin: 24px 0;
}

.rs-prose figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.rs-prose table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 14px;
}

.rs-prose th,
.rs-prose td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.rs-prose th {
  border-bottom: 2px solid var(--navy);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* 窄屏表格：允许横向滚动，但容器本身不撑破布局 */
.rs-prose .wp-block-table,
.rs-prose figure.wp-block-table {
  overflow-x: auto;
}

.rs-prose hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   8. 署名条
   -------------------------------------------------------------------------- */

.rs-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 74ch;
  margin-top: 48px;
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--r-md);
  background: var(--bg);
}

.rs-byline__text {
  flex: 1 1 320px;
  min-width: 0;
}

.rs-byline__label {
  margin-bottom: 6px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.rs-byline__note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   9. 详情页关联机型
   -------------------------------------------------------------------------- */

.rs-machine {
  display: flex;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.rs-machine:hover,
.rs-machine:focus-visible {
  border-color: rgba(21, 40, 61, 0.28);
  box-shadow: var(--shadow-md);
}

.rs-machine__media {
  flex: 0 0 40%;
  max-width: 40%;
  background: var(--bg);
  overflow: hidden;
}

.rs-machine__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rs-machine__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
}

.rs-machine__label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rs-machine__title {
  margin-bottom: 14px;
  color: var(--navy);
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.rs-machine__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.rs-machine__more svg {
  width: 15px;
  height: 15px;
}

.rs-more {
  margin-top: 32px;
  text-align: center;
}

.rs-more .link-arrow {
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   10. 响应式
   -------------------------------------------------------------------------- */

/* 1024–1199：featured 收成整行，网格两列 */
@media (max-width: 1199px) {
  .rs-card--featured {
    grid-column: span 2;
  }

  .rs-card--featured .rs-card__link {
    gap: 20px;
  }

  .rs-card--featured .rs-card__title {
    font-size: 21px;
  }
}

@media (max-width: 1023px) {
  .rs-grid,
  .rs-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rs-pillars {
    grid-template-columns: minmax(0, 1fr);
  }

  .rs-families {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 目录从侧栏改为正文前的普通块，不再 sticky */
  .rs-article {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .rs-toc {
    position: static;
  }

  /* 询价卡从右栏落到正文下方，不再吸顶 */
  .rs-side-cta {
    position: static;
  }

  .rs-side-cta .btn {
    width: auto;
  }

  .rs-toc__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 20px;
  }
}

@media (max-width: 767px) {
  .rs-grid,
  .rs-grid--compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .rs-card--featured {
    grid-column: auto;
  }

  .rs-card--featured .rs-card__link {
    flex-direction: column;
    gap: 16px;
    padding: 20px;
  }

  .rs-card--featured .rs-card__media {
    flex: 0 0 auto;
    max-width: 100%;
    aspect-ratio: 16 / 9;
  }

  .rs-card--featured .rs-card__title {
    font-size: 19px;
  }

  .rs-families {
    grid-template-columns: minmax(0, 1fr);
  }

  .rs-page .cat-hero__title,
  .rs-single .rs-hero__title {
    max-width: none;
  }

  .rs-toc__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .rs-prose h2 {
    font-size: 22px;
  }

  .rs-prose h3 {
    font-size: 18px;
  }

  .rs-machine {
    flex-direction: column;
  }

  .rs-machine__media {
    flex: 0 0 auto;
    max-width: 100%;
    aspect-ratio: 16 / 9;
  }
}
