/**
 * CSGOJ 设计 token（叠在 Bootstrap 5 之上，不另起 UI 库）。
 * 气质：紧凑、小圆角、浅底细边、纯色。禁渐变、玻璃拟态、胶囊、实心大 badge 混用。
 *
 * 业务页优先用这些变量与原语（.csg-tag / .csg-cell-action / .csg-panel*），不要按列各抄一套 Bootstrap 组件。
 */

:root {
    --csg-radius: 2px;
    --csg-radius-tight: 1px;

    --csg-text: #212529;
    --csg-text-muted: #6c757d;
    --csg-line: var(--bs-border-color, #dee2e6);
    /* 卡片、可点块的外框：比 --csg-line 稍醒目，暗色下单独提亮 */
    --csg-line-strong: var(--bs-border-color, #dee2e6);
    --csg-surface: #fff;
    --csg-surface-muted: #f8f9fa;

    --csg-ok: #146c43;
    --csg-ok-bg: #eef8f2;
    --csg-ok-bd: #8fc9a8;

    --csg-danger: #b42318;
    --csg-danger-bg: #fdf2f1;
    --csg-danger-bd: #e8a39c;

    --csg-warn: #9a3412;
    --csg-warn-bg: #fdf6ee;
    --csg-warn-bd: #e4b98a;

    --csg-info: #1e4b7a;
    --csg-info-bg: #f0f6fc;
    --csg-info-bd: #8ab0d4;

    /* 样例读入 / 写出。编辑页只用字色；题目页浅底用 *-bg。 */
    --csg-sample-in: var(--csg-info);
    --csg-sample-in-bg: #f2f6fa;
    --csg-sample-out: var(--csg-ok);
    --csg-sample-out-bg: #f7f6f4;

    --csg-muted: #5c6570;
    --csg-muted-bg: #f4f5f6;
    --csg-muted-bd: #c5c9ce;

    --csg-dur-fast: 160ms;
    --csg-dur: 280ms;
    --csg-ease: cubic-bezier(0.22, 1, 0.36, 1);

    /*
     * 层叠梯子（SSOT）。对齐 Bootstrap 5 默认档，只在档与档之间插入本系统层。
     * 禁止业务页再写 1065 / 9999 这类散数，禁止业务写 calc(var(--csg-z-*) ± n)。
     * 档差（fixed+1、offcanvas-1）只以具名 token 写在本文件。JS 读 token 用 CsgZ.token / CsgZ.stackingFor。
     * 细则：docs/harness/03 · #csg-z-index
     *
     * 页面孤岛（榜单 --rank-z-index-base、气球沉浸、颁奖投屏）自有基准，勿把那些数打进本梯子。
     */
    --csg-z-dropdown: var(--bs-dropdown-zindex, 1000);
    --csg-z-sticky: var(--bs-sticky-zindex, 1020);
    --csg-z-fixed: var(--bs-fixed-zindex, 1030);
    --csg-z-fixed-edge: 1031; /* 贴顶栏铬条，必须 = fixed+1；课程组边条 */
    --csg-z-page-float: 1040; /* portal 到 body 的页面浮层（flyout）；必须 < modal-backdrop */
    --csg-z-offcanvas-mask: 1044; /* 必须 = offcanvas-1；移动端侧栏遮罩 */
    --csg-z-offcanvas: var(--bs-offcanvas-zindex, 1045);
    --csg-z-modal-backdrop: var(--bs-backdrop-zindex, 1050);
    --csg-z-modal: var(--bs-modal-zindex, 1055);
    --csg-z-over-modal-mask: 1059; /* 必须 = over-modal-1；叠在已打开 modal 上的第二层遮罩 */
    --csg-z-over-modal: 1060; /* 打开中的 modal 内部再 portal 到 body 的浮层；筛选侧栏盖住遮罩等同档 */
    --csg-z-popover-mask: 1069; /* 必须 = popover-1；第三层 modal 遮罩 */
    --csg-z-popover: var(--bs-popover-zindex, 1070);
    --csg-z-tooltip: var(--bs-tooltip-zindex, 1080);
    --csg-z-toast: var(--bs-toast-zindex, 1090);
    --csg-z-in-pane: 2; /* 某一 stacking context 内部（modal sticky header/footer、页内标题栏探出内容） */
    --csg-z-alerty: 9999;
    --csg-z-overlay: 10000;
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --csg-dur-fast: 1ms;
        --csg-dur: 1ms;
    }
}

/**
 * 表格里可点的正文（打开详情等）。继承单元格字色，不要做成蓝链接或按钮。
 */
.csg-cell-action {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
}
a.csg-cell-action:link,
a.csg-cell-action:visited {
    color: inherit;
    text-decoration: none;
}
.csg-cell-action:hover,
.csg-cell-action:focus-visible {
    color: var(--bs-primary);
    text-decoration: none;
}
.csg-cell-action:focus-visible {
    outline: 1px solid var(--bs-primary);
    outline-offset: 1px;
}
.csg-cell-action--center {
    text-align: center;
}

/* 暗色主题（Bootstrap data-bs-theme="dark"）下的 token 覆盖 */
[data-bs-theme="dark"] {
    --csg-line-strong: rgba(255, 255, 255, 0.26);
}
