/**
 * @fileoverview Global Styles for Vidya Chaitanya Samakhya
 * @description Main stylesheet containing global styles, typography, navigation,
 *              animations, and performance optimizations used across all pages.
 * @author Vidya Chaitanya Samakhya
 * @version 1.0.0
 */

/* ============================================
   RESET & BASE STYLES
   ============================================ */

/* Prevent horizontal overflow and optimize scrolling */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* ============================================
   ACCESSIBILITY - SCREEN READER ONLY
   ============================================ */

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

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================
   ACCESSIBILITY - FOCUS INDICATORS
   ============================================ */

/* Enhanced focus indicators for keyboard navigation */
.keyboard-navigation *:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Focus indicators for interactive elements */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Remove outline for mouse users (when not using keyboard) */
body:not(.keyboard-navigation) *:focus {
    outline: none;
}

/* Ensure focus is visible for keyboard users */
.keyboard-navigation a:focus,
.keyboard-navigation button:focus,
.keyboard-navigation input:focus,
.keyboard-navigation textarea:focus,
.keyboard-navigation select:focus,
.keyboard-navigation [tabindex]:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Focus within for containers */
.keyboard-navigation .nav-link:focus,
.keyboard-navigation .mobile-menu-link:focus {
    background-color: rgba(59, 130, 246, 0.1);
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* Focus for buttons */
.keyboard-navigation button:focus,
.keyboard-navigation .back-to-top:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Performance Optimization: GPU acceleration for transform and opacity */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Optimize common hover transforms */
.transform {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize transition-all to use only GPU-accelerated properties where possible */
.transition-all {
    will-change: transform, opacity;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

/* Base font family - Inter for body text */
* {
    font-family: 'Inter', sans-serif;
}

/* Performance: Optimize AOS animations and common card effects */
[data-aos] {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Unified Animation Flow - Ensures smooth sequential animations */
/* Standard delay increments: 0, 50, 100, 150, 200, 250, 300ms for sequential elements */
/* Cards in rows animate with 50ms spacing for smooth flow */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    letter-spacing: 0.025em;
}

/* ============================================
   SCROLL PROGRESS BAR
   ============================================ */

/* Scroll Progress Bar - Optimized for GPU acceleration */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(to right, #1E40AF, #F59E0B);
    z-index: 9999;
    transform-origin: left;
    transform: scaleX(0) translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    transition: transform 0.1s ease-out;
}

/* ============================================
   LOGO STYLES
   ============================================ */

/* Logo Styles - Performance Optimized */
.logo-navbar {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.logo-footer {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    backface-visibility: hidden;
}

/* ============================================
   NAVIGATION TEXT STYLES
   ============================================ */

/* Navigation Text Styles */
.nav-brand-text {
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
    color: #1e3a8a; /* Improved contrast: blue-800 */
}

.nav-link {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    color: #111827; /* Improved contrast: gray-900 */
}

.nav-link:hover {
    color: #1e3a8a; /* Improved contrast: blue-800 */
}

.navbar-scrolled .nav-brand-text {
    text-shadow: none;
}

.navbar-scrolled .nav-link {
    text-shadow: none;
}

/* ============================================
   NAVBAR RESPONSIVE STYLES
   ============================================ */

/* Navbar Mobile Containment */
#navbar {
    box-sizing: border-box;
}

@media (max-width: 768px) {
    #navbar {
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
        transform: none;
        margin-left: 0;
    }
}

/* ============================================
   MOBILE MENU STYLES
   ============================================ */

/* Mobile Menu Overlay - Backdrop for mobile menu */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    will-change: opacity;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backface-visibility: hidden;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(20px);
    z-index: 50;
    transform: translateX(100%) translateZ(0);
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    backface-visibility: hidden;
}

.mobile-menu.active {
    transform: translateX(0) translateZ(0);
}

.mobile-menu-close {
    will-change: transform;
    transition: transform 0.2s ease;
    backface-visibility: hidden;
}

.mobile-menu-close:hover {
    transform: rotate(90deg) translateZ(0);
}

.mobile-menu-link {
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
    will-change: background-color, color;
}

.mobile-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 60%;
    background: linear-gradient(to bottom, #1E40AF, #F59E0B);
    border-radius: 0 2px 2px 0;
    transform: translateY(-50%) scaleY(0) translateZ(0);
    transform-origin: top;
    will-change: transform;
    transition: transform 0.2s ease;
    backface-visibility: hidden;
}

.mobile-menu-link:hover::before,
.mobile-menu-link.active::before {
    transform: translateY(-50%) scaleY(1) translateZ(0);
}

.menu-close-icon {
    will-change: transform;
    transition: transform 0.3s ease;
    backface-visibility: hidden;
}

/* ============================================
   INITIATIVE CARD STYLES
   ============================================ */

/* Initiative Card Styles (for Initiatives page) - GPU Optimized */
.initiative-card {
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backface-visibility: hidden;
    transform: translateZ(0);
}

.initiative-card:hover {
    transform: translateY(-8px) translateZ(0);
}

.initiative-card:hover .card-title {
    text-decoration: underline;
    text-decoration-color: #F59E0B;
    text-underline-offset: 8px;
}

/* ============================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ============================================ */

/* Unified Animation Standards - CSS Variables for consistent timing */
:root {
    --animation-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.2s;
    --transition-medium: 0.3s;
    --transition-slow: 0.5s;
}

/* ============================================
   ANIMATION STANDARDS
   ============================================ */

/* Standardize card hover effects across all pages - uniform translate */
[class*="hover:-translate-y-2"],
[class*="hover:-translate-y-3"] {
    transition: transform var(--transition-medium) var(--animation-ease), 
                box-shadow var(--transition-medium) var(--animation-ease);
    will-change: transform;
    backface-visibility: hidden;
}

/* Smaller elements use less translation */
[class*="hover:-translate-y-1"] {
    transition: transform var(--transition-fast) var(--animation-ease), 
                box-shadow var(--transition-fast) var(--animation-ease);
    will-change: transform;
    backface-visibility: hidden;
}

/* Standardize icon/logo scale animations */
[class*="hover:scale-"],
.group-hover\:scale-110 {
    transition: transform var(--transition-fast) var(--animation-ease);
    will-change: transform;
    backface-visibility: hidden;
}

/* Standardize button animations */
[class*="transform hover:scale-105"] {
    transition: transform var(--transition-fast) var(--animation-ease), 
                background-color var(--transition-fast) ease;
    will-change: transform;
    backface-visibility: hidden;
}

/* Uniform transition-all timing */
.transition-all {
    transition: transform var(--transition-medium) var(--animation-ease),
                opacity var(--transition-medium) var(--animation-ease),
                box-shadow var(--transition-medium) var(--animation-ease),
                background-color var(--transition-medium) ease,
                color var(--transition-medium) ease;
}

.transition-transform {
    transition: transform var(--transition-fast) var(--animation-ease);
}

.transition-colors {
    transition: color var(--transition-fast) ease,
                background-color var(--transition-fast) ease;
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Featured Initiative Animation - Optimized for Performance */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
        filter: brightness(1.02);
    }
}

.featured-initiative {
    will-change: box-shadow, filter;
    animation: pulse-glow 3s ease-in-out infinite;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Use contain to isolate the animation */
    contain: layout style paint;
}

/* ============================================
   ERROR NOTIFICATION STYLES
   ============================================ */

.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    min-width: 300px;
    background: #fff;
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backface-visibility: hidden;
}

.error-notification--visible {
    opacity: 1;
    transform: translateX(0);
}

.error-notification--dismissing {
    opacity: 0;
    transform: translateX(100%);
}

.error-notification__content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}

.error-notification__icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.error-notification__text {
    flex: 1;
    min-width: 0;
}

.error-notification__text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #111827; /* Improved contrast: gray-900 */
    margin-bottom: 4px;
}

.error-notification__text p {
    font-size: 13px;
    color: #374151; /* Improved contrast: gray-700 */
    margin: 0;
    line-height: 1.5;
}

.error-notification__close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.error-notification__close:hover {
    color: #6b7280;
    background-color: #f3f4f6;
}

.error-notification__close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .error-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
    }

    .error-notification--visible {
        transform: translateY(0);
    }

    .error-notification {
        transform: translateY(-100%);
    }

    .error-notification--dismissing {
        transform: translateY(-100%);
    }
}

