/* 全站共用：footer、法律頁、內容分級、健康免責、搜尋 */

/* 全站版面：單一 Y 軸卷軸（僅 html）、禁止水平溢出 */
html {
    scroll-behavior: smooth;
    overflow-x: clip;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(240, 214, 158, 0.85) rgba(246, 239, 230, 0.75);
}
html::-webkit-scrollbar {
    width: 12px;
}
html::-webkit-scrollbar-track {
    background: rgba(246, 239, 230, 0.85);
    border-left: 1px solid rgba(240, 214, 158, 0.35);
}
html::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(240, 214, 158, 0.95) 0%, rgba(160, 124, 55, 0.95) 100%);
    border-radius: 999px;
    border: 3px solid rgba(246, 239, 230, 0.85);
    box-shadow: 0 6px 14px rgba(15, 28, 46, 0.18);
}
html::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(240, 214, 158, 1) 0%, rgba(140, 103, 34, 1) 100%);
}
body {
    max-width: 100%;
    overflow-wrap: break-word;
}
img, video, svg, canvas {
    max-width: 100%;
    height: auto;
}
table {
    max-width: 100%;
}
.article-body table,
.book-content table,
.legal-page .legal-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
main,
.page,
.shell-page,
.layout-container,
.main-content,
.banner,
.site-footer,
.top-nav {
    max-width: 100%;
}

/* 全站連結：無下底線、無預設藍色 */
a,
a:link,
a:visited,
a:hover,
a:focus,
a:active {
    color: inherit;
    text-decoration: none;
}

.content-grades {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}
.content-grade {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    border: 1px solid rgba(240, 214, 158, 0.45);
    background: rgba(240, 214, 158, 0.18);
    color: rgba(15, 28, 46, 0.82);
}
.grade-research { background: rgba(52, 120, 180, 0.12); border-color: rgba(52, 120, 180, 0.35); }
.grade-experience { background: rgba(120, 80, 160, 0.12); border-color: rgba(120, 80, 160, 0.35); }
.grade-traditional { background: rgba(140, 100, 50, 0.12); border-color: rgba(140, 100, 50, 0.35); }
.grade-hypothesis { background: rgba(180, 120, 50, 0.12); border-color: rgba(180, 120, 50, 0.35); }
.grade-practice { background: rgba(50, 130, 90, 0.12); border-color: rgba(50, 130, 90, 0.35); }

.health-disclaimer-short {
    margin-top: 28px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(240, 214, 158, 0.35);
    font-size: 0.88rem;
    line-height: 1.85;
    color: rgba(44, 62, 80, 0.82);
}
.health-disclaimer-short a {
    color: var(--bg-dark, #0f1c2e);
    font-weight: 800;
}

.site-footer {
    margin-top: clamp(50px, 8vw, 90px);
    background: var(--bg-dark, #0f1c2e);
    color: #fff;
    border-radius: 28px 28px 0 0;
    padding: clamp(30px, 5vw, 52px) clamp(20px, 5vw, 40px) 0;
}
.site-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 0.9fr;
    gap: 34px;
    padding-bottom: 28px;
}
.footer-quote {
    font-family: var(--font-serif, "Noto Serif TC", serif);
    font-size: 1.05rem;
    line-height: 1.85;
    margin-bottom: 18px;
    color: rgba(255, 255, 255, 0.9);
}
.footer-legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 0.82rem;
}
.footer-legal-links a {
    color: rgba(240, 214, 158, 0.88);
    text-decoration: none;
    font-weight: 700;
}
.footer-legal-links a:hover { color: #fff; }
.footer-col h4 {
    font-family: var(--font-serif, "Noto Serif TC", serif);
    color: var(--text-gold, #f0d69e);
    margin-bottom: 14px;
    font-size: 1.02rem;
    letter-spacing: 1px;
}
.footer-list {
    list-style: none;
    display: grid;
    gap: 10px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.92rem;
}
.footer-list li {
    display: grid;
    grid-template-columns: 1.125rem minmax(0, 1fr);
    column-gap: 10px;
    align-items: center;
    min-width: 0;
    line-height: 1.5;
}
.footer-list i {
    grid-column: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    line-height: 1;
    color: var(--text-gold, #f0d69e);
    font-size: 0.875rem;
}
.footer-list i::before {
    display: block;
    line-height: 1;
}
.footer-list li > a:not(:only-child),
.footer-list li > span {
    grid-column: 2;
    min-width: 0;
    line-height: 1.2;
    translate: 0 -1px;
}
.footer-list li > a {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-weight: 700;
}
.footer-list li > a:only-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.125rem minmax(0, 1fr);
    column-gap: 10px;
    align-items: center;
    min-width: 0;
}
.footer-list li > a:only-child > i {
    grid-column: 1;
}
.footer-list a:hover { color: var(--text-gold, #f0d69e); }
.footer-support-note {
    margin-top: 14px;
    font-size: 0.85rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.62);
}
.footer-support-note a { color: rgba(240, 214, 158, 0.95); }
.footer-bottom {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 0 24px;
    border-top: 1px solid rgba(240, 214, 158, 0.15);
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
}

.back-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1200;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 1px solid rgba(240, 214, 158, 0.55);
    background:
        radial-gradient(120% 120% at 30% 20%, rgba(240, 214, 158, 0.18) 0%, rgba(240, 214, 158, 0) 55%),
        linear-gradient(180deg, rgba(20, 36, 59, 0.96) 0%, rgba(15, 28, 46, 0.96) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f0d69e;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow:
        0 18px 46px rgba(15, 28, 46, 0.26),
        0 0 0 1px rgba(240, 214, 158, 0.16) inset;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}
.back-to-top i {
    font-size: 1.05rem;
}
.back-to-top::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 20%, rgba(240, 214, 158, 0.55), rgba(240, 214, 158, 0) 60%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.back-to-top:hover {
    transform: translateY(8px);
    box-shadow:
        0 22px 58px rgba(15, 28, 46, 0.32),
        0 0 0 1px rgba(240, 214, 158, 0.22) inset;
}
.back-to-top:hover::before {
    opacity: 1;
}
.back-to-top:active {
    transform: translateY(9px);
    filter: brightness(0.98);
}
.back-to-top:focus-visible {
    outline: 3px solid rgba(240, 214, 158, 0.65);
    outline-offset: 3px;
}
.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.legal-page .legal-body {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 0 60px;
    line-height: 2;
    color: rgba(44, 62, 80, 0.88);
}
.legal-page .legal-body h2 {
    font-family: var(--font-serif, "Noto Serif TC", serif);
    color: var(--bg-dark, #0f1c2e);
    font-size: 1.35rem;
    margin: 32px 0 12px;
}
.legal-page .legal-body h2:first-child { margin-top: 0; }
.legal-page .legal-body p,
.legal-page .legal-body li { margin-bottom: 12px; }
.legal-page .legal-body ul { padding-left: 1.4rem; }
.legal-page .legal-body a {
    color: var(--bg-dark, #0f1c2e);
    font-weight: 700;
}

.nav-search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    flex-shrink: 0;
}
.nav-search-form input {
    width: min(140px, 28vw);
    border: 1px solid rgba(240, 214, 158, 0.45);
    border-radius: 999px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.65);
    outline: none;
}
.nav-search-form button {
    border: 0;
    background: rgba(240, 214, 158, 0.35);
    color: var(--bg-dark, #0f1c2e);
    border-radius: 999px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    flex-shrink: 0;
}

@media (max-width: 1120px) {
    .site-footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .back-to-top { right: 14px; bottom: 14px; width: 48px; height: 48px; }
}
