:root {
	--color-bg: #050505;
	--color-surface: rgba(30, 30, 30, 0.4);
	--color-surface-hover: rgba(40, 40, 40, 0.75);
	--color-border: rgba(255, 255, 255, 0.08);
	--color-glow: rgba(255, 255, 255, 0.1);
	--color-text-primary: #ffffff;
	--color-text-secondary: #a0a0a0;
	--color-accent: #ffffff;
	--font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
	--font-mono: "SF Mono", "Fira Code", Consolas, monospace;
	--radius-lg: 16px;
	--radius-sm: 6px;
	--transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
	background-color: var(--color-bg);
	color: var(--color-text-primary);
	font-family: var(--font-main);
	line-height: 1.6;
	min-height: 100vh;
	overflow-x: hidden;
}

::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

::-webkit-scrollbar-track {
	background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
	background: #333;
	border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
	background: #555;
}

.noselect {
	-webkit-user-select: none;
	user-select: none;
}

.bg-noise {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.05' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
	pointer-events: none;
	z-index: -1;
	opacity: 0.7;
}

.bg-gradient {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: 
		radial-gradient(circle at 15% 50%, rgba(76, 29, 149, 0.15), transparent 25%),
		radial-gradient(circle at 85% 15%, rgba(56, 189, 248, 0.1), transparent 25%),
		radial-gradient(circle at 50% 80%, rgba(120, 31, 76, 0.12), transparent 25%);
	z-index: -2;
	animation: bgPulse 15s ease-in-out infinite alternate;
}

.site-header {
	text-align: center;
	padding: 5rem 1rem 3rem;
	animation: fadeIn 0.8s ease-out;
}

.site-header h1 {
	font-weight: 300;
	font-size: 3rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	margin-bottom: 0.5rem;
	background: linear-gradient(to bottom, #fff, #888);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
}

.site-header h4 {
	color: var(--color-text-secondary);
	font-weight: 400;
	font-size: 1.1rem;
	margin-bottom: 1rem;
}

.site-header p {
	color: var(--color-text-secondary);
	font-size: 1rem;
	max-width: 600px;
	margin: 0 auto;
}

.controls-section {
	display: flex;
	justify-content: center;
	margin-bottom: 4rem;
	padding: 0 1rem;
	position: sticky;
	top: 20px;
	z-index: 100;
	pointer-events: none;
}

.controls-container {
	pointer-events: auto;
	animation: slideUpFade 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
	opacity: 0;
	transform: translateY(20px);
}

.search-filter-pill {
	display: flex;
	align-items: center;
	background: rgba(20, 20, 20, 0.7);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 50px;
	padding: 6px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
	transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-filter-pill:hover,
.search-filter-pill:focus-within {
	border-color: rgba(255, 255, 255, 0.25);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
	transform: translateY(-2px);
}

.search-part {
	display: flex;
	align-items: center;
	padding-left: 12px;
	position: relative;
}

.search-icon {
	color: var(--color-text-secondary);
	font-size: 0.9rem;
	transition: color 0.3s ease;
}

#searchInput {
	background: transparent;
	border: none;
	color: var(--color-text-primary);
	font-family: var(--font-main);
	font-size: 0.95rem;
	padding: 8px 12px;
	width: 100px;
	outline: none;
	transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#searchInput::placeholder {
	color: rgba(255, 255, 255, 0.3);
}

#searchInput:focus {
	width: 220px;
}

.search-filter-pill:focus-within .search-icon {
	color: var(--color-accent);
}

.pill-separator {
	width: 1px;
	height: 20px;
	background: rgba(255, 255, 255, 0.1);
	margin: 0 4px;
}

.filter-part {
	position: relative;
}

.filter-trigger {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px 8px 12px;
	cursor: pointer;
	border-radius: 30px;
	transition: background-color 0.2s ease;
	user-select: none;
}

.filter-trigger:hover {
	background: rgba(255, 255, 255, 0.05);
}

.filter-trigger span {
	font-size: 0.9rem;
	color: var(--color-text-secondary);
	font-weight: 500;
	transition: color 0.2s ease;
}

.filter-trigger:hover span,
.filter-part.open .filter-trigger span {
	color: var(--color-text-primary);
}

.filter-icon {
	font-size: 0.8rem;
	color: var(--color-text-secondary);
}

