/* 衛教文章共用樣式 — 沿用首頁的色票與字體
 * 所有文章共用這一份，改版時只需要動這裡。 */

:root {
    --primary: #1a4a5e;
    --primary-light: #2d7a9c;
    --primary-dark: #0d2d3a;
    --accent: #e58a2c;
    --accent-light: #f5a54a;
    --bg-light: #faf5ee;
    --bg-cream: #f9f1e8;
    --bg-white: #fdf8f2;
    --text-dark: #1a202c;
    --text-body: #374151;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #a5342a;
    --danger-bg: #fbeeeb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-body);
    background: var(--bg-light);
    line-height: 1.9;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- 導覽 */
nav {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}
.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.4px;
    white-space: nowrap;
}
.nav-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all 0.25s ease;
    white-space: nowrap;
}
.nav-back:hover { color: var(--primary); border-color: var(--primary-light); }

/* ---------------------------------------------------------------- 版面 */
.article-wrap { max-width: 760px; margin: 0 auto; padding: 0 1.5rem 5rem; }

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 1.6rem 0 0;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); text-decoration: underline; }

.article-header { padding: 1rem 0 2rem; border-bottom: 1px solid var(--border); }
.article-tag {
    display: inline-block;
    background: var(--bg-cream);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    margin-bottom: 1rem;
    letter-spacing: 0.03em;
}
h1 {
    font-size: clamp(1.65rem, 4.6vw, 2.3rem);
    line-height: 1.42;
    color: var(--text-dark);
    font-weight: 900;
    letter-spacing: -0.5px;
    text-wrap: balance;
}
.article-meta {
    margin-top: 1.1rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.4rem;
}

/* ------------------------------------------------------------ 醫師速答 */
.quick-answer {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-sm);
}
.quick-answer h2 {
    margin: 0 0 0.7rem;
    font-size: 0.82rem;
    color: var(--primary);
    letter-spacing: 0.12em;
    font-weight: 700;
}
.quick-answer p { font-size: 1.02rem; color: var(--text-dark); margin-bottom: 0.8rem; }
.quick-answer p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ 內文 */
h2 {
    font-size: 1.4rem;
    color: var(--text-dark);
    font-weight: 700;
    margin: 3rem 0 1rem;
    scroll-margin-top: 80px;
    line-height: 1.5;
    letter-spacing: -0.3px;
}
h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    font-weight: 700;
    margin: 2rem 0 0.7rem;
}
p { margin-bottom: 1.25rem; }
strong { color: var(--text-dark); font-weight: 700; }
article ul, article ol { margin: 0 0 1.4rem 1.3rem; }
article li { margin-bottom: 0.6rem; }
a { color: var(--primary-light); }

/* ------------------------------------------------------------ 對照表 */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}
table { border-collapse: collapse; width: 100%; min-width: 540px; font-size: 0.94rem; }
th, td { text-align: left; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
    background: var(--bg-cream);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
td:first-child { font-weight: 700; color: var(--text-dark); white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tr.row-danger td { background: var(--danger-bg); }
tr.row-danger td:first-child { color: var(--danger); }
.table-note { font-size: 0.85rem; color: var(--text-muted); margin: -0.6rem 0 1.5rem; }

/* ------------------------------------------------------------ 警訊框 */
.alert {
    background: var(--danger-bg);
    border: 1px solid #f0cfc8;
    border-left: 4px solid var(--danger);
    border-radius: 12px;
    padding: 1.4rem 1.6rem;
    margin: 1.75rem 0;
}
.alert h3 { margin: 0 0 0.6rem; color: var(--danger); font-size: 1.02rem; }
.alert ul { margin: 0 0 0 1.2rem; }
.alert li { margin-bottom: 0.5rem; }
.alert li:last-child { margin-bottom: 0; }

.note {
    background: var(--bg-cream);
    border-radius: 12px;
    padding: 1.3rem 1.6rem;
    margin: 1.75rem 0;
    font-size: 0.97rem;
}
.note h3 { margin: 0 0 0.5rem; font-size: 1rem; color: var(--primary); }
.note p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ 相關內容 */
.related { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 1.5rem 0; }
.related-card {
    display: block;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.3rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.related-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent-light); }
.related-kind { font-size: 0.75rem; color: var(--accent); font-weight: 700; letter-spacing: 0.05em; }
.related-card h4 { font-size: 1rem; color: var(--text-dark); margin: 0.3rem 0 0.25rem; font-weight: 700; }
.related-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; line-height: 1.6; }

