/* ============================================================
   CareNation — Responsive & Animation System
   Covers: Mobile / Tablet / Desktop / Ultra-wide
   ============================================================ */

/* ══════════════════════════════════════════════════════════════
   1. ANIMATION KEYFRAMES
   ══════════════════════════════════════════════════════════════ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14, 164, 114, 0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(14, 164, 114, 0); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes countUp {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes progressFill {
  from { width: 0; }
}
@keyframes mobileCtaPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}

/* ══════════════════════════════════════════════════════════════
   2. SCROLL REVEAL — AOS-lite System
   ══════════════════════════════════════════════════════════════ */

[data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-reveal="left"]  { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="scale"] { transform: scale(0.88); }
[data-reveal="fade"]  { transform: none; }

[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

[data-reveal][data-delay="100"] { transition-delay: 0.1s; }
[data-reveal][data-delay="200"] { transition-delay: 0.2s; }
[data-reveal][data-delay="300"] { transition-delay: 0.3s; }
[data-reveal][data-delay="400"] { transition-delay: 0.4s; }
[data-reveal][data-delay="500"] { transition-delay: 0.5s; }

/* AOS compatibility */
[data-aos] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
[data-aos="fade-up"]    { transform: translateY(28px); }
[data-aos="fade-right"] { transform: translateX(-28px); }
[data-aos="fade-left"]  { transform: translateX(28px); }
[data-aos="fade"]       { transform: none; }
[data-aos="scale"]      { transform: scale(0.9); }

[data-aos].aos-animate {
  opacity: 1;
  transform: none !important;
}

/* ══════════════════════════════════════════════════════════════
   3. HERO SECTION — Animations
   ══════════════════════════════════════════════════════════════ */

.animate-fadeInUp {
  animation: fadeInUp 0.9s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.animate-fadeInUp .hero-badge    { animation-delay: 0.1s; }
.animate-fadeInUp .hcs-heading   { animation-delay: 0.25s; }
.animate-fadeInUp .hcs-lead      { animation-delay: 0.4s; }
.animate-fadeInUp .hero-actions  { animation-delay: 0.55s; }
.animate-fadeInUp .hero-stats    { animation-delay: 0.7s; }

.hcs-float-card {
  animation: floatY 4s ease-in-out infinite;
}
.hcs-float-tr { animation-delay: 1.5s; }

/* Hero CTA button pulse on mobile */
.btn-orange { animation: pulse-glow 2.5s ease-in-out infinite; }

/* Slide badge entrance */
.hcs-slide-badge {
  animation: slideInDown 0.6s ease both;
  animation-delay: 0.8s;
}

/* ══════════════════════════════════════════════════════════════
   4. CARD HOVER EFFECTS
   ══════════════════════════════════════════════════════════════ */

.card-cn {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease;
  will-change: transform;
}
.card-cn:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.13) !important;
}
.card-cn-img {
  transition: transform 0.5s ease;
  overflow: hidden;
}
.card-cn:hover .card-cn-img {
  transform: scale(1.05);
}

/* Movement cards */
.movement-card {
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              box-shadow 0.3s ease;
}
.movement-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.12);
}
.movement-card .icon-circle {
  transition: transform 0.4s ease;
}
.movement-card:hover .icon-circle {
  transform: rotate(10deg) scale(1.1);
}

/* Team cards */
.team-card {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.team-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

/* Rights/RC cards */
.rcv-card {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
}
.rcv-card:hover {
  transform: translateY(-6px) scale(1.03);
}

/* Impact banner items */
.impact-banner-item {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.impact-banner-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

/* Progress bar animation on scroll */
.progress-bar-fill {
  animation: progressFill 1.5s ease both;
  animation-play-state: paused;
}
.progress-bar-fill.animate {
  animation-play-state: running;
}

/* Announcement cards */
.announcement-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.announcement-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.1);
}

/* ══════════════════════════════════════════════════════════════
   5. HEADER SCROLL ANIMATION
   ══════════════════════════════════════════════════════════════ */

