/**
 * 无障碍阅读 + 适老模式   v3.10
 * 配色沿用站点主色（--c-primary #0e4da4 蓝白体系），不照搬他站橙红。
 * 所有状态挂在 <html> 的 class 上，不改动现有布局结构。
 */

/* ============================================================
   一、顶栏两个入口按钮
   ============================================================ */
/* v3.22 强显眼：深蓝顶栏底色上，必须用主蓝实心+白字，弱视用户一秒能找到。
   v3.23 按钮更胖一点（padding 6 18 → 7 20，min-height 36 → 38），与加高的顶栏(44px) 协调。 */
.a11y-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 16px;
    padding: 7px 20px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    /* v3.115：38px → 44px。这两个按钮正是「放大点击区」功能的入口，
       入口本身必须好点，否则 elderly/a11y 模式等于用不上的功能。 */
    min-height: 44px;
    color: #fff;
    background: var(--c-primary);
    border: 1.5px solid #ffffff;
    border-radius: 999px;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s, transform .12s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.a11y-nav-btn svg { flex: 0 0 auto; width: 17px; height: 17px; }
.a11y-nav-btn:hover,
.a11y-nav-btn:focus-visible {
    color: var(--c-primary);
    background: #ffffff;
    border-color: #ffffff;
    outline: none;
    transform: translateY(-1px);
}
.a11y-nav-btn:active { transform: translateY(0); }

/* 启用中（适老/阅读已开）：用站点红强调，比 hover 更醒目 */
.a11y-nav-btn.is-on {
    color: #fff;
    background: var(--c-accent);
    border-color: #ffffff;
}
.a11y-nav-btn.is-on:hover,
.a11y-nav-btn.is-on:focus-visible {
    color: var(--c-accent);
    background: #ffffff;
    border-color: var(--c-accent);
}

/* ============================================================
   二、无障碍工具条（右上角浮出，不遮挡正文）
   ============================================================ */
.a11y-bar {
    position: fixed;
    top: 46px;
    right: 20px;
    z-index: 9999;
    width: 330px;
    max-width: calc(100vw - 32px);
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #d6e0f0;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(14, 77, 164, 0.16);
}
.a11y-bar[hidden] { display: none !important; }

.a11y-bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.a11y-bar-label {
    flex: 0 0 100%;
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-primary);
}

.a11y-bar button {
    padding: 6px 12px;
    font: inherit;
    font-size: 14px;
    color: var(--c-primary);
    background: var(--c-primary-light);
    border: 1px solid #c8d8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s;
}
.a11y-bar button:hover,
.a11y-bar button:focus-visible {
    color: #fff;
    background: var(--c-primary);
    border-color: var(--c-primary);
    outline: none;
}
.a11y-bar button.is-on {
    color: #fff;
    background: var(--c-primary);
    border-color: var(--c-primary);
    font-weight: 600;
}

.a11y-bar-sep {
    flex: 1 1 auto;
    min-width: 8px;
}
.a11y-bar-close {
    background: #fff !important;
    color: #6b7a90 !important;
    border-color: #dde3ec !important;
}

.a11y-bar-tip {
    margin: 10px 0 0;
    padding-top: 9px;
    font-size: 12px;
    line-height: 1.7;
    color: #6b7a90;
    border-top: 1px dashed #dde3ec;
}
.a11y-bar-tip[hidden] { display: none; }

@media (max-width: 640px) {
    .a11y-bar { top: 8px; right: 12px; left: 12px; width: auto; }
}

/* ============================================================
   三、字号档位（1 大 / 2 特大 / 3 超大）
   ============================================================ */
html.a11y-fs-1 { --a11y-fs: 17px; --a11y-lh: 1.85; }
html.a11y-fs-2 { --a11y-fs: 19px; --a11y-lh: 1.95; }
html.a11y-fs-3 { --a11y-fs: 21px; --a11y-lh: 2.05; }

html[class*="a11y-fs-"] body,
html[class*="a11y-fs-"] p,
html[class*="a11y-fs-"] li,
html[class*="a11y-fs-"] td,
html[class*="a11y-fs-"] th,
html[class*="a11y-fs-"] dd,
html[class*="a11y-fs-"] dt,
html[class*="a11y-fs-"] blockquote,
html[class*="a11y-fs-"] label,
html[class*="a11y-fs-"] input,
html[class*="a11y-fs-"] textarea,
html[class*="a11y-fs-"] select,
html[class*="a11y-fs-"] .entry-content,
html[class*="a11y-fs-"] .news-list .tt,
html[class*="a11y-fs-"] .news-list .date,
html[class*="a11y-fs-"] .card-title,
html[class*="a11y-fs-"] .info-card-body {
    font-size: var(--a11y-fs) !important;
    line-height: var(--a11y-lh) !important;
}

/* 标题跟着放大，但保持层级差 */
html.a11y-fs-1 h1 { font-size: 28px !important; }
html.a11y-fs-1 h2 { font-size: 24px !important; }
html.a11y-fs-1 h3 { font-size: 21px !important; }
html.a11y-fs-2 h1 { font-size: 32px !important; }
html.a11y-fs-2 h2 { font-size: 27px !important; }
html.a11y-fs-2 h3 { font-size: 23px !important; }
html.a11y-fs-3 h1 { font-size: 36px !important; }
html.a11y-fs-3 h2 { font-size: 30px !important; }
html.a11y-fs-3 h3 { font-size: 25px !important; }

/* ============================================================
   四、适老模式（GB/T 37668：大字号 + 宽行距 + 放大点击区 + 关动效）
   ============================================================ */
