/* ============================================================
   PC 静态首页「节点树」消费端渲染层样式（配套 diy-page-runtime.js）

   部署方式：源码在本文件，部署时原样拷为 dist/zoze-deco-page.css，
   index.html 里在 /styles.css 之后用 <link> 引入（见文件头注释）。

   两条约定：
   1. 类名统一 zdeco- 前缀，全部收敛在 .zdeco 作用域下 —— 既不碰既有
      zsec-* / feed / hero，也不会被它们的规则命中（互不干扰）；
   2. 颜色、圆角、阴影一律复用 styles.css 在 .zhome 上定义的 token
      （--text / --surface-2 / --orange / --r-m / --shadow-card …），
      所以本文件里没有一处硬编码品牌色，后台换主题时这里跟着变。
   ============================================================ */

/* ---------- 外层：与 .feed 同宽同位（1720 / 24px），插在 hero 与 feed 之间 ---------- */
/* .main::before 是固定定位的点阵纹理（z-index:0），故本层抬到 z-index:1 才不被压在纹理下 */
.zdeco {
  position: relative;
  z-index: 1;
  text-align: left;
}
.zdeco-wrap {
  /* max-width 与 padding-top / padding-bottom 由页面级样式内联覆盖（后台可调） */
  max-width: 1720px;
  margin: 0 auto;
  padding: 8px 24px 0;
}
/* 模块之间的纵向间距（row-gap 由页面级样式内联覆盖） */
.zdeco-list {
  display: flex;
  flex-direction: column;
  row-gap: 12px;
}

/* ---------- 通用块 ---------- */
/* 模块容器：默认不画底色，视觉交给各自的形状类；后台设了背景/圆角就内联覆盖 */
.zdeco-node {
  width: 100%;
  box-sizing: border-box;
}
.zdeco-grid {
  display: grid;
  gap: 12px;
  align-items: start;
}
.zdeco-grid-one {
  grid-template-columns: minmax(0, 1fr);
}
/* 键盘可达性：本层所有可点元素给统一的橙色焦点环 */
.zdeco a:focus-visible,
.zdeco button:focus-visible,
.zdeco [tabindex]:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 文字 ---------- */
.zdeco-h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
}
.zdeco-h2 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--text);
}
.zdeco-h3 {
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
}
.zdeco-sub {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
}
.zdeco-p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  word-break: break-word;
}
.zdeco-p:last-child {
  margin-bottom: 0;
}

/* 标题模块：左标题区 + 右「更多」 */
.zdeco-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}
.zdeco-head-main {
  min-width: 0;
  flex: 1;
}
.zdeco-more {
  flex: none;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  transition: color 0.2s;
}
.zdeco-more:hover {
  color: var(--orange);
}

/* ---------- 图片 / 视频 / 音频 ---------- */
.zdeco-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--r-m);
  background: var(--surface-2);
}
.zdeco-img.is-contain {
  object-fit: contain;
}
.zdeco-sq {
  aspect-ratio: 1 / 1;
}
.zdeco-link-block {
  display: block;
}
.zdeco-video {
  display: block;
  width: 100%;
  border-radius: var(--r-m);
  background: #000;
}
.zdeco-audio {
  display: block;
  width: 100%;
}

/* ---------- 按钮 ---------- */
.zdeco-actions {
  display: block;
}
.zdeco-btn {
  display: inline-block;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--r-m);
  cursor: pointer;
  transition: filter 0.2s, background 0.2s, color 0.2s;
}
.zdeco-btn.is-solid {
  background: var(--orange);
  color: #fff;
}
.zdeco-btn.is-solid:hover {
  filter: brightness(0.94);
}
.zdeco-btn.is-outline {
  border: 1px solid var(--orange);
  color: var(--orange);
  background: transparent;
}
.zdeco-btn.is-outline:hover {
  background: var(--orange-soft);
}

/* ---------- 分割线 / 留白 ---------- */
.zdeco-divider {
  position: relative;
  height: 1px;
  background: var(--border);
}
.zdeco-divider.is-dashed {
  background: none;
  border-top: 1px dashed var(--border);
}
/* 线上带文案时把文字压在中间（底色用页面底色盖住线，避免穿过字） */
.zdeco-divider > span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-3);
  background: var(--bg);
  white-space: nowrap;
}
.zdeco-blank {
  width: 100%;
}

/* ---------- 导航 / 选项卡 ---------- */
.zdeco-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  transition: background 0.2s;
}
.zdeco-nav-item:hover {
  background: var(--surface-3);
}
.zdeco-nav-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--orange-soft);
  box-shadow: inset 0 0 0 2px rgba(255, 106, 0, 0.35);
}
.zdeco-nav-text {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  word-break: break-all;
}
.zdeco-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.zdeco-tab {
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-2);
  border-radius: 999px;
  background: var(--surface-2);
}
.zdeco-tab.is-on {
  color: #fff;
  font-weight: 600;
  background: var(--orange);
}