.custom-header {
  transition: box-shadow 0.3s ease;
}
.custom-header.scrolled .header-bottom {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

/* ══════════════════════════════════════════════════════════════
   6. MOBILE FLOATING CTA BAR
   ══════════════════════════════════════════════════════════════ */

.mobile-cta-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 10px 8px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
  gap: 6px;
}
.mobile-cta-bar a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.mobile-cta-donate {
  background: var(--orange);
  color: #fff !important;
  animation: mobileCtaPulse 2.5s ease-in-out infinite;
}
.mobile-cta-member {
  background: var(--green);
  color: #fff !important;
}
.mobile-cta-volunteer {
  background: var(--blue-light);
  color: var(--blue) !important;
}

/* ══════════════════════════════════════════════════════════════
   7. BUTTON GLOBAL HOVER ANIMATIONS
   ══════════════════════════════════════════════════════════════ */

.btn {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              background 0.3s ease !important;
}
.btn:hover {
  transform: translateY(-3px) !important;
}
.btn:active {
  transform: translateY(0) scale(0.97) !important;
}

.welcome-btn {
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.welcome-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(14, 164, 114, 0.3);
}

/* ══════════════════════════════════════════════════════════════
   8. SECTION ENTRY ANIMATIONS (applied via JS)
   ══════════════════════════════════════════════════════════════ */

.section-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.section-animate.visible {
  opacity: 1;
  transform: none;
}

/* Stagger children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.stagger-children.visible > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: none; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.15s; opacity: 1; transform: none; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.25s; opacity: 1; transform: none; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.35s; opacity: 1; transform: none; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.45s; opacity: 1; transform: none; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.55s; opacity: 1; transform: none; }

/* ══════════════════════════════════════════════════════════════
   9. FOOTER SOCIAL ICONS ANIMATION
   ══════════════════════════════════════════════════════════════ */

.footer-social a {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.3s ease;
}
.footer-social a:hover {
  transform: translateY(-4px) scale(1.15);
}

/* ══════════════════════════════════════════════════════════════
   10. DESKTOP — Large screen enhancements (≥1200px)
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 1200px) {
  .container { max-width: 1200px; }

  /* Parallax-ready hero */
  .hero-carousel-section { perspective: 1000px; }

  /* Multi-column welcome section */
  .welcome-grid { gap: 6rem; }

  /* Spacious sections */
  .section { padding: 100px 0; }
  .movement-section { padding: 100px 0; }
  .welcome-section  { padding: 100px 0; }
  .impact-section   { padding: 80px 0; }
  .stories-section  { padding: 100px 0; }

  /* Row cards — lift on hover with deeper shadow */
  .card-cn:hover { box-shadow: 0 28px 60px rgba(0,0,0,0.14) !important; }

  /* Team: 4-column */
  .col-sm-6.col-lg-3 { flex: 0 0 25%; max-width: 25%; }
}

/* Ultra-wide (≥1600px) */
@media (min-width: 1600px) {
  .container { max-width: 1400px; }
  h2 { font-size: 2.8rem; }
  .hcs-heading { font-size: 3.6rem; }
  .section { padding: 120px 0; }
}

