/*!
 * FlintHub post_share — 海报弹层样式
 * 颜色一律走 --mn-* 主题变量（§11.7）；数值 fallback 仅在变量缺失时生效。
 * 海报图本身强制浅色（白卡深字），不随暗色主题变化 —— 这是对外分享物料。
 * @file plugins/post_share/assets/style.css
 * @version 1.3.2
 */

/* ===== 弹层骨架 =====
 * z-index 层级说明：
 *   核心 Toast/灯箱 10000 · 编辑器浮层 ~9000 · 本插件 9990
 * 本弹层只需盖住页面内容与编辑器浮层，且不要盖住核心 Toast（复制成功提示要靠它）。
 */
.ps-layer {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ps-layer.ps-hidden { display: none !important; }
.ps-hidden { display: none !important; }

/* 弹层打开时禁止背景滚动（配合 body position:fixed 双保险） */
html.ps-locked { overflow: hidden; }

.ps-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.ps-dialog {
    position: relative;
    width: min(430px, 100%);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--mn-bg-card, #fff);
    color: var(--mn-text, #1a1a1a);
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
    overflow: hidden;
    /* 从下往上轻微入场，避免生硬弹出 */
    animation: ps-in .18s ease-out both;
}
@keyframes ps-in {
    from { opacity: 0; transform: translateY(12px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.ps-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--mn-border-light, #eef0f3);
    flex: 0 0 auto;
}
.ps-dialog-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}
.ps-close {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
    color: var(--mn-text-muted, #8b95a1);
    border-radius: 8px;
    transition: background .15s;
}
.ps-close:hover,
.ps-close:focus-visible { background: var(--mn-bg-row-hover, rgba(0, 0, 0, .06)); }

/* ===== 预览区 ===== */
.ps-stage {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 18px 4px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    -webkit-overflow-scrolling: touch;
}
.ps-stage-empty::before {
    content: '';
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    border: 1px dashed var(--mn-border, #dfe3e8);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, .015), rgba(0, 0, 0, .035));
}

/* canvas 只在绘制期使用，画完即隐藏；可见的一律是 <img>（iOS/微信长按保存的关键） */
.ps-canvas { display: none !important; }

.ps-img {
    display: block;
    width: 100%;
    max-width: 340px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
    /* 触屏长按需要图片可被系统识别：不要禁用 pointer-events，也不要加遮挡层 */
    -webkit-touch-callout: default;
    -webkit-user-select: auto;
    user-select: auto;
    -webkit-user-drag: none;
    background: #fff;
}

.ps-loading {
    font-size: 13px;
    color: var(--mn-text-muted, #8b95a1);
    padding: 56px 0;
    text-align: center;
}

/* ===== 提示与操作 ===== */
.ps-tip {
    margin: 0;
    padding: 8px 18px 0;
    font-size: 12px;
    line-height: 1.6;
    min-height: 20px;
    color: var(--mn-text-muted, #8b95a1);
    text-align: center;
    word-break: break-all;
}
.ps-tip-warn { color: var(--mn-warning, #d97706); }

.ps-actions {
    display: flex;
    gap: 10px;
    padding: 12px 18px 18px;
    flex: 0 0 auto;
}
.ps-actions .mn-btn {
    flex: 1 1 0;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ps-actions .mn-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ===== 信息条内的分享按钮（与收藏/举报同排） ===== */
.ps-share-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ===== 窄屏：底部抽屉 ===== */
@media (max-width: 860px) {
    .ps-layer { padding: 0; align-items: flex-end; }
    .ps-dialog {
        width: 100%;
        max-height: 92dvh;
        border-radius: 18px 18px 0 0;
        animation: ps-up .2s ease-out both;
    }
    @keyframes ps-up {
        from { transform: translateY(24px); opacity: .6; }
        to   { transform: none; opacity: 1; }
    }
    .ps-head { padding: 12px 14px; }
    .ps-stage { padding: 10px 14px 2px; }
    .ps-img { max-width: min(300px, 72vw); }
    .ps-tip { padding: 6px 14px 0; }
    .ps-actions { padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
}

/* 暗色主题下仅调整弹层外壳，海报图保持浅色不动 */
@media (prefers-color-scheme: dark) {
    .ps-dialog { box-shadow: 0 28px 80px rgba(0, 0, 0, .6); }
}
