/* Match Calvary Chapel Eldoret (cceldoret.org / Wix): Wix Madefor Display + Text */
@import url('https://fonts.googleapis.com/css2?family=Wix+Madefor+Display:wght@400;500;600;700;800&family=Wix+Madefor+Text:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --primary-red: #8B0000;
  --primary-red-glow: rgba(139, 0, 0, 0.5);
  --burgundy: #4A0D0D;
  --gold: #D4AF37;
  --cream: #FFF7ED;
  --charcoal: #111111;
  --soft-gray: #F5F5F5;
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-blur: blur(12px);
}

html {
  font-size: 15px;
}

/* ─── Mobile global tweaks ─── */
@media (max-width: 767px) {
  /* Compress overly-large section vertical padding on phones */
  .py-24 { padding-top: 3.5rem !important; padding-bottom: 3.5rem !important; }
  .py-28 { padding-top: 4rem !important;   padding-bottom: 4rem !important; }
  .py-32 { padding-top: 4.5rem !important; padding-bottom: 4.5rem !important; }
  .py-36 { padding-top: 5rem !important;   padding-bottom: 5rem !important; }
  /* Compress large uniform padding cards on phones */
  .p-16  { padding: 1.75rem !important; }
  .p-14  { padding: 1.5rem !important; }
  /* Prevent excessively large letter-spacing on tiny screens */
  .tracking-\[0\.24em\] { letter-spacing: 0.18em !important; }
}

/* Mobile-only typography tuning */
@media (max-width: 767px) {
  html {
    font-size: 13.5px;
  }

  /* So mobile menu labels are not overly large */
  #mobile-menu .text-3xl {
    font-size: 1.38rem;
    line-height: 1.25;
  }

  #mobile-menu .text-xl {
    font-size: 0.98rem;
    line-height: 1.35;
  }

  /* Global heading downscale for phone responsiveness */
  .text-8xl { font-size: 2.65rem !important; line-height: 1.1 !important; }
  .text-7xl { font-size: 2.4rem !important; line-height: 1.1 !important; }
  .text-6xl { font-size: 2.2rem !important; line-height: 1.12 !important; }
  .text-5xl { font-size: 1.98rem !important; line-height: 1.15 !important; }
  .text-4xl { font-size: 1.72rem !important; line-height: 1.2 !important; }
  .text-3xl { font-size: 1.45rem !important; line-height: 1.25 !important; }
  .text-2xl { font-size: 1.2rem !important; line-height: 1.3 !important; }
  .text-xl { font-size: 1.04rem !important; line-height: 1.35 !important; }

  /* Body copy tuning for compact mobile readability */
  .text-lg { font-size: 1rem !important; line-height: 1.45 !important; }
  .text-base { font-size: 0.94rem !important; line-height: 1.45 !important; }

  /* Slightly calmer section headings on phones */
  .section-title {
    letter-spacing: -0.02em;
  }

  /* Footer link grids: mix horizontal + vertical flow instead of one long column */
  footer .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
    row-gap: 1.75rem;
  }

  footer .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-5 > div:first-child {
    grid-column: 1 / -1;
  }

  footer .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
    row-gap: 1.5rem;
  }

  footer .mx-auto.grid.max-w-7xl.sm\:grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
    row-gap: 1.75rem;
  }

  /* Copyright / legal row: side-by-side where it fits, wraps instead of stacked column */
  footer .max-w-7xl > div.flex.flex-col.md\:flex-row.justify-between {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.65rem 1.25rem;
    text-align: center;
  }

  footer .max-w-7xl > div.flex.flex-col.md\:flex-row.justify-between > div.flex {
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 1.25rem;
    row-gap: 0.35rem;
  }
}

.dark {
  --glass-bg: rgba(0, 0, 0, 0.3);
  --glass-border: rgba(255, 255, 255, 0.1);
  --bg-color: #0a0a0a;
  --text-color: #f5f5f5;
}

body {
  @apply transition-colors duration-300;
  font-family: 'Wix Madefor Text', system-ui, sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.section-title,
.section-kicker {
  font-family: 'Wix Madefor Display', 'Wix Madefor Text', system-ui, sans-serif;
}

/* Glassmorphism Classes */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

/* Light mode only: main header row (nav) reads as a white bar, not faint glass over the hero */
html:not(.dark) header > div.glass:has(> nav) {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(17, 17, 17, 0.08);
  box-shadow: 0 1px 0 rgba(17, 17, 17, 0.05);
}

.glass-dark {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-red {
  background: rgba(139, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 0, 0, 0.3);
}

/* Animations */
@keyframes pulse-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 0, 0, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(139, 0, 0, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 0, 0, 0); }
}

.animate-pulse-red {
  animation: pulse-red 2s infinite;
}

.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);
}

/* Buttons */
.btn-primary,
.btn-gold,
.btn-glass {
  position: relative;
  border-radius: 18px;
  font-weight: 700;
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease, background 0.25s ease;
  transform: translateY(0);
  overflow: hidden;
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
}