/* ══════════════════════════════════════════════════════════════
   11. TABLET — (769px – 1199px)
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 1199px) {
  /* Section spacing */
  .section          { padding: 70px 0; }
  .welcome-section  { padding: 70px 0; }
  .movement-section { padding: 70px 0; }
  .impact-section   { padding: 60px 0; }
  .stories-section  { padding: 70px 0; }

  /* Push content below fixed header (header-top + visible teal nav bar) */
  body { padding-top: 240px; }

  /* Update navbar-h: header-top (~170px) + header-bottom with nav (~70px) */
  :root { --navbar-h: 240px; }

  /* Welcome: stack on tablet portrait */
  .welcome-grid {
    flex-direction: column;
    gap: 3rem;
    align-items: center;
  }
  .welcome-img-col { width: 100%; max-width: 500px; margin: 0 auto; }
  .welcome-text-col { padding-right: 0; text-align: center; }
  .welcome-tagline::after { left: 50%; transform: translateX(-50%); }
  .welcome-btn { margin-top: 1rem; }

  /* Movement grid: 2×2 */
  .movement-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.2rem;
  }

  /* Branch stats */
  .branch-stats-grid { grid-template-columns: 1fr 1fr; }

  /* Impact banner: 2×2 */
  .impact-banner-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }

  /* Rights grid */
  .rights-grid-v2 {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem;
  }

  /* Stories slider */
  .story-card { min-width: calc(50% - 1rem); }

  /* Hero content */
  .hcs-heading  { font-size: clamp(1.8rem, 3.5vw, 2.5rem); }
  .hcs-lead     { font-size: 0.95rem; max-width: 460px; }
  .hero-actions { flex-direction: row; flex-wrap: wrap; gap: 0.75rem; }
  .hero-stats   { gap: 1.2rem; }
  .hero-stat strong { font-size: 1.4rem; }

  /* Branches */
  .branches-section .row { gap: 2rem; }

  /* Typography */
  h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
  .section-desc { font-size: 0.9rem; }
}

/* ══════════════════════════════════════════════════════════════
   12. MOBILE — (≤768px)
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Fix horizontal overflow white stripe on mobile */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
    width: 100%;
  }

  /* Push body below fixed teal bar */
  body { padding-top: 60px; padding-bottom: 0; }

  /* Global Fix: Remove duplicate margin-top for all hero sections on mobile */
  [class$="-hero-section"], [class*="-hero-section "] {
    margin-top: 0 !important;
  }

  /* Circular Mobile Logo */
  .header-logo-box {
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: 2px solid #0f766e !important; /* Premium dark teal theme border */
    background: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    margin-left: 10px !important;
    overflow: hidden !important;
  }
  .header-logo-box .cn-logo {
    gap: 0 !important;
    margin: 0 !important;
  }
  .header-logo-box .cn-logo img {
    height: 32px !important;
    width: 32px !important;
    object-fit: contain !important;
    display: block !important;
  }
  .cn-logo-text {
    display: none !important;
  }

  /* Show floating CTA bar */
  .mobile-cta-bar { display: flex; }

  /* Rights Cards Static Grid Mobile Fix */
  .rights-grid-v2 {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    justify-content: center !important;
    gap: 15px !important;
  }
  .rcv-connector {
    flex: 0 0 calc(50% - 10px) !important;
    margin: 0 !important;
  }
  .rcv-card {
    width: 100% !important;
    margin: 0 !important;
  }
  .rcv-dot {
    display: none !important;
  }

  /* Sections */
  .section          { padding: 50px 0; }
  .welcome-section  { padding: 50px 0; }
  .movement-section { padding: 50px 0; }
  .impact-section   { padding: 40px 0; }
  .stories-section  { padding: 50px 0; }
  .branches-section { padding: 50px 0; }

  /* Hero */
  .hcs-heading  { font-size: clamp(1.6rem, 6vw, 2rem); }
  .hcs-lead     { font-size: 0.9rem; margin-bottom: 1.2rem; }
  .hero-actions { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .hero-actions .btn { width: 100%; justify-content: center; max-width: 300px; }
  .hero-stats   { gap: 1rem; flex-wrap: wrap; }
  .hero-stat    { min-width: 80px; }
  .hero-stat strong { font-size: 1.3rem; }

  /* Float cards hide on very small screens */
  .hcs-float-bl,
  .hcs-float-tr { display: none; }

  /* Welcome */
  .welcome-section::before { width: 100%; height: 40%; }
  .welcome-grid {
    flex-direction: column;
    gap: 2.5rem;
    align-items: center;
  }
  .welcome-img-col { width: 100%; max-width: 360px; margin: 0 auto; }
  .welcome-text-col { padding-right: 0; text-align: center; }
  .welcome-title { font-size: clamp(1.4rem, 5vw, 1.9rem); }
  .welcome-tagline::after { left: 50%; transform: translateX(-50%); }
  .welcome-badge-circle { width: 80px; height: 80px; }

  /* Rights grid: 2 columns on mobile */
  .rights-grid-v2 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }
  .rcv-connector { flex-direction: column !important; }
  .rcv-dot { display: none !important; }

  /* Movement: 2x2 grid for portrait cards */
  .movement-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }
  .movement-card { padding: 1.5rem 1rem; min-height: 230px; }
  .movement-card h4 { font-size: 0.95rem; margin-bottom: 1.5rem; }

  /* Impact banner: 2×2 */
  .impact-banner-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .impact-banner-num { font-size: 2rem; }

  /* What We Do cards — full width stack */
  .col-md-4 { flex: 0 0 100%; max-width: 100%; }

  /* Featured projects — full width */
  .col-md-6.col-lg-4,
  .col-lg-4,
  .col-md-6 { flex: 0 0 100%; max-width: 100%; }

  /* Stories slider: 1 card at a time */
  .story-card { flex: 0 0 100%; }
  .stories-nav { margin-top: 1.5rem; }

  /* Blog/news: stack */
  .col-md-6.col-lg-4 { flex: 0 0 100%; max-width: 100%; }

  /* Social cards: stack */
  .col-lg-6 { flex: 0 0 100%; max-width: 100%; }

  /* Team: 2 per row */
  .col-sm-6.col-lg-3 { flex: 0 0 50%; max-width: 50%; }

  /* Branch stats: 1×1 */
  .branch-stats-grid { grid-template-columns: 1fr !important; gap: 1rem; }

  /* Announcement cards: stack */
  .col-md-6.col-lg-4 { flex: 0 0 100%; max-width: 100%; }

  /* Notifications section */
  .announcement-section { padding: 40px 0; }

  /* Typography */
  h2 { font-size: clamp(1.3rem, 5vw, 1.8rem); }
  .section-desc { font-size: 0.85rem; }
  .section-label { font-size: 0.72rem; }

  /* Card images: proper aspect ratio */
  .card-cn-img { height: 180px !important; object-fit: cover; }

  /* Buttons: proper sizing */
  .btn-lg { padding: 0.75rem 1.5rem !important; font-size: 0.9rem !important; }
  .btn-sm { padding: 0.45rem 1rem !important; }

  /* Table overflow fix — tables scroll internally inside .table-wrap */
  .table-wrap { overflow-x: auto; }

  /* Decorative elements: hide on mobile to save space */
  .welcome-decor-heart,
  .welcome-decor-dots,
  .welcome-decor-yellow,
  .welcome-decor-circle { display: none; }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }
  .footer-social { justify-content: flex-start; }
  footer { text-align: left; }

  /* Add bottom padding to footer so content clears the fixed mobile CTA bar.
     This keeps the gap inside the blue footer background, not as bare white below it. */
  footer.cn-footer { padding-bottom: 90px; }
}

