/* ==============================================================================
 * 分享条 / 浮层 / 二维码弹窗
 *
 * 与 liquid-glass.css、tool-shells.css 同级的全局样式（public/ 直通到 dist/）。
 *
 * 为什么不做成 Astro 组件的 scoped <style>：
 *   share-kit.js 会在运行时切换 data-open、给 <html> 加 .share-native-supported、
 *   并可能创建 toast。scoped 样式靠 data-astro-cid-* 属性选择，动态改的属性
 *   与类名拿不到那个前缀，会静默失效。全局样式文件没有这个问题。
 * ============================================================================ */

/* ---------------------------------------------------------------------------
 * 分享条本体
 * ------------------------------------------------------------------------- */

.share-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

.share-bar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.share-bar-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ---------------------------------------------------------------------------
 * 按钮
 * ------------------------------------------------------------------------- */

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 650;
  font-family: inherit;
  line-height: 1.2;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.18s, transform 0.18s, border-color 0.18s;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.share-btn:active {
  transform: translateY(0.5px);
}

.share-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.share-btn-primary {
  background: rgba(255, 255, 255, 0.92);
  color: #0050a0;
  border-color: rgba(255, 255, 255, 0.92);
}

.share-btn-primary:hover {
  background: #fff;
}

.share-btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

/* 系统分享面板按钮：只在 navigator.share 存在时出现。
   脚本给 <html> 加 .share-native-supported。没有 JS 就永远不显示 ——
   这是对的，因为 navigator.share 本身就需要 JS 才能调用。 */
.share-native {
  display: none;
}

.share-native-supported .share-native {
  display: inline-flex;
}

/* ---------------------------------------------------------------------------
 * 浮层（更多渠道 / 导出）
 * ------------------------------------------------------------------------- */

.share-pop {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 10px;
  z-index: 60;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(0, 80, 160, 0.14);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.26);
  text-align: left;
}

.share-pop[data-open='true'] {
  display: block;
}

.share-pop-more {
  width: min(92vw, 460px);
}

.share-pop-export {
  width: min(92vw, 220px);
}

/* 浮层里的按钮要深字浅底 —— 浮层是浅色卡片，不是玻璃 */
.share-pop .share-btn {
  color: #0f172a;
  background: rgba(0, 80, 160, 0.07);
  border-color: rgba(0, 80, 160, 0.16);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font-size: 12px;
  padding: 7px 13px;
}

.share-pop .share-btn:hover {
  background: rgba(0, 80, 160, 0.14);
  transform: none;
}

.share-pop .share-btn:focus-visible {
  outline: 2px solid #0050a0;
  outline-offset: 2px;
}

.share-pop-group + .share-pop-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 80, 160, 0.1);
}

.share-pop-group-title {
  display: block;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.share-pop-group-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* 导出菜单项 */
.share-export-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #0f172a;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.share-export-item:hover {
  background: rgba(0, 80, 160, 0.09);
}

.share-export-item:focus-visible {
  outline: 2px solid #0050a0;
  outline-offset: -2px;
}

/* 二维码入口只在桌面出现：移动端有 App 可跳，扫码是多余的一步 */
@media (max-width: 640px) {
  .share-export-qr {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
 * 二维码弹窗
 * ------------------------------------------------------------------------- */

.share-qr-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* 打开态才 display:flex。关闭态靠 [hidden] 的 UA 规则藏起来，
   所以这里**不能**给 .share-qr-modal 本身写 display。
   显式再挡一道 [data-open="false"]：万一 hidden 被移除而 data-open 还是 false，
   默认的 display:block 会让弹窗漏出来 */
.share-qr-modal[data-open='false'] {
  display: none;
}

.share-qr-modal[data-open='true'] {
  display: flex;
}

.share-qr-dialog {
  width: 100%;
  max-width: 340px;
  padding: 22px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.42);
  text-align: center;
}

.share-qr-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.share-qr-hint {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.6;
  color: #64748b;
}

.share-qr-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 256px;
  margin-bottom: 10px;
}

.share-qr-canvas-wrap canvas {
  display: block;
  border-radius: 8px;
  background: #fff;
}

.share-qr-status {
  min-height: 16px;
  margin: 0 0 10px;
  font-size: 11.5px;
  color: #64748b;
}

.share-qr-url {
  width: 100%;
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 80, 160, 0.18);
  background: rgba(0, 80, 160, 0.04);
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.share-qr-url:focus {
  outline: none;
  border-color: #0050a0;
  box-shadow: 0 0 0 3px rgba(0, 80, 160, 0.16);
}

.share-qr-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* 弹窗在浅色卡片上，按钮配色要反过来 */
.share-qr-dialog .share-btn {
  color: #0f172a;
  background: rgba(0, 80, 160, 0.07);
  border-color: rgba(0, 80, 160, 0.16);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.share-qr-dialog .share-btn:hover {
  background: rgba(0, 80, 160, 0.14);
  transform: none;
}

.share-qr-dialog .share-btn-primary {
  background: #0050a0;
  color: #fff;
  border-color: #0050a0;
}

.share-qr-dialog .share-btn-primary:hover {
  background: #003d7a;
}

.share-qr-dialog .share-btn:focus-visible {
  outline: 2px solid #0050a0;
  outline-offset: 2px;
}

.share-qr-dialog .share-btn-primary:focus-visible {
  outline-color: #0f172a;
}

@media (max-width: 640px) {
  .share-bar-row .share-btn {
    padding: 7px 13px;
    font-size: 12px;
  }
}
