/* Custom animations and styles for Francarbi */

/* ================================
   CSS Variables for Colors
   ================================ */
:root {
    /* Primary color palette - RGB values (for Tailwind opacity support) */
    /* Base color: #839688 — 800/900 are slightly darker for white text readability */
    --color-primary-50-rgb: 244 247 245;
    --color-primary-100-rgb: 226 233 228;
    --color-primary-200-rgb: 197 209 201;
    --color-primary-300-rgb: 166 183 172;
    --color-primary-400-rgb: 147 168 155;
    --color-primary-500-rgb: 131 150 136;
    --color-primary-600-rgb: 115 132 120;
    --color-primary-700-rgb: 100 115 105;
    --color-primary-800-rgb: 82 94 86;
    --color-primary-900-rgb: 65 75 68;
    --color-primary-950-rgb: 48 55 50;

    /* Primary color palette - full colors (for non-Tailwind usage) */
    --color-primary-50: rgb(var(--color-primary-50-rgb));
    --color-primary-100: rgb(var(--color-primary-100-rgb));
    --color-primary-200: rgb(var(--color-primary-200-rgb));
    --color-primary-300: rgb(var(--color-primary-300-rgb));
    --color-primary-400: rgb(var(--color-primary-400-rgb));
    --color-primary-500: rgb(var(--color-primary-500-rgb));
    --color-primary-600: rgb(var(--color-primary-600-rgb));
    --color-primary-700: rgb(var(--color-primary-700-rgb));
    --color-primary-800: rgb(var(--color-primary-800-rgb));
    --color-primary-900: rgb(var(--color-primary-900-rgb));
    --color-primary-950: rgb(var(--color-primary-950-rgb));
}

/* Brand color backgrounds */
.bg-brand {
    background-color: #839688 !important;
}

.bg-brand-hover:hover {
    background-color: #748777 !important;
}

/* Typography */
body {
    font-family: 'Open Sans', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Logo and navigation text */
nav {
    font-family: 'Open Sans', sans-serif;
}

.nav-button {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Buttons and CTAs */
button {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
}

/* Paragraphs and body text */
p {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.7;
}

/* Stats and numbers - use Cormorant Garamond for elegance */
[data-count] {
    font-family: 'Cormorant Garamond', serif;
}

/* Publication cards enhancements */
.group:hover .group-hover\:text-primary {
    color: var(--color-primary-800);
}

/* Badge animations */
.inline-flex {
    transition: all 0.3s ease;
}

/* Year display in publications */
.text-6xl {
    transition: all 0.3s ease;
}

.group:hover .text-6xl {
    transform: scale(1.05);
}

/* Smooth scrolling + prevent scrollbar layout shift */
html {
    scroll-behavior: smooth;
    overflow-y: scroll;
}

/* Page transitions — scoped to SPA container (not used in WP) */

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hero section styles */
.hero-section {
    background: #839688;
    position: relative;
    min-height: 500px;
}


/* Modern Hero Section */
.hero-section-modern {
    position: relative;
}


.hero-image-container {
    clip-path: polygon(15% 0%, 100% 0%, 100% 100%, 0% 100%);
    overflow: hidden;
}

.hero-image-container img {
    object-position: center;
    filter: brightness(0.85) contrast(1.1);
    transition: transform 0.6s ease, filter 0.6s ease;
}

.hero-image-container:hover img {
    transform: scale(1.05);
    filter: brightness(0.9) contrast(1.15);
}

/* Decorative gradient overlay on image */
.hero-image-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #839688 0%, transparent 50%, #839688 100%);
    opacity: 0.3;
    z-index: 1;
    pointer-events: none;
}


/* Pattern overlay for hero */
.pattern-svg-hero {
    pointer-events: none;
}

/* Hero content animations */
.hero-section-modern h1 {
    animation: slideInLeft 0.8s ease-out;
}

.hero-section-modern p {
    animation: slideInLeft 0.8s ease-out 0.2s both;
}

.hero-section-modern button {
    animation: slideInLeft 0.8s ease-out 0.4s both;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Decorative line animation */
.hero-section-modern .h-1 {
    animation: expandWidth 1s ease-out 0.5s both;
}

@keyframes expandWidth {
    from {
        width: 0;
    }
    to {
        width: 4rem;
    }
}

/* Responsive adjustments */
@media (max-width: 1023px) {
    .hero-section-modern {
        background: #839688;
    }
}

/* Stats mini hover effect */
.hero-section-modern .grid > div {
    transition: transform 0.3s ease;
}

.hero-section-modern .grid > div:hover {
    transform: translateY(-4px);
}

.pattern-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.3;
}

.scroll-indicator {
    animation: bounce 2s ease-in-out infinite;
}

/* Navigation items */
.nav-button {
    position: relative;
    background-color: transparent !important;
}

.nav-button:hover {
    color: var(--color-primary-800);
}

/* Navigation active state */
.nav-active {
    color: var(--color-primary-800) !important;
    font-weight: 600;
}

.nav-active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: calc(100% - 24px);
    height: 2px;
    background-color: var(--color-primary-800);
    border-radius: 2px;
    transform: translateX(-50%);
    animation: underlineGrow 0.3s ease forwards;
}