/* ══════════════════════════════════════════════════════════════
   13. SMALL MOBILE — (≤480px)
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  body { font-size: 15px; }

  /* Movement: single column */
  .movement-grid {
    grid-template-columns: 1fr !important;
  }

  /* Impact: single column */
  .impact-banner-grid {
    grid-template-columns: 1fr;
  }

  /* Team: 1 per row */
  .col-sm-6.col-lg-3 { flex: 0 0 100%; max-width: 100%; }

  /* Hero stats: wrap to 2×2 */
  .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

  /* Section headings */
  .section-title { font-size: 1.3rem; }

  /* Teal bar: compact */
  .header-bottom-inner { height: 56px !important; padding: 0 10px !important; }
  .cn-logo-text { display: none !important; }

  /* Float CTA: 2 items only */
  .mobile-cta-volunteer { display: none; }

  /* Announcement section header */
  .d-flex.align-items-end.justify-content-between { flex-direction: column; align-items: flex-start !important; gap: 1rem; }
}

/* ══════════════════════════════════════════════════════════════
   14. PRINT — minimal
   ══════════════════════════════════════════════════════════════ */

@media print {
  .header-top,
  .header-bottom,
  .mobile-cta-bar,
  .hcs-btn,
  .hcs-dots,
  footer { display: none !important; }
  body { padding: 0 !important; color: #000; }
}
