/* 無障礙CSS樣式 - WCAG 2.1 AA 標準 */

/* 跳至主要內容連結 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 4px;
    font-size: 0.875rem;
    font-weight: bold;
}

.skip-link:focus {
    top: 0;
}

/* 確保焦點可見 */
*:focus {
    outline: 2px solid #005fcc !important;
    outline-offset: 2px !important;
}

/* 連結懸停和聚焦時的統一樣式 */
a:hover,
a:focus {
    outline: 2px dotted #FFD700 !important;
    outline-offset: 2px !important;
}

/* 隱藏僅供螢幕閱讀器使用的內容 */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 高對比度支援 */
@media (prefers-contrast: high) {
    body {
        background-color: #fff !important;
        color: #000 !important;
    }
    
    a {
        color: #0000ff !important;
    }
    
    a:visited {
        color: #800080 !important;
    }
}

/* 減少動畫偏好設定 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 確保按鈕和互動元素有足夠的目標大小 (至少44x44px) */
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.btn,
a[role="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* 表單標籤和輸入框的樣式 */
label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

input[required],
select[required],
textarea[required] {
    border-left: 3px solid #d73527;
}

input:invalid,
select:invalid,
textarea:invalid {
    border-color: #d73527;
    box-shadow: 0 0 3px #d73527;
}

/* 錯誤訊息樣式 */
.error-message {
    color: #d73527;
    font-size: 0.875rem;
    margin-top: 4px;
}

/* 確保圖片不會溢出容器 */
img {
    max-width: 100%;
    height: auto;
}

/* 確保文字放大到200%時仍可閱讀 */
@media (min-width: 1200px) {
    html {
        font-size: 112.5%;
    }
}