.btn-primary::before,
.btn-gold::before,
.btn-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.03) 45%, rgba(255, 255, 255, 0.18));
  opacity: 0.85;
  pointer-events: none;
}

.btn-primary:hover,
.btn-gold:hover,
.btn-glass:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn-primary:active,
.btn-gold:active,
.btn-glass:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.btn-primary {
  @apply px-8 py-3 font-bold transition-all duration-300 transform hover:scale-105 active:scale-95 flex items-center justify-center;
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.82), rgba(74, 13, 13, 0.78));
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 10px 24px rgba(74, 13, 13, 0.35);
}

.btn-gold {
  @apply px-8 py-3 font-bold transition-all duration-300 transform hover:scale-105 active:scale-95 flex items-center justify-center;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.8), rgba(184, 134, 11, 0.76));
  color: #111;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 24px rgba(123, 92, 15, 0.3);
}

.btn-glass {
  @apply px-8 py-3 font-bold transition-all duration-300 transform hover:scale-105 active:scale-95 flex items-center justify-center glass text-white;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 10px 22px rgba(0, 0, 0, 0.2);
}

/* Liquid glass image cards */
.image-capsule,
.glass-dark.rounded-\[2rem\],
.glass-dark.group.relative.overflow-hidden.rounded-3xl {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px) saturate(165%);
  -webkit-backdrop-filter: blur(10px) saturate(165%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 18px 36px rgba(17, 17, 17, 0.2);
}

.image-capsule::before,
.glass-dark.rounded-\[2rem\]::before,
.glass-dark.group.relative.overflow-hidden.rounded-3xl::before,
.btn-primary::after,
.btn-gold::after,
.btn-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.image-capsule::before,
.glass-dark.rounded-\[2rem\]::before,
.glass-dark.group.relative.overflow-hidden.rounded-3xl::before {
  border-radius: inherit;
  background:
    radial-gradient(140px 80px at 14% 18%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 70%),
    radial-gradient(110px 70px at 85% 24%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 72%),
    radial-gradient(90px 56px at 70% 76%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 72%);
  mix-blend-mode: screen;
  opacity: 0.9;
}

/* Droplet sweep for buttons */
.btn-primary::after,
.btn-gold::after,
.btn-glass::after {
  border-radius: inherit;
  background:
    radial-gradient(38px 24px at 22% 36%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 74%),
    radial-gradient(54px 30px at 80% 52%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 75%);
  opacity: 0.8;
  transform: translateX(-12%);
  transition: transform 0.6s ease, opacity 0.6s ease;
}

.btn-primary:hover::after,
.btn-gold:hover::after,
.btn-glass:hover::after {
  transform: translateX(10%);
  opacity: 1;
}

/* Custom Utilities */
.text-shadow {
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.bg-hero-overlay {
  background: linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0.8));
}

/* Slightly lighter overlay on small viewports so the hero photo reads better on phones */
@media (max-width: 1023px) {
  .bg-hero-overlay {
    background: linear-gradient(to bottom, rgba(0,0,0,0.32), rgba(0,0,0,0.72));
  }
}

.bg-red-gradient {
  background: linear-gradient(135deg, var(--primary-red), var(--burgundy));
}

/* Hide scrollbar for Chrome, Safari and Opera */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

/* Image Capsules */
.image-capsule {
  @apply rounded-3xl overflow-hidden transition-transform duration-500 hover:scale-[1.02];
}

/* Navigation */
.nav-link {
  @apply relative py-2 px-0.5 text-xs font-semibold tracking-wide transition-colors duration-200 hover:text-red-500;
}

.nav-link::after {
  content: '';
  @apply absolute bottom-0 left-0 w-0 h-0.5 bg-red-600 transition-all duration-300;
}

.nav-link:hover::after {
  @apply w-full;
}

.nav-link.active {
  @apply text-red-600;
}

.nav-link.active::after {
  @apply w-full;
}

/* Center desktop nav: default link styles stay dark on glass; force light text in dark theme */
.dark .nav-link {
  color: rgba(255, 255, 255, 0.92);
}

.dark .nav-link:hover {
  color: #ef4444;
}

.dark .nav-link.active {
  color: #f87171;
}

/* Desktop dropdown animation */
.nav-dropdown-panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -14px) scale(0.98);
  transform-origin: top center;
  transition: opacity 0.34s ease, transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.34s ease;
}

