/*
 * AIS-TIP 首页响应式与交互收口
 * 正式桌面基线：1024px；960px 仍保持完整可用；720px 以下进入单列安全降级。
 * 不改变 Hero V5.6.7 的核心视觉参数，仅做视口适配。
 */

html[data-page="home"],
html[data-page="home"] body {
  min-width: 0;
  overflow-x: hidden;
}

html[data-page="home"] {
  scroll-padding-top: var(--topbar-height);
}

html[data-page="home"] .app {
  min-width: 0;
}

/* C3.1 Hero 三层保持内部相对位置，只将整套宿主统一上移 4px。 */
html[data-page="home"] {
  --home-hero-c31-offset-y: -4px;
  --home-overview-vulnerability-gap: var(--home-overview-gap);
}
html[data-page="home"] .hero-globe-layer,
html[data-page="home"] .ais-orbit3d-layer,
html[data-page="home"] .ais-orbit3d-node-host {
  top: calc(50px + var(--home-hero-c31-offset-y));
}

/* 蓝色摘要卡均为可跳转入口。 */
html[data-page="home"] .signal-summary,
html[data-page="home"] .latest-issue {
  cursor: pointer;
  transition:
    box-shadow var(--motion-fast) var(--motion-standard),
    filter var(--motion-fast) var(--motion-standard);
}
html[data-page="home"] .signal-summary:hover,
html[data-page="home"] .latest-issue:hover {
  filter: brightness(.994) saturate(1.015);
  box-shadow: inset 0 0 0 1px rgba(0, 82, 217, .08);
}
html[data-page="home"] .signal-summary:focus-visible,
html[data-page="home"] .latest-issue:focus-visible {
  outline: 2px solid rgba(0, 82, 217, .30);
  outline-offset: 2px;
}

