/* ============================================
   KASARACHI FOUNDATION - Main Stylesheet
   Premium NGO Website Design
   ============================================ */

/* CSS Custom Properties */
:root {
  --primary: #0D6EFD;
  --primary-dark: #0B5ED7;
  --primary-light: #6EA8FE;
  --secondary: #198754;
  --secondary-dark: #157347;
  --accent: #FFC107;
  --accent-dark: #E5AC00;
  --dark: #1E293B;
  --dark-light: #334155;
  --light: #F8FAFC;
  --light-alt: #F1F5F9;
  --white: #FFFFFF;
  --gray: #64748B;
  --gray-light: #CBD5E1;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.15);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1200px;
}

/* Reset & Base */
*,*::before,*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  font-size: 16px;
}

body {
  font-family: var(--font);
  color: var(--dark);
  background: var(--white);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Accessibility utilities */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.page-hero {
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 50%, #0d1b33 100%);
  color: var(--white);
  padding: 120px 0 80px;
}

.page-hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(13, 110, 253, 0.12) 0%, transparent 60%);
  z-index: 0;
}

.page-hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.page-hero .badge {
  margin-bottom: 16px;
}

.page-hero h1 {
  margin-bottom: 16px;
}

.legal-content {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.legal-content h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p,
.legal-content li {
  line-height: 1.7;
  color: var(--text-muted, rgba(255, 255, 255, 0.85));
}

.legal-content ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0.75rem 0 1rem;
}

.legal-content a {
  color: var(--primary, #0D6EFD);
  text-decoration: underline;
}

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

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

ul {
  list-style: none;
}

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

.section-padding {
  padding: 80px 0;
}

.bg-light {
  background: var(--light);
}

/* Typography */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--gray);
  font-size: 1.1rem;
  max-width: 600px;
}

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

/* Section Header */
.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-header h2 {
  position: relative;
  display: inline-block;
}

.section-header h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--accent);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-logo {
  display: block;
  width: 88px;
  height: auto;
  object-fit: contain;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Progress Bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  z-index: 1000;
  width: 0%;
  transition: width 0.1s linear;
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 900;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

.navbar.scrolled {
  background: rgba(255,255,255,0.95);
  border-bottom-color: var(--border);
  box-shadow: var(--shadow);
}

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

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--dark);
}

.logo-img {
  display: block;
  height: 52px;
  width: auto;
  max-width: min(168px, 42vw);
  object-fit: contain;
}

.logo-img--footer {
  height: 72px;
  max-width: 180px;
  margin-bottom: 0.75rem;
}

.footer-logo-link {
  display: inline-block;
  line-height: 0;
}

.logo-highlight {
  color: var(--primary);
}

.nav-menu ul {
  display: flex;
  gap: 28px;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--dark-light);
  position: relative;
  padding: 4px 0;
}

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

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--primary);
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  width: 100%;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 1001;
}

.hamburger span {
  width: 26px;
  height: 2.5px;
  background: var(--dark);
  border-radius: 2px;
  transition: var(--transition);
  display: block;
}

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

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  border: 2px solid transparent;
  cursor: pointer;
  gap: 8px;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: var(--white);
}

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

.btn-secondary {
  background: var(--secondary);
  color: var(--white);
  border-color: var(--secondary);
}

