/* Feature List 页面（对齐 Figma node 574-9991）：Sender × Receiver 特性矩阵。
   合并为单张大表，所有行共享一个粘顶悬浮栏。 */
body:has(.features-page) {
  color: #181818;
  background: #fff;
  /* Clip horizontal overflow without making body an overflow container;
     overflow-x:hidden prevents the matrix headers from sticking to the viewport. */
  overflow-x: clip;
}

body:has(.features-page) .redirect-bar {
  display: none !important;
  height: 0 !important;
}

body:has(.features-page) .header-menu,
body:has(.features-page) .header-menu nav {
  height: 84px;
}

.features-page,
.features-page * {
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

/* ── Hero (Header D) ─────────────────────────────────────────────── */
.features-hero {
  display: flex;
  width: 100%;
  height: 330px;
  margin-top: -84px;
  padding-top: 84px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f7f6ff 0%, #fff 100%);
}

.features-hero-copy {
  text-align: center;
}

.features-hero h1 {
  margin: 0 0 18px;
  color: #181818;
  font-size: 42px;
  font-weight: 700;
  line-height: 56px;
}

.features-hero p {
  margin: 0;
  color: #666;
  font-size: 24px;
  font-weight: 400;
  line-height: 32px;
}

/* ── Matrix ──────────────────────────────────────────────────────── */
.feature-matrix-section {
  width: 100%;
  padding: 40px 0 80px;
  background: #fff;
}

.feature-matrix {
  width: 1200px;
  max-width: calc(100% - 48px);
  margin: 0 auto;
  border: 1px solid #e6e6e6;
  border-radius: 20px;
}

/* 头顶第一个子元素承载顶部圆角（避免 overflow:clip 剪裁粘顶的 sticky bar） */
.feature-matrix > :first-child {
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

/* 最后一行承载底部圆角 */
.feature-matrix > :last-child {
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  overflow: clip;
}

/* ── 粘顶高度变量 + 三层粘顶体系 ────────────────────────────────── */
.features-page {
  --fm-sticky-top: 84px;
  --fm-header-height: 44px;
  --fm-bar-height: 110px;
}

/* 第一层：Sender / Receiver 图例表头 */
.feature-matrix-head {
  position: sticky;
  top: var(--fm-sticky-top);
  z-index: 5;
  display: flex;
  color: #4a4a4a;
  background: #f0edfb;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  border-bottom: 1px solid #e2ddf5;
}

.fm-head-sender {
  flex: 0 0 200px;
  width: 200px;
  padding: 10px 20px;
  text-align: center;
}

.fm-head-receiver {
  flex: 1 1 auto;
  padding: 10px 20px;
  text-align: center;
  border-left: 1px solid #e2ddf5;
}

/* 第二层：共享粘顶悬浮栏 — Receiver 列头 */
.fm-sticky-bar {
  position: sticky;
  top: calc(var(--fm-sticky-top) + var(--fm-header-height));
  z-index: 4;
  display: flex;
  background: #f0edfb;
  border-bottom: 2px solid #e2ddf5;
}

.fm-bar-sender {
  flex: 0 0 200px;
  width: 200px;
  padding: 10px 20px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: #4a4a4a;
  border-right: 1px solid #e2ddf5;
}

.fm-bar-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
}

.fm-bar-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 12px;
  text-align: center;
  background: #f8f7fe;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: #000;
}

.fm-bar-col + .fm-bar-col {
  border-left: 1px solid #e6e6e6;
}

/* ── 数据行 ───────────────────────────────────────────────────────── */
.fm-data-row {
  display: flex;
  align-items: stretch;
}

.fm-data-row + .fm-data-row {
  border-top: 1px solid #e6e6e6;
}

.fm-row-sender {
  flex: 0 0 200px;
  width: 200px;
  background: #f8f7fe;
  border-right: 1px solid #e6e6e6;
}

/* 第三层：Sender 名称随行粘顶 — 标注当前窗口所处的 sender */
.fm-row-sender-inner {
  position: sticky;
  top: calc(var(--fm-sticky-top) + var(--fm-header-height) + var(--fm-bar-height));
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: #f8f7fe;
  text-align: center;
}

