/* ============================================================
   share.css — 社交分享组件（5 个页面共用）
   ------------------------------------------------------------
   只使用各页面都提供的语义变量，并用首页的 --p-* 兜底：
   --bg / --surface / --ink / --muted / --line / --accent
   所以 4 套配色 × 明暗模式都会自动跟随，不需要单独配。
   所有类名以 .share- 开头，不会污染页面既有样式。
   ============================================================ */

.share-root {
  --sh-surface: var(--surface, var(--p-panel, #fffdf8));
  --sh-ink: var(--ink, #433c34);
  --sh-muted: var(--muted, #82796d);
  --sh-line: var(--line, #e9e1d4);
  --sh-accent: var(--accent, var(--p-accent, var(--orange, #bd623d)));
  --sh-hover: var(--p-hover, rgba(0, 0, 0, .04));
}

/* ---------- 触发按钮 ---------- */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--sh-line, #e9e1d4);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.share-btn:hover { background: var(--sh-hover, rgba(0, 0, 0, .04)); border-color: var(--sh-accent, #bd623d) }

.share-btn--pill {
  min-height: 38px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 1;
}
.share-btn--pill .share-ico { font-size: 13px; line-height: 1 }

.share-btn--icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
}

/* ---------- 面板 ---------- */
.share-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(376px, calc(100vw - 36px));
  max-height: min(88vh, 700px);
  padding: 0;
  border: 1px solid var(--sh-line, #e9e1d4);
  border-radius: 16px;
  background: var(--sh-surface, #fffdf8);
  color: var(--sh-ink, #433c34);
  overflow: auto;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .24);
  -webkit-overflow-scrolling: touch;
}
.share-dialog::backdrop { background: rgba(18, 18, 20, .44) }
.share-dialog[open] { animation: share-in .18s ease-out }

@keyframes share-in {
  from { opacity: 0; transform: translateY(8px) scale(.98) }
  to { opacity: 1; transform: none }
}

.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
}
.share-head strong {
  font-family: Georgia, "Songti SC", serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: .5px;
}
.share-close {
  border: 0;
  background: transparent;
  color: var(--sh-muted, #82796d);
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.share-close:hover { color: var(--sh-ink, #433c34) }

.share-url {
  margin: 0 20px 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--sh-hover, rgba(0, 0, 0, .04));
  color: var(--sh-muted, #82796d);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

/* ---------- 平台按钮 ---------- */
.share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 20px;
}
.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 74px;
  padding: 10px 4px;
  border: 1px solid var(--sh-line, #e9e1d4);
  border-radius: 10px;
  background: transparent;
  color: var(--sh-ink, #433c34);
  font: inherit;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  transition: background .16s, border-color .16s;
}
.share-item:hover { background: var(--sh-hover, rgba(0, 0, 0, .04)); border-color: var(--sh-accent, #bd623d) }
.share-item:active { transform: scale(.985) }
.share-grid--four { grid-template-columns: repeat(2, 1fr) }
.share-item[hidden] { display: none }

.share-item svg { width: 21px; height: 21px; display: block }
.share-item .share-glyph { font-size: 19px; line-height: 1 }

/* ---------- 微信二维码区 ---------- */
.share-wx {
  margin: 16px 20px 0;
  padding: 14px;
  border: 1px dashed var(--sh-line, #e9e1d4);
  border-radius: 12px;
  text-align: center;
}
.share-wx img {
  display: block;
  width: 132px;
  height: 132px;
  margin: 0 auto 8px;
  border-radius: 6px;
  background: #fff;
}
.share-wx p {
  margin: 0;
  color: var(--sh-muted, #82796d);
  font-size: 11px;
  line-height: 1.6;
}

/* ---------- 海报 ---------- */
.share-poster-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: calc(100% - 40px);
  margin: 14px 20px 0;
  min-height: 44px;
  border: 1px solid var(--sh-accent, #bd623d);
  border-radius: 10px;
  background: transparent;
  color: var(--sh-accent, #bd623d);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .16s;
}
.share-poster-btn:hover { background: var(--sh-hover, rgba(0, 0, 0, .04)) }

.share-note {
  margin: 10px 20px 18px;
  min-height: 16px;
  color: var(--sh-muted, #82796d);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

/* ---------- 海报预览 ---------- */
.share-poster-view { padding: 0 20px 18px; text-align: center }
.share-poster-view[hidden] { display: none }
.share-poster-view img {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0 auto 10px;
  border-radius: 10px;
  border: 1px solid var(--sh-line, #e9e1d4);
}
.share-poster-view p {
  margin: 0 0 10px;
  color: var(--sh-muted, #82796d);
  font-size: 11px;
  line-height: 1.6;
}
.share-poster-view .share-dl {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--sh-line, #e9e1d4);
  border-radius: 8px;
  color: var(--sh-ink, #433c34);
  font-size: 12px;
  text-decoration: none;
}

/* ---------- 移动端：底部抽屉 ---------- */
@media (max-width: 560px) {
  .share-dialog {
    inset: auto 0 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  .share-dialog[open] { animation: share-up .22s ease-out }
  @keyframes share-up {
    from { opacity: 0; transform: translateY(30px) }
    to { opacity: 1; transform: none }
  }
  .share-poster-view img { max-width: 280px }
}

@media (prefers-reduced-motion: reduce) {
  .share-dialog[open] { animation: none }
  .share-item:active { transform: none }
}
