/*
 * PDSMS2026 無障礙認證第一階段：共用基礎樣式
 * 說明：跳過連結、可見焦點、視覺隱藏文字。
 * 本檔於三個網站經由 SharedAssets/_CoreStyles 一併載入。
 */

/* 跳至主要內容：平時移出畫面外，鍵盤聚焦時才顯示 */
.skip-link {
    position: fixed;
    z-index: 10000;
    top: .5rem;
    left: .5rem;
    padding: .75rem 1rem;
    background: #004a99;
    color: #ffffff;
    text-decoration: none;
    border-radius: .25rem;
    transform: translateY(-200%);
    transition: transform .15s ease-in-out;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 3px solid #ffbf47;
    outline-offset: 3px;
    color: #ffffff;
}

/* 可見焦點：確保鍵盤操作時焦點外框清楚可見 */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid #005fcc !important;
    outline-offset: 3px;
}

/* 讓 skip link 目標取得焦點時不再顯示預設外框造成干擾 */
main[tabindex="-1"]:focus {
    outline: none;
}

/* 視覺隱藏但仍可被輔具讀取；取得焦點時（如 skip-link）則顯示 */
.visually-hidden:not(:focus):not(:active) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/*
 * 選單子項觸發器：因無障礙需求改為原生 <button>，
 * 但視覺需與一般 <a class="menu-link"> 連結一致（去除按鈕外觀）。
 * 僅套用於選單內的 button.menu-link，不影響帳號管理等實體按鈕。
 */
button.menu-link {
    background-color: transparent;
    background-image: none;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    width: 100%;
    text-align: inherit;
    font: inherit;
    color: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

button.menu-link:hover,
button.menu-link:focus {
    background-color: transparent;
    box-shadow: none;
}