/* 本期重点：任何卡宽下都不能越界。 */
html[data-page="home"] .issue-summary {
  display: -webkit-box;
  overflow: hidden;
  max-height: 80px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
html[data-page="home"] .focus-title {
  top: 180px;
}
html[data-page="home"] .focus-tags {
  top: 206px;
  right: 12px;
  width: auto;
  height: 20px;
  max-height: 20px;
  flex-wrap: nowrap;
  align-content: center;
  gap: 4px;
  overflow: hidden;
}
html[data-page="home"] .focus-tag {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 1280px) {
  html[data-page="home"][data-locale="en-US"] .primary-nav > .nav-item:nth-child(1) {
    width: 82px;
  }

  html[data-page="home"][data-locale="en-US"] .primary-nav > .nav-item:nth-child(2) {
    width: 142px;
  }

  html[data-page="home"][data-locale="en-US"] .primary-nav > .nav-item:nth-child(3) {
    width: 126px;
  }

  html[data-page="home"][data-locale="en-US"] .primary-nav > .nav-item:nth-child(4) {
    width: 76px;
  }

  html[data-page="home"][data-locale="en-US"] .nav-item--developer {
    min-width: 136px;
  }
}

/* 1200px 以下先收紧 Header 与卡片内部密度。 */
@media (max-width: 1279px) {
  html[data-page="home"] {
    --home-header-x: 14px;
    --home-header-gap: 10px;
    --home-gutter-x: 14px;
    --home-overview-gap: 16px;
    --home-card-inner-x: 16px;
  }

  html[data-page="home"] .primary-nav {
    left: calc(var(--home-header-x) + 128px);
    gap: 4px;
  }
  html[data-page="home"] .primary-nav > .nav-item,
  html[data-page="home"] .primary-nav > .nav-item:nth-child(1),
  html[data-page="home"] .primary-nav > .nav-item:nth-child(2),
  html[data-page="home"] .primary-nav > .nav-item:nth-child(3),
  html[data-page="home"] .primary-nav > .nav-item:nth-child(4),
  html[data-page="home"] .nav-item--developer {
    width: auto;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    gap: 6px;
  }
  html[data-page="home"] .utility-platform {
    width: 112px;
    flex-basis: 112px;
    padding-right: 8px;
    padding-left: 8px;
    gap: 6px;
  }

  html[data-page="home"] .latest-issue {
    width: calc(54% - 24px);
  }
  html[data-page="home"] .issue-archive {
    left: calc(54% + 1px);
  }
  html[data-page="home"] .focus-tag {
    padding: 0 5px;
    font-size: 11px;
  }
}

/*
 * 小桌面 / 窄窗口：主内容改为两列，周报横跨两列。
 * 这是 B 端正式支持的主要响应式模式，避免 1200px 固定画布导致横向滚动。
 */
@media (max-width: 1180px) {
  html[data-page="home"] {
    --home-page-footer-top: calc(var(--home-content-offset-y) + var(--home-vulnerability-top) + 289px);
    --home-app-height: calc(var(--home-page-footer-top) + 44px);
    --hero-search-width: 860px;
    --home-overview-stack-height: 764px;
    --home-overview-vulnerability-gap: var(--home-overview-gap);
  }

  html[data-page="home"] .overview-grid {
    height: var(--home-overview-stack-height);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 374px 374px;
    gap: 16px;
  }
  html[data-page="home"] .weekly-card {
    grid-column: 1 / -1;
  }
  html[data-page="home"] .weekly-card .latest-issue {
    width: calc(50% - 28px);
  }
  html[data-page="home"] .weekly-card .issue-archive {
    left: calc(50% + 2px);
  }
  html[data-page="home"] .vulnerability-card {
    top: var(--home-vulnerability-top);
  }

  /* 视觉增强层统一缩放，仍以标题与搜索框为前景主任务。 */
  html[data-page="home"] .hero-globe-geometry,
  html[data-page="home"] .ais-orbit3d-stage,
  html[data-page="home"] .ais-orbit3d-node-stage {
    transform: scale(.96);
    transform-origin: 610px 0;
  }
}

/* Header 在 1024 左右保持完整功能，不挤占。 */
@media (max-width: 1040px) {
  html[data-page="home"] {
    --home-header-x: 12px;
    --home-header-gap: 8px;
  }
  html[data-page="home"] .brand,
  html[data-page="home"] .brand img {
    width: 108px;
  }
  html[data-page="home"] .primary-nav {
    left: 132px;
    gap: 2px;
  }
  html[data-page="home"] .nav-item {
    font-size: 13px;
  }
  /* This selector intentionally matches the fixed-width rules in the base
     sheet so the compact padding/gap wins at the same cascade level. */
  html[data-page="home"] .primary-nav > .nav-item:nth-child(n) {
    padding-right: 6px;
    padding-left: 6px;
    gap: 5px;
  }
  html[data-page="home"] .utility-nav {
    gap: 8px;
  }
  html[data-page="home"] .utility-platform {
    width: 100px;
    flex-basis: 100px;
    font-size: 13px;
  }
  html[data-page="home"] .search-shell,
  html[data-page="home"] .search-focus-panel {
    width: calc(100vw - 48px);
  }
}

/* 960px 及以下进一步压缩 Header；内容仍保持两列。 */
@media (max-width: 960px) {
  html[data-page="home"] {
    --hero-search-width: 100%;
  }
  html[data-page="home"] .primary-nav {
    left: 126px;
  }
  html[data-page="home"] .nav-item--developer > span,
  html[data-page="home"] .utility-platform > span {
    display: none;
  }
  html[data-page="home"] .nav-item--developer {
    width: 50px;
    justify-content: center;
  }
  html[data-page="home"] .utility-platform {
    width: 54px;
    flex-basis: 54px;
    justify-content: center;
  }
  html[data-page="home"] .utility-platform img:last-child,
  html[data-page="home"] .nav-item--developer .nav-chevron {
    margin-left: 0;
  }
  html[data-page="home"] .search-shell,
  html[data-page="home"] .search-focus-panel {
    width: calc(100% - 24px);
  }

  /* 搜索展开层从三栏绝对坐标改为窄屏双栏，避免帮助区出框。 */
  html[data-page="home"] .search-focus-panel {
    height: 430px;
  }
  html[data-page="home"] .search-focus-hot,
  html[data-page="home"] .search-focus-history {
    top: 20px;
    width: calc(50% - 32px);
  }
  html[data-page="home"] .search-focus-hot {
    left: 20px;
  }
  html[data-page="home"] .search-focus-history {
    left: calc(50% + 12px);
  }
  html[data-page="home"] .search-focus-help {
    top: 214px;
    left: 20px;
    right: auto;
    width: calc(50% - 32px);
  }
  html[data-page="home"] .search-focus-quick {
    top: 304px;
    left: 20px;
    right: 20px;
  }

  html[data-page="home"] .hero-globe-geometry,
  html[data-page="home"] .ais-orbit3d-stage,
  html[data-page="home"] .ais-orbit3d-node-stage {
    transform: scale(.91);
  }
}

/*
 * 821–1040px：保留热门 IOC / 历史查询双栏，但让查询帮助和 Quick Try
 * 进入真实的内容流。两区的高度由标题、链接和卡片内容决定，避免固定
 * top 值在不同语言、字体或窗口高度下造成重叠与大段空隙。
 */
@media (min-width: 821px) and (max-width: 1040px) {
  html[data-page="home"] .search-focus-panel {
    box-sizing: border-box;
    display: grid;
    height: auto;
    min-height: 0;
    max-height: min(65vh, 520px, max(220px, calc(100vh - 310px)));
    max-height: min(65dvh, 520px, max(220px, calc(100dvh - 310px)));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "hot history"
      "help help"
      "quick quick";
    gap: 16px 24px;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scroll-padding-block: 12px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-section,
  html[data-page="home"] .search-focus-panel .search-focus-quick {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: auto;
    min-width: 0;
    min-height: 0;
  }

  html[data-page="home"] .search-focus-hot {
    grid-area: hot;
    height: 192px;
  }
  html[data-page="home"] .search-focus-history {
    grid-area: history;
    height: 192px;
  }
  html[data-page="home"] .search-focus-help {
    grid-area: help;
    height: auto;
  }
  html[data-page="home"] .search-focus-quick {
    grid-area: quick;
    height: auto;
  }

  html[data-page="home"] .search-focus-help .search-focus-heading,
  html[data-page="home"] .search-focus-quick .search-focus-heading {
    position: relative;
    top: auto;
    left: auto;
  }
  html[data-page="home"] .search-focus-help-list,
  html[data-page="home"] .search-focus-quick-grid {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    margin-top: 12px;
  }
  html[data-page="home"] .search-focus-quick-grid {
    height: 48px;
  }
  html[data-page="home"] .search-focus-quick .search-focus-heading-row {
    position: relative;
    top: auto;
    left: auto;
  }
}

/* 820px：进一步保证 Header 与 Hero 文本不互相挤压。 */
@media (max-width: 820px) {
  html[data-page="home"] .brand,
  html[data-page="home"] .brand img {
    width: 102px;
  }
  html[data-page="home"] .primary-nav {
    left: 118px;
  }
  html[data-page="home"] .nav-item {
    padding-right: 5px;
    padding-left: 5px;
    font-size: 12px;
  }
  html[data-page="home"] .nav-item img {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
  }
  html[data-page="home"] .primary-nav > .nav-item:nth-child(n) {
    padding-right: 5px;
    padding-left: 5px;
    gap: 5px;
  }
  html[data-page="home"] .primary-nav > .nav-item > .skill-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    object-fit: contain;
  }
  html[data-page="home"] .utility-nav {
    right: 10px;
    gap: 6px;
  }
  html[data-page="home"] .utility-divider {
    display: none;
  }
  html[data-page="home"] .hero-title {
    top: var(--hero-title-top);
    font-size: 36px;
    line-height: 48px;
  }
  html[data-page="home"] .hero-globe-geometry,
  html[data-page="home"] .ais-orbit3d-stage,
  html[data-page="home"] .ais-orbit3d-node-stage {
    transform: scale(.86);
  }
}

/* The dot is an overlay marker, not a navigation icon; keep its size stable. */
html[data-page="home"] .primary-nav > .nav-item > .skill-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  object-fit: contain;
}