@keyframes underlineGrow {
    from {
        width: 0;
    }
    to {
        width: calc(100% - 24px);
    }
}

/* Stat cards animation */
.stat-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* Mission cards hover gradient effect */
.mission-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.mission-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-primary-50);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.mission-card:hover::before {
    opacity: 0.5;
}

.mission-card > * {
    position: relative;
    z-index: 1;
}

/* Scroll animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Counter animation */
@keyframes countUp {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.counting {
    animation: countUp 0.3s ease-out;
}

/* ================================
   Mobile Menu - Hamburger Icon
   ================================ */
.hamburger-icon {
    position: relative;
    width: 24px;
    height: 24px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #374151;
    border-radius: 2px;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.hamburger-line:nth-child(1) {
    top: 4px;
}

.hamburger-line:nth-child(2) {
    top: 11px;
}

.hamburger-line:nth-child(3) {
    top: 18px;
}

/* Hamburger → X animation */
.hamburger-icon.open .hamburger-line:nth-child(1) {
    transform: rotate(45deg);
    top: 11px;
}

.hamburger-icon.open .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(10px);
}

.hamburger-icon.open .hamburger-line:nth-child(3) {
    transform: rotate(-45deg);
    top: 11px;
}

/* ================================
   Mobile Menu - Slide Panel
   ================================ */
#mobile-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

#mobile-menu-panel.open {
    transform: translateX(0);
}

/* Mobile navigation items */
.mobile-nav-item {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s ease;
    text-align: left;
}

.mobile-nav-item:hover {
    background-color: var(--color-primary-50);
    color: var(--color-primary-800);
}

.mobile-nav-item:hover svg {
    color: var(--color-primary-800);
    transform: translateX(4px);
}

.mobile-nav-item svg {
    transition: all 0.2s ease;
}

/* Active state for mobile nav */
.mobile-nav-item.nav-active {
    color: var(--color-primary-800);
    background-color: var(--color-primary-50);
}

.mobile-nav-item.nav-active::after {
    display: none;
}

/* Staggered animation for menu items */
.mobile-nav-item {
    opacity: 0;
    transform: translateX(20px);
}

#mobile-menu-panel.open .mobile-nav-item {
    animation: slideInMenuItem 0.4s ease-out forwards;
}

#mobile-menu-panel.open .mobile-nav-item:nth-child(1) { animation-delay: 0.1s; }
#mobile-menu-panel.open .mobile-nav-item:nth-child(2) { animation-delay: 0.18s; }
#mobile-menu-panel.open .mobile-nav-item:nth-child(3) { animation-delay: 0.26s; }
#mobile-menu-panel.open .mobile-nav-item:nth-child(4) { animation-delay: 0.34s; }
#mobile-menu-panel.open .mobile-nav-item:nth-child(5) { animation-delay: 0.42s; }

@keyframes slideInMenuItem {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Body scroll lock when menu is open */
body.menu-open {
    overflow: hidden;
}

/* Custom shadow and hover effects */
.hover-lift {
    transition: all 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(135deg, var(--color-primary-800) 0%, var(--color-primary-700) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card shine effect on hover */
.card-shine {
    position: relative;
    overflow: hidden;
}

.card-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.6s ease;
}

.card-shine:hover::after {
    transform: rotate(45deg) translateX(100%);
}

/* Responsive utilities */
@media (max-width: 768px) {
    .hero-section {
        min-height: 400px;
    }

    .pattern-svg {
        opacity: 0.2;
    }
}

/* Membership card selection */
.membership-card {
    transition: all 0.3s ease;
}

.membership-card:hover {
    cursor: pointer;
}

/* Form section slide-in animation */
#formSection {
    animation: fadeSlideUp 0.4s ease-out;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Smooth transitions for all interactive elements */
button, a, .nav-button {
    transition: all 0.3s ease;
}

/* Remove focus outline on click for all interactive elements */
button:focus, a:focus {
    outline: none;
}

/* Focus states for accessibility (keyboard only, not mouse clicks) */
button:focus-visible, a:focus-visible {
    outline: 2px solid var(--color-primary-800);
    outline-offset: 2px;
}

/* Smooth transition for filter dropdowns focus ring */
#filter-type-select,
#filter-country-select {
    box-shadow: 0 0 0 0 transparent;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#filter-type-select:focus-visible,
#filter-country-select:focus-visible {
    box-shadow: 0 0 0 3px rgba(63, 125, 90, 0.3);
    border-color: var(--color-primary-500);
}

/* Print styles */
@media print {
    .hero-section {
        background: #839688;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    nav {
        display: none;
    }

    .page {
        display: block !important;
        page-break-after: always;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero-section {
        background: #839688;
    }

    .text-gray-600, .text-gray-700 {
        color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary-800);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-900);
}

/* Selection color */
::selection {
    background-color: var(--color-primary-800);
    color: white;
}

::-moz-selection {
    background-color: var(--color-primary-800);
    color: white;
}