.fm-sender-label {
  color: #000;
  font-size: 18px;
  line-height: 24px;
}

.fm-devices {
  display: inline-flex;
  gap: 14px;
  align-items: center;
}

.fm-devices img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  /* 设计稿中设备图标为黑色；源 SVG 是灰色，用 brightness(0) 转纯黑（保留透明通道），
     不改动被导航共用的 SVG 源文件。 */
  filter: brightness(0);
}

/* 移动端 Receiver 列头表（默认隐藏，移动端显示） */
.fm-col-head-mobile {
  display: none;
}

.fm-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
}

/* Windows / Mac：shared advanced 在列下方纵向堆叠 */
.fm-row-body--shared {
  flex-direction: column;
}

/* Android / iOS：3 列并排，每列含 General + Advanced */
.fm-row-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fm-row-col + .fm-row-col {
  border-left: 1px solid #e6e6e6;
}

/* Desktop rows share the same two grid tracks across all receiver columns.
   This keeps the General / Advanced cell boundaries aligned even when one
   column wraps substantially more tags than the others. */
/* Figma@1024 aligns the Advanced title across all three columns (y=312 in every
   column of the Android row); Figma@768 deliberately does not (y=330/292/290).
   The tablet band below owns <=768, so subgrid applies from 768.1 upward. */
@media (min-width: 768.1px) {
  .fm-row-body:not(.fm-row-body--shared) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto;
  }

  .fm-row-body:not(.fm-row-body--shared) > .fm-row-col {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;
  }
}

/* General / Advanced section content fills the shared grid track. */
.fm-section-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.fm-section-group + .fm-section-group {
  border-top: 1px solid #e6e6e6;
}

.fm-section-group .fm-tags {
  flex: 1;
}

/* Windows / Mac：3 列仅 General 用 .fm-row-cols 包裹，Advanced 横跨下方 */
.fm-row-cols {
  display: flex;
  align-items: stretch;
}

.fm-row-shared {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #e6e6e6;
}

/* General / Advanced 小节标题（border-top 由父容器 .fm-section-group 提供） */
.fm-section-title {
  padding: 12px 20px 8px;
  color: #666;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.fm-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  padding: 20px;
}