/* 720px 以下作为安全降级：单列，不横向滚动。 */
@media (max-width: 720px) {
  html[data-page="home"] {
    --home-page-footer-top: calc(var(--home-content-offset-y) + var(--home-vulnerability-top) + 289px);
    --home-app-height: calc(var(--home-page-footer-top) + 44px);
    --home-gutter-x: 12px;
    --home-overview-gap: 16px;
    --home-overview-stack-height: 1154px;
    --home-overview-vulnerability-gap: var(--home-overview-gap);
  }
  html[data-page="home"] .overview-grid {
    height: var(--home-overview-stack-height);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(3, 374px);
    gap: 16px;
  }
  html[data-page="home"] .weekly-card {
    grid-column: auto;
  }
  html[data-page="home"] .weekly-card .latest-issue {
    width: calc(54% - 24px);
  }
  html[data-page="home"] .weekly-card .issue-archive {
    left: calc(54% + 1px);
  }
  html[data-page="home"] .vulnerability-card {
    top: var(--home-vulnerability-top);
  }
  html[data-page="home"] .vulnerability-related-text {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-page="home"] .signal-summary,
  html[data-page="home"] .latest-issue {
    transition: none;
  }
}


/* V1.1.1 Header adaptive navigation: preserve core tasks, move lower-priority items into More. */
html[data-page="home"] .nav-item--overflow {
  display: none;
  min-width: 64px;
  justify-content: center;
}
html[data-page="home"] .header-dropdown--navigation {
  display: flex;
  width: 156px;
  min-height: 100px;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
}
html[data-page="home"] .header-dropdown--navigation[hidden] { display: none; }
html[data-page="home"] .header-dropdown--navigation .overflow-item--vulnerability,
html[data-page="home"] .header-dropdown--navigation .overflow-item--batch {
  display: none;
}

