@import url("https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

:root {
	/* --primary-color: #dc3545; */
	--primary-color: #a00020;
	--primary-contrast: #ffffff;
	--secondary-color: #c82333;
	--accent-color: #f8d7da;
	--text-dark: #1f2937;
	--text-gray: #6b7280;
}

html {
	/* filter: grayscale(55%); */
}

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

body {
	font-family: "Kanit", sans-serif;
}

/* ตั้งค่าพื้นฐาน */
header {
	transition: ease-in-out 0.2s;
	z-index: 1000;
}

/* เมื่อมีคลาส .scrolled */
header.scrolled {
	background-color: white;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

header.scrolled .text-white,
header.scrolled .nav-item,
header.scrolled .brand {
	color: black !important;
}

.nav-item {
	text-decoration: none;
	font-weight: 300;
	transition: ease-in-out 0.2s;
	padding: 5px 15px;
	border-radius: 20px;
}

.nav-item:hover {
	color: var(--primary-color) !important;
	background-color: white;
}

.nav-item:hover i {
	color: var(--primary-color) !important;
}

.nav-link {
	transition: 0.05s !important;
}

header.scrolled .nav-item:hover {
	color: var(--primary-color) !important;
}

.web-logo {
	width: 100px;
	height: auto;
	transition: ease-in-out 0.2s;
}

header.scrolled .web-logo {
	/* width: 50px;
	height: auto; */
}

.brand {
	font-size: 1.375rem;
	font-weight: 700;
}

.smart-mdri {
	padding: 10px 20px;
	background-color: var(--secondary-color);
	border-radius: 2.5px;
	text-decoration: none;
}

header.scrolled .smart-mdri {
	color: white !important;
}

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

.dropdown:hover .dropdown-menu {
	display: block;
}

.dropdown::before {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	width: 100%;
	height: 20px;
	content: "";
}

.dropdown-menu {
	min-width: 300px;
	margin-top: 20px;
	border: none;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	transition: ease-in-out 0.2s;
	left: -15px;
}

.dropdown-menu li {
	padding: 5px 10px;
}

.dropdown-menu li a:hover {
	background-color: #fff;
	color: var(--primary-color) !important;
}

.dropdown-item {
	width: 100%;
}

.dropdown-toggle::after {
	font-family: "boxicons";
	border: none;
	vertical-align: middle;
	line-height: 1;
	font-size: 1.15em;
	margin-top: -0.06rem;
	font-weight: normal;
	content: "\f293";
}

.subdropdown-item {
	list-style-type: disc;
}

.subdropdown-item a {
	padding-left: 0;
	font-size: 0.9rem;
}

.flex-menu {
	width: 1000px;
	/* right: -300%; */
	left: -230%;
}

a {
	/* color: inherit; */
	text-decoration: none;
}

footer a{
	color: inherit;
}

.text-main {
	color: var(--primary-color);
}

.research-card {
	min-height: 150px;
}

.banner-bg {
	height: 100vh;
	/* background-image: url('/assets/img/background1.jpg'); */
	background-image: url("/assets/img/background1.jpg");
	background-attachment: fixed;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	overflow: hidden;
}

/* เพิ่ม overlay สีดำอ่อนๆ */
.banner-bg::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.35); /* ปรับความเข้มได้ เช่น 0.3 = อ่อน, 0.6 = เข้ม */
	z-index: 1;
}

/* เพื่อให้เนื้อหาด้านในแสดงอยู่เหนือ overlay */
.banner-bg > * {
	position: relative;
	z-index: 2;
}

.banner-content {
	font-size: 3.5rem;
	font-weight: 700;
	/* font-family: "Kanit", sans-serif; */
	font-family: math;
}

.banner-content::before {
	/* content: "สถาบันวิจัยพหุศาสตร์ \A มหาวิทยาลัยเชียงใหม่"; */
	content: "Multidisciplinary Research Institute \A Chiang Mai University";
	white-space: pre;
}

.scroll-down {
	position: absolute;
	bottom: 40px;
	left: 50%;
	transform: translateX(-50%);
	width: 30px;
	height: 50px;
	border: 2px solid white;
	border-radius: 25px;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	z-index: 3;
	opacity: 0.8;
	animation: bounceBox 2s infinite ease-in-out; /* ⬅️ animation สำหรับวงใหญ่ */
}

/* จุดภายใน (ลูกศรเล็ก ๆ เคลื่อนลง) */
.scroll-down span {
	display: block;
	width: 6px;
	height: 6px;
	background: white;
	border-radius: 50%;
	margin-top: 10px;
	animation: scrollDot 1.5s infinite;
}

/* Animation ของวงใหญ่ */
@keyframes bounceBox {
	0%,
	100% {
		transform: translate(-50%, 0);
	}
	50% {
		transform: translate(-50%, -8px); /* เด้งขึ้นเล็กน้อย */
	}
}

/* END HEADER */

.news-image {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	height: 300px;
}

.news-section .card-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

.swiper {
	width: 100%;
	height: 370px;
}

.swiper-slide {
	text-align: center;
	font-size: 18px;
	background: #fff;
	display: flex;
	justify-content: center;
	align-items: center;
}

.swiper-slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.navBar-toggler {
	display: none;
}

