/* ==========================================================================
   Lalit Pathak — Shared site stylesheet
   One file, used by every page. Edit here once; every page updates.
   ========================================================================== */

:root {
	--primary-color: #2a6e3f;
	--primary-dark: #1e4f2d;
	--primary-light: #3d8c55;
	--secondary-color: #1a365d;
	--accent-color: #e9c46a;
	--light-color: #f8f9fa;
	--dark-color: #343a40;
	--gray-color: #6c757d;
	--light-gray: #e9ecef;
	--border-radius: 8px;
	--box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	--transition: all 0.3s ease;

	--card-bg: #ffffff;
	--body-bg: #ffffff;
	--nav-bg: rgba(255, 255, 255, 0.95);
	--border-color: var(--light-gray);
}

/* ---- Dark theme overrides (toggled via [data-theme="dark"] on <html>) ---- */
html[data-theme="dark"] {
	--light-color: #1f2937;
	--dark-color: #e8eaed;
	--gray-color: #a8b0bb;
	--light-gray: #2f3947;
	--card-bg: #17202b;
	--body-bg: #10161f;
	--nav-bg: rgba(16, 22, 31, 0.92);
	--border-color: #2b3646;
	--box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] body { color: var(--dark-color); background-color: var(--body-bg); }
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4 { color: #f2f4f7; }
html[data-theme="dark"] h2 { border-bottom-color: var(--light-gray); }
html[data-theme="dark"] .nav-logo { color: #f2f4f7; }
html[data-theme="dark"] .nav-menu a { color: #d7dce3; }
html[data-theme="dark"] .skill-category,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .publication-item,
html[data-theme="dark"] .training-card,
html[data-theme="dark"] .blog-card,
html[data-theme="dark"] .progress-container,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .contact-card { background-color: var(--card-bg); }
html[data-theme="dark"] .experience-content { background-color: var(--card-bg); }
html[data-theme="dark"] .menu_trigger,
html[data-theme="dark"] .nav-menu a:not(.active) { color: #d7dce3; }

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

html {
	scroll-behavior: smooth;
}

body {
	font-family: 'Open Sans', sans-serif;
	font-size: 16px;
	line-height: 1.6;
	color: var(--dark-color);
	background-color: var(--body-bg);
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	transition: background-color 0.3s ease, color 0.3s ease;
	animation: page-fade-in 0.5s ease both;
}

@keyframes page-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

h1, h2, h3, h4, h5, h6 {
	font-family: 'Montserrat', sans-serif;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 1rem;
	color: var(--secondary-color);
}

h1 { font-size: 2.5rem; font-weight: 700; }

h2 {
	font-size: 2rem;
	margin-top: 2.5rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--light-gray);
}

h3 { font-size: 1.5rem; color: var(--primary-color); }

p { margin-bottom: 1.5rem; }

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

a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

.container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

.btn {
	display: inline-block;
	padding: 10px 24px;
	background-color: var(--primary-color);
	color: white;
	border: none;
	border-radius: var(--border-radius);
	font-weight: 600;
	font-size: 1rem;
	cursor: pointer;
	transition: var(--transition);
	text-align: center;
}

.btn:hover {
	background-color: var(--primary-dark);
	color: white;
	transform: translateY(-2px);
	box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.btn-outline {
	background-color: transparent;
	border: 2px solid var(--primary-color);
	color: var(--primary-color);
}

.btn-outline:hover { background-color: var(--primary-color); color: white; }

.btn-outline.on-dark { border-color: rgba(255,255,255,0.8); color: #fff; }
.btn-outline.on-dark:hover { background-color: rgba(255,255,255,0.15); color: #fff; }

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* Skip link for accessibility */
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--primary-color);
	color: #fff;
	padding: 10px 18px;
	z-index: 2000;
	border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

/* ---------------- Header (hero) ---------------- */
#header {
	background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-dark) 100%);
	color: white;
	padding: 100px 0 80px;
	text-align: center;
	position: relative;
	overflow: hidden;
}

#header::before {
	content: "";
	position: absolute;
	top: 0; left: 0;
	width: 100%; height: 100%;
	background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23ffffff" fill-opacity="0.1" d="M0,224L48,213.3C96,203,192,181,288,181.3C384,181,480,203,576,192C672,181,768,139,864,138.7C960,139,1056,181,1152,181.3C1248,181,1344,139,1392,117.3L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
	background-size: cover;
	background-position: center bottom;
}

.header-content { position: relative; z-index: 1; }

.page-title { font-size: 3rem; font-weight: 700; margin-bottom: 1rem; color: white; }

.page-subtitle {
	font-size: 1.3rem;
	font-weight: 400;
	margin-bottom: 2rem;
	color: rgba(255, 255, 255, 0.9);
	max-width: 700px;
	margin-left: auto;
	margin-right: auto;
}

/* ---------------- Navigation ---------------- */
#nav {
	position: fixed;
	top: 0; left: 0;
	width: 100%;
	background-color: var(--nav-bg);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	z-index: 1000;
	padding: 15px 0;
	transition: var(--transition);
	backdrop-filter: blur(6px);
}

