/* =========================================
   CSS 變數參數化設計
========================================= */
:root {
    --color-brown:          #40220f; /* 深咖啡色 */
    --color-brown-light:    #6a3906; /* 淺咖啡色 */
    --color-gold:           #ffd700; /* 金色 */
    --color-white:          #ffffff; /* 純白色 */
    --color-black:          #000000; /* 純黑色 */
    --color-dark-blue:      #0f172a; /* 深藍色 */
    --color-cream:          #fffdf5; /* 奶油色/米白色 */
    --color-cream-dark:     #f2ebd9; /* 深奶油色/淺沙色 */
    --color-text-main:      #2c241b; /* 深棕灰色 */
    --color-text-sub:       #5d554a; /* 灰褐色 */

    --radius-sm:            0.5rem;
    --radius-md:            1rem;
    --radius-lg:            2rem;

    --ease-brand:           cubic-bezier(.25, .46, .45, .94); 
    --duration-fast:        0.2s;
    --duration-normal:      0.4s;
    --transition-base:      all var(--duration-normal) var(--ease-brand);

    --glass-shadow:         0 12px 40px rgba(0, 51, 102, 0.08);
}

*, *::before, *::after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

img, video, iframe, canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

body {
    font-family: "Roboto", "Helvetica Neue", "Inter", "PingFang TC", "Microsoft JhengHei", sans-serif;
    color: var(--color-text-main);
    background: var(--color-cream);
    line-height: 1.6;
}

body.menu-open {
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-base);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* =========================================
	返回按鈕 
========================================= */
.back-btn {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    color: white;
    text-decoration: none;
    font-size: 0.9375rem;
    padding: 0.625rem 1.25rem;
    border-radius: 1.875rem;
    transition: var(--transition-fast);
    z-index: 1000;
    background-color: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(4px);
}

.back-btn:hover {
    background-color: var(--color-black);
    transform: translateX(-3px);
}

@media (max-width: 48rem) {
	.back-btn {
		font-size: 0.6rem;
	}
}

/* --- 滾動文字浮現動畫核心 (Scroll Reveal) --- */
.reveal-item {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 1.2s cubic-bezier(0.215, 0.610, 0.355, 1.000), 
                transform 1.2s cubic-bezier(0.215, 0.610, 0.355, 1.000);
    will-change: opacity, transform;
}