/* ---------- 横幅 / 卡片 ---------- */
.zdeco-banner {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 160px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
}
.zdeco-banner-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 有底图时压一层暗色渐变，保证叠上去的文字可读（无底图时这层不可见） */
.zdeco-banner-bg + .zdeco-banner-body {
  position: relative;
  background: linear-gradient(90deg, rgba(17, 24, 39, 0.62) 0%, rgba(17, 24, 39, 0.24) 60%, transparent 100%);
}
.zdeco-banner-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
  padding: 28px 32px;
  box-sizing: border-box;
}
.zdeco-banner-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.zdeco-banner-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
}
.zdeco-banner-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--orange);
}
.zdeco-banner-bg ~ .zdeco-banner-body .zdeco-banner-title,
.zdeco-banner-bg ~ .zdeco-banner-body .zdeco-banner-desc {
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
.zdeco-banner-bg ~ .zdeco-banner-body .zdeco-banner-link {
  color: #fff;
}

.zdeco-card {
  display: block;
  overflow: hidden;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, box-shadow 0.2s;
}
.zdeco-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-fly);
}
.zdeco-card-img {
  border-radius: 0;
  aspect-ratio: 16 / 9;
}
.zdeco-card-body {
  padding: 14px 16px 16px;
}

/* ---------- 公告 / 搜索 ---------- */
.zdeco-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--r-m);
  background: var(--orange-soft);
  color: var(--text);
}
.zdeco-notice-icon {
  flex: none;
  font-size: 15px;
}
.zdeco-notice-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zdeco-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s;
}
.zdeco-search:hover {
  border-color: rgba(255, 106, 0, 0.4);
  background: var(--surface-3);
}
.zdeco-search-icon {
  flex: none;
  font-size: 14px;
}
.zdeco-search-ph {
  font-size: 14px;
  color: var(--text-3);
}

/* ---------- 列表 / 表格 ---------- */
.zdeco-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-m);
  background: var(--surface-2);
}
.zdeco-row + .zdeco-row {
  margin-top: 8px;
}
.zdeco-row-main {
  flex: 1;
  min-width: 0;
}
.zdeco-row-t {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.zdeco-row .zdeco-sub {
  margin-top: 2px;
}
.zdeco-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  table-layout: fixed;
}
.zdeco-table th,
.zdeco-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  color: var(--text);
  word-break: break-word;
}
.zdeco-table th {
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
}

/* ---------- 表单（静态展示，无提交接口） ---------- */
.zdeco-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-l);
  background: var(--surface-2);
}
.zdeco-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.zdeco-form-label {
  flex: none;
  width: 88px;
  font-size: 13.5px;
  color: var(--text-2);
}
.zdeco-form-input {
  flex: 1;
  height: 34px;
  border-radius: var(--r-s);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ---------- 地图（只呈现地址，不接图商） ---------- */
.zdeco-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  box-sizing: border-box;
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px dashed var(--border);
}
.zdeco-map-pin {
  font-size: 24px;
}
.zdeco-map-addr {
  font-size: 13.5px;
  color: var(--text-2);
  text-align: center;
  word-break: break-word;
}

/* ---------- 二维码位（只给可点链接，不画假码） ---------- */
.zdeco-qr-note {
  color: var(--text-2);
}
.zdeco-link {
  color: var(--orange);
  word-break: break-all;
}
.zdeco-link:hover {
  text-decoration: underline;
}

/* ---------- 倒计时 ---------- */
.zdeco-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.zdeco-count-num {
  min-width: 40px;
  padding: 6px 10px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--orange);
  border-radius: var(--r-s);
}
.zdeco-count-colon {
  font-size: 18px;
  font-weight: 700;
  color: var(--orange);
}

/* ---------- 商品 / 优惠券 / 活动 ---------- */
.zdeco-good {
  display: block;
  overflow: hidden;
  padding: 10px;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.zdeco-good:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
/* 无图商品的占位底色（后台只填了名称/价格时，不留一块空洞） */
.zdeco-good-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-s);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}
.zdeco-good-name {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.zdeco-good-price {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--orange);
}
/* 横向滚动的商品行（卡多时不换行、不撑破版面） */
.zdeco-row-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.zdeco-row-scroll::-webkit-scrollbar {
  display: none;
}
.zdeco-good-sm {
  flex: 0 0 auto;
  width: 156px;
}

.zdeco-coupons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.zdeco-coupon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 108px;
  padding: 12px 16px;
  border-radius: var(--r-m);
  background: var(--orange-soft);
  border: 1px dashed rgba(255, 106, 0, 0.45);
}
.zdeco-coupon-amt {
  font-size: 20px;
  font-weight: 700;
  color: var(--orange);
}
.zdeco-coupon-name {
  font-size: 12.5px;
  color: var(--text-2);
}
.zdeco-act {
  padding: 20px 24px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  text-align: center;
}
.zdeco-act .zdeco-btn {
  margin-top: 12px;
}

/* ---------- 窄屏兜底 ---------- */
/* PC 页偶尔被窄窗打开时，6 列会挤成细条；此时强制折成 2 列。
   列数由内联 style 给出（后台可调），故这里只能用 !important 覆盖 —— 影响范围仅本层。 */
@media (max-width: 900px) {
  .zdeco-grid[style*='grid-template-columns'] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .zdeco-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }
  .zdeco-banner-body {
    padding: 20px;
  }
}
