/* ============================================================
   GLOBAL.CSS — Reginaldo Trust
   Shared styles used across all pages
   ============================================================ */


/* ── Base ─────────────────────────────────────────────────── */
html, body {
  background-color: #fbf8ff;
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

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

section {
  scroll-margin-top: 104px;
}

p {
  line-height: 1.6;
}

/* ── Core Theme Fallbacks ─────────────────────────────────── */
.bg-primary { background-color: #2e3b80; }
.text-primary { color: #2e3b80; }
.text-on-primary { color: #ffffff; }
.bg-surface { background-color: #fbf8ff; }
.bg-surface-container-lowest { background-color: #ffffff; }
.bg-surface-container-low { background-color: #f3f2ff; }
.bg-surface-container-highest { background-color: #e2e2e9; }
.shadow-xs { box-shadow: 0 1px 2px rgba(46, 59, 128, 0.05); }


/* ── Scroll Progress Bar ──────────────────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%; height: 4px;
  background: #2e3b80;
  z-index: 100;
  transition: width 0.1s ease-out;
}


/* ── Navigation & Anti-Overlay Protection ─────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  z-index: 50;
  background-color: rgba(251, 248, 255, 0.96) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #e8e7ee;
}

/* ── Nav Link Underline ───────────────────────────────────── */
.nav-link {
  position: relative;
  padding-bottom: 2px;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background-color: #2e3b80;
  transition: width 0.3s ease;
}
.nav-link:hover::after,
.nav-link.active-page::after { width: 100%; }

/* Nav links collapse into the drawer below lg (1024px), not md — six items plus the
   logo and Donate button no longer fit on a tablet. */
@media (max-width: 1023px) {
  .nav-link {
    padding: 6px 0;
    display: inline-block;
  }
}

@media (max-width: 640px) {
  nav .flex { flex-wrap: nowrap; }
  nav a.bg-primary {
    padding-left: 12px;
    padding-right: 12px;
    font-size: 14px;
    white-space: nowrap;
  }
}


/* ── Mobile Menu & Drawer Animation ──────────────────────── */
.mobile-menu {
  display: flex !important;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: #fbf8ff;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              padding 0.35s ease;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top: 0 solid transparent;
}
.mobile-menu.open {
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 1;
  pointer-events: auto;
  padding-top: 14px !important;
  padding-bottom: 24px !important;
  border-top: 1px solid #e8e7ee;
}
@media (min-width: 1024px) {
  .mobile-menu {
    display: none !important;
  }
}


/* ── Scroll Reveal ────────────────────────────────────────── */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  transition:
    opacity 1.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, opacity;
}
.reveal-on-scroll.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}


/* ── Image Reveal ─────────────────────────────────────────── */
.image-reveal {
  opacity: 0;
  transform: scale(0.95);
  transition:
    opacity 1.5s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.image-reveal.active {
  opacity: 1;
  transform: scale(1);
}


/* ── Animated Heading (word-by-word) ─────────────────────── */
.animated-heading {
  display: flex;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
  line-height: 1.25;
}
.animated-heading .word-wrapper {
  display: inline-block;
  overflow: hidden;
  margin-right: 0.25em;
  padding-bottom: 0.08em;
  vertical-align: bottom;
}
.animated-heading .word {
  display: inline-block;
  transform: translateY(105%);
  opacity: 0;
  transition:
    transform 1.2s cubic-bezier(0.19, 1, 0.22, 1),
    opacity 1s ease-out;
  will-change: transform, opacity;
  white-space: nowrap;
}
.animated-heading.active .word {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 768px) {
  .animated-heading {
    max-width: 100%;
    word-break: break-word;
    line-height: 1.22;
  }
}
@media (max-width: 640px) {
  .animated-heading {
    font-size: clamp(1.65rem, 6.5vw, 2.25rem);
    line-height: 1.2;
    max-width: 100%;
    padding-inline: 0.25rem;
  }
}
@media (max-width: 480px) {
  .animated-heading {
    font-size: clamp(1.45rem, 6.2vw, 1.85rem);
    letter-spacing: -0.01em;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .animated-heading { font-size: 1.75rem; }
}


/* ── Char Reveal (hero title) ─────────────────────────────── */
.char-reveal-container {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
}
@media (min-width: 768px) {
  .char-reveal-container {
    justify-content: flex-start;
  }
}
.char-reveal-word { display: inline-flex; margin-right: 0.3em; overflow: hidden; }
.char-reveal-char {
  display: inline-block;
  transform: translateY(110%) rotate(5deg);
  opacity: 0;
  transition:
    transform 1s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.8s ease-out;
  will-change: transform, opacity;
}
.char-reveal-container.active .char-reveal-char {
  transform: translateY(0) rotate(0deg);
  opacity: 1;
}

/* ── Initiatives Accordion (Desktop Expanding Panels) ────── */
@media (min-width: 768px) {
  .accordion-panel {
    flex: 2;
    transition: flex 0.6s cubic-bezier(0.25, 1, 0.5, 1), transform 0.4s ease, box-shadow 0.4s ease;
  }
  .accordion-panel:hover {
    flex: 5;
  }
}


/* ── Interactive Lift (cards) ─────────────────────────────── */
.interactive-lift {
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.4s ease;
}
.interactive-lift:hover {
  transform: translateY(-8px);
  box-shadow:
    0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.card { transition: 0.3s ease; }
.card:hover { transform: translateY(-8px); }


/* ── Button Hover ─────────────────────────────────────────── */
.btn-hover {
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-hover:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}


/* ── Marquee ──────────────────────────────────────────────── */
.marquee-wrapper {
  position: relative;
  overflow: hidden;
  user-select: none;
  background-color: #2e3b80;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
}
.marquee-container {
  display: flex;
  width: max-content;
  overflow: hidden;
}
.marquee-content {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  animation: marquee-scroll 38s linear infinite;
}
.marquee-wrapper:hover .marquee-content {
  animation-play-state: paused;
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}


/* ── Shimmer Loading ──────────────────────────────────────── */
.shimmer-loading {
  background: linear-gradient(90deg, #eeedf4 25%, #e2e2e9 50%, #eeedf4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ── Toast ────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #2e3b80;
  color: #fff;
  padding: 14px 28px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  pointer-events: none;
}
#toast.show {
  display:block;
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}


/* ── Scroll Indicator Bounce ──────────────────────────────── */
.scroll-indicator {
  animation: bounce-gentle 2.5s infinite cubic-bezier(0.45, 0.05, 0.55, 0.95);
}
@keyframes bounce-gentle {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}


/* ── Mobile: touch background-attachment fix ─────────────── */
@media (hover: none) {
  section[style*="background-attachment"] {
    background-attachment: scroll !important;
  }
}

/* ── Mobile responsiveness & touch safety ─────────────────── */
* {
  -webkit-tap-highlight-color: transparent;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

@media (max-width: 640px) {
  .grid { row-gap: 1rem; }
  /* Prevents iOS Safari from zooming in on input focus */
  input, select, textarea {
    font-size: 16px !important;
  }
}
@media (max-width: 480px) {
  body { -webkit-text-size-adjust: 100%; }
}

/* ── Floating Social Buttons ──────────────────────────────── */
.floating-socials {
  position: fixed;
  bottom: 100px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}
.floating-socials a {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.floating-socials a:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.floating-socials .fab-whatsapp { background: #25D366; }
.floating-socials .fab-whatsapp:hover { background: #1eb457; }
.floating-socials .fab-twitter { background: #000; }
.floating-socials .fab-twitter:hover { background: #222; }

@media (max-width: 640px) {
  .floating-socials {
    bottom: 80px;
    right: 12px;
    gap: 8px;
  }
  .floating-socials a {
    width: 38px;
    height: 38px;
  }
  #toTopBtn {
    bottom: 20px !important;
    right: 12px !important;
    padding: 10px !important;
  }
}

/* Visible keyboard focus across the site */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #2e3b80;
  outline-offset: 2px;
}

/* Respect reduced-motion preferences */
@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-on-scroll,
  .image-reveal,
  .slide-left,
  .slide-right,
  .text-reveal > * {
    opacity: 1 !important;
    transform: none !important;
  }
  .animated-heading .word,
  .char-reveal-char {
    transform: none !important;
    opacity: 1 !important;
  }
}