/* 當 JS 偵測到進入視窗時，加上 active 類名觸發優雅上浮 */
.reveal-item.active {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   Doctor Hero
========================================= */
.doctor-page-main {
    background-color: var(--color-cream);
    min-height: calc(100vh - 300px);
}

.doctor-hero {
    background-color: var(--color-brown);
    color: var(--color-white);
    padding: 4rem 0;
    text-align: center;
    border-bottom: 4px solid var(--color-gold);
    margin-bottom: 3rem;
}

.doctor-hero .page-title {
    font-size: 2.5rem;
    color: var(--color-gold);
    margin-bottom: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.doctor-hero .page-subtitle {
    font-size: 1.05rem;
    color: var(--color-cream-dark);
    opacity: 0.9;
}

/* =========================================
   醫師介紹 (Doctor Profile Section) 
========================================= */
.doctor-profile-section {
    position: relative;
    z-index: 10;
    margin-bottom: 4rem;
}

.doctor-profile-card {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 3rem;
    display: flex;
    align-items: center;
    gap: 4rem;
    overflow: hidden;
}

/* --- 左側：醫師圖片 --- */
.doctor-image-wrapper {
    flex: 0 0 35%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 圖片後方的裝飾圓形 */
.doctor-image-bg {
    position: absolute;
    width: 85%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, var(--color-cream-dark) 0%, var(--color-cream) 100%);
    border-radius: 50%;
    z-index: 1;
}

.doctor-img {
    position: relative;
    z-index: 2;
    width: 100%;
    max-height: 450px;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

/* --- 右側：醫師資訊 --- */
.doctor-info-wrapper {
    flex: 1;
}

.doctor-header {
    border-bottom: 2px solid var(--color-cream-dark);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.doctor-name {
    font-size: 2.25rem;
    color: var(--color-brown);
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.doctor-title {
    font-size: 1.1rem;
    color: var(--color-text-sub);
    font-weight: 500;
    background-color: var(--color-cream);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-gold);
}

.doctor-current {
    font-size: 1.1rem;
    color: var(--color-brown-light);
    font-weight: 500;
}

/* --- 經歷細節清單 --- */
.doctor-details {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.detail-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    background-color: var(--color-cream);
    color: var(--color-brown);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--color-cream-dark);
}

.detail-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.detail-text h3 {
    font-size: 1.05rem;
    color: var(--color-brown);
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.detail-text p {
    color: var(--color-text-sub);
    line-height: 1.6;
}

/* --- 科別標籤 (Tags) --- */
.specialty-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background-color: var(--color-cream-dark);
    color: var(--color-brown);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    transition: var(--transition-base);
}

.tag:hover {
    background-color: var(--color-gold);
    color: var(--color-brown);
    transform: translateY(-2px);
}

/* --- RWD --- */
@media (max-width: 62rem) {
    .doctor-profile-card {
        padding: 2.5rem;
        gap: 2.5rem;
    }
}

@media (max-width: 48rem) {
    .doctor-profile-card {
        flex-direction: column;
        padding: 2rem;
        text-align: center;
        gap: 2rem;
    }

    .doctor-image-wrapper {
        width: 60%;
    }

    .doctor-header {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .detail-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
    }

    .specialty-tags {
        justify-content: center;
    }
}

/* =========================================
   主治醫療項目 (Medical Projects) 
========================================= */
.main_medical_projects {
    padding-bottom: 5rem;
}

.medical-projects-header {
    text-align: center;
    margin-bottom: 4rem;
}

.medical-projects-header h2 {
    color: var(--color-brown);
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

/* 控制副標題的顏色與大小 */
.medical-projects-header p {
    color: var(--color-text-sub);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

.medical-flow-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* --- 非對稱橫向列表 --- */
.medical-row {
    display: flex;
    align-items: flex-start;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px dashed var(--color-cream-dark);
}

.medical-row:last-of-type {
    border-bottom: none;
    padding-bottom: 1rem;
}

/* 左側：科別標題 */
.medical-category {
    flex: 0 0 20%;
    min-width: 150px;
}

.category-title {
    position: relative;
    padding-left: 1rem;
}

.category-title h3 {
    font-size: 1.5rem;
    color: var(--color-brown);
    font-weight: 700;
    margin: 0;
}

/* 標題左側的裝飾線 */
.category-line {
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 4px;
    border-radius: 2px;
}

.general-med .category-line {
    background-color: #6C9BCF; /* 柔和藍 */
}

.gyn-peds .category-line {
    background-color: #F19EAF; /* 柔和粉 */
}

/* 右側：流動標籤 (Flex Wrap) */
.medical-items {
    flex: 1;
    display: flex;
    flex-wrap: wrap; 	/* 讓標籤自然流動換行 */
    gap: 0.75rem 1rem; 	/* 上下 0.75rem, 左右 1rem */
}

.med-tag {
    background-color: var(--color-white);
    color: var(--color-text-main);
    border: 1px solid var(--color-cream-dark);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition-base);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.med-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.06);
    background-color: var(--color-cream);
    color: var(--color-brown);
    border-color: var(--color-gold);
}

/* 婦兒科的淡淡的粉色底 */
.tag-pink {
    background-color: #FFF5F7;
    border-color: #FCE1E6;
}

.tag-pink:hover {
    background-color: #FCE1E6;
    border-color: #F19EAF;
    color: #A9435B;
}

/* --- 注意事項 Callout Box --- */
.medical-notice-box {
    background-color: #FFF9F0;
    border-left: 4px solid #E6B86A;
    padding: 2rem;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    margin-top: 1rem;
}

.notice-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #B8862D;
    margin-bottom: 1rem;
}

.notice-header svg {
    width: 1.5rem;
    height: 1.5rem;
}

.notice-header h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.notice-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notice-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-sub);
    line-height: 1.6;
}

.notice-list li::before {
    content: "•";
    position: absolute;
    left: 0.25rem;
    color: #E6B86A;
    font-size: 1.2rem;
}

/* --- RWD --- */
@media (max-width: 48rem) {
    .medical-row {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .medical-category {
        flex: 1;
        width: 100%;
    }
    
    .medical-items {
        width: 100%;
    }
    
    .medical-notice-box {
        padding: 1.5rem;
    }
}

/* =========================================
   中醫調理 (Medicine Section) 
========================================= */
.medicine-section {
    padding-bottom: 5rem;
}

.medicine-section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.medicine-section-header h2 {
    color: var(--color-brown);
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.medicine-section-header p {
    color: var(--color-text-sub);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

/* 水藥 Grid 排版 */
.tcm-modern-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3.5rem 1.75rem; 
    margin-top: 3rem;
    padding: 1rem 0;
}

.tcm-grid-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 確保文字靠頂對齊 */
    background: transparent;
    transition: var(--transition-base);
}

/* --- 上方文字區 --- */
.tcm-card-text {
    text-align: center;
    margin-bottom: 1rem; /* 與下方圖片的間距 */
    padding: 0 auto;
}

.tcm-card-num {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-gold);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.tcm-card-title {
    font-size: 1.25rem;
    color: var(--color-brown);
    font-weight: 600;
    transition: color var(--duration-fast) var(--ease-brand);
}

/* --- 下方圖片區 --- */
.tcm-card-img-wrap {
    width: 100%;
    aspect-ratio: 5 / 8; 
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(64, 34, 15, 0.04);
    border: 1px solid var(--color-cream-dark);
    position: relative;
}

.tcm-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-normal) var(--ease-brand); 
}

