/* HTS UI 展示页布局（组件样式统一在 style.css） */

.ui-head {
    background-color: var(--block);
    border-bottom: 1px solid var(--border);
    text-align: center;
    padding: 56px 0 44px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.ui-head h1 {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 4px;
}

.ui-head p {
    margin-top: 8px;
    font-size: 15px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.ui-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 侧边导航 */
.ui-side-wrap {
    position: sticky;
    top: 88px;
    flex: none;
}

.ui-side-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-soft);
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.25s ease;
}

.ui-side-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.ui-side {
    width: 180px;
    padding: 12px 0 32px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.ui-side.collapsed {
    width: 0;
    opacity: 0;
}

.ui-side a {
    padding: 8px 14px;
    font-size: 14px;
    color: var(--text-soft);
    text-decoration: none;
    border-radius: 10px;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.ui-side a:hover {
    color: var(--primary);
    background-color: var(--block);
}

.ui-side a.active {
    color: var(--on-primary);
    background-color: var(--primary);
}

/* 内容区 */
.ui-main {
    flex: 1;
    min-width: 0;
    padding: 40px 0 80px;
}

.ui-block {
    margin-bottom: 64px;
    scroll-margin-top: 88px;
}

.ui-block h2 {
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 2px;
}

.ui-desc {
    margin: 6px 0 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.ui-desc code {
    font-family: "Consolas", "Monaco", monospace;
    font-size: 13px;
    color: var(--text-soft);
}

/* 演示面板 */
.ui-demo {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 28px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.ui-demo-col {
    flex-direction: column;
    align-items: stretch;
}

.ui-demo-full {
    width: 100%;
}

.ui-label {
    font-size: 13px;
    color: var(--text-faint);
}

/* 字体示例 */
.ui-type-h1 { font-size: 36px; font-weight: bold; letter-spacing: 3px; }
.ui-type-h2 { font-size: 22px; font-weight: bold; letter-spacing: 2px; }
.ui-type-body { font-size: 16px; color: var(--text-soft); }
.ui-type-small { font-size: 13px; color: var(--text-faint); }

/* 色板 */
.ui-swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    width: 100%;
}

.ui-swatch {
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.ui-swatch .chip {
    height: 64px;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.ui-swatch:hover .chip {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.ui-swatch .hex {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-soft);
}

.ui-swatch .name {
    font-size: 12px;
    color: var(--text-faint);
}

/* 侧边导航遮罩：桌面端不存在 */
.ui-side-mask { display: none; }

/* 按主题显隐的内容块（如色彩区的双主题代码框） */
.only-dark { display: none; }

html[data-theme="dark"] .only-dark { display: block; }
html[data-theme="dark"] .only-light { display: none; }

@media (prefers-color-scheme: dark) {
    html:not([data-theme]) .only-dark { display: block; }
    html:not([data-theme]) .only-light { display: none; }
}

/* ===== MCP 2.5：组件交互演示补充样式 ===== */
/* 字体区块：可复制行悬停反馈 */
#typo [data-copy] {
    border-radius: 8px;
    padding: 2px 8px;
    margin-left: -8px;
    transition: background-color 0.2s ease;
}

#typo [data-copy]:hover {
    background-color: var(--block);
}

/* 提示条：右上角关闭按钮 */
#alert .alert {
    position: relative;
    padding-right: 44px;
}

.alert-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px 6px;
    font-family: inherit;
}

.alert-close:hover {
    opacity: 1;
}

/* 列表组：可点与选中态 */
#listgroup .list-group-item {
    cursor: pointer;
}

#listgroup .list-group-item.active {
    background-color: var(--block);
    box-shadow: inset 3px 0 0 var(--primary);
}

/* 步骤条按钮禁用态保持组件库按钮样式 */
#uiStepPrev:disabled,
#uiStepNext:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 响应式 */
@media (max-width: 800px) {
    .ui-layout {
        flex-direction: column;
        align-items: stretch; /* column 下此项控制宽度：必须 stretch，
                                  否则 ui-main 按内容收缩，代码框长行会撑破页面 */
        gap: 0;
    }

    .ui-main {
        width: 100%;
        min-width: 0;
    }

    /* 窄屏：侧边导航变为隐藏式抽屉，左下 ☰ 按钮唤出 */
    .ui-side-mask {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--modal-overlay);
        z-index: 54;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .ui-side-mask.show {
        opacity: 1;
        visibility: visible;
    }

    .ui-side-wrap {
        position: fixed;
        left: -230px; /* 用 left 而非 transform 做滑入：
                         transform 会让内部 fixed 按钮跟随位移而"消失" */
        top: 0;
        height: 100%;
        width: 230px;
        max-width: 80vw;
        padding: 20px 12px;
        background-color: var(--surface);
        border-right: 1px solid var(--border);
        overflow-y: auto;
        transition: left 0.3s ease;
        z-index: 55;
    }

    .ui-side-wrap.open {
        left: 0;
    }

    .ui-side {
        width: 100%;
        flex-direction: column;
        flex-wrap: nowrap;
        padding: 0;
        gap: 4px;
        transition: none;
    }

    .ui-side-toggle {
        position: fixed;
        left: 14px;
        bottom: 20px;
        width: 44px;
        height: 44px;
        margin: 0;
        border-radius: 50%;
        border: none;
        background-color: var(--primary);
        color: var(--on-primary);
        font-size: 16px;
        z-index: 60;
        box-shadow: 0 4px 14px var(--shadow);
    }

    body.drawer-open {
        overflow: hidden;
    }
}