.filter-dropdown {
	position: absolute;
	top: calc(100% + 12px);
	right: 0;
	width: 200px;
	background: #111;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	padding: 6px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px) scale(0.98);
	transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	box-shadow: 0 10px 40px rgba(0,0,0,0.8);
	z-index: 1000;
	max-height: 300px;
	overflow-y: auto;
}

.filter-part.open .filter-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.filter-option {
	padding: 8px 12px;
	font-size: 0.85rem;
	color: var(--color-text-secondary);
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.filter-option:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
}

.filter-option.selected {
	background: rgba(255, 255, 255, 0.05);
	color: var(--color-accent);
}

.filter-option.selected::after {
	content: "\f00c";
	font-family: "Font Awesome 6 Free";
	font-weight: 900;
	font-size: 0.7rem;
}

.projects-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	grid-auto-flow: dense;
	gap: 2rem;
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 1.5rem;
	min-height: 80vh;
	align-content: start;
}

.loader-wrapper {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 50vh;
	color: var(--color-text-secondary);
	font-family: var(--font-mono);
	gap: 1.5rem;
	animation: fadeIn 0.5s ease-out;
}

.loader-wrapper i {
	font-size: 3rem;
	color: var(--color-accent);
	opacity: 0.5;
}

.loader-wrapper p {
	font-size: 1rem;
	letter-spacing: 0.1em;
	opacity: 0.5;
}

.card {
	background: var(--color-surface);
	border: none;
	border-radius: var(--radius-lg);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	position: relative;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	cursor: pointer;
	height: 100%;
	transform-style: preserve-3d;
	will-change: transform, width, height, opacity;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	
	transform-origin: top left;
	will-change: transform, width, height;
	contain: layout style; 
	
	transition: box-shadow 0.7s cubic-bezier(0.16, 1, 0.3, 1),
				background 0.7s cubic-bezier(0.16, 1, 0.3, 1),
				border-color 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.card::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--radius-lg);
	padding: 1px;
	background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), transparent 60%, rgba(255, 255, 255, 0.05));
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
	z-index: 2;
}

.card::after {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.04), transparent 40%);
	opacity: 0;
	transition: opacity 0.5s;
	z-index: 1;
	pointer-events: none;
}

.card:hover::after {
	opacity: 1;
}

.card.hidden {
	display: none;
}

.card.expanded {
	grid-column: span 2;
	grid-row: span 2;
	background: rgba(20, 20, 20, 0.95);
	border-color: rgba(255, 255, 255, 0.2);
	z-index: 50;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.card:hover {
	border-color: rgba(255, 255, 255, 0.2);
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
	background: var(--color-surface-hover);
}

.card.expanded:hover {
	transform: none;
}

.card.is-flipping,
.card.is-flipping * {
	will-change: transform, opacity;
}
.card.is-flipping {
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
	box-shadow: none !important;
	border-color: transparent !important;
}
.card.is-flipping::before,
.card.is-flipping::after {
	content: none !important;
}

.card-img {
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	background-color: #111;
	border-bottom: 1px solid var(--color-border);
}

.card-header {
	padding: 1.5rem 1.5rem 0.5rem;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
}

.card-title {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--color-text-primary);
}

.date {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--color-text-secondary);
	opacity: 0.8;
}

.description {
	padding: 0.5rem 1.5rem;
	font-size: 0.95rem;
	color: var(--color-text-secondary);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card.expanded .description {
	display: none;
}

.long-description {
	display: none;
	padding: 0 1.5rem 1rem;
	font-size: 1rem;
	color: #d0d0d0;
	line-height: 1.7;
	white-space: pre-wrap;
	opacity: 0;
}

.card.expanded .long-description {
	display: block;
	animation: fadeInContent 0.5s ease forwards;
	animation-delay: 0.3s;
}

.expanded-content {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
}

.tags {
	padding: 0 1.5rem 1rem;
	display: none;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: auto;
}

.card.expanded .tags {
	display: flex;
}

.tag {
	font-size: 0.75rem;
	padding: 4px 12px;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	color: #eee;
}

.links {
	padding: 1.5rem;
	margin-top: auto;
	display: flex;
	gap: 10px;
	border-top: 1px solid var(--color-border);
}

.btn {
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 8px 16px;
	border-radius: var(--radius-sm);
	font-size: 0.85rem;
	font-weight: 600;
	transition: var(--transition);
	background: rgba(255, 255, 255, 0.03);
	color: var(--color-text-primary);
	border: 1px solid rgba(255, 255, 255, 0.08);
	position: relative;
	overflow: hidden;
}

.btn:hover {
	background: rgba(255, 255, 255, 0.15);
	border-color: rgba(255, 255, 255, 0.1);
}

.expand-trigger {
	min-width: 90px;
}

.expand-trigger i {
	transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.85);
	backdrop-filter: blur(8px);
	z-index: 1000;
	padding: 2rem;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.modal-overlay.show {
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 1;
}

.modal-container {
	background: #0f0f0f;
	border: 1px solid var(--color-border);
	width: 100%;
	max-width: 1100px;
	max-height: 85vh;
	border-radius: var(--radius-lg);
	position: relative;
	box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.8);
	display: flex;
	overflow: hidden;
	transform: scale(0.95);
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	flex-direction: row;
}