/* --- 微互動：懸浮滑過效果 --- */
.tcm-grid-card:hover .tcm-card-title {
    color: var(--color-brown-light); /* 標題微變色 */
}

.tcm-grid-card:hover .tcm-card-img {
    transform: scale(1.05); /* 圖片在框內優雅放大 */
}

/* --- RWD --- */
@media (max-width: 64rem) {
	
    /* 平板與中螢幕：轉為 2×4 佈局（每排2個，共4排） */
    .tcm-modern-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 3rem 2rem;
    }
}

@media (max-width: 48rem) {
    /* 手機版：轉為單欄直式流動 */
    .tcm-modern-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem 0;
    }
    
    /* 手機版稍微收斂圖片比例，避免直式圖片在單欄下被撐得太高 */
    .tcm-card-img-wrap {
        aspect-ratio: 5 / 8; /* 手機版改為橫向寬螢幕比例，更適合單指滑動閱讀 */
        max-width: 26rem;
        margin: 0 auto; /* 置中 */
    }
}

/* =========================================
   Floating UI (FAB & Back To Top)
========================================= */
.side-fab-group {
	position: fixed;
	right: 1.25rem;
	bottom: 1.875rem; 
	display: flex;
	flex-direction: column;
	gap: 1rem;
	z-index: 998;
	align-items: flex-end; 
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px);
	transition: all var(--duration-normal) ease;
}

.side-fab-group.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-item {
    display: flex;
    align-items: center;
    justify-content: flex-end; 
    width: 3rem; height: 3rem;
    padding: 0 0.75rem; 
    background: var(--color-gold); 
    color: var(--color-brown);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.4);
    border-radius: 2rem; 
    cursor: pointer; border: none;
    overflow: hidden; white-space: nowrap;
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color var(--duration-normal) ease;
}

.fab-item svg {
	width: 1.5rem;
	height: 1.5rem;
	flex-shrink: 0;
	transition: transform 0.3s ease;
}

.fab-item::before {
	content: attr(title);
	margin-right: 0.75rem;
	font-size: 0.95rem;
	font-weight: 600;
	opacity: 0;
	transform: translateX(10px);
	transition: all 0.3s ease;
}

.back-to-top {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- RWD --- */
@media (min-width: 48rem) {
	.fab-item:hover {
		width: 9rem;
		background-color: #ffe066;
	}

	.fab-item:hover::before {
		opacity: 1;
		transform: translateX(0);
		transition-delay: 0.1s;
	}

	/* BackToTop 不延展寬度 */
	.fab-item.back-to-top:hover {
		width: 3rem;
		background-color: #ffe066;
		transform: translateY(-4px);
	}

	.fab-item.back-to-top::before {
		display: none;
	}
}

@media (max-width: 48rem) {
	.fab-item {
		width: 2.75rem;
		height: 2.75rem;
		justify-content: center;
		padding: 0;
	}

	.fab-item::before {
		display: none;
	}

	.side-fab-group {
		bottom: 1.25rem;
		right: 0.9375rem;
	}
}

/* =========================================
   Footer
========================================= */
footer {
	background-color: var(--color-brown);
	color: var(--color-white);
	padding-top: 1rem;
}

.footer-grid {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: 3rem;
	padding-bottom: 1rem;
	align-items: start;
}

.footer-heading {
	color: var(--color-gold);
	font-size: 1.25rem;
	margin-bottom: 1.5rem;
}

.footer-contact p {
	margin-bottom: 0.8rem;
	color: rgba(255, 255, 255, 0.9);
}

.nhi-logo-wrapper {
	margin-top: 1rem;
	display: inline-block;
}

.footer-bottom {
	background-color: rgba(0, 0, 0, 0.2);
	padding: 1rem 0;
}

.copyright-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.6);
}

/* --- RWD --- */
@media (max-width: 48rem) {
	.footer-grid {
		grid-template-columns: 1fr;
		gap: 2.5rem;
		text-align: center;
	}

	.copyright-row {
		flex-direction: column;
		gap: 0.5rem;
	}
}