/**
 * WordPress / keys-theme 兼容 — KEY1 React 详情页
 * 目标：线上与本地 Vite 预览版式一致
 */

@font-face {
  font-family: 'D-DIN PRO';
  src: url('../../fonts/D-DIN-PRO-600-SemiBold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

body.single-product .site-content,
body.single-product .entry-content,
body.single-product .content-area,
body.single-product #primary,
body.single-product main.site-main,
body.single-product .page-content,
body.single-product article,
body.single-post-type-product .site-content,
body.single-post-type-product .entry-content,
body.single-post-type-product .content-area,
body.single-post-type-product #primary,
body.single-post-type-product main.site-main,
body[class*='page-template'][class*='key1'] .site-content,
body[class*='page-template'][class*='key1'] .entry-content,
body[class*='page-template'][class*='key1'] .content-area,
body[class*='page-template'][class*='key1'] #primary,
body[class*='page-template'][class*='key1'] main.site-main,
.site-content:has(#key1-detail-root),
.entry-content:has(#key1-detail-root),
.content-area:has(#key1-detail-root),
#primary:has(#key1-detail-root),
.main-con:has(#key1-detail-root),
article:has(#key1-detail-root) {
  max-width: none !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  overflow: visible !important;
  transform: none !important;
  filter: none !important;
  contain: none !important;
}

body:has(#key1-detail-root),
body[class*='page-template'][class*='key1'] {
  overflow-x: hidden !important;
}

body.single-product .entry-header,
body.single-product .page-header,
body.single-product h1.entry-title,
body.single-product h1.product_title,
body.single-post-type-product .entry-header,
body.single-post-type-product h1.entry-title,
body.single-post-type-product h1.product_title,
body[class*='page-template'][class*='key1'] .entry-header,
body[class*='page-template'][class*='key1'] h1.entry-title {
  display: none !important;
}

/* 仅重置详情页内排版，勿影响主题导航 */
#key1-detail-root p,
#key1-detail-root h1,
#key1-detail-root h2,
#key1-detail-root h3,
#key1-detail-root h4 {
  margin: 0 !important;
  padding: 0;
  line-height: normal !important;
  letter-spacing: normal !important;
  text-transform: none;
}

#key1-detail-root {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  position: relative !important;
  background: #fff;
  contain: none !important;
  isolation: auto !important;
  font-family: 'HarmonyOS Sans SC', 'Microsoft YaHei', sans-serif;
}

#key1-detail-root #key1-root,
#key1-detail-root #key1-root > main,
#key1-detail-root .key1-page {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 1px;
  overflow: visible !important;
  contain: none !important;
}

/* 主题外壳 — sticky 卡屏需要整条祖先链 overflow 可见 */
body:has(#key1-detail-root) :is(
  #page,
  .site,
  #wrapper,
  .wrapper,
  .main-con,
  .main-wrap,
  main.site-main
) {
  overflow: visible !important;
  transform: none !important;
  filter: none !important;
  contain: none !important;
}

/* 仅修复主题导航 Logo 图片，勿改 header/nav 定位 */
body:has(#key1-detail-root) :is(
  .site-header,
  #masthead,
  .main-header
) img {
  display: inline-block !important;
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  user-select: auto !important;
}

#key1-detail-root *,
#key1-detail-root *::before,
#key1-detail-root *::after {
  box-sizing: border-box;
}

#key1-detail-root video {
  display: block;
  object-fit: cover;
  background: transparent;
}

#key1-detail-root img {
  display: block;
  max-width: none !important;
}

#key1-detail-root button {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  outline: none !important;
  min-height: 0 !important;
  line-height: normal !important;
  font: inherit !important;
  color: inherit !important;
}

#key1-detail-root button:hover,
#key1-detail-root button:focus,
#key1-detail-root button:active {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* 气流区卡屏 */
#key1-detail-root .airflow-section--pin {
  overflow: visible !important;
  position: relative !important;
  contain: none !important;
}

#key1-detail-root .airflow-section__sticky {
  position: relative !important;
  top: 0 !important;
  overflow: hidden !important;
  contain: none !important;
}

#key1-detail-root .airflow-section__sticky.is-pin-fixed {
  position: fixed !important;
  top: 0 !important;
  left: var(--pin-left, 0) !important;
  width: var(--pin-width, 100%) !important;
  z-index: 5 !important;
}

#key1-detail-root .airflow-section__sticky.is-pin-after {
  position: absolute !important;
  top: auto !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
}
