/* 全站共用：跳到內容連結、手機選單、無障礙色彩（首頁與內頁都載入，放在其他樣式之後） */
:root {
    --text-light: #666666;   /* 輔助文字：在米白底上對比 5:1，達 WCAG AA */
    --primary-text: #4D6C66; /* 鼠尾草綠加深，用於文字連結與按鈕底色：米白底 5:1，達 WCAG AA */
    --accent-text: #875E3F;  /* 暖陶色加深，用於小標題與按鈕底色：米白底 5:1，達 WCAG AA */
}

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--primary-text); color: #fff; padding: 0.6rem 1rem; z-index: 2000; border-radius: 0 0 6px 0; }
.skip-link:focus { left: 0; }

.btn-reserve { background-color: var(--primary-text) !important; }
.btn-reserve:hover { background-color: #3F5A55 !important; }

.nav-toggle {
    display: none;
    font: inherit;
    background: none;
    border: 1px solid #D6D1C7;
    border-radius: 6px;
    padding: 0.35rem 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
}
.nav-toggle:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

@media (max-width: 768px) {
    header { flex-direction: row !important; flex-wrap: wrap; align-items: center !important; padding: 0.8rem 16px !important; }
    .nav-toggle { display: inline-block; }
    #site-nav { display: none; width: 100%; }
    #site-nav.open { display: block; }
    #site-nav ul { flex-direction: column; gap: 0 !important; }
    #site-nav li { display: block !important; border-top: 1px solid #EEE; }
    #site-nav a { display: block; padding: 0.7rem 0.2rem; }
    #site-nav .btn-reserve { text-align: center; margin: 0.8rem 0 0.4rem; padding: 0.6rem 1rem; }
}

/* 【待補】標記：提醒還需要本人資料的地方，上線前要換掉 */
.todo { background: #FFF4D6; color: #6B4E00; border: 1px dashed #C9A13B; border-radius: 4px; padding: 0 0.3rem; font-size: 0.92em; }

@media (min-width: 769px) and (max-width: 1150px) {
    #site-nav ul { gap: 1.1rem !important; font-size: 0.95rem; }
}

/* 常見問題 */
.faq-item { background: var(--white); border-radius: 8px; padding: 0.9rem 1.2rem; margin-top: 0.8rem; }
main section:nth-of-type(even) .faq-item { background: var(--secondary-color); }
.faq-item summary { cursor: pointer; font-weight: bold; color: var(--text-dark); }
.faq-item[open] summary { color: var(--primary-text); margin-bottom: 0.5rem; }

/* 知識專欄：以問題分類 */
.q-list { display: grid; gap: 0.8rem; margin-top: 1rem; }
.q-list a { display: block; background: var(--white); border-radius: 8px; padding: 1rem 1.2rem; text-decoration: none; color: var(--text-dark); border-left: 4px solid var(--primary-color); }
main section:nth-of-type(even) .q-list a { background: var(--secondary-color); }
.q-list a:hover { border-left-color: var(--accent-color); }
.q-list strong { display: block; color: var(--primary-text); }
.q-list span { color: var(--text-light); font-size: 0.93rem; }
.q-list .soon { display: block; background: var(--white); border-radius: 8px; padding: 1rem 1.2rem; border-left: 4px solid #D6D1C7; }
main section:nth-of-type(even) .q-list .soon { background: var(--secondary-color); }
.q-list .soon strong { color: var(--text-dark); }

/* 電子報訂閱（Buttondown） */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.newsletter { background: var(--white); border-radius: 8px; padding: 1.3rem 1.4rem; border-left: 4px solid var(--primary-color); }
main section:nth-of-type(even) .newsletter { background: var(--secondary-color); }
.newsletter h3 { color: var(--primary-text); margin: 0 0 0.4rem; }
.nl-form { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.nl-form input[type="email"] { flex: 1 1 220px; min-width: 0; padding: 0.65rem 0.8rem; border: 1px solid #C9C3B8; border-radius: 6px; font: inherit; }
.nl-form button { padding: 0.65rem 1.4rem; border: 0; border-radius: 6px; background: var(--primary-text); color: #fff; font: inherit; cursor: pointer; }
.nl-form button:hover { background: var(--accent-text); }
.nl-note { font-size: 0.88rem; color: var(--text-light); margin-top: 0.7rem; }

/* 標誌「臨床心語 ClinicMind」不換行；中等寬度時縮小，讓導覽列放得下 */
.logo { white-space: nowrap; }
@media (min-width: 769px) and (max-width: 1150px) {
    .logo { font-size: 1.15rem !important; letter-spacing: 0 !important; }
    #site-nav ul { gap: 0.75rem !important; font-size: 0.88rem; }
    #site-nav a { white-space: nowrap; }
}

/* ---- 2026-09-30 體驗與無障礙優化 ---- */

/* 錨點跳轉時，標題不會被固定的導覽列蓋住 */
html { scroll-padding-top: 5.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .service-card:hover { transform: none !important; }
}

/* 導覽列：目前頁與滑過時用加深的綠，小字也清楚 */
nav a:hover, nav a[aria-current="page"] { color: var(--primary-text) !important; }
nav a[aria-current="page"] { font-weight: bold; }
.nav-toggle { min-height: 44px; min-width: 44px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--primary-text); outline-offset: 2px; }

/* 內文裡的連結加底線，不只靠顏色辨識（WCAG 1.4.1） */
main p a:not(.btn-reserve):not(.cta-button):not(.cta-secondary),
main li a, main td a, .faq-item a, .callout a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
main .q-list a, main .service-card, main .toc a { text-decoration: none; }
main .q-list a strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* 中文不用斜體（瀏覽器只會把字硬拉斜） */
em, cite, blockquote { font-style: normal; }

/* 作者與更新日期 */
.byline { color: var(--text-light); font-size: 0.92rem; margin-top: 1rem !important; }
.page-hero .byline { margin-top: 1.2rem; }

/* 快速認識（給第一次來的人，也方便搜尋與 AI 正確引用） */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.4rem; background: var(--white); border-radius: 10px; padding: 1.3rem 1.5rem; margin-top: 1rem; }
main section:nth-of-type(even) .facts { background: var(--secondary-color); }
.facts dt { font-weight: bold; color: var(--primary-text); }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; gap: 0.1rem; } .facts dd { margin-bottom: 0.6rem; } }

/* 延伸閱讀 */
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.related a { display: block; background: var(--white); border-radius: 8px; padding: 0.9rem 1.1rem; border-left: 4px solid var(--primary-color); text-decoration: none !important; color: var(--text-dark); }
main section:nth-of-type(even) .related a { background: var(--secondary-color); }
.related a:hover { border-left-color: var(--accent-color); }
.related strong { display: block; color: var(--primary-text); }

/* 頁尾連結：手指好按 */
.footer-links a { display: inline-block; padding: 0.35rem 0; }
footer h3, footer h4 { color: #fff; margin-bottom: 0.4rem; }

/* 表格標題 */
table caption { text-align: left; font-weight: bold; color: var(--text-dark); padding-bottom: 0.5rem; }

/* 中文標題按詞組斷行，不把「找回」這類詞拆開 */
.nb { display: inline-block; }

/* 心理名詞小辭典 */
.glossary { display: grid; gap: 0.8rem; margin-top: 1rem; }
.glossary .term { background: var(--white); border-radius: 8px; padding: 0.9rem 1.2rem; border-left: 4px solid var(--primary-color); scroll-margin-top: 5rem; }
main section:nth-of-type(even) .glossary .term { background: var(--secondary-color); }
.glossary .term:target { border-left-color: var(--accent-color); }
.glossary dt { font-weight: bold; color: var(--primary-text); }
.glossary dt .en { font-weight: normal; color: var(--text-light); font-size: 0.9rem; margin-left: 0.3rem; }
.glossary dd { margin: 0.3rem 0 0; }
.glossary dd a { white-space: nowrap; }

/* ---- 2026-10 批次 B：導覽、按鈕與閱讀 ---- */

/* 即時支援：導覽列上清楚可見的文字連結，不搶主要按鈕 */
#site-nav .nav-support { color: #8A2E2E; font-weight: bold; text-decoration: underline; text-underline-offset: 3px; }
#site-nav .nav-support:hover { color: #6E2222 !important; }

/* 主要操作全站統一為深鼠尾草綠實心，手指好按 */
.btn-reserve { display: inline-block; min-height: 44px; line-height: 1.6; }
@media (min-width: 769px) { #site-nav ul { align-items: center; } #site-nav .btn-reserve { display: inline-flex; align-items: center; } }

/* 內頁閱讀：內文字級稍大 */
main .inner { font-size: 1.0625rem; }
.page-hero h1 { font-size: clamp(1.6rem, 1.15rem + 2vw, 2.2rem) !important; }