/* ------------------------------------------------------------ 作者卡 */
.author-card {
    display: flex;
    gap: 1.3rem;
    align-items: flex-start;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem 1.7rem;
    margin: 3rem 0 1.5rem;
    box-shadow: var(--shadow-sm);
}
.author-photo-pic { flex-shrink: 0; display: block; font-size: 0; }
.author-photo {
    width: 76px; height: 76px; border-radius: 50%;
    object-fit: cover; object-position: top center;
    flex-shrink: 0; border: 2px solid var(--bg-cream);
}
.author-info h3 { margin: 0 0 0.2rem; font-size: 1.08rem; color: var(--text-dark); }
.author-role { font-size: 0.88rem; color: var(--primary); font-weight: 500; margin-bottom: 0.6rem; }
.author-info p { font-size: 0.9rem; color: var(--text-muted); margin: 0 0 0.6rem; line-height: 1.7; }
.author-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; font-size: 0.87rem; }
.author-links a { color: var(--primary-light); text-decoration: none; }
.author-links a:hover { text-decoration: underline; }

.refs { font-size: 0.9rem; color: var(--text-muted); }
.refs ul { margin: 0.5rem 0 0 1.2rem; }
.refs li { margin-bottom: 0.45rem; }

.ref-list { list-style: none; margin: 0.5rem 0 0; padding: 0; counter-reset: ref; }
.ref-list li {
    position: relative;
    padding: 0.85rem 0 0.85rem 2.1rem;
    border-bottom: 1px solid var(--border);
    margin: 0;
    line-height: 1.65;
}
.ref-list li:last-child { border-bottom: none; }
.ref-list li::before {
    counter-increment: ref;
    content: counter(ref);
    position: absolute;
    left: 0; top: 0.95rem;
    width: 1.4rem; height: 1.4rem;
    background: var(--bg-cream);
    color: var(--primary);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.ref-name { display: block; color: var(--text-dark); font-weight: 500; }
.ref-src { display: block; font-size: 0.83rem; margin-top: 0.15rem; }
.ref-list a { font-size: 0.83rem; }
.ref-note {
    font-size: 0.83rem;
    color: var(--text-muted);
    margin: 1rem 0 0;
    padding-top: 0.9rem;
    border-top: 1px dashed var(--border);
}

.disclaimer {
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 1.3rem;
    margin-top: 1.5rem;
    line-height: 1.75;
}

footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 2rem 1.5rem;
    font-size: 0.85rem;
}

footer .footer-privacy {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.6;
}

footer .footer-privacy a {
    color: inherit;
    text-decoration: underline;
}

/* ------------------------------------------------------ 審閱模式標記
 * 正式版：移除 <body> 上的 data-review 屬性，所有標記自動消失。 */
.review-banner { display: none; }
.review-only { display: none; }
[data-review] .review-only { display: inline; }
[data-review] .review-banner {
    display: block;
    background: #fff8ec;
    border: 1px dashed var(--accent);
    border-radius: 12px;
    padding: 1.1rem 1.4rem;
    margin: 1.5rem 0 0;
    font-size: 0.9rem;
    color: #8a5410;
    line-height: 1.75;
}
[data-review] .review-banner strong { color: #8a5410; }
[data-review] .tbc {
    background: #fff3df;
    border-bottom: 2px dotted var(--accent);
    padding: 0 2px;
    border-radius: 2px;
}

@media (max-width: 640px) {
    body { font-size: 16px; }
    .article-wrap { padding: 0 1.15rem 3.5rem; }
    .quick-answer { padding: 1.25rem 1.3rem; }
    .author-card { flex-direction: column; gap: 1rem; }
    .author-photo { width: 64px; height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}

/* ------------------------------------------------------ 文章索引頁 */
.filter-note {
    font-size: 0.92rem;
    color: var(--text-muted);
    padding: 1.4rem 0 0.4rem;
}
.post-list { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.post-list li { margin: 0 0 0.9rem; }
.post {
    display: block;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.4rem 1.6rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.post:hover, .post:focus-visible {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-light);
}
.post-tag {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--bg-cream);
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    letter-spacing: 0.03em;
}
.post h2 {
    font-size: 1.18rem;
    margin: 0.6rem 0 0.45rem;
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.5;
}
.post p {
    font-size: 0.93rem;
    color: var(--text-muted);
    margin: 0 0 0.7rem;
    line-height: 1.75;
}
.post-meta { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
