/* =========================================
   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.scroll-lock {
    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;
	}
}

/* =========================================
   最新消息
========================================= */
.news-page-main {
    background-color: var(--color-cream);
    min-height: calc(100vh - 300px);
}

/* 消息標題條 */
.news-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;
}

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

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

/* ====================================================
    Gallery Section
==================================================== */
.gallery-item {
    display: flex;
    overflow: hidden;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;	
	margin: 0;
	background-color: #fdfdfc;
	opacity: 1;
	transform: scale(1);
	transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out, background-color 0.5s ease-in-out;
}

.gallery-item img {
	display: block;
	width: 100%;       
	aspect-ratio: 16 / 9; 
	object-fit: cover; 
	transition: transform 0.5s ease;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.05);
}

.gallery-image:hover {
    cursor: zoom-in;
}

.gallery-section {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(18.75rem, 1fr));
	align-items: stretch;
    gap: 1.5625rem;
	padding: 0 0.625rem;
	opacity: 0;	
    transition: opacity 0.6s ease-out;
}

.gallery-section.initialized {
    opacity: 1;
}

.gallery-item.hidden {
	display: none;
}

.image-name {
	padding: 1rem;
	color: #4c4443;
	font-weight: 400;
	font-size: 1.2rem;
	font-family: 'Georgia', 'Palatino Linotype', 'Book Antiqua', serif;
	text-align: center;
}

/* ----------------------------------------------------
    輪播器樣式 (light box style)
---------------------------------------------------- */
.lightbox {
	display: flex;
	position: fixed;
	top: 0;
	left: 0;
	z-index: 1000;
	visibility: hidden;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 100%;
	
    /* 是一種防禦性編程，確保沒有任何繼承或瀏覽器預設樣式會偷偷限制它的最大尺寸，
    從而確保它能完全擴展到視口的大小。*/
	max-width: none;
    max-height: none;
    padding: 0;
	border: none;
	background: rgba(255, 255, 255, 0.7);	
	opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox[open] {
    visibility: visible;
    opacity: 1;
}

.lightbox::backdrop {
    background: rgba(255, 255, 255, 0.7);	
}

.slides-container {
    overflow: hidden;	
    width: 100%;
    height: 100%;
    max-width: 90vw;
    max-height: 90vh;
    pointer-events: none;
}

.slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease-out;	
}

.slide-wrapper {
    display: flex;	
    justify-content: center;
    align-items: center;
    height: 100%;
    min-width: 100%;	
}

.slide-image {
	width: auto;
    height: auto;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.close-button {
	position: absolute;
	top: 0.9375rem;
    right: 0.9375rem;
    z-index: 1002;
    cursor: pointer;
    border: none;
    background: none;
    opacity: 0.8;	
    color: #333;
    font-size: 2rem;
    font-weight: 300;
    transition: opacity 0.3s;
}

.close-button:focus {
    outline: none;
}

.close-button:hover {
    opacity: 1;
}

.left-button, .right-button {
	position: absolute;
	top: 50%;
	z-index: 1001;
	cursor: pointer;
	width: 2.5rem;
	height: 2.5rem;
	padding: 1.2rem 0.5rem;
	border: none;
	border-radius: 50%;
	background: none;
	color: #666;
    font-size: 1.25rem;
    transform: translateY(-50%);
    transition: background-color 0.3s, color 0.3s, opacity 0.3s;
}

.left-button:hover, .right-button:hover {
    background-color: rgba(255, 255, 255, 0.9);
    color: #008b8b;
}

.left-button:disabled, .right-button:disabled {
    cursor: default;
    background: none;	
	opacity: 0.3;	
    pointer-events: none;
}

.left-button {
    left: 1.25rem;
}

.right-button {
    right: 1.25rem;	
}

.left-button::after, .right-button::after {
	position: absolute;
	bottom: -2.5rem;
	left: 50%;
	z-index: 1003;
    visibility: hidden;
	padding: 0.4rem 0.6rem;
	border-radius: 0.25rem;
	background-color: #333;
	opacity: 0;
	color: #fdfdfc;
	font-size: 0.8rem;
	white-space: nowrap;
	content: attr(data-tooltip);
	transform: translateX(-50%) scale(0.9);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.left-button:hover::after, .right-button:hover::after,
.left-button:hover::before, .right-button:hover::before {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) scale(1);	
}

.thumbnail-navigation {
	display: flex;
	position: absolute;
	bottom: -0.25rem;
	left: 50%;
	z-index: 1001;
	overflow-x: auto;
	overflow-y: hidden;
	justify-content: flex-start;
	align-items: center;
    gap: 0.625rem;
	width: min(100%, 800px);
    max-width: none;
	padding: 0.625rem 2rem;
    touch-action: pan-x;
    transform: translateX(-50%);
    pointer-events: auto;
}

.thumbnail-item {
	overflow: hidden;
    cursor: pointer;
	flex-shrink: 0;
	width: 4.5rem;
	height: 4.5rem;
	border: 0.125rem solid transparent;
	border-radius: 0.25rem;
	box-shadow: 0 0 0.3125rem rgba(0, 0, 0, 0.3);
    opacity: 0.5;	
    transition: opacity 0.3s ease, border-color 0.3s ease;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;	
}

.thumbnail-item.active {
    border-color: #008b8b;
    box-shadow: 0 0 0.625rem rgba(0, 139, 139, 0.7);
    opacity: 1;	
}

.thumbnail-navigation::-webkit-scrollbar {
    height: 0.5rem;
}
.thumbnail-navigation::-webkit-scrollbar-thumb {
	border-radius: 0.25rem;
    background-color: rgba(0, 0, 0, 0.2);
}

.slide-image, .left-button, .right-button, .close-button {
    pointer-events: auto;
}

.gallery-item img,
.slide-image {
    -webkit-user-drag: none;
    user-drag: none;
}

/* 防止圖片在移動設備上被長按儲存，並禁用選取 */
.gallery-item img,
.slide-image {
    -webkit-user-select: none; 		/* iOS/Android 禁用選取 */
    -webkit-touch-callout: none; 	/* iOS 禁用長按菜單 */
    user-select: none; 				/* 標準屬性禁用選取 */
}

/* =========================================
   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: flex; 
	justify-content: space-between;
	flex-wrap: wrap;
}

.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;
	}
}

#copyright-toast {
    position: fixed;
    left: 1.875rem;
    z-index: 99999;
    bottom: clamp(1rem, 5vw, 2rem);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    background-color: rgba(0, 0, 0, 0.85);
    box-shadow: 0 0.25rem 1.875rem rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    opacity: 0;
    color: #fff;
    font-size: 0.875rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft JhengHei", sans-serif;
    transform: translateY(100px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),	
                opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
                	
    pointer-events: none;
    user-select: none;
}

/* 顯示時的 class */
#copyright-toast.show {
    opacity: 1;
	transform: translateY(0);
}
