/* Custom styling and utilities for WRC (World Relief Committee) Website */
/* Only CSS that Tailwind cannot replicate is kept here. */
/* Animations (pulse-glow, progress) are now in Tailwind config. */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  font-family: 'Inter', sans-serif;
  --color-primary: #ca0000;
  --color-primary-hover: #a30000;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Outfit', sans-serif;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar (no Tailwind equivalent) */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f8fafc;
}
::-webkit-scrollbar-thumb {
  background: #ca0000;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a30000;
}

/* Reveal animation for timeline section (state-based, requires CSS) */
.reveal,
.fade-up {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s ease, transform .7s ease;
}

.reveal.is-visible,
.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

#spine-fill {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .15s linear;
}

.timeline-track {
  position: relative;
}

.node-dot {
  box-shadow: 0 0 0 6px #f8fafc;
}

/* --- Clean White Mega Menu & Dropdown Styling (complex selectors) --- */

.nav-item-dropdown {
  position: relative;
}

.nav-link-item {
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.nav-link-item:hover,
.nav-item-dropdown:hover > .nav-link-item,
.nav-item-dropdown:focus-within > .nav-link-item {
  background-color: transparent !important;
  color: var(--color-primary) !important;
}

.nav-item-dropdown:hover > .nav-link-item i,
.nav-item-dropdown:focus-within > .nav-link-item i {
  color: var(--color-primary) !important;
}

.dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  left: 0;
  right: auto;
  max-width: min(100vw, 360px);
  box-sizing: border-box;
}

.nav-item-dropdown:hover .dropdown-menu,
.nav-item-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-item-dropdown[data-align="right"] .dropdown-menu,
.nav-item-dropdown.right-align .dropdown-menu {
  left: auto;
  right: 0;
}

/* Mega Menu Alignment for Desktop Viewports */
@media (min-width: 1280px) {
  .mega-menu-full {
    width: min(1100px, calc(100vw - 3rem));
    max-width: 700px;
    left: 0;
    right: auto;
    transform: translateX(0) translateY(8px);
  }
  .nav-item-dropdown:hover .mega-menu-full {
    transform: translateX(0) translateY(0);
  }
}

.dropdown-menu a,
.mega-menu a {
  display: block;
  padding: 0.75rem 0.9rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  color: #334155;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dropdown-menu a i,
.mega-menu a i {
  color: #ca0000;
}

.dropdown-menu a:hover,
.mega-menu a:hover {
  background: rgba(254, 226, 226, 0.95);
  color: #0f172a;
  border-color: rgba(202, 0, 0, 0.24);
  transform: translateX(1px);
}

.dropdown-menu a:hover i,
.mega-menu a:hover i {
  color: #a30000;
}

.dropdown-menu a + a,
.mega-menu a + a {
  margin-top: 0.35rem;
}

/* Mobile submenu items match the desktop dropdown tone */
.mobile-submenu a {
  border-radius: 0.75rem;
}
.mobile-submenu a:hover {
  background: rgba(254, 226, 226, 0.95);
  color: #0f172a;
}

/* Mobile Accordion Smooth Collapse */
.mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-submenu.open {
  max-height: 800px;
}

/* Hamburger to X animation */
.hamburger-line {
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.25s ease;
  transform-origin: center;
}
.mobile-menu-btn.menu-open .hamburger-line:first-child {
  transform: translateY(8px) rotate(45deg);
}
.mobile-menu-btn.menu-open .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.mobile-menu-btn.menu-open .hamburger-line:last-child {
  transform: translateY(-8px) rotate(-45deg);
}

/* === MOBILE SIDE TRAY === */
/* Hidden by default on all screens */
.mobile-tray-overlay,
.mobile-tray {
  display: none;
}

@media (max-width: 1023px) {
  .mobile-tray-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    z-index: 70;
    pointer-events: none;
    transition: background 0.45s cubic-bezier(0.4, 0, 0.2, 1), backdrop-filter 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: background, backdrop-filter;
  }
  .mobile-tray-overlay.active {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    pointer-events: auto;
  }

  .mobile-tray {
    position: fixed;
    top: 0;
    right: 0;
    width: min(380px, 88vw);
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    z-index: 80;
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    will-change: transform;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  }
  .mobile-tray.active {
    transform: translateX(0);
  }

  .mobile-tray-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
  }

  .mobile-tray-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    background: none;
    cursor: pointer;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .mobile-tray-close:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: rotate(90deg);
  }

  .mobile-tray-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.75rem 1rem 2rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .mobile-tray-body::-webkit-scrollbar {
    display: none;
  }

  .mobile-tray-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .mobile-tray-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0.875rem;
    border-radius: 0.625rem;
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background 0.25s ease, color 0.25s ease, opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
  }
  .mobile-tray-link:hover,
  .mobile-tray-link:active {
    background: #f8fafc;
    color: #0f172a;
  }

  .mobile-tray-link.active-link,
  .mobile-tray-submenu a.active-link {
    color: #ca0000;
    background: rgba(202, 0, 0, 0.06);
  }

  .mobile-tray-accordion-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.8rem 0.875rem;
    border-radius: 0.625rem;
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.25s ease, color 0.25s ease, opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-tray-accordion-btn:hover {
    background: #f8fafc;
  }

  .mobile-tray-accordion-btn .acc-icon {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 0.6rem;
    color: #94a3b8;
  }
  .mobile-tray-accordion-btn.open .acc-icon {
    transform: rotate(180deg);
    color: #475569;
  }

  .mobile-tray-submenu {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: 0.5rem;
    overflow: hidden;
  }
  .mobile-tray-submenu > div {
    overflow: hidden;
  }
  .mobile-tray-submenu.open {
    grid-template-rows: 1fr;
  }

  .mobile-tray-submenu a {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
    text-decoration: none;
  }
  .mobile-tray-submenu a:hover {
    background: #f1f5f9;
    color: #0f172a;
    transform: translateX(3px);
  }

  .mobile-tray-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
  }

  .mobile-tray-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem 1.5rem;
    border-radius: 0.625rem;
    background: #ca0000;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  }
  .mobile-tray-cta:hover {
    background: #a30000;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(202, 0, 0, 0.3);
  }

  body.tray-open {
    overflow: hidden;
  }
}

