/**
 * MIT HCI Group Website - Interactive Components
 * Styles for filters, animations, and dynamic elements
 */

/* ===================================
   Group Filter UI
   =================================== */

.filter-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 10px auto 30px;
	padding: 15px 30px 30px;
	border: 2px solid rgba(255, 102, 0, 0.3);
	border-radius: 12px;
	background: rgba(255, 102, 0, 0.02);
	width: fit-content;
	max-width: 90%;
	grid-column: 1 / -1;
}

.filter-label {
	font-size: 13px;
	font-weight: 600;
	text-transform: lowercase;
	color: hsl(20, 100%, 45%);
	margin: 0 0 12px 0;
	letter-spacing: 0.5px;
}

.group-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	align-items: center;
	width: fit-content;
}

.filter-btn {
	background: transparent;
	border: none;
	padding: 6px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: #666;
	transition: all 0.3s ease;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	-webkit-tap-highlight-color: transparent;
}

.filter-btn img {
	height: 60px;
	width: auto;
	max-width: 180px;
	object-fit: contain;
	transition: all 0.3s ease;
}

.filter-btn:hover {
	transform: scale(1.05);
}

.group-filters.has-active .filter-btn:not(.active) img {
	filter: grayscale(100%) opacity(0.4);
}

.group-filters.has-active .filter-btn:not(.active) {
	color: rgba(0, 0, 0, 0.3);
}

.filter-btn.active img {
	filter: drop-shadow(0 0 8px rgba(255, 102, 0, 1))
	        drop-shadow(0 0 16px rgba(255, 102, 0, 0.6));
	transform: scale(1.1);
}

.filter-btn.active {
	color: #ff6600;
}

/* ===================================
   Filtering States
   =================================== */

.people article {
	transition: opacity 0.3s ease, filter 0.3s ease;
}

.people article.filtered {
	pointer-events: none;
}

.people article.filtered img {
	filter: grayscale(100%) opacity(0.3);
}

.people article.filtered h1,
.people article.filtered .group {
	opacity: 0.3;
}

#phds.people article {
	transition: all 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
	order: 1;
}

#phds.people article.selected {
	order: 0;
	transform: scale(1.02);
}

#phds.people article.selected img {
	box-shadow: 0 0 15px rgba(255, 102, 0, 0.8), 0 0 30px rgba(255, 102, 0, 0.4);
	border: 2px solid rgba(255, 102, 0, 0.6);
	transform: scale(1.02);
	transition: all 0.3s ease;
}

#phds.people article.filtered {
	order: 2;
	opacity: 0.3;
	filter: grayscale(100%);
	pointer-events: none;
	transform: scale(0.98);
}

/* ===================================
   Research Section
   =================================== */

#research {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

#research h1 {
	width: 100%;
	text-align: center;
	margin-bottom: 8px;
}

#research article {
	width: 100%;
	max-width: 800px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 20px 40px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
	transition: box-shadow 0.3s ease;
}

#research .project-group {
	margin-bottom: 15px;
	font-weight: 300;
	color: #666;
	font-size: 0.9em;
}

#research .project-group a {
	color: #888;
	text-decoration: none;
}

#research .project-group a:hover {
	color: #ff6600;
}

#research article h1 {
	width: auto;
	flex-basis: auto;
	text-align: left;
	margin-bottom: 15px;
	font-size: 1.2em;
	line-height: 1.3;
}

#research article p {
	margin-bottom: 15px;
	line-height: 1.5;
	color: #555;
}

#research article footer {
	font-size: 0.9em;
	color: #666;
	border-top: 1px solid #f0f0f0;
	padding-top: 15px;
	margin-top: 15px;
}

/* ===================================
   Alumni Section
   =================================== */

.see-more-btn {
	display: inline-block;
	padding: 10px 20px;
	background: linear-gradient(135deg, #ff6600, #ff4500);
	color: white;
	text-decoration: none;
	border-radius: 25px;
	font-weight: 500;
	transition: box-shadow 0.3s ease;
	border: none;
}

.see-more-btn:hover {
	color: white;
}

#previous h2.seminaryear {
	position: relative;
	text-align: center;
	margin: 40px 0 20px 0;
	color: #2c3e50;
	font-size: 28px;
	font-weight: 600;
}