.btn-secondary:hover {
  background: var(--secondary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 50%, #0d1b33 100%);
  color: var(--white);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(13,110,253,0.15) 0%, transparent 60%),
              radial-gradient(circle at 70% 30%, rgba(25,135,84,0.1) 0%, transparent 50%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero-text {
  max-width: 580px;
}

.badge {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  border: 1px solid rgba(255,255,255,0.2);
}

.hero-sub {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 28px;
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.floating-cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.float-card {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 16px 20px;
  border-radius: var(--radius);
  text-align: center;
  min-width: 120px;
}

.float-card span {
  font-size: 1.8rem;
  font-weight: 700;
  display: block;
}

.float-card small {
  font-size: 0.8rem;
  opacity: 0.85;
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-img-placeholder {
  width: 300px;
  height: 300px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  text-align: center;
  background: rgba(255,255,255,0.08);
  border: 2px dashed rgba(255,255,255,0.2);
}

/* Glass Card */
.glass-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.about-text p {
  margin-bottom: 20px;
  font-size: 1.05rem;
  color: var(--dark-light);
}

.mission-vision {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mission-vision div {
  background: var(--light);
  padding: 16px;
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}

.founder-card {
  padding: 32px;
  text-align: center;
}

.founder-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-light);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--white);
}

.founder-title {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 12px;
}

.founder-card em {
  color: var(--gray);
  font-size: 0.95rem;
}

/* Impact Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px;
  text-align: center;
}

.stat-item {
  padding: 28px 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.stat-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-item span {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.stat-item small {
  color: var(--gray);
  font-size: 0.9rem;
}

/* Programs */
.programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.program-card {
  padding: 32px 24px;
  text-align: center;
  transition: var(--transition);
  cursor: default;
}

.program-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.program-card i {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 16px;
}

.program-card p {
  color: var(--gray);
  font-size: 0.95rem;
}

/* Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.feature {
  padding: 20px;
  background: var(--white);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.feature span {
  font-size: 1.5rem;
}

/* Testimonials */
.testimonial {
  padding: 40px 32px;
  text-align: center;
}

.testimonial p {
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 16px;
  color: var(--dark-light);
}

.testimonial strong {
  color: var(--primary);
}

/* Gallery */
.masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-auto-rows: 180px;
  gap: 16px;
  grid-auto-flow: dense;
}

.masonry-item {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.masonry-item.tall {
  grid-row: span 2;
}

.masonry-item.wide {
  grid-column: span 2;
}

.gallery-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}

.gallery-placeholder:hover {
  transform: scale(1.03);
}

.filter-btn {
  padding: 8px 20px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 50px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  margin: 0 4px;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* Partners */
.partner-logos {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  font-weight: 600;
  color: var(--gray);
  font-size: 1.2rem;
  opacity: 0.8;
}

/* Donation CTA */
.cta-box {
  padding: 56px 32px;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.cta-box h2 {
  margin-bottom: 12px;
}

.cta-box p {
  margin-bottom: 24px;
  color: var(--gray);
}

/* Volunteer Form */
.volunteer-form {
  display: flex;
  gap: 16px;
  padding: 24px;
  max-width: 600px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.volunteer-form input {
  flex: 1 1 200px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-family: var(--font);
}

.volunteer-form button {
  flex-shrink: 0;
}

/* News */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.news-card {
  padding: 24px;
  background: var(--white);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-sm);
}

.news-card .date {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-form input,
.contact-form textarea {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  resize: vertical;
}

.contact-info p {
  margin-bottom: 12px;
}

.map-placeholder {
  height: 180px;
  background: var(--light-alt);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  color: var(--gray);
}

/* Footer */
.footer {
  background: var(--dark);
  color: var(--light);
  padding: 60px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  margin-bottom: 40px;
}

.footer h4 {
  color: var(--white);
  margin-bottom: 12px;
}

.footer ul li {
  margin-bottom: 6px;
  opacity: 0.8;
  cursor: pointer;
}

.social-links {
  font-size: 1.4rem;
  display: flex;
  gap: 12px;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 20px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.7;
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 992px) {
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text {
    max-width: 100%;
  }

  .hero-buttons {
    justify-content: center;
  }

  .floating-cards {
    justify-content: center;
  }

  .hero-visual {
    display: none;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-xl);
    padding: 100px 32px 32px;
    transition: var(--transition);
    z-index: 999;
  }

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

  .nav-menu ul {
    flex-direction: column;
    gap: 20px;
  }

  .masonry-item.wide {
    grid-column: span 1;
  }
}