/**
 * 火桥（huoqiao）· 多功能沉浸式 WordPress 主题
 * 联系方式：12492501@qq.com
 * 支持正版，从我做起，你的支持是我们前行的动力！
 *
 * @package   huoqiao
 * @author    三木
 * @copyright Copyright (c) 2026-09-01 huoqiao.cn
 * @license   GPL-2.0-or-later
 * @link      https://huoqiao.cn
 * @tags      design-tokens, responsive, dark-mode, glassmorphism, animation
 */

/* ============================================================
   全站模态框基准（.hq-modal）
   说明：把「天气组件模态框」那套玻璃外壳沉淀为唯一基座，全站模态复用，
   组件只需：class="hq-modal <组件类>" + __backdrop/__dialog/__header/__spacer/__close/__body
   并设置尺寸变量即可，不再各自复制外壳 CSS/JS。
   - 打开/关闭：由 js/hq-core.js 驱动（data-hq-open / data-hq-close / data-hq-dismiss / Esc / .is-open）
   - 宽度：   --hq-modal-width（默认 780px）
   - 圆角：   --hq-modal-radius（默认 24px）
   - 背景：   --hq-modal-bg（默认暖白玻璃），暗色自动切换
   ============================================================ */

/* 打开状态下锁定页面滚动 */
html.hq-modal-open {
    overflow: hidden;
}

.hq-modal {
    position: fixed;
    inset: 0;
    z-index: 100002;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.hq-modal.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.25s ease, visibility 0s;
}

.hq-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(58, 46, 40, 0.45);
    backdrop-filter: blur(var(--glass-blur-sm));
    -webkit-backdrop-filter: blur(var(--glass-blur-sm));
}

.hq-modal__dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(0.97);
    display: flex;
    flex-direction: column;
    width: var(--hq-modal-width, 780px);
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    background: var(--hq-modal-bg, rgba(255, 255, 255, 0.7));
    backdrop-filter: var(--glass-filter-lg);
    -webkit-backdrop-filter: var(--glass-filter-lg);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: var(--hq-modal-radius, 24px);
    box-shadow: 0 20px 60px rgba(58, 46, 40, 0.16);
    overflow: hidden;
    transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.22s ease;
}

.hq-modal.is-open .hq-modal__dialog {
    transform: translate(-50%, -50%) scale(1);
}

.hq-modal__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 22px 14px;
    font-size: 15px;
    font-weight: 700;
    color: #3a2e28;
    flex-shrink: 0;
}

.hq-modal__header > i {
    color: var(--color-primary);
    font-size: 15px;
}

.hq-modal__spacer {
    flex: 1;
}

.hq-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(58, 46, 40, 0.06);
    color: #8a7a70;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.hq-modal__close:hover {
    background: rgba(var(--color-primary-rgb), 0.2);
    color: var(--color-primary);
    transform: rotate(90deg);
}

.hq-modal__body {
    flex: 1;
    min-height: 0;
    padding: 0 22px 22px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(58, 46, 40, 0.18) transparent;
}

.hq-modal__body::-webkit-scrollbar {
    width: 6px;
}

.hq-modal__body::-webkit-scrollbar-track {
    background: transparent;
}

.hq-modal__body::-webkit-scrollbar-thumb {
    background: rgba(58, 46, 40, 0.18);
    border-radius: 3px;
}

/* 暗色模式 */
[data-theme="dark"] .hq-modal__dialog {
    background: var(--hq-modal-bg-dark, rgba(46, 38, 32, 0.82));
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .hq-modal__header {
    color: #efe6db;
}

[data-theme="dark"] .hq-modal__close {
    background: rgba(255, 255, 255, 0.08);
    color: #b8a898;
}

[data-theme="dark"] .hq-modal__close:hover {
    background: rgba(var(--color-primary-rgb), 0.2);
    color: var(--color-primary-pale);
}

[data-theme="dark"] .hq-modal__body {
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

[data-theme="dark"] .hq-modal__body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
}

/* 移动端：底部抽屉（同天气模态框） */
@media (max-width: 760px) {
    .hq-modal__dialog {
        top: auto;
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
        max-height: 82vh;
        transform: translateY(20px) scale(0.98);
        border-radius: var(--hq-modal-radius-mobile, 18px);
    }

    .hq-modal.is-open .hq-modal__dialog {
        transform: translateY(0) scale(1);
    }

    .hq-modal__header {
        padding: 16px 16px 10px;
    }

    .hq-modal__body {
        padding: 0 16px 16px;
    }
}