html.a11y-elder { --a11y-fs: 18px; --a11y-lh: 1.95; }

html.a11y-elder body,
html.a11y-elder p,
html.a11y-elder li,
html.a11y-elder td,
html.a11y-elder th,
html.a11y-elder dd,
html.a11y-elder dt,
html.a11y-elder blockquote,
html.a11y-elder label,
html.a11y-elder .entry-content,
html.a11y-elder .news-list .tt,
html.a11y-elder .news-list .date {
    font-size: var(--a11y-fs) !important;
    line-height: var(--a11y-lh) !important;
}

/* 段落宽度收窄，减少眼球扫动距离 */
html.a11y-elder .entry-content,
html.a11y-elder .page-content,
html.a11y-elder .article-body {
    max-width: 720px;
}

/* 关闭所有动效，避免眩晕 */
html.a11y-elder *,
html.a11y-elder *::before,
html.a11y-elder *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* 点击区域放大到 44px（移动端可点性国标下限） */
html.a11y-elder a,
html.a11y-elder button,
html.a11y-elder input[type="submit"],
html.a11y-elder input[type="button"],
html.a11y-elder .btn {
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
}
/* 导航 / 列表类链接不做纵向撑高，只放宽内边距 */
html.a11y-elder .mainnav .nav-list a,
html.a11y-elder .news-list a,
html.a11y-elder .tb-right a,
html.a11y-elder .site-footer a {
    min-height: 0;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* 链接加下划线，便于识别可点 */
html.a11y-elder .entry-content a,
html.a11y-elder .news-list .tt {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* 移除装饰性元素，降低干扰 */
html.a11y-elder .hero-badge,
html.a11y-elder .deco,
html.a11y-elder .hero-decoration {
    display: none !important;
}

/* v3.32 扩展覆盖 —— 原版只覆盖 body/p/li 等 10 几个选择器，
   标题、顶栏、导航、卡片标题、表单全没变化（用户实测反馈"开了没感觉"）。
   补全：标题层级 / 顶栏文字 / 主导航 / 信息枢纽按钮+标题 / 表单元素。 */

/* 标题层级 */
html.a11y-elder h1 { font-size: 40px !important; line-height: 1.4 !important; }
html.a11y-elder h2 { font-size: 30px !important; line-height: 1.4 !important; }
html.a11y-elder h3 { font-size: 24px !important; line-height: 1.5 !important; }
html.a11y-elder h4 { font-size: 20px !important; line-height: 1.55 !important; }

/* 顶栏文字（不撑高顶栏，只把字号加大 + 行距加宽） */
html.a11y-elder .tb-left,
html.a11y-elder .tb-right,
html.a11y-elder .tb-right a {
    font-size: 15.5px !important; line-height: 1.5 !important;
}

/* 主导航（沿用原有不撑高的 padding 控制） */
html.a11y-elder .mainnav a {
    font-size: 17px !important; line-height: 1.5 !important;
}

/* 信息枢纽：tab 按钮 + 卡片标题 */
html.a11y-elder .info-index-btn {
    font-size: 16.5px !important; padding: 10px 14px !important;
    min-height: 44px !important;
}
html.a11y-elder .info-card-head {
    font-size: 19px !important; line-height: 1.4 !important;
}

/* 表单元素（适老用户需要更宽的输入区） */
html.a11y-elder input[type="text"],
html.a11y-elder input[type="password"],
html.a11y-elder input[type="email"],
html.a11y-elder input[type="search"],
html.a11y-elder input[type="tel"],
html.a11y-elder input[type="url"],
html.a11y-elder textarea,
html.a11y-elder select {
    font-size: 17px !important;
    padding: 12px 14px !important;
    min-height: 44px !important;
}

/* ============================================================
   五、高对比度（黑底黄字）
   ============================================================ */
html.a11y-contrast,
html.a11y-contrast body {
    background: #000 !important;
    color: #ff0 !important;
}
html.a11y-contrast p,
html.a11y-contrast li,
html.a11y-contrast h1,
html.a11y-contrast h2,
html.a11y-contrast h3,
html.a11y-contrast h4,
html.a11y-contrast td,
html.a11y-contrast th,
html.a11y-contrast span,
html.a11y-contrast div,
html.a11y-contrast label {
    background: #000 !important;
    color: #ff0 !important;
}
html.a11y-contrast a {
    color: #0ff !important;
    text-decoration: underline !important;
}
html.a11y-contrast a:visited { color: #f9f !important; }
html.a11y-contrast input,
html.a11y-contrast textarea,
html.a11y-contrast select,
html.a11y-contrast button {
    background: #000 !important;
    color: #ff0 !important;
    border: 2px solid #ff0 !important;
}
html.a11y-contrast img { filter: contrast(1.4); }

/* ============================================================
   六、十字光标（辅助定位）
   ============================================================ */
.a11y-cursor-h,
.a11y-cursor-v {
    position: fixed;
    z-index: 9998;
    pointer-events: none;
    background: rgba(200, 22, 29, 0.55);
}
.a11y-cursor-h { left: 0; width: 100%; height: 2px; }
.a11y-cursor-v { top: 0; width: 2px; height: 100%; }

/* ============================================================
   七、朗读模式（划过段落高亮）
   ============================================================ */
html.a11y-reading p,
html.a11y-reading li,
html.a11y-reading h1,
html.a11y-reading h2,
html.a11y-reading h3,
html.a11y-reading td,
html.a11y-reading blockquote {
    cursor: pointer;
}
html.a11y-reading .a11y-read-hi {
    background: #fff5cc !important;
    outline: 2px dashed var(--c-primary);
    outline-offset: 2px;
}