.modal-overlay.show .modal-container {
	transform: scale(1);
}

.close-modal {
	position: absolute;
	top: 15px;
	right: 15px;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	border: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	font-size: 1.2rem;
	cursor: pointer;
	z-index: 10;
	transition: var(--transition);
	display: flex;
	align-items: center;
	justify-content: center;
}

.close-modal:hover {
	background: rgba(255, 255, 255, 0.2);
}

.modal-layout {
	display: grid;
	grid-template-columns: 1.4fr 1fr;
	width: 100%;
	height: 100%;
}

.modal-media {
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.modal-media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	max-height: 85vh;
}

.modal-details {
	padding: 2.5rem;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	background: #121212;
}

.modal-header {
	margin-bottom: 1rem;
	border-bottom: 1px solid var(--color-border);
	padding-bottom: 1rem;
}

.modal-header h2 {
	font-size: 2rem;
	font-weight: 600;
	color: var(--color-text-primary);
	line-height: 1.2;
}

.meta-date {
	display: block;
	margin-top: 0.5rem;
	font-family: var(--font-mono);
	color: var(--color-text-secondary);
	font-size: 0.9rem;
}

.tag-cloud {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 1.5rem;
}

.modal-scroll-area {
	flex-grow: 1;
	overflow-y: auto;
	margin-bottom: 2rem;
	padding-right: 10px;
}

#modalDescription {
	font-size: 1rem;
	color: #d0d0d0;
	line-height: 1.8;
	white-space: pre-wrap;
}

.modal-actions {
	display: flex;
	gap: 1rem;
	margin-top: auto;
}

.site-footer {
	margin-top: 6rem;
	padding: 2rem 1rem;
	border-top: 1px solid var(--color-border);
	background: linear-gradient(to top, rgba(10, 10, 10, 0.8), transparent);
	color: var(--color-text-secondary);
	font-size: 0.9rem;
	position: relative;
	z-index: 10;
}

.footer-content {
	max-width: 1400px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	text-align: center;
}

.copyright {
	opacity: 0.6;
}

.footer-nav {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	justify-content: center;
}

.footer-link {
	color: var(--color-text-primary);
	text-decoration: none;
	margin-left: 4px;
	font-weight: 500;
	transition: color 0.3s ease;
}

.footer-link i {
	font-size: 0.8em;
	margin-left: 2px;
	opacity: 0.7;
	transition: transform 0.3s ease;
}

.footer-link:hover {
	color: var(--color-accent);
}

.footer-link:hover i {
	transform: translate(2px, -2px);
	opacity: 1;
}

.divider {
	width: 4px;
	height: 4px;
	background: var(--color-border);
	border-radius: 50%;
}

.badge {
	display: inline-block;
	font-size: 0.65rem;
	padding: 3px 8px;
	border-radius: 4px;
	margin-left: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	vertical-align: middle;
	transform: translateY(-2px);
}

.badge-new {
	background: #60a5fa;
	color: #050505;
	box-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

.badge-updated {
	background: #60c9fa;
	color: #050505;
	box-shadow: 0 0 8px rgba(62, 222, 130, 0.3);
}

.back-to-top {
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 45px;
	height: 45px;
	border-radius: 50%;
	background: rgba(20, 20, 20, 0.8);
	border: 1px solid var(--color-border);
	color: var(--color-text-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 90;
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px);
	transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
				visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1),
				transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
				background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
				color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
				box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.back-to-top.visible {
	opacity: 0.4;
	visibility: visible;
	transform: translateY(0);
}

.back-to-top:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.1);
	color: var(--color-accent);
	transform: translateY(-2px);
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