.nav-dropdown-group:hover .nav-dropdown-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.nav-dropdown-group.is-open .nav-dropdown-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.nav-dropdown-panel .nav-dropdown-item {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-dropdown-group:hover .nav-dropdown-panel .nav-dropdown-item,
.nav-dropdown-group.is-open .nav-dropdown-panel .nav-dropdown-item {
  opacity: 1;
  transform: translateY(0);
}

.nav-dropdown-panel .nav-dropdown-item:nth-child(1) { transition-delay: 40ms; }
.nav-dropdown-panel .nav-dropdown-item:nth-child(2) { transition-delay: 90ms; }
.nav-dropdown-panel .nav-dropdown-item:nth-child(3) { transition-delay: 140ms; }
.nav-dropdown-panel .nav-dropdown-item:nth-child(4) { transition-delay: 190ms; }
.nav-dropdown-panel .nav-dropdown-item:nth-child(5) { transition-delay: 240ms; }
.nav-dropdown-panel .nav-dropdown-item:nth-child(6) { transition-delay: 290ms; }

.nav-dropdown-group.closing .nav-dropdown-panel .nav-dropdown-item {
  transition-delay: 0ms !important;
}

/* Header language dropdown */
.lang-dropdown {
  position: relative;
}

/* Panel lives on <nav> (not inside hidden desktop-only flex) so mobile can open it */
header nav > .lang-dropdown.lang-dropdown-mount {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  z-index: 55;
  transform: translateY(-50%);
}

@media (min-width: 1024px) {
  header nav > .lang-dropdown.lang-dropdown-mount {
    right: 0.75rem;
  }
}

.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.78rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.dark .lang-trigger {
  background: rgba(31, 41, 55, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
}

.lang-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.65rem);
  width: 18rem;
  padding: 0.7rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  box-shadow: 0 20px 34px rgba(15, 23, 42, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.28s ease, visibility 0.25s ease;
}

.dark .lang-panel {
  background: rgba(17, 24, 39, 0.95);
  border-color: rgba(255, 255, 255, 0.18);
}

.lang-dropdown.is-open .lang-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.lang-search {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.84rem;
  outline: none;
}

.dark .lang-search {
  background: rgba(31, 41, 55, 0.75);
  border-color: rgba(255, 255, 255, 0.2);
}

.lang-options {
  margin-top: 0.55rem;
  max-height: 16rem;
  overflow-y: auto;
  display: grid;
  gap: 0.25rem;
}

.lang-option {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 0.55rem 0.6rem;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.18s ease;
}

.lang-option:hover {
  background: rgba(239, 68, 68, 0.12);
}

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

/* Floating quick contact widget */
.quick-contact-widget {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.quick-contact-toggle {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.9), rgba(74, 13, 13, 0.88));
  color: #fff;
  box-shadow: 0 12px 24px rgba(74, 13, 13, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.quick-contact-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.quick-contact-panel {
  min-width: 15.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px) saturate(165%);
  -webkit-backdrop-filter: blur(14px) saturate(165%);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.22);
  padding: 0.7rem;
  display: none;
}

.dark .quick-contact-panel {
  background: rgba(17, 24, 39, 0.94);
  border-color: rgba(255, 255, 255, 0.18);
}

.quick-contact-widget.is-open .quick-contact-panel {
  display: block;
}

.quick-contact-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ef4444;
  margin: 0.15rem 0.35rem 0.55rem;
}

.quick-contact-link {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border-radius: 0.75rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 700;
  transition: background 0.18s ease, transform 0.18s ease;
}

.quick-contact-icons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.quick-contact-icon {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 0.75rem;
  justify-content: center;
  padding: 0;
}

.quick-contact-link:hover {
  background: rgba(239, 68, 68, 0.12);
  transform: translateX(2px);
}

.quick-contact-close {
  width: 100%;
  margin-top: 0.25rem;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  padding: 0.55rem 0.7rem 0.25rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b7280;
}

.dark .quick-contact-close {
  border-top-color: rgba(255, 255, 255, 0.14);
  color: #d1d5db;
}

/* Global premium loader */
.site-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 35%, #1a0006 0%, #0b0b0d 45%, #060607 100%);
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.6s ease;
}

.site-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.site-loader-core {
  position: relative;
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
}

.site-loader-halo {
  position: absolute;
  inset: -18px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 26, 26, 0.28), rgba(230, 0, 35, 0.05) 60%, transparent 72%);
  filter: blur(8px);
  animation: loaderHaloSpin 2.3s linear infinite;
}

.site-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.06);
  border-top-color: #ff1a1a;
  border-right-color: #e60023;
  box-shadow: 0 0 22px rgba(255, 26, 26, 0.45), inset 0 0 18px rgba(230, 0, 35, 0.12);
  animation: loaderRingSpin 1.45s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.site-loader-orb {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ff6a6a 0%, #ff1a1a 40%, #c20020 100%);
  box-shadow: 0 0 26px rgba(255, 26, 26, 0.68), 0 0 44px rgba(230, 0, 35, 0.35);
  animation: loaderPulse 1.8s ease-in-out infinite;
}

.site-loader-text {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.82);
}

@keyframes loaderRingSpin {
  0% { transform: rotate(0deg) scale(0.96); }
  50% { transform: rotate(180deg) scale(1); }
  100% { transform: rotate(360deg) scale(0.96); }
}

@keyframes loaderPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes loaderHaloSpin {
  0% { transform: rotate(0deg); opacity: 0.7; }
  50% { opacity: 1; }
  100% { transform: rotate(360deg); opacity: 0.7; }
}
