/* 失智症照護網絡：全站共用樣式（所有頁面都只引用這一個檔案）
   新頁面請沿用這裡的色票與元件，不要在 HTML 裡另寫 <style>。
   引用方式（用相對路徑，子資料夾頁面要加 ../）：<link rel="stylesheet" href="assets/site.css?v=dev">
   ?v=dev 會在部署時自動換成這個檔案內容的版本號，改了 CSS 瀏覽器就會抓新版。 */

:root {
  color-scheme: light;
  --text: #222; --muted: #4a4a4a; --page: #e3f4f2; --panel: #fff; --line: #d0d0d0;
  --accent: #0abab5; --brush: #81d8d0; --btn: #00706c; --btn-hover: #005451; --link: #00706c;
  --tint: #e6f6f4; --tint2: #f0faf9; --tiffany-soft: #81d8d0; --focus: #f5a300;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
/* 高齡友善：內文 18px、行距 1.8、深色字 */
body { margin: 0; font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif; font-size: 1.125rem; line-height: 1.8; color: var(--text); background: var(--page); }
a { color: var(--link); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ico { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* ── 頁首 ── */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--panel); box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.topbar .in { max-width: 82rem; margin: 0 auto; display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; min-height: 80px; }
.menu-btn { flex: 0 0 auto; width: 60px; height: 60px; border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-radius: 10px; padding: 0; color: #222; font: inherit; }
.menu-btn span { display: block; width: 26px; height: 3px; background: currentColor; border-radius: 2px; }
.menu-btn em { font-style: normal; font-size: .85rem; line-height: 1; margin-top: 3px; font-weight: 500; }
.menu-btn:hover, .menu-btn:focus-visible { background: var(--tint); }
.logo { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: #1f3b3a; min-height: 56px; }
.logo img { width: 52px; height: 52px; display: block; flex: 0 0 auto; }
.logo span { display: flex; flex-direction: column; line-height: 1.2; }
.logo b { font-size: 1.6rem; font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.logo small { font-size: .9rem; font-weight: 500; color: var(--btn); letter-spacing: .12em; margin-top: .2rem; white-space: nowrap; }
.topnav { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.topnav a { display: inline-flex; align-items: center; min-height: 48px; color: #222; text-decoration: none; padding: 0 .1rem; font-size: 1.125rem; }
.topnav a:hover, .topnav a:focus-visible { color: var(--btn); text-decoration: underline; }
.topnav a + a::before { content: "|"; color: #999; margin: 0 .9rem; display: inline-block; text-decoration: none; }

/* ── 側邊選單 ── */
.drawer { position: fixed; inset: 0; z-index: 100; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer .shade { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; }
.drawer.open .shade { opacity: 1; }
.drawer nav { position: absolute; top: 0; bottom: 0; left: 0; width: min(340px, 88vw); background: var(--panel); padding: 1rem 1.25rem; overflow-y: auto; transform: translateX(-100%); transition: transform .2s; }
.drawer.open nav { transform: none; }
.drawer .close { display: inline-flex; align-items: center; gap: .4rem; min-height: 52px; padding: 0 1.1rem; border: 2px solid var(--btn); border-radius: 999px; background: var(--panel); color: var(--btn); font: inherit; font-weight: 700; cursor: pointer; margin: 0 0 .75rem; }
.drawer .close:hover, .drawer .close:focus-visible { background: var(--tint); }
.drawer a { display: flex; align-items: center; gap: .75rem; min-height: 60px; padding: .5rem 0; color: #222; text-decoration: none; border-bottom: 1px solid var(--line); font-size: 1.2rem; }
.drawer a .ico { color: var(--btn); }
.drawer a:hover, .drawer a:focus-visible { color: var(--btn); }

/* ── 白色內容區 ── */
.sheet { max-width: 82rem; margin: 0 auto; background: var(--panel); padding: 1.5rem 1rem 3rem; min-height: calc(100vh - 80px); }
.hero { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: start; }
.hero .art { justify-self: center; width: min(55vw, 240px); }
.hero .art img { display: block; width: 100%; height: auto; }
.hint { margin: 0 0 .5rem; color: var(--muted); }

/* 項目清單：左側圖示、標題＋一句白話說明、右側三角形；整列都能點 */
.links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.links a { display: flex; align-items: center; gap: 1rem; min-height: 88px; padding: .85rem .5rem; border-bottom: 1px solid var(--line); color: #222; text-decoration: none; }
.links a::after { content: ""; flex: 0 0 auto; margin-left: auto; border-style: solid; border-width: 10px 0 10px 14px; border-color: transparent transparent transparent var(--accent); }
.links a:hover, .links a:focus-visible { background: var(--tint2); }
.links a:hover b, .links a:focus-visible b { color: var(--btn); }
.badge { flex: 0 0 auto; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--tint); color: var(--btn); }
.badge .ico { width: 30px; height: 30px; }
.links .txt { display: flex; flex-direction: column; min-width: 0; }
.links b { font-size: 1.35rem; font-weight: 700; line-height: 1.4; letter-spacing: .03em; }
.links .txt span { font-size: 1.05rem; color: var(--muted); line-height: 1.5; margin-top: .15rem; }

/* ── 最新消息 ── */
.news { margin-top: 2.25rem; }
.news h2 { display: flex; align-items: center; gap: .6rem; margin: 0 0 .5rem; font-size: 1.5rem; line-height: 1.4; color: #1f3b3a; }
.news h2 .badge { width: 48px; height: 48px; background: var(--btn); color: #fff; }
.news h2 .badge .ico { width: 26px; height: 26px; }
.news ol { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--accent); }
.news li { border-bottom: 1px solid var(--line); }
.news li > a, .news li > div { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 1.25rem; min-height: 64px; padding: .8rem .5rem; color: #222; text-decoration: none; }
.news li > a:hover, .news li > a:focus-visible { background: var(--tint2); }
.news time { flex: 0 0 auto; color: var(--btn); font-weight: 700; white-space: nowrap; }
.news .msg { flex: 1 1 16rem; }
.news .empty > div { color: var(--muted); }
.news a .msg { color: var(--btn); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

/* ── 詳細說明區塊 ── */
.sec { margin-top: 3rem; }
.sec > h2 { margin: 0 0 1rem; font-size: 1.6rem; line-height: 1.4; padding-left: .75rem; border-left: 6px solid var(--accent); }
.sec > p { margin: 0 0 1rem; }
.row { display: flex; gap: 1.5rem; align-items: flex-start; padding: 1.25rem 0; border-top: 1px solid var(--line); }
.row:last-child { border-bottom: 1px solid var(--line); }
.row h3 { margin: 0 0 .5rem; font-size: 1.3rem; line-height: 1.4; }
.row p { margin: 0 0 .75rem; }
.row ul { margin: 0 0 .75rem; padding-left: 1.4rem; }
.row li { margin-bottom: .25rem; }
.cover { flex: 0 0 auto; display: block; width: 150px; border-radius: 4px; overflow: hidden; box-shadow: 0 3px 12px rgba(0,0,0,.15); }
.cover img { display: block; width: 100%; height: auto; }
.info { flex: 1 1 auto; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin: .5rem 0 .75rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 56px; padding: .6rem 1.75rem; border-radius: 999px; background: var(--btn); color: #fff; text-decoration: none; font-size: 1.2rem; font-weight: 700; }
.btn:hover, .btn:focus-visible { background: var(--btn-hover); }
.link2 { display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: .5rem 1.5rem; border: 2px solid var(--btn); border-radius: 999px; color: var(--btn); font-size: 1.125rem; font-weight: 700; text-decoration: none; }
.link2:hover, .link2:focus-visible { background: var(--tint); }
.note { font-size: 1.05rem; color: var(--muted); margin-bottom: 0 !important; }
.foot { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 1rem; }
.visits { margin: .25rem 0 0; text-align: right; color: var(--muted); font-size: .9rem; }

/* ── 跳出卡片 ── */
.card-dlg { width: min(960px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25); color: var(--text); background: var(--panel); overflow-y: auto; overscroll-behavior: contain; }
.card-dlg::backdrop { background: rgba(0,0,0,.5); }
.card-dlg .dlg-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: .6rem .75rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.card-dlg .dlg-body { padding: 1.25rem 1.5rem 1rem; }
.card-dlg .dlg-foot { display: flex; justify-content: center; padding: .5rem 1.5rem 1.5rem; }
.card-dlg .sec { margin-top: 0; }
.card-dlg .row:last-child { border-bottom: 0; padding-bottom: 0; }
.dlg-close { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 52px; padding: 0 1.25rem; border: 2px solid var(--btn); border-radius: 999px; background: var(--panel); color: var(--btn); font: inherit; font-size: 1.15rem; font-weight: 700; cursor: pointer; }
.dlg-close:hover, .dlg-close:focus-visible { background: var(--tint); }
.dlg-foot .dlg-close { min-width: min(100%, 280px); background: var(--btn); color: #fff; }
.dlg-foot .dlg-close:hover, .dlg-foot .dlg-close:focus-visible { background: var(--btn-hover); }
/* 長照1966：服務對象方塊、四包錢 */
.sec > h3 { margin: 1.75rem 0 .5rem; font-size: 1.3rem; line-height: 1.4; }
.who { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: .75rem; }
.who li { display: flex; align-items: center; justify-content: center; min-height: 92px; padding: .9rem 1rem; background: var(--tiffany-soft); border-radius: 8px; color: #1a1a1a; font-weight: 700; font-size: 1.15rem; line-height: 1.5; text-align: center; }
.who li small { display: block; font-size: 1rem; font-weight: 500; }
.money { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: .75rem; }
.money li { padding: 1rem 1.1rem; background: var(--tint2); border-radius: 8px; }
.money b { display: block; font-size: 1.15rem; }
.money .amt { display: block; font-style: normal; margin: .15rem 0; color: var(--btn); font-size: 1.35rem; font-weight: 700; line-height: 1.4; }
.money span { display: block; font-size: 1.05rem; color: var(--muted); line-height: 1.6; }
.tel { font-size: 1.2rem; }
.tel a { display: inline-flex; align-items: center; gap: .4rem; min-height: 48px; font-weight: 700; }
/* 預立醫療決定：健保給付重點、六大對象、App 查詢步驟 */
.key { margin: 1.25rem 0 .5rem; padding: 1rem 1.25rem; background: var(--tint); border-left: 6px solid var(--btn); border-radius: 8px; }
.key p { margin: 0 0 .35rem; }
.key p:last-child { margin-bottom: 0; }
.key strong { color: var(--btn); font-size: 1.25rem; }
.who li.hl { background: var(--btn); color: #fff; box-shadow: 0 0 0 3px var(--accent); }
.steps { margin: 0 0 .75rem; padding-left: 1.6rem; }
.steps li { margin-bottom: .25rem; }
.steps b { color: var(--btn); }
@media (max-width: 540px) { .card-dlg .dlg-body { padding: 1rem 1rem .75rem; } .card-dlg .dlg-foot { padding: .5rem 1rem 1.25rem; } }

/* 平板 */
@media (min-width: 640px) {
  .sheet { padding: 2.5rem 2rem 3.5rem; }
}
/* 桌面：左插圖、右清單與最新消息 */
@media (min-width: 1100px) {
  .sheet { padding: 3rem 3.5rem 4rem; }
  .hero { grid-template-columns: 300px 1fr; gap: 3rem; }
  .hero .art { width: 100%; margin-top: .5rem; }
  .cover { width: 170px; }
}
/* 頁首：平板改小字；手機收起上方文字選單（改用左上「選單」） */
@media (max-width: 1180px) { .topnav a { font-size: 1.05rem; } .topnav a + a::before { margin: 0 .55rem; } }
@media (max-width: 1023px) { .topnav { display: none; } }
@media (max-width: 540px) {
  .topbar .in { min-height: 72px; padding: .4rem .6rem; gap: .4rem; }
  .logo { gap: .5rem; }
  .logo img { width: 44px; height: 44px; }
  .logo b { font-size: 1.3rem; letter-spacing: .04em; }
  .logo small { font-size: .8rem; letter-spacing: .06em; }
  .links a { gap: .75rem; padding: .75rem .25rem; }
  .badge { width: 50px; height: 50px; }
  .links b { font-size: 1.25rem; }
  .row { flex-direction: column; align-items: center; }
  .row .info { width: 100%; }
  .cover { width: min(60vw, 220px); }
  .cover.tall { width: min(42vw, 160px); }
  .actions { flex-direction: column; align-items: stretch; gap: .6rem; }
  .btn, .link2 { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .drawer nav, .drawer .shade { transition: none; } }

/* ════════════════════════════════════════════════
   翻頁閱讀器（手冊、預立醫療說明工具等電子書頁面）
   頁面用法：<html class="reader">，深色全螢幕版面
   ════════════════════════════════════════════════ */
html.reader { --bar: #2b2b33; --accent: #00706c; --text: #f4f4f6; }
html.reader, html.reader body { margin: 0; height: 100%; }
html.reader body { height: 100vh; height: 100dvh; }
html.reader body { font-family: system-ui, "Noto Sans TC", sans-serif; font-size: 1rem; line-height: normal; background: #3a3a44; color: var(--text); display: flex; flex-direction: column; overflow: hidden; }
html.reader header, html.reader footer { background: var(--bar); display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; flex-wrap: wrap; }
html.reader header h1 { font-size: 1.15rem; margin: 0 auto 0 0; font-weight: 600; }
html.reader a, html.reader button, html.reader select { font: inherit; }
html.reader .tbtn { background: transparent; color: var(--text); border: 1px solid #66667a; border-radius: 6px; padding: .4rem .8rem; text-decoration: none; cursor: pointer; font-size: 1rem; white-space: nowrap; }
html.reader .tbtn:hover, html.reader .tbtn:focus-visible { background: #44444f; }
html.reader .tbtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
html.reader .tbtn:disabled { opacity: .4; cursor: default; }
html.reader select.tbtn { background: var(--bar); }
html.reader main { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px; position: relative; }
html.reader #book { margin: 0 auto; }
html.reader .page { background: #fff; overflow: hidden; }
html.reader .page img { width: 100%; height: 100%; display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; }
html.reader footer { justify-content: center; }
html.reader #pageInfo { min-width: 7.5em; text-align: center; font-variant-numeric: tabular-nums; }
html.reader #loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
html.reader .hint { margin: 0; font-size: .9rem; color: #b8b8c4; width: 100%; text-align: center; }
/* 放大閱讀 */
html.reader #zoom { position: fixed; inset: 0; background: #1d1d22; z-index: 1000; display: none; flex-direction: column; }
html.reader #zoom.open { display: flex; }
html.reader #zoom .zbar { display: flex; gap: .5rem; align-items: center; padding: .5rem .75rem; background: var(--bar); }
html.reader #zoom .zbar span { margin-right: auto; }
html.reader #zoomBody { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; text-align: center; padding: 8px; }
html.reader #zoomBody img { display: block; margin: 0 auto 8px; background: #fff; max-width: none; }
/* 觸控裝置（手機、平板）：按鈕加大好點按，提示改成手勢說明 */
html.reader.touch .tbtn { min-height: 44px; min-width: 44px; padding: .4rem .8rem; }
html.reader.touch .tip-kbd, html.reader:not(.touch) .tip-touch { display: none; }
/* 手機直向 */
@media (max-width: 600px) {
  html.reader header h1 { font-size: 1rem; width: 100%; }
  html.reader header { gap: .4rem; }
  html.reader .tbtn, html.reader.touch .tbtn { padding: .35rem .6rem; font-size: .95rem; }
  html.reader #toc { flex: 1 1 auto; }
  html.reader main { padding: 6px; }
  html.reader footer { gap: .35rem; }
  html.reader #pageInfo { min-width: 5.5em; }
}
/* 窄手機：首頁／末頁按鈕收起來（可用章節目錄跳轉），讓翻頁按鈕排成一行 */
@media (max-width: 420px) { html.reader #first, html.reader #last { display: none; } }
/* 矮螢幕（手機橫向）：工具列縮成一行、隱藏提示，把空間留給書 */
@media (max-height: 520px) {
  html.reader header, html.reader footer { padding: .25rem .5rem; flex-wrap: nowrap; }
  html.reader header h1 { font-size: .95rem; width: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.reader .tbtn, html.reader.touch .tbtn { min-height: 36px; padding: .2rem .6rem; font-size: .9rem; }
  html.reader .hint { display: none; }
  html.reader main { padding: 4px; }
}