@media screen and (max-width: 600px) {
	.banner-content::before {
		content: "Multidisciplinary \A Research Institute \A Chiang Mai University"; /* \A คือขึ้นบรรทัดใหม่ */
		font-size: 2.5rem;
		white-space: pre;
		text-align: start;
	}

	header {
		/* display: none; */
	}

	.swiper {
		width: 100%;
		height: 240px;
	}

	.g-calendar {
		width: 100% !important;
	}
}

/* ============================
   Responsive Navbar
   ============================ */

/* คุมการจัดเรียงตอนจอแคบ */
@media (max-width: 992px) {
	#navbar {
		z-index: 10000;
	}

	#navbar nav {
		display: none;
		padding: 10px 15px !important;
		height: 100vh;
	}

	#navbar nav.active {
		display: block;
	}

	/* ให้องค์ประกอบเรียงเป็นคอลัมน์ */
	#navbar nav .d-flex {
		flex-direction: column;
		align-items: center !important;
		flex-wrap: nowrap;
		text-align: center !important;
	}

	/* เมนูหลักวางเป็น column */
	.nav-menu {
		width: 100%;
	}

	.nav-item {
		width: 100%;
		padding: 10px 15px;
	}

	.nav-item .dropdown-menu {
		position: relative;
		width: 100%;
		box-shadow: none;
		background-color: #fff;
		margin-top: 5px;
	}

	/* dropdown แบบเปิดปิดตามปกติ */
	.dropdown-menu {
		transform: none !important;
		opacity: 1 !important;
		visibility: visible !important;
		display: none;
	}

	/* .dropdown-menu.show{
		display: block;
	} */

	.dropdown:hover .dropdown-menu {
		display: none;
	}

	.dropdown-menu.show {
		display: block !important;
	}

	/* ปุ่มด้านขวาให้ขึ้นบรรทัดใหม่ */
	#navbar .d-flex.align-items-center.gap-3 {
		width: 100%;
		justify-content: space-between;
		margin-top: 10px;
	}

	/* ปรับโลโก้ */
	.web-logo {
		width: 70px !important;
	}

	.navBar-toggler {
		height: 75px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 5px 15px;
	}

	.nav-toggle.active {
		position: fixed;
		top: 15px;
		right: 15px;
	}

	.flex-menu {
		left: 0 !important;
	}

	#navbar nav.active {
		background-color: #fff;
	}

	#navbar nav.active ul li {
		color: #000 !important;
	}
}

/* ============================
   Extra Small (มือถือ)
   ============================ */
@media (max-width: 576px) {
	/* ขนาดฟอนต์ */
	.nav-item a,
	.dropdown-item {
		font-size: 14px;
	}

	.smart-mdri {
		font-size: 12px;
		width: 75%;
		padding: 15px 0 !important;
	}

	.web-logo {
		width: 60px !important;
	}

	/* ปรับตำแหน่งค้นหาในมือถือ */
	.bi-search + .dropdown-menu {
		left: 0 !important;
		right: 0 !important;
		width: 100% !important;
	}
}

/* floating menu */

.floating-menu {
	position: fixed;
	bottom: 30px;
	right: 30px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	z-index: 1000;
}

.menu-item {
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	padding: 10px 20px;
	background-color: #ae0001;
	color: white;
	border-radius: 25px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	transition: transform 0.2s;
	font-size: 14px;
}

.btn-main {
	background-color: #b60000;
}

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

.menu-item a {
	color: inherit;
}

.menu-icon {
	margin-right: 10px;
	font-size: 18px;
}

.close-button {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background-color: #1e3a8a;
	color: #fff;
	/* border: 1px solid #4169e185; */
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	font-size: 20px;
	margin-top: 10px;
}

.menu-item.first {
	background-color: #1e3a8a;
}

.menu-item.second {
	background-color: #ae0001;
}

.menu-item.third {
	background-color: #fff;
	color: #1e3a8a;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Hero Section */
.hero-section {
	background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
	padding: 50px 0 50px;
	margin-top: 110px;
	position: relative;
	overflow: hidden;
}

.hero-section::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	/* background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" fill="none"/><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>'); */
	opacity: 0.5;
}

.hero-content {
	position: relative;
	z-index: 1;
	color: white;
}

.hero-title {
	font-size: 3rem;
	font-weight: 700;
	margin-bottom: 1rem;
	animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
	font-size: 1.25rem;
	opacity: 0.95;
	animation: fadeInUp 0.8s ease-out 0.2s both;
}

.breadcrumb-custom {
	background: rgba(255, 255, 255, 0.1);
	padding: 0.75rem 1.5rem;
	border-radius: 50px;
	display: inline-flex;
	animation: fadeInUp 0.8s ease-out 0.4s both;
}

.breadcrumb-custom a {
	color: white;
	text-decoration: none;
	transition: opacity 0.3s;
}

.breadcrumb-custom a:hover {
	opacity: 0.8;
}

/* Animations */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.fade-in {
	animation: fadeInUp 0.8s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
	.hero-section {
		margin-top: 75px;
	}

	.hero-content {
		text-align: center;
	}

	.hero-title {
		font-size: 2rem;
	}

	.hero-subtitle {
		font-size: 1rem;
	}

	.section-title {
		font-size: 1.8rem;
	}
}

.btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	--si-btn-size: 2.75rem;
	--si-btn-icon-size: 1.25rem;
	flex-shrink: 0;
	width: var(--si-btn-size);
	height: var(--si-btn-size);
	padding: 0;
}

.fs-sm {
	font-size: 0.875rem !important;
}