/* Gallery Items */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  cursor: pointer;
}
.gallery-item::after {
  content: '\f00e';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(202, 0, 0, 0.7);
  color: white;
  font-size: 1.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gallery-item:hover::after {
  opacity: 1;
}

/* Lightbox transitions */
#gallery-lightbox {
  transition: opacity 0.3s ease;
}
#gallery-lightbox img {
  transition: transform 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .fade-up {
    transition: none !important;
    transform: none !important;
  }
  .mobile-tray,
  .mobile-tray-overlay {
    transition: none !important;
  }
  .mobile-tray-link,
  .mobile-tray-accordion-btn {
    transition: none !important;
  }
  .hamburger-line {
    transition: none !important;
  }
  .mobile-tray-submenu {
    transition: none !important;
  }
  .mobile-tray-close {
    transition: none !important;
  }
}

/* --- WRC "Our Work" Enhancement CSS --- */

/* Breadcrumb Component */
.breadcrumb-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 1.5rem;
}
.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.breadcrumb-item a {
  color: #ca0000;
  transition: color 0.2s ease;
  text-decoration: none;
}
.breadcrumb-item a:hover {
  color: #a30000;
}
.breadcrumb-separator {
  color: #cbd5e1;
}

/* Program Card Hover & Animations */
.program-card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.program-card-hover:hover {
  transform: translateY(-4px);
  border-color: rgba(202, 0, 0, 0.3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}

/* Image overlay for program hero sections */
.hero-image-overlay {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.85) 100%);
}

/* Process Timeline (Horizontal on desktop, Vertical on mobile) */
.process-timeline {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  width: 100%;
}
.process-step {
  flex: 1;
  position: relative;
  text-align: center;
}
.process-step::after {
  content: '';
  position: absolute;
  top: 1.75rem;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}
.process-step:last-child::after {
  display: none;
}
.process-icon-wrapper {
  position: relative;
  z-index: 10;
  background: white;
  margin: 0 auto 1rem;
}

@media (max-width: 1024px) {
  .process-timeline {
    flex-direction: column;
    gap: 1.5rem;
  }
  .process-step {
    text-align: left;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
  }
  .process-step::after {
    left: 1.75rem;
    top: 3.5rem;
    width: 2px;
    height: calc(100% + 1.5rem);
  }
  .process-step:last-child::after {
    display: none;
  }
  .process-icon-wrapper {
    margin: 0;
    flex-shrink: 0;
  }
}