#xp-portfolio-link {
	display: inline-flex;
	align-items: center;
	margin-left: 4px;
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#xp-portfolio-link img {
	width: 14px;
	height: auto;
	filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
	transition: filter 0.3s ease;
}

#xp-portfolio-link:hover {
	transform: scale(1.15) rotate(-5deg);
}

#xp-portfolio-link:hover img {
	filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

@keyframes fadeInContent {
	to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
	from { opacity: 0; transform: translateY(20px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes bgPulse {
	0% { opacity: 0.5; transform: scale(1); }
	100% { opacity: 0.8; transform: scale(1.1); }
}

@keyframes slideUpFade {
	to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
	.controls-section {
		padding: 0 1rem;
		bottom: 2rem;
		top: auto;
	}
	
	.search-filter-pill {
		background: rgba(10, 10, 10, 0.85);
		backdrop-filter: blur(20px);
	}

	#searchInput {
		width: 80px;
	}
	
	#searchInput:focus {
		width: 140px;
	}
}

@media (max-width: 750px) {
	.card.expanded {
		grid-column: auto;
		grid-row: auto;
	}
}

@media (min-width: 768px) {
	.site-footer {
		padding: 3rem 2rem;
	}
	
	.footer-content {
		flex-direction: row;
		justify-content: space-between;
		text-align: left;
	}
}

@media (max-width: 900px) {
	.modal-layout {
		grid-template-columns: 1fr;
		overflow-y: auto;
	}
	
	.modal-container {
		flex-direction: column;
		height: auto;
		max-height: 90vh;
		overflow-y: auto;
	}
	
	.modal-media {
		min-height: 250px;
		max-height: 350px;
	}
	
	.modal-details {
		padding: 1.5rem;
		height: auto;
	}
}

@media (max-width: 600px) {
	.site-header {
		padding: 3rem 1rem 2rem;
	}
	
	.site-header h1 {
		font-size: 2rem;
	}
	
	.projects-grid {
		grid-template-columns: 1fr;
		padding: 0 1rem;
	}
	
	.modal-overlay {
		padding: 0;
	}
	
	.modal-container {
		max-height: 100vh;
		border-radius: 0;
	}
}

@media (max-width: 900px) {
	.modal-container {
		flex-direction: column;
		max-height: 90vh;
	}

	.modal-layout {
		display: flex;
		flex-direction: column;
		height: 100%;
		overflow: hidden;
	}
	
	.modal-media {
		height: 250px;
		min-height: 250px;
		flex-shrink: 0;
		border-bottom: 1px solid var(--color-border);
	}
	
	.modal-media img {
		height: 100%;
		width: 100%;
		object-fit: cover;
	}
	
	.modal-details {
		padding: 1.5rem;
		overflow-y: auto;
		height: auto;
		flex-grow: 1;
	}
}

@media (max-width: 600px) {
	.site-header {
		padding: 3rem 1rem 1.5rem;
	}
	
	.site-header h1 {
		font-size: 2rem;
	}

	.controls-section {
		padding: 0 1rem;
		top: 10px;
	}
	
	.search-filter-pill {
		background: rgba(10, 10, 10, 0.9);
		backdrop-filter: blur(20px);
		max-width: 100%;
	}

	#searchInput {
		width: 100px;
		font-size: 16px; 
	}
	
	#searchInput:focus {
		width: 130px;
	}

	.modal-overlay {
		padding: 0;
		align-items: flex-end; 
	}
	
	.modal-container {
		max-height: 95vh;
		border-bottom-left-radius: 0;
		border-bottom-right-radius: 0;
		border-bottom: none;
	}

	.close-modal {
		top: 10px;
		right: 10px;
		background: rgba(0,0,0,0.7);
	}
}

@media (max-height: 500px) and (orientation: landscape) {
	.site-header {
		padding: 1rem 1rem 0.5rem;
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 1rem;
	}

	.site-header h1 {
		font-size: 1.5rem;
		margin: 0;
	}

	.site-header h4, .site-header p {
		display: none; 
	}

	.modal-container {
		flex-direction: row;
		max-height: 100vh;
		border-radius: 0;
	}

	.modal-media {
		width: 40%;
		height: 100%;
		border-bottom: none;
		border-right: 1px solid var(--color-border);
	}

	.modal-details {
		width: 60%;
	}
}