/*
 * Desktop / tablet header: keep all five primary entrances visible while the
 * compressed labels and utility icons still leave enough measured room.
 * The previous fixed 1080px/820px cut-offs folded the bar long before it was
 * actually full. The true More button remains the mobile safety state below.
 */

/* 700px: keep Home as the visible primary route; vulnerability moves into More. */
@media (max-width: 700px) {
  html[data-page="home"] .nav-item--vulnerability {
    display: none;
  }
  html[data-page="home"] .header-dropdown--navigation .overflow-item--vulnerability {
    display: flex;
  }
  html[data-page="home"] .primary-nav {
    left: 112px;
  }
  html[data-page="home"] .utility-platform {
    width: 46px;
    flex-basis: 46px;
    padding-inline: 6px;
  }
}

/* Very narrow safety state: retain brand, Home, More, language and profile without horizontal scrolling. */
@media (max-width: 560px) {
  html[data-page="home"] {
    --home-mobile-actions-width: 88px;
  }

  html[data-page="home"] .brand,
  html[data-page="home"] .brand img {
    width: 92px;
  }
  html[data-page="home"] .primary-nav {
    right: calc(var(--home-mobile-actions-right) + var(--home-mobile-actions-width) + 8px);
  }
  html[data-page="home"] .nav-item--home {
    width: 34px !important;
    padding-inline: 9px;
  }
  html[data-page="home"] .nav-item--home > span {
    display: none;
  }
  html[data-page="home"] .utility-platform {
    display: none;
  }
  html[data-page="home"] .utility-nav {
    right: 8px;
    gap: 8px;
  }
}


/* ===== V1.1.2.4 targeted fixes: adaptive focus panel + safe independent query entries ===== */

/* Signal summary and signal rows are genuine navigation targets on pointer + touch devices. */
html[data-page="home"] .signal-summary,
html[data-page="home"] .signal-item {
  cursor: pointer;
  touch-action: manipulation;
}
html[data-page="home"] .signal-summary {
  z-index: 2;
}
html[data-page="home"] .signal-list {
  pointer-events: none;
}
html[data-page="home"] .signal-item {
  pointer-events: auto;
}
html[data-page="home"] .signal-item:focus-visible {
  outline: 2px solid rgba(0, 82, 217, .24);
  outline-offset: 2px;
  border-radius: var(--radius-control);
}

/* Home proxy is only visible inside collapsed navigation. */
html[data-page="home"] .header-dropdown--navigation .overflow-item--home,
html[data-page="home"] .header-dropdown--navigation .overflow-item--developer,
html[data-page="home"] .header-dropdown--navigation .overflow-item--platform,
html[data-page="home"] .header-dropdown--navigation .mobile-nav-submenu {
  display: none;
}

/* 701–1080px: keep Developer Resources reachable after it leaves the primary bar. */
@media (min-width: 701px) and (max-width: 1080px) {
  html[data-page="home"] .header-dropdown--navigation .overflow-item--developer {
    display: flex;
    justify-content: space-between;
  }

  html[data-page="home"] .header-dropdown--navigation .mobile-nav-submenu {
    margin: 2px 0 6px 12px;
    padding-left: 8px;
    border-left: 1px solid #e7e7e7;
  }

  html[data-page="home"] .header-dropdown--navigation .mobile-nav-submenu:not([hidden]) {
    display: block;
  }

  html[data-page="home"] .header-dropdown--navigation .mobile-nav-subitem {
    min-height: 40px;
    color: var(--text-secondary);
    font-size: 13px;
  }

  html[data-page="home"] .header-dropdown--navigation .mobile-nav-subitem:hover,
  html[data-page="home"] .header-dropdown--navigation .mobile-nav-subitem:focus-visible {
    color: var(--text);
    background: #f2f4f8;
  }

  html[data-page="home"] .header-dropdown--navigation .mobile-nav-chevron {
    width: 16px;
    height: 16px;
    margin-left: 12px;
    opacity: .6;
    transition: transform var(--motion-fast) ease;
  }

  html[data-page="home"] [data-mobile-submenu][aria-expanded="true"] .mobile-nav-chevron {
    transform: rotate(180deg);
  }
}

