/* =========================================
   0. HARD FIXES (STOP MOBILE WHITE PAGE)
========================================= */
* { box-sizing: border-box; }

html, body {
	width: 100%;
	overflow-x: hidden;
	margin: 0;
	padding: 0;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

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

/* =========================================
   1. BASE STYLES
========================================= */
body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	line-height: 1.6;
	color: #333;
}

/* =========================================
   2. NAVIGATION
========================================= */
.navbar {
	background: #2c3e50;
	padding: 1rem 0;
	position: fixed;
	width: 100%;
	top: 0;
	z-index: 1000;
	box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar .container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
}

.logo {
	color: #fff;
	font-size: 1.2rem;
	font-weight: bold;
	line-height: 1.2;
	max-width: 60ch;
}

.nav-menu {
	display: flex;
	list-style: none;
	gap: 2rem;
	margin: 0;
	padding: 0;
}

.nav-link {
	color: #fff;
	text-decoration: none;
	transition: color 0.3s;
}

.nav-link:hover { color: #3498db; }

.hamburger {
	display: none;
	flex-direction: column;
	cursor: pointer;
	background: transparent;
	border: 0;
	padding: 0.25rem;
}

.hamburger span {
	width: 25px;
	height: 3px;
	background: #fff;
	margin: 3px 0;
	transition: 0.3s;
}

.hamburger.active span:nth-child(1) { transform: rotate(-45deg) translate(-5px, 6px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(45deg) translate(-5px, -6px); }

/* =========================================
   3. BUTTONS & GLOBAL COMPONENTS
========================================= */
.btn {
	display: inline-block;
	padding: 0.8rem 2rem;
	text-decoration: none;
	border-radius: 5px;
	transition: all 0.3s;
	border: none;
	cursor: pointer;
	font-size: 1rem;
}

.btn-primary {
	background: #3498db;
	color: #fff;
}

.btn-primary:hover {
	background: #2980b9;
	transform: translateY(-2px);
	box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.btn-contribute {
	background: #e74c3c;
	padding: 0.5rem 1rem;
	border-radius: 5px;
}

.btn-contribute:hover {
	background: #c0392b;
	color: #fff;
}

.section-title {
	text-align: center;
	font-size: 2.2rem;
	margin-bottom: 1rem;
	color: #2c3e50;
}

.section-subtitle {
	text-align: center;
	color: #7f8c8d;
	margin-bottom: 3rem;
}

/* =========================================
   4. HERO SECTION
========================================= */
.hero {
	min-height: 100vh;
	background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('IMG-20260208-WA0005.jpg') center/cover;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: #fff;
	padding: 6rem 0 2rem;
}

.hero-content h1 {
	font-size: clamp(1.8rem, 4vw, 3rem);
	margin-bottom: 1rem;
	animation: fadeInDown 1s;
	padding: 0 1rem;
}

.hero-content p {
	font-size: 1.1rem;
	margin-bottom: 2rem;
	animation: fadeInUp 1s;
	padding: 0 1rem;
}

/* =========================================
   5. ABOUT SECTION
========================================= */
.about {
	padding: 5rem 0;
	background: #f8f9fa;
}

.about-content {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 3rem;
	margin-top: 3rem;
}

.about-text h3 {
	color: #2c3e50;
	margin-bottom: 1rem;
	font-size: 1.6rem;
}

.about-text p, .about-text ul {
	margin-bottom: 1.5rem;
	line-height: 1.8;
	font-size: 1rem;
}

.about-stats {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.stat-box {
	background: #fff;
	padding: 2rem;
	border-radius: 10px;
	text-align: center;
	box-shadow: 0 5px 15px rgba(0,0,0,0.1);
	transition: transform 0.3s;
}

.stat-box:hover { transform: translateY(-5px); }

.stat-box h3 {
	font-size: 2.5rem;
	color: #3498db;
	margin-bottom: 0.5rem;
}

/* =========================================
   6. GALLERY SECTION
========================================= */
.gallery { padding: 5rem 0; }

.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.5rem;
	margin-top: 3rem;
}

.gallery-item {
	position: relative;
	overflow: hidden;
	border-radius: 10px;
	height: 280px;
	cursor: pointer;
	box-shadow: 0 5px 15px rgba(0,0,0,0.1);
	background: #f0f3f7;
}

.gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.gallery-item:hover img { transform: scale(1.1); }

.gallery-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
	color: white;
	padding: 1.5rem 1rem;
	transform: translateY(100%);
	transition: transform 0.3s ease;
	text-align: center;
	font-weight: 500;
	font-size: 1.05rem;
	z-index: 2;
}

.gallery-item:hover .gallery-overlay { transform: translateY(0); }

/* Lightbox */
.lightbox {
	display: none;
	position: fixed;
	z-index: 2000;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.95);
	justify-content: center;
	align-items: center;
	padding: 20px;
}

.lightbox-content {
	max-width: 92vw;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 5px;
	box-shadow: 0 5px 30px rgba(0,0,0,0.5);
}

.close {
	position: absolute;
	top: 12px;
	right: 16px;
	color: white;
	font-size: 44px;
	font-weight: bold;
	cursor: pointer;
	z-index: 2001;
	transition: color 0.3s;
	background: transparent;
	border: 0;
}

.close:hover { color: #3498db; }

/* =========================================
   7. CONTACT SECTION
========================================= */
.contact {
	padding: 5rem 0;
	background: #f8f9fa;
}

.contact-content {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 3rem;
	margin-top: 3rem;
}

.contact-info h3 {
	color: #2c3e50;
	margin-bottom: 2rem;
}

.info-item { margin-bottom: 1.5rem; }

.info-item strong {
	color: #3498db;
	display: block;
	margin-bottom: 0.5rem;
}

.contact-form input,
.contact-form textarea {
	width: 100%;
	padding: 0.8rem;
	margin-bottom: 1rem;
	border: 1px solid #ddd;
	border-radius: 5px;
	font-family: inherit;
}

.contact-form textarea { resize: vertical; }

/* Optional message styles */
.form-message { display: none; }
.form-message.success { display: block; color: #1f7a3e; }
.form-message.error { display: block; color: #a12020; }

/* =========================================
   8. CONTRIBUTE & PAYMENT SECTION
========================================= */
.contribute { padding: 5rem 0; }

.donation-info {
	background: #fff;
	padding: 2.5rem;
	border-radius: 10px;
	margin: 2rem auto 3rem;
	max-width: 900px;
	box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.donation-grid {
	display: grid;
	gap: 1.2rem;
	max-width: 700px;
	margin: 0 auto;
}

.payment-method-box {
	background: #f8f9fa;
	padding: 1.5rem;
	border-radius: 8px;
	border-left: 4px solid #3498db;
	overflow: hidden;
}

.payment-method-title {
	color: #3498db;
	display: block;
	margin-bottom: 0.8rem;
	font-size: 1.1rem;
}

.bank-details {
	line-height: 1.8;
	color: #2c3e50;
	margin-bottom: 1rem;
	overflow-wrap: anywhere;
}

.payment-link {
	display: inline-block;
	padding: 0.6rem 1.2rem;
	color: white;
	text-decoration: none;
	border-radius: 5px;
	text-align: center;
	transition: all 0.3s;
	border: none;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 500;
}

.payment-link:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0,0,0,0.2);
	opacity: 0.95;
}

.mpesa-link { background: #3498db; }
.zelle-link { background: #6d1ed4; }
.cashapp-link { background: #00c244; }
.taptap-link { background: #e74c3c; }
.copy-btn { background: #3498db; }

.copy-success {
	color: #27ae60;
	margin-left: 1rem;
	display: none;
	font-weight: bold;
}

.usa-payment-buttons {
	display: flex;
	flex-direction: column;
	gap: 0.8rem;
}

.contribute-content {
	max-width: 800px;
	margin: 3rem auto;
}

.integrated-payment-section {
	background: #fff;
	padding: 3rem;
	border-radius: 10px;
	box-shadow: 0 5px 15px rgba(0,0,0,0.1);
	max-width: 700px;
	margin: 0 auto;
	overflow: hidden;
}

.visa-logo-container {
	display: flex;
	justify-content: center;
	margin-bottom: 1.5rem;
}

.payment-logo-large {
	height: 60px;
	width: auto;
}

.quick-amounts {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
	margin-bottom: 1.2rem;
}

.amount-link {
	padding: 1rem;
	background: #fff;
	border: 2px solid #1a1f71;
	color: #1a1f71;
	border-radius: 5px;
	text-align: center;
	text-decoration: none;
	font-weight: bold;
	transition: all 0.3s;
}

.amount-link:hover {
	background: #1a1f71;
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(26, 31, 113, 0.3);
}

.custom-amount-form {
	display: flex;
	gap: 1rem;
	max-width: 420px;
	margin: 0 auto;
}

.custom-amount-form input {
	flex: 1;
	padding: 0.8rem;
	border: 2px solid #ddd;
	border-radius: 5px;
	font-size: 1rem;
	min-width: 0;
}

.custom-amount-form button { white-space: nowrap; }

.payment-security-info {
	margin-top: 1.5rem;
	padding: 1rem;
	background: #f0f8ff;
	border-left: 4px solid #3498db;
	border-radius: 5px;
	text-align: center;
}

.payment-security-info p {
	margin: 0.4rem 0;
	color: #2c3e50;
	font-size: 0.95rem;
}

/* =========================================
   9. BOOKS SECTION (MOBILE SAFE)
========================================= */
.books {
	padding: 5rem 0;
	background: #f8fafc;
}

.book-showcase {
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

.book-card {
	display: flex;
	background: white;
	border-radius: 15px;
	box-shadow: 0 5px 15px rgba(0,0,0,0.1);
	overflow: hidden;
	transition: transform 0.3s;
	min-width: 0;
}

/* Safety to prevent overflow overlap in flex layouts */
.book-card > * { min-width: 0; }

.book-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.book-cover-image {
	flex: 0 0 200px;
	background: #f0f3f7;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	overflow: hidden;
}

.book-cover-image img {
	width: 100%;
	height: auto;
	max-height: 250px;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}

.book-details {
	flex: 1;
	padding: 1.8rem;
	min-width: 0;
}

.book-title {
	font-size: 1.5rem;
	color: #2c3e50;
	margin-bottom: 0.3rem;
}

.book-author-info {
	color: #7f8c8d;
	font-size: 0.95rem;
	margin-bottom: 1rem;
}

.book-description {
	color: #34495e;
	line-height: 1.6;
	margin-bottom: 1.2rem;
	font-size: 0.95rem;
	overflow-wrap: anywhere;
}

.book-impact {
	background: #f8f9fa;
	padding: 1rem 1.2rem;
	border-radius: 10px;
	margin: 1.2rem 0;
	border-left: 4px solid #3498db;
}

.book-impact ul {
	margin: 0.5rem 0 0;
	padding-left: 1.2rem;
}

.btn-buy-book {
	display: inline-block;
	background: #3498db;
	color: white;
	font-weight: 600;
	padding: 0.8rem 2rem;
	border-radius: 5px;
	text-decoration: none;
	font-size: 1rem;
	transition: background 0.3s;
}

.btn-buy-book:hover { background: #2980b9; }

.books-note {
	text-align: center;
	margin-top: 3rem;
	padding: 1.5rem;
	background: #f8f9fa;
	border-radius: 10px;
	color: #2c3e50;
}

.books-note a {
	color: #3498db;
	text-decoration: none;
	font-weight: 600;
}

.books-note a:hover { text-decoration: underline; }

/* =========================================
   10. FOOTER
========================================= */
.footer {
	background: #2c3e50;
	color: #fff;
	padding: 3rem 0 1rem;
}

.footer-content {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 2rem;
	margin-bottom: 2rem;
}

.footer-section ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.footer-section a {
	color: #ecf0f1;
	text-decoration: none;
	transition: color 0.3s;
}

.footer-section a:hover { color: #3498db; }

.footer-bottom {
	text-align: center;
	padding-top: 2rem;
	border-top: 1px solid #34495e;
}

/* =========================================
   11. ANIMATIONS
========================================= */
@keyframes fadeInDown {
	from { opacity: 0; transform: translateY(-30px); }
	to { opacity: 1; transform: translateY(0); }
}

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

/* =========================================
   12. SCROLL TO TOP BUTTON
========================================= */
.scroll-to-top {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: #3498db;
	color: white;
	border: none;
	border-radius: 50%;
	width: 50px;
	height: 50px;
	font-size: 24px;
	cursor: pointer;
	transition: background 0.3s;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
}

.scroll-to-top:hover { background: #2980b9; }

/* =========================================
   12.5 FADE-IN (MOVED FROM JS TO CSS)
========================================= */
.fade-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
	.fade-in {
		opacity: 0;
		transform: translateY(20px);
		transition: opacity 0.6s ease-out, transform 0.6s ease-out;
	}
	.fade-in-visible {
		opacity: 1;
		transform: translateY(0);
	}
}

/* =========================================
   13. RESPONSIVE MEDIA QUERIES
========================================= */
@media (max-width: 768px) {
	.hamburger { display: flex; }

	.nav-menu {
		position: fixed;
		left: -100%;
		top: 64px;
		flex-direction: column;
		background-color: #2c3e50;
		width: 100%;
		text-align: center;
		transition: 0.3s;
		padding: 1.5rem 0;
		box-shadow: 0 4px 6px rgba(0,0,0,0.1);
		gap: 1rem;
	}

	.nav-menu.active { left: 0; }

	.about-content,
	.contact-content,
	.footer-content {
		grid-template-columns: 1fr;
	}

	.gallery-grid {
		grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
		gap: 1rem;
	}

	.gallery-item { height: 220px; }

	.integrated-payment-section { padding: 1.5rem; }

	.quick-amounts { grid-template-columns: repeat(2, 1fr); }

	.custom-amount-form { flex-direction: column; }

	/* ===== Books overlap fix on mobile ===== */
	.books .book-card { flex-direction: column; }

	.books .book-cover-image {
		flex: 0 0 auto;
		width: 100%;
		padding: 1rem;
	}

	.books .book-cover-image img {
		width: 100%;
		max-width: 100%;
		height: auto;
		max-height: 320px;
		object-fit: contain;
	}

	.books .book-details {
		width: 100%;
		padding: 1.5rem;
	}

	.book-details,
	.book-description {
		overflow-wrap: anywhere;
		word-break: break-word;
	}

	.close {
		font-size: 40px;
		top: 10px;
		right: 12px;
	}

	/* Show full gallery images on phones (no cropping) */
	.gallery-item {
		height: auto;
		aspect-ratio: 4 / 3;
		background: #111;
	}

	.gallery-item img {
		object-fit: contain;
		background: #111;
	}
}

@media (max-width: 480px) {
	.gallery-grid { grid-template-columns: 1fr; }
	.gallery-item { height: 250px; }
	.btn-buy-book { width: 100%; text-align: center; }
	.section-title { font-size: 1.8rem; }
}
/* ===== Mobile: always show full gallery overlay text ===== */
@media (max-width: 768px) {
  .gallery-overlay{
    transform: translateY(0) !important;   /* always visible */
    padding: 1rem 0.9rem;
    font-size: 1rem;
    line-height: 1.35;

    /* make sure long captions show fully */
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* optional: darker overlay so text is readable */
  .gallery-overlay{
    background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0.20));
  }
}