#previous h2.seminaryear:not(:first-child):before {
	content: '';
	position: absolute;
	top: -20px;
	left: 50%;
	transform: translateX(-50%);
	width: 60px;
	height: 2px;
	background: linear-gradient(90deg, transparent, rgba(255, 102, 0, 0.6), transparent);
	box-shadow: 0 1px 3px rgba(255, 102, 0, 0.3);
}

#previous article {
	margin: 8px 0;
	padding: 8px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#previous article:last-child {
	border-bottom: none;
}

/* ===================================
   Easter Egg Animations
   =================================== */

@keyframes profile-roll {
	0% {
		transform: rotateZ(0deg);
	}
	100% {
		transform: rotateZ(360deg);
	}
}

.profile-roll {
	animation: profile-roll 0.6s ease-in-out;
}

@keyframes profile-bounce {
	0% { transform: rotateZ(0deg) translate(0px, 0px); }
	15% { transform: rotateZ(1080deg) translate(200px, 30vh); }
	30% { transform: rotateZ(2160deg) translate(-100px, 50vh); }
	45% { transform: rotateZ(3240deg) translate(300px, 70vh); }
	60% { transform: rotateZ(4320deg) translate(-200px, 85vh); }
	75% { transform: rotateZ(5400deg) translate(150px, 95vh); }
	90% { transform: rotateZ(6480deg) translate(-50px, 88vh); }
	100% { transform: rotateZ(7200deg) translate(100px, 92vh); }
}

.profile-fall {
	animation: profile-bounce 4s ease-out forwards;
}

/* ===================================
   Hint Popup
   =================================== */

.h-key-popup {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 10000;
	background: rgba(0, 0, 0, 0.3);
	color: rgba(255, 255, 255, 0.9);
	padding: 10px 15px;
	border-radius: 6px;
	font-size: 12px;
	font-family: "Open Sans", sans-serif;
	opacity: 0.7;
	transition: opacity 0.3s ease;
	animation: popup-slide-in 0.3s ease-out;
	backdrop-filter: blur(5px);
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.h-key-popup .popup-content {
	text-align: center;
}

.h-key-popup p {
	margin: 0 0 10px 0;
	font-weight: 500;
}

.popup-timer {
	width: 100%;
	height: 2px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 1px;
	overflow: hidden;
}

.timer-bar {
	width: 100%;
	height: 100%;
	background: rgba(255, 255, 255, 0.6);
	border-radius: 1px;
	animation: timer-countdown 5s linear forwards;
}

@keyframes popup-slide-in {
	0% {
		transform: translateX(100%);
		opacity: 0;
	}
	100% {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes timer-countdown {
	0% { width: 100%; }
	100% { width: 0%; }
}

/* ===================================
   Mobile Optimizations
   =================================== */

@media (max-width: 768px) {
	#research article {
		padding: 20px 25px;
	}

	.filter-wrapper {
		padding: 20px 15px;
		max-width: 95%;
	}

	.filter-btn img {
		height: 50px;
		max-width: 150px;
	}

	.filter-label {
		font-size: 12px;
	}
}

@media (max-width: 600px) {
	.filter-wrapper {
		display: none;
	}

	#phds.people article.filtered {
		opacity: 1 !important;
		filter: none !important;
		pointer-events: auto !important;
		transform: none !important;
		order: 1 !important;
	}

	#phds.people article.selected {
		order: 1 !important;
		transform: none !important;
	}

	#phds.people article.filtered img {
		filter: none !important;
	}

	#phds.people article.filtered h1,
	#phds.people article.filtered .group {
		opacity: 1 !important;
	}

	body > section > h1 {
		font-size: 200%;
		padding-top: 1em;
	}

	#research article {
		padding: 15px 20px;
		margin-bottom: 15px;
	}

	#research article h1 {
		font-size: 1.1em;
	}
}

@media (max-width: 400px) {
	.filter-btn img {
		height: 35px;
		max-width: 100px;
	}

	.group-filters {
		gap: 6px;
	}
}