/* Mobile navigation: Logo + language + profile + one true hamburger. */
@media (max-width: 700px) {
  html[data-page="home"] {
    --home-mobile-actions-right: 8px;
    --home-mobile-actions-width: 84px;
  }

  html[data-page="home"] .nav-item--home,
  html[data-page="home"] .nav-item--vulnerability,
  html[data-page="home"] .nav-item--batch,
  html[data-page="home"] .nav-item--skill,
  html[data-page="home"] .nav-item--developer {
    display: none !important;
  }

  html[data-page="home"] .header-dropdown--navigation .overflow-item--api,
  html[data-page="home"] .header-dropdown--navigation .overflow-item--syntax {
    display: none;
  }

  html[data-page="home"] .header-dropdown--navigation .overflow-item--home,
  html[data-page="home"] .header-dropdown--navigation .overflow-item--vulnerability,
  html[data-page="home"] .header-dropdown--navigation .overflow-item--batch,
  html[data-page="home"] .header-dropdown--navigation .overflow-item--skill,
  html[data-page="home"] .header-dropdown--navigation .overflow-item--developer,
  html[data-page="home"] .header-dropdown--navigation .overflow-item--platform {
    display: flex;
  }

  html[data-page="home"] .brand,
  html[data-page="home"] .brand img {
    width: 96px;
  }

  html[data-page="home"] .primary-nav {
    top: 5px;
    left: auto;
    right: calc(var(--home-mobile-actions-right) + var(--home-mobile-actions-width) + 8px);
    width: 40px;
    height: 40px;
    gap: 0;
  }

  html[data-page="home"] .primary-nav > .nav-item--overflow {
    position: relative;
    display: inline-flex !important;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    align-items: center;
    justify-content: center;
    gap: 0;
    border-radius: var(--radius-control);
  }

  html[data-page="home"] .nav-item--overflow > span,
  html[data-page="home"] .nav-item--overflow > .nav-chevron {
    display: none !important;
  }

  html[data-page="home"] .nav-item--overflow::before {
    width: 19px;
    height: 14px;
    border-radius: 1px;
    background:
      linear-gradient(to bottom,
        currentColor 0 2px,
        transparent 2px 6px,
        currentColor 6px 8px,
        transparent 8px 12px,
        currentColor 12px 14px);
    content: "";
  }

  html[data-page="home"] .utility-platform {
    display: none !important;
  }

  html[data-page="home"] .utility-nav {
    top: 5px;
    right: 8px;
    height: 40px;
    gap: 4px;
  }

  html[data-page="home"] .utility-language,
  html[data-page="home"] .utility-avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
  }

  html[data-page="home"] .utility-language {
    border-radius: var(--radius-control);
  }

  html[data-page="home"] .utility-avatar img {
    width: 20px;
    height: 20px;
  }

  html[data-page="home"] .header-dropdown--navigation {
    left: 12px !important;
    right: 12px !important;
    top: 56px !important;
    width: auto !important;
    max-width: none;
    max-height: calc(100vh - 68px);
    max-height: calc(100dvh - 68px);
    min-height: 0;
    padding: 8px;
    border-radius: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  html[data-page="home"] .header-dropdown--navigation .menu-row {
    min-height: 40px;
    height: auto;
    padding: 8px 12px;
    border-radius: 5px;
  }

  html[data-page="home"] .header-dropdown--navigation .menu-row[aria-current="page"] {
    color: var(--td-brand-color);
    background: rgba(0, 82, 217, .06);
    box-shadow: inset 3px 0 0 var(--td-brand-color);
    font-weight: 500;
  }

  html[data-page="home"] .header-dropdown--navigation .overflow-item--developer,
  html[data-page="home"] .header-dropdown--navigation .overflow-item--platform {
    justify-content: space-between;
  }

  html[data-page="home"] .mobile-nav-chevron {
    width: 16px;
    height: 16px;
    margin-left: 12px;
    opacity: .6;
    transition: transform var(--motion-fast) ease;
  }

  html[data-page="home"] [data-mobile-submenu][aria-expanded="true"] .mobile-nav-chevron {
    transform: rotate(180deg);
  }

  html[data-page="home"] .header-dropdown--navigation .mobile-nav-submenu {
    margin: 2px 0 6px 12px;
    padding-left: 8px;
    border-left: 1px solid #e7e7e7;
  }

  html[data-page="home"] .header-dropdown--navigation .mobile-nav-submenu:not([hidden]) {
    display: block;
  }

  html[data-page="home"] .header-dropdown--navigation .mobile-nav-subitem {
    min-height: 40px;
    color: var(--text-secondary);
    font-size: 13px;
  }

  /* Search focus panel becomes a true mobile content flow instead of a compressed desktop grid. */
  html[data-page="home"] .search-focus-panel {
    box-sizing: border-box;
    display: grid;
    width: calc(100% - 24px);
    height: auto;
    min-height: 0;
    max-height: min(65vh, 520px, max(220px, calc(100vh - 310px)));
    max-height: min(65dvh, 520px, max(220px, calc(100dvh - 310px)));
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "hot"
      "history"
      "help"
      "quick";
    gap: 18px;
    padding: 18px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scroll-padding-block: 12px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-section,
  html[data-page="home"] .search-focus-panel .search-focus-quick {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
  }

  html[data-page="home"] .search-focus-hot { grid-area: hot; }
  html[data-page="home"] .search-focus-history { grid-area: history; }
  html[data-page="home"] .search-focus-help { grid-area: help; }
  html[data-page="home"] .search-focus-quick { grid-area: quick; }

  html[data-page="home"] .search-focus-panel .search-focus-heading {
    position: relative;
    top: auto;
    left: auto;
  }

  html[data-page="home"] .search-focus-panel .search-focus-hot-list,
  html[data-page="home"] .search-focus-panel .search-focus-history-list,
  html[data-page="home"] .search-focus-panel .search-focus-help-list,
  html[data-page="home"] .search-focus-panel .search-focus-quick-grid {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    margin-top: 12px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-hot-row,
  html[data-page="home"] .search-focus-panel .search-focus-history-row {
    width: 100%;
  }

  html[data-page="home"] .search-focus-panel .search-focus-value {
    max-width: calc(100% - 64px);
  }

  html[data-page="home"] .search-focus-panel .search-focus-help-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-help-row {
    width: 100%;
    min-height: 36px;
    margin-bottom: 0;
    padding-inline: 6px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-quick-grid {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-history-empty {
    position: relative;
    top: auto;
    left: auto;
    margin-top: 12px;
  }
}

/* 701–820px：平板宽度也必须退出桌面绝对坐标，避免帮助区与快速体验区挤在面板底部。 */
@media (min-width: 701px) and (max-width: 820px) {
  html[data-page="home"] .search-shell,
  html[data-page="home"] .search-focus-panel {
    width: calc(100% - 24px);
  }

  html[data-page="home"] .search-focus-panel {
    box-sizing: border-box;
    display: grid;
    height: auto;
    min-height: 0;
    max-height: min(65vh, 520px, max(220px, calc(100vh - 310px)));
    max-height: min(65dvh, 520px, max(220px, calc(100dvh - 310px)));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "hot history"
      "help quick";
    gap: 20px 24px;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scroll-padding-block: 12px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-section,
  html[data-page="home"] .search-focus-panel .search-focus-quick {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
  }

  html[data-page="home"] .search-focus-hot { grid-area: hot; }
  html[data-page="home"] .search-focus-history { grid-area: history; }
  html[data-page="home"] .search-focus-help { grid-area: help; }
  html[data-page="home"] .search-focus-quick { grid-area: quick; }

  html[data-page="home"] .search-focus-panel .search-focus-heading {
    position: relative;
    top: auto;
    left: auto;
  }

  html[data-page="home"] .search-focus-panel .search-focus-hot-list,
  html[data-page="home"] .search-focus-panel .search-focus-history-list,
  html[data-page="home"] .search-focus-panel .search-focus-help-list,
  html[data-page="home"] .search-focus-panel .search-focus-quick-grid {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    margin-top: 12px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-hot-row,
  html[data-page="home"] .search-focus-panel .search-focus-history-row {
    width: 100%;
  }

  html[data-page="home"] .search-focus-panel .search-focus-value {
    max-width: calc(100% - 64px);
  }

  html[data-page="home"] .search-focus-panel .search-focus-help-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-help-row {
    width: 100%;
    min-height: 36px;
    margin-bottom: 0;
    padding-inline: 6px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-quick-grid {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-history-empty {
    position: relative;
    top: auto;
    left: auto;
    margin-top: 12px;
  }
}

/* 英文帮助项较长时使用两列，给文字与右侧箭头保留独立空间。 */
@media (min-width: 431px) and (max-width: 700px) {
  html[data-page="home"][data-locale="en-US"] .search-focus-panel .search-focus-help-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 超窄英文首页保留完整 Hero 标题，字号按可用宽度收缩，避免被视口裁掉。 */
@media (max-width: 550px) {
  html[data-page="home"][data-locale="en-US"] .hero-title {
    font-size: min(36px, calc((100vw - 48px) * .0755));
    line-height: 1.3;
  }
}

/* 英文热点卡片按实际卡宽切换标题；大屏宽卡保留完整产品文案。 */
html[data-page="home"] .hot-card {
  container: hot-card / inline-size;
}
html[data-page="home"] .weekly-card {
  container: weekly-card / inline-size;
}
html[data-page="home"] .vulnerability-card {
  container: vulnerability-card / inline-size;
}
html[data-page="home"] .card-title-label--compact {
  display: none;
}
@container hot-card (max-width: 500px) {
  html[data-page="home"][data-locale="en-US"] .hot-card .card-title-label--full {
    display: none;
  }
  html[data-page="home"][data-locale="en-US"] .hot-card .card-title-label--compact {
    display: inline;
  }
}

/* Vulnerability Intelligence uses its Figma short label only when its own
   card becomes narrow; ordinary desktop keeps the full product wording. */
@container vulnerability-card (max-width: 500px) {
  html[data-page="home"][data-locale="en-US"] .vulnerability-card .card-title-label--full {
    display: none;
  }
  html[data-page="home"][data-locale="en-US"] .vulnerability-card .card-title-label--compact {
    display: inline;
  }
}

/* Key Focus never wraps. When the weekly card itself is narrow, keep the first two tags only. */
@container weekly-card (max-width: 520px) {
  html[data-page="home"] .weekly-card .focus-tag:nth-child(n + 3) {
    display: none;
  }
}

/* 周报卡在窄宽度下保留核心期号、摘要和日期；辅助 tag 直接隐藏，避免出现两行标签。 */
@media (max-width: 820px) {
  html[data-page="home"] .search-focus-panel .search-focus-heading-row {
    position: relative;
    top: auto;
    left: auto;
    width: max-content;
    height: 22px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-heading-row .search-focus-heading,
  html[data-page="home"] .search-focus-panel .search-focus-heading-row .search-focus-clear,
  html[data-page="home"] .search-focus-panel .search-focus-heading-row .search-focus-refresh {
    position: relative;
    top: auto;
    left: auto;
  }
}

@media (max-width: 430px) {
  html[data-page="home"] .brand,
  html[data-page="home"] .brand img {
    width: 88px;
  }

  html[data-page="home"] .primary-nav {
    left: auto;
    right: calc(var(--home-mobile-actions-right) + var(--home-mobile-actions-width) + 8px);
  }

  html[data-page="home"] .search-focus-panel {
    width: calc(100% - 24px);
    gap: 16px;
    padding: 16px 14px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-value,
  html[data-page="home"] .search-focus-panel .search-focus-history-row {
    font-size: 13px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-help-list {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-width: 374px) {
  html[data-page="home"] {
    --home-mobile-actions-right: 6px;
    --home-mobile-actions-width: 82px;
  }

  html[data-page="home"] .brand,
  html[data-page="home"] .brand img {
    width: 84px;
  }

  html[data-page="home"] .primary-nav {
    right: calc(var(--home-mobile-actions-right) + var(--home-mobile-actions-width) + 8px);
  }

  html[data-page="home"] .utility-nav {
    right: 6px;
    gap: 2px;
  }

  html[data-page="home"] .search-focus-panel .search-focus-quick-grid {
    grid-template-columns: 1fr;
  }
}
