/* ==========================================
   🦽 深水咕碌 全局無障礙系統 (A11y Core)
   ========================================== */

/* 👁️ 1. 高對比度模式 (High Contrast Mode) */
body.high-contrast {
    --bg-color: #000000 !important;
    --card-bg: #000000 !important;
    --text-main: #ffffff !important;
    --text-muted: #ffff00 !important;
    --border-color: #ffffff !important;
    --primary: #ffff00 !important;
}
body.high-contrast .glass-card { border: 2px solid #fff !important; box-shadow: none !important; background: #000 !important; }
body.high-contrast .section-badge { background: #000 !important; color: #ff0 !important; border: 2px solid #ff0 !important; }
body.high-contrast .ticker-wrap, body.high-contrast nav, body.high-contrast footer { background: #000 !important; border-color: #fff !important; }
body.high-contrast input { background: #000 !important; color: #fff !important; border-color: #fff !important; }

/* 🛑 2. 停用動畫模式 (Reduce Motion) */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* ⌨️ 3. 鍵盤 Focus 狀態增強 (為 Tab 導航而設) */
*:focus-visible {
    outline: 3px solid var(--primary) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3) !important;
    border-radius: 4px;
}
.glass-card:focus-visible { border-radius: 1.25rem; }

/* 🦘 4. 跳至主要內容捷徑 (Skip Link) */
.skip-link {
    position: absolute; top: -100px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: white; padding: 12px 24px;
    border-radius: 0 0 12px 12px; z-index: 100000; font-weight: 900; transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* 🎛️ 5. 無障礙選單 (A11y Menu) 浮動 UI */
#a11y-fab { position: fixed; bottom: 20px; right: 20px; z-index: 99999; }
#a11y-toggle { width: 50px; height: 50px; border-radius: 50%; background: var(--primary); color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; cursor: pointer; transition: transform 0.2s; border: none; outline: none; }
#a11y-toggle:hover { transform: scale(1.1); }
#a11y-panel { position: absolute; bottom: 65px; right: 0; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 16px; width: 220px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); display: none; flex-direction: column; gap: 10px; transform-origin: bottom right; }
#a11y-panel.show { display: flex; animation: a11yPop 0.2s ease-out; }
@keyframes a11yPop { 0% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } }

.a11y-btn { background: var(--bg-color); border: 1px solid var(--border-color); color: var(--text-main); padding: 10px; border-radius: 8px; font-weight: bold; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: all 0.2s; text-align: left; }
.a11y-btn:hover { background: var(--border-color); }
.a11y-btn.active { background: var(--primary); color: white; border-color: var(--primary-dark); }
.a11y-font-controls { display: flex; gap: 8px; }
.a11y-font-controls button { flex: 1; justify-content: center; }