/* Project snapshot grid */
.snapshot-grid-item {
  border-right: 1px solid #e2e8f0;
}
.snapshot-grid-item:last-child {
  border-right: none;
}
@media (max-width: 768px) {
  .snapshot-grid-item {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }
  .snapshot-grid-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }
}

/* === PREMIUM PROJECT DETAIL ANIMATIONS === */

/* Hero Parallax */
.hero-parallax {
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  will-change: transform;
}
@media (max-width: 768px) {
  .hero-parallax {
    background-attachment: scroll;
  }
}

/* Float Animation for Particles */
@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.3; }
  25% { transform: translateY(-20px) translateX(10px); opacity: 0.6; }
  50% { transform: translateY(-10px) translateX(-5px); opacity: 0.4; }
  75% { transform: translateY(-25px) translateX(15px); opacity: 0.5; }
}
.animate-float {
  animation: float 8s ease-in-out infinite;
}
.animate-float-delayed {
  animation: float 10s ease-in-out 2s infinite;
}

/* Fade In Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
  animation: fadeIn 0.8s ease-out 0.3s both;
}
.animate-slide-up {
  animation: slideUp 0.8s ease-out 0.5s both;
}
.animate-slide-up-delay {
  animation: slideUp 0.8s ease-out 0.7s both;
}
.animate-fade-in-delay {
  animation: fadeIn 0.8s ease-out 0.9s both;
}

/* Scroll Indicator Animation */
@keyframes scrollIndicator {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(8px); opacity: 1; }
}
.animate-scroll-indicator {
  animation: scrollIndicator 1.5s ease-in-out infinite;
}

/* Progress Bar Fill Animation */
.progress-bar-fill {
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Progress Ring Animation */
@keyframes progressRing {
  from { stroke-dashoffset: 339.292; }
}
.progress-ring-circle {
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reveal Section Animation */
.reveal-section {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal-section.revealed {
  opacity: 1;
  transform: translateY(0);
}
.reveal-section:nth-child(2) { transition-delay: 0.1s; }
.reveal-section:nth-child(3) { transition-delay: 0.2s; }
.reveal-section:nth-child(4) { transition-delay: 0.3s; }

/* Timeline Line Animation */
@keyframes timelineLine {
  from { height: 0; }
  to { height: 100%; }
}
.timeline-line {
  animation: timelineLine 1.5s ease-out forwards;
}

/* Timeline Item Animation */
.timeline-item {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.timeline-item.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Quick Facts Bar Shadow on Scroll */
.quick-facts-bar {
  transition: box-shadow 0.3s ease;
}
.quick-facts-bar.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Gallery Hover Effects */
.gallery-item {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

/* Button Hover Effects */
.btn-premium {
  position: relative;
  overflow: hidden;
}
.btn-premium::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}
.btn-premium:hover::before {
  left: 100%;
}

/* Card Hover Lift Effect */
.card-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card-hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Sticky Sidebar Enhancement */
@media (min-width: 1024px) {
  .lg\:sticky {
    position: sticky;
    top: 8rem;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
  }
  .lg\:sticky::-webkit-scrollbar {
    width: 4px;
  }
  .lg\:sticky::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
  }
}

/* Number Counter Animation */
.counter-number {
  font-variant-numeric: tabular-nums;
}

/* Mobile Responsive Adjustments */
@media (max-width: 1023px) {
  .quick-facts-bar {
    position: relative;
    top: auto;
    z-index: auto;
  }
}

/* Print Styles */
@media print {
  .hero-parallax {
    background-attachment: scroll !important;
  }
  .quick-facts-bar {
    position: relative;
    top: auto;
  }
  .reveal-section {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Line Clamp Utility */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Dashboard Donut Chart */
.donut-segment {
  transition: all 0.5s ease;
}
.donut-segment:hover {
  filter: brightness(1.2);
}

/* Dashboard Stat Cards */
.dashboard-stat-card {
  position: relative;
  overflow: hidden;
}
.dashboard-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-color, #ca0000), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.dashboard-stat-card:hover::before {
  opacity: 1;
}

/* Sector Bar Animation */
.sector-bar-fill {
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dashboard Counter */
.dashboard-counter {
  font-variant-numeric: tabular-nums;
}