.nav-container { display: flex; justify-content: space-between; align-items: center; }

.nav-logo { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 1.5rem; color: var(--secondary-color); display: inline-block; transition: color 0.25s ease, transform 0.25s ease; }
.nav-logo:hover { color: var(--primary-color); transform: translateY(-1px); }

.nav-right { display: flex; align-items: center; gap: 1.5rem; }

.nav-menu { display: flex; list-style: none; }

.nav-menu li { margin-left: 2rem; }

.nav-menu a { color: var(--dark-color); font-weight: 500; padding: 5px 0; position: relative; }

.nav-menu a::after {
	content: '';
	position: absolute;
	bottom: 0; left: 0;
	width: 0; height: 2px;
	background-color: var(--primary-color);
	transition: var(--transition);
}

.nav-menu a:hover::after,
.nav-menu a.active::after { width: 100%; }

.nav-menu a.active { color: var(--primary-color); }

.theme-toggle {
	background: none;
	border: 2px solid var(--light-gray);
	color: var(--dark-color);
	width: 38px;
	height: 38px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.95rem;
	transition: var(--transition);
	flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--primary-color); color: var(--primary-color); transform: rotate(15deg); }
.theme-toggle:active { transform: scale(0.9); }
.theme-toggle i { transition: transform 0.5s ease, opacity 0.3s ease; }
.theme-toggle.is-switching i { transform: rotate(180deg) scale(0.6); opacity: 0; }
.theme-toggle .fa-sun { display: none; }
html[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
html[data-theme="dark"] .theme-toggle .fa-sun { display: inline-block; }

.menu_trigger { display: none; font-size: 1.5rem; color: var(--dark-color); background: none; border: none; cursor: pointer; }

/* ---------------- Main ---------------- */
#main { padding: 80px 0; flex: 1; }

.section-intro { margin-bottom: 3rem; }

.intro-text { font-size: 1.2rem; line-height: 1.8; color: var(--gray-color); }

.highlight { color: var(--primary-color); font-weight: 600; }

/* Reveal-on-scroll animation, applied by js/site.js */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Reveal-on-scroll for individual cards inside a grid — js/site.js sets --i per
   child so they cascade in one after another instead of popping in together. */
.reveal-item {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity 0.5s ease, transform 0.5s ease;
	transition-delay: calc(var(--i, 0) * 0.07s);
}
.reveal-item.is-visible { opacity: 1; transform: translateY(0); }

/* Hero entrance sequence — plays once on load, no scroll needed */
.hero-in { opacity: 0; animation: hero-fade-up 0.7s ease forwards; animation-delay: calc(var(--i, 0) * 0.12s + 0.1s); }
@keyframes hero-fade-up {
	from { opacity: 0; transform: translateY(22px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Gentle zoom on card/thumbnail images when their card is hovered */
.img-zoom { overflow: hidden; }
.img-zoom img { transition: transform 0.5s ease; }
.img-zoom:hover img { transform: scale(1.06); }

/* Reading progress bar — auto-injected by js/site.js on article pages */
#reading-progress {
	position: fixed;
	top: 0; left: 0;
	height: 3px;
	width: 0%;
	background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
	z-index: 1100;
	transition: width 0.12s ease;
}

/* Accessible keyboard focus ring, only shown for keyboard navigation */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
.filter-btn:focus-visible,
.category-card:focus-visible {
	outline: 3px solid var(--primary-color);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Loading state for buttons (e.g. the contact form's submit button) */
@keyframes lp-spin { to { transform: rotate(360deg); } }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
	content: '';
	position: absolute;
	top: 50%; left: 50%;
	width: 16px; height: 16px;
	margin: -8px 0 0 -8px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: lp-spin 0.7s linear infinite;
}

/* Contact form status message (success/error), injected by form-handler.js */
#form-status { animation: hero-fade-up 0.35s ease both; }

/* Respect the user's OS-level request for less motion: shorten/disable
   everything above (and any per-page inline transitions) to near-instant. */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
	.reveal, .reveal-item, .hero-in { opacity: 1 !important; transform: none !important; }
}

/* ---------------- Stats strip (used on homepage) ---------------- */
.stats-strip {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1.5rem;
	margin: 2.5rem 0 1rem;
}
.stat-card {
	background-color: var(--light-color);
	border-radius: var(--border-radius);
	box-shadow: var(--box-shadow);
	padding: 1.5rem 1rem;
	text-align: center;
}
.stat-number {
	font-family: 'Montserrat', sans-serif;
	font-size: 2.3rem;
	font-weight: 700;
	color: var(--primary-color);
	line-height: 1;
	margin-bottom: 0.4rem;
}
.stat-label { font-size: 0.9rem; color: var(--gray-color); font-weight: 500; }

/* ---------------- Tags / badges ---------------- */
.tag {
	display: inline-block;
	padding: 3px 12px;
	border-radius: 20px;
	font-size: 0.78rem;
	font-weight: 600;
	background-color: var(--light-gray);
	color: var(--gray-color);
}
.tag-accent { background-color: var(--accent-color); color: var(--dark-color); }
.tag-primary { background-color: var(--primary-color); color: #fff; }

/* ---------------- Filter / search bar (portfolio + blog) ---------------- */
.filter-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	align-items: center;
	margin: 1.5rem 0 0.5rem;
}
.filter-btn {
	background: var(--light-color);
	border: 1px solid var(--light-gray);
	color: var(--gray-color);
	padding: 6px 16px;
	border-radius: 20px;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: var(--transition);
}
.filter-btn:hover { border-color: var(--primary-color); color: var(--primary-color); transform: translateY(-1px); }
.filter-btn:active { transform: scale(0.95); }
.filter-btn.active { background-color: var(--primary-color); border-color: var(--primary-color); color: #fff; }

.search-input {
	flex: 1;
	min-width: 200px;
	padding: 8px 16px;
	border-radius: 20px;
	border: 1px solid var(--light-gray);
	font-family: inherit;
	font-size: 0.9rem;
	background-color: var(--card-bg);
	color: var(--dark-color);
}
.search-input:focus { outline: none; border-color: var(--primary-color); }

.empty-state { color: var(--gray-color); font-style: italic; padding: 2rem 0; }

.skeleton {
	background: linear-gradient(90deg, var(--light-gray) 25%, var(--border-color) 37%, var(--light-gray) 63%);
	background-size: 400% 100%;
	animation: skeleton-loading 1.4s ease infinite;
	border-radius: var(--border-radius);
	min-height: 120px;
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- Back to top ---------------- */
#back-to-top {
	position: fixed;
	bottom: 28px;
	right: 28px;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background-color: var(--primary-color);
	color: #fff;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.1rem;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(0,0,0,0.2);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: var(--transition);
	z-index: 900;
}
#back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
#back-to-top:hover { background-color: var(--primary-dark); transform: translateY(-3px); }
#back-to-top:active { transform: translateY(-1px) scale(0.94); }

/* ---------------- Footer ---------------- */
#footer {
	background-color: var(--secondary-color);
	color: white;
	padding: 60px 0 30px;
	width: 100%;
	margin-top: auto;
}

.footer-content { display: flex; flex-direction: column; align-items: center; text-align: center; }

.footer-tagline { color: rgba(255,255,255,0.75); max-width: 480px; margin: -1.2rem 0 1.8rem; font-size: 0.95rem; }

.social { display: flex; list-style: none; margin-bottom: 2rem; flex-wrap: wrap; justify-content: center; }

.social li { margin: 0 10px; }

.social a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background-color: rgba(255, 255, 255, 0.1);
	border-radius: 50%;
	color: white;
	transition: var(--transition);
}

.social a:hover { background-color: var(--primary-color); transform: translateY(-3px); }

.footer-links { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: rgba(255,255,255,0.75); font-size: 0.9rem; }
.footer-links a:hover { color: #fff; }

.copy { color: rgba(255, 255, 255, 0.7); font-size: 0.9rem; }

/* ---------------- Responsive ---------------- */
@media (max-width: 768px) {
	h1 { font-size: 2rem; }
	h2 { font-size: 1.75rem; }
	.page-title { font-size: 2.5rem; }
	.page-subtitle { font-size: 1.1rem; }

	.nav-menu {
		position: fixed;
		top: 70px;
		right: -100%;
		flex-direction: column;
		background-color: var(--nav-bg);
		width: 80%;
		height: calc(100vh - 70px);
		box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
		transition: var(--transition);
		padding: 2rem;
	}

	.nav-menu.active { right: 0; }
	.nav-menu li { margin: 0 0 1.5rem 0; }
	.menu_trigger { display: block; }
	.menu_trigger.is-open i { transform: rotate(90deg); }
	.menu_trigger i { display: inline-block; transition: transform 0.3s ease; }

	/* Links cascade in one-by-one as the mobile menu opens */
	.nav-menu a { opacity: 0; transform: translateX(16px); transition: opacity 0.3s ease, transform 0.3s ease; }
	.nav-menu.active a { opacity: 1; transform: none; }
	.nav-menu.active li:nth-child(1) a { transition-delay: 0.05s; }
	.nav-menu.active li:nth-child(2) a { transition-delay: 0.1s; }
	.nav-menu.active li:nth-child(3) a { transition-delay: 0.15s; }
	.nav-menu.active li:nth-child(4) a { transition-delay: 0.2s; }
	.nav-menu.active li:nth-child(5) a { transition-delay: 0.25s; }
}

@media (max-width: 576px) {
	.container { padding: 0 15px; }
	#header { padding: 80px 0 60px; }
	#main { padding: 60px 0; }
	#back-to-top { right: 16px; bottom: 16px; }
}