/* ── Feature tag ─────────────────────────────────────────────────── */
.feature-note {
  width: 1200px;
  max-width: calc(100% - 48px);
  margin: 24px auto 0;
  color: #999;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

body:has(.features-page) footer {
  min-height: 458px;
}

/* ── Tablet (≤1439.9): 稍缩窄导航与英雄区 ────────────────────────── */
@media (max-width: 1439.9px) {
  body:has(.features-page) .header-menu,
  body:has(.features-page) .header-menu nav {
    height: 74px;
  }

  .features-page {
    --fm-sticky-top: 74px;
  }

  .features-hero {
    height: 254px;
    margin-top: -74px;
    padding-top: 74px;
  }

  .features-hero h1 {
    margin-bottom: 16px;
    font-size: 38px;
    line-height: 48px;
  }

  .features-hero p {
    font-size: 20px;
    line-height: 28px;
  }

  body:has(.features-page) footer {
    min-height: 468px;
  }
}

/* ── Mobile / small tablet (≤768): 竖向堆叠 ──────────────────────── */
@media (max-width: 768px) {
  body:has(.features-page) .header-menu,
  body:has(.features-page) .header-menu nav {
    height: 56px;
  }

  .features-page {
    --fm-sticky-top: 56px;
  }

  .features-hero {
    height: 202px;
    margin-top: -56px;
    padding-top: 56px;
  }

  .features-hero h1 {
    margin-bottom: 12px;
    font-size: 30px;
    line-height: 38px;
  }

  .features-hero p {
    font-size: 16px;
    line-height: 24px;
  }

  .feature-matrix-section {
    padding: 32px 0 56px;
  }

  /* 图例表头在窄屏下由粘顶元素替代，隐藏 */
  .feature-matrix-head {
    display: none;
  }

  /* 窄屏隐去全局粘顶栏，由每列自带的 Receiver 表头 + 行 Sender 分担 */
  .fm-sticky-bar {
    display: none;
  }

  .fm-data-row {
    flex-direction: column;
  }

  /* 第一层：Sender 粘顶 */
  .fm-row-sender {
    position: sticky;
    top: var(--fm-sticky-top);
    z-index: 4;
    flex: none;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #e6e6e6;
  }

  .fm-row-sender-inner {
    position: static;
    flex-direction: row;
    justify-content: center;
    padding: 16px 12px;
  }

  /* 第二层：每列自己的 Receiver 图标 + 名称，粘在 Sender 下方 */
  .fm-col-head-mobile {
    display: flex;
    position: sticky;
    top: calc(var(--fm-sticky-top) + 69px);
    z-index: 3;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8f7fe;
    border-bottom: 1px solid #e6e6e6;
    font-size: 16px;
    font-weight: 600;
    color: #000;
  }

  .fm-col-head-mobile .fm-devices img {
    width: 24px;
    height: 24px;
  }

  .fm-row-body {
    flex-direction: column;
  }

  .fm-row-cols {
    flex-direction: column;
  }

  /* 竖向堆叠时每列取自然高度，不参与 flex 均分 */
  .fm-row-col {
    flex: none;
    width: 100%;
  }

  .fm-section-group {
    flex: none;
  }

  .fm-row-col + .fm-row-col {
    border-left: 0;
    border-top: 1px solid #e6e6e6;
  }

  body:has(.features-page) footer {
    min-height: 0;
  }
}

/* ── Tablet band (480–768): Figma Features@768 `592:24393` ───────────
   The 768 frame is NOT the stacked mobile layout: each sender is a 42px
   full-width bar followed by the three receiver columns side by side
   (3 × 229.33 inside a 688 wide matrix). Only below 480 do the receiver
   columns stack, matching Features@360 `592:26426`. */
@media (min-width: 480px) and (max-width: 768px) {
  .feature-matrix-section {
    padding: 40px 0;
  }

  /* Frame 4 uses 40px side padding at 768, not the 24px mobile gutter. */
  .feature-matrix {
    max-width: calc(100% - 80px);
  }

  /* Frame 995 "Mirror from | <sender>" bar: 24px device icon + 9px padding. */
  .fm-row-sender-inner {
    padding: 9px 12px;
  }

  .fm-row-sender .fm-devices img {
    width: 24px;
    height: 24px;
  }

  /* Frame 1005: receiver columns share the row width. Windows / Mac keep the
     column direction so their shared Advanced block stays below the columns. */
  .fm-row-body:not(.fm-row-body--shared),
  .fm-row-cols {
    flex-direction: row;
  }

  .fm-row-col {
    flex: 1 1 0;
  }

  .fm-row-col + .fm-row-col {
    border-top: 0;
    border-left: 1px solid #e6e6e6;
  }

  /* Frame 988: stacked icon over label, 78px tall, static (not sticky). */
  .fm-col-head-mobile {
    position: static;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
  }

  /* Frame 1007 / 1008 section titles are 32px at this width. */
  .fm-section-title {
    padding: 12px 20px 0;
    font-size: 14px;
    line-height: 20px;
  }

  /* Every "Feature tag" instance in the 768 frame is capped at 200px and wraps
     beyond that; without the cap the shared Advanced rows stretch their tags to
     the full 686 and the rows collapse vertically. Specificity has to beat
     `.features-page .fm-tag { max-width: 100% }` in feature-tags.css. */
  .features-page .fm-tags .fm-tag {
    max-width: 200px;
  }
}

@media (max-width: 479.9px) {
  .features-hero {
    height: 188px;
    padding: 56px 24px 0;
  }

  .features-hero h1 {
    max-width: 260px;
    margin: 0 auto 10px;
    font-size: 26px;
    line-height: 32px;
  }

  .features-hero p {
    font-size: 14px;
    line-height: 20px;
  }

  .fm-tag {
    max-width: 100%;
  }
}
