/* Add at the very top of the file */
/* Improved scrolling and animations */
html {
    scroll-behavior: smooth;
}

* {
    box-sizing: border-box;
}

/* Enhanced focus states for accessibility */
*:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

:root {
    color-scheme: light dark;
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --text-color: #1f2937;
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --hover-color: #3b82f6;
    --nav-text: #1f2937;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --border-color: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    transition: all 0.3s ease;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: #fff;
    padding: 8px 16px;
    z-index: 2000;
    border-radius: 0 0 6px 0;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* Focus Styles */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduce motion respect */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* Typography */
h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: linear-gradient(120deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

/* Navbar */
.navbar {
    padding: 1.5rem 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: var(--nav-bg) !important;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color) !important;
    letter-spacing: -0.02em;
}

.navbar-dark .navbar-nav .nav-link {
    color: var(--nav-text) !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
    transform: translateY(-1px);
}

.navbar-dark .navbar-toggler {
    border-color: var(--text-color);
}

.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(37, 99, 235, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

body.dark-mode .navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(96, 165, 250, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Cards */
.card {
    border: none;
    border-radius: 16px;
    background: var(--card-bg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.card-body {
    padding: 2.5rem;
}

.card-title {
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.75rem;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--hover-color);
    transform: translateY(-2px);
    color: #ffffff;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: #ffffff;
    transform: translateY(-2px);
}

/* Dark Mode */
body.dark-mode {
    --bg-color: #111827;
    --text-color: #f3f4f6;
    --card-bg: #1f2937;
    --primary-color: #60a5fa;
    --secondary-color: #3b82f6;
    --hover-color: #2563eb;
    --nav-text: #f3f4f6;
    --nav-bg: rgba(17, 24, 39, 0.95);
    --border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .navbar {
    background-color: var(--nav-bg) !important;
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .navbar-dark .navbar-nav .nav-link {
    color: var(--nav-text) !important;
}

body.dark-mode .navbar-brand {
    color: var(--primary-color) !important;
}

body.dark-mode .card {
    background: var(--card-bg);
    color: var(--text-color);
}

body.dark-mode .form-control {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .form-control:focus {
    background-color: var(--card-bg);
    border-color: var(--primary-color);
    color: var(--text-color);
}

body.dark-mode .form-label {
    color: var(--text-color);
}

body.dark-mode .btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

body.dark-mode .btn-outline-primary:hover {
    background: var(--primary-color);
    color: var(--bg-color);
}

body.dark-mode h1 {
    background: linear-gradient(120deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .badge {
    /* Higher contrast, lighter background */
    background-color: rgba(255,255,255,0.18) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255,255,255,0.35);
    font-weight: 500;
    backdrop-filter: blur(2px);
}

body.dark-mode .badge.bg-primary-subtle { background-color: rgba(255,255,255,0.22) !important; border-color: rgba(255,255,255,0.45); }
body.dark-mode .badge.bg-secondary-subtle { background-color: rgba(255,255,255,0.22) !important; border-color: rgba(255,255,255,0.45); }

/* Resume skills section refinements */
#skills .h6.text-uppercase { color: #1f2937; letter-spacing: .5px; }
body.dark-mode #skills .h6.text-uppercase { color: #ffffff; }

/* Enhanced badge animations */
.badge-skill {
    background: rgba(37,99,235,0.08) !important; 
    color: #1e40af !important; 
    border: 1px solid rgba(37,99,235,0.35) !important;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: default;
}

.badge-skill:hover {
    background: rgba(37,99,235,0.12) !important;
    border-color: rgba(37,99,235,0.5) !important;
    transform: translateY(-1px);
}

body.dark-mode .badge-skill { 
    background: rgba(96,165,250,0.15) !important; 
    color: #60a5fa !important; 
    border: 1px solid rgba(96,165,250,0.55) !important;
}

body.dark-mode .badge-skill:hover {
    background: rgba(96,165,250,0.2) !important;
    border-color: rgba(96,165,250,0.7) !important;
}

/* Keep resume page legacy selector for safety */
#skills .badge { 
    background: rgba(37,99,235,0.08) !important; 
    color: #1e40af !important; 
    border: 1px solid rgba(37,99,235,0.35);
}
body.dark-mode #skills .badge { 
    background: rgba(96,165,250,0.15) !important; 
    color: #60a5fa !important; 
    border: 1px solid rgba(96,165,250,0.55);
}

/* Stronger contrast for skill group headings */
#skills .skill-group-heading { color: #1f2937; letter-spacing: .5px; }
body.dark-mode #skills .skill-group-heading { color: #ffffff; text-shadow: 0 0 4px rgba(0,0,0,0.4); }

body.dark-mode a {
    color: var(--primary-color);
}

body.dark-mode a:hover {
    color: var(--hover-color);
}

body.dark-mode .bi {
    color: var(--text-color);
}

body.dark-mode .btn-primary {
    background: var(--primary-color);
    color: var(--bg-color);
}

body.dark-mode .btn-primary:hover {
    background: var(--hover-color);
    color: var(--bg-color);
}

/* Footer */
footer {
    background-color: transparent;
    color: var(--text-color);
    padding: 3rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

/* Form Styles */
.form-control {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Dark Mode Toggle */
.theme-toggle {
    background: linear-gradient(to right, #f59e0b, #0ea5e9);
    border: none;
    padding: 0;
    cursor: pointer;
    width: 64px;
    height: 32px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.theme-toggle:focus {
    outline: none;
}

.theme-toggle .toggle-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px;
    z-index: 1;
}

.theme-toggle .toggle-icons img {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.3));
}

body.dark-mode .theme-toggle .toggle-icons img {
    filter: drop-shadow(0 0 2px rgba(255,255,255,0.3));
}

.theme-toggle .toggle-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

body.dark-mode .theme-toggle .toggle-handle {
    transform: translateX(32px);
}

.theme-toggle:hover .toggle-handle {
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Enhanced Timeline Styles */
.timeline {
    position: relative;
    padding-left: 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), rgba(37, 99, 235, 0.3));
}

.timeline-item {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 2.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--primary-color);
    z-index: 1;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item ul {
    margin-top: 0.5rem;
    padding-left: 0;
}

.timeline-item li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.timeline-item li:last-child {
    margin-bottom: 0;
}

.timeline-item li i {
    margin-top: 0.25rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.timeline-item h3 {
    margin-bottom: 0.5rem;
}

.timeline-item p.text-muted {
    margin-bottom: 0.75rem;
}

/* Performance optimizations */
.card, .btn, .badge-skill, .timeline-item li {
    will-change: transform;
}

/* Image optimization */
img {
    height: auto;
    max-width: 100%;
}

/* Reduce layout shifts */
.navbar-brand {
    min-height: 1.5rem;
}

/* Enhanced Hero Section with NYC Background - Back to Working Version */
.hero-section {
    position: relative;
    padding: 2rem 0;
    background: url('images/nyc-hero.jpg') center 40% / cover no-repeat;
    color: white;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.hero-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.2), 
        rgba(0, 0, 0, 0.1), 
        rgba(0, 0, 0, 0.15));
    z-index: 1;
}

.hero-section * {
    position: relative;
    z-index: 2;
}

/* Mobile optimization for hero */
@media (max-width: 768px) {
    .hero-section {
        background-attachment: scroll;
        padding: 4rem 0 3rem;
    }
}

/* Dark mode adjustments for hero */
body.dark-mode .hero-section {
    background: url('images/nyc-hero.jpg') center 40% / cover no-repeat;
    color: white;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.8);
}

body.dark-mode .hero-section::after {
    background: linear-gradient(135deg, 
        rgba(15, 23, 42, 0.3), 
        rgba(30, 41, 59, 0.25), 
        rgba(51, 65, 85, 0.2));
}

.hero-section .display-4 {
    font-weight: 800;
    text-shadow: 0 6px 12px rgba(0, 0, 0, 0.8);
    letter-spacing: -0.03em;
    font-size: 5.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    line-height: 1.1;
    background: linear-gradient(45deg, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-section .lead {
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
    font-weight: 500;
    font-size: 1.4rem;
    margin-bottom: 2rem;
}

/* Mobile optimization for hero */
@media (max-width: 768px) {
    .hero-section {
        background-attachment: scroll;
        padding: 4rem 0 3rem;
    }
    
    .hero-section .display-4 {
        font-size: 3.5rem;
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-section .display-4 {
        font-size: 2.8rem;
    }
}



/* Add smooth transitions for better UX */
.hero-section .btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-section .btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 15px 30px rgba(255, 255, 255, 0.25), 0 5px 15px rgba(0, 0, 0, 0.2);
}

.hero-section .btn-primary {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    border: 2px solid rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.hero-section .btn-primary:hover {
    background: white;
    color: var(--primary-color);
    border-color: white;
}

.hero-section .btn-outline-primary {
    border: 2px solid rgba(255, 255, 255, 0.9);
    color: white;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    font-weight: 600;
}

.hero-section .btn-outline-primary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    color: white;
}

.hero-section .btn:active {
    transform: translateY(0) scale(0.98);
}

/* Remove background image from non-index pages */
body:not([data-page="index"]) .hero-section {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    min-height: 50vh;
}

body:not([data-page="index"]) .hero-section::after {
    display: none;
}

body.dark-mode:not([data-page="index"]) .hero-section {
    background: linear-gradient(135deg, #1e293b, #334155) !important;
}

/* Enhanced skill section */
.skill-section {
    padding: 1.25rem;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.02);
    border: 1px solid rgba(37, 99, 235, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.skill-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.05), transparent);
    transition: left 0.5s ease;
}

.skill-section:hover::before {
    left: 100%;
}

.skill-section:hover {
    background: rgba(37, 99, 235, 0.04);
    border-color: rgba(37, 99, 235, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.1);
}

body.dark-mode .skill-section {
    background: rgba(96, 165, 250, 0.05);
    border-color: rgba(96, 165, 250, 0.15);
}

body.dark-mode .skill-section::before {
    background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.08), transparent);
}

body.dark-mode .skill-section:hover {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(96, 165, 250, 0.25);
    box-shadow: 0 8px 25px rgba(96, 165, 250, 0.1);
}

/* Contact card enhancements */
.contact-item {
    transition: all 0.2s ease;
    padding: 1rem;
    border-radius: 8px;
}

.contact-item:hover {
    background: rgba(37, 99, 235, 0.03);
    transform: translateX(4px);
}

body.dark-mode .contact-item:hover {
    background: rgba(96, 165, 250, 0.08);
}
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 50%;
    z-index: 1000;
}

.back-to-top.show {
    display: flex;
}

/* Utility: ensure images don't exceed container */
/* Print styles and accessibility */
@media print {
    .navbar, .back-to-top, footer, .theme-toggle, .no-print { 
        display: none !important; 
    }
    .card { 
        page-break-inside: avoid; 
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
    .container { 
        max-width: 100% !important; 
    }
    body { 
        color: #000 !important; 
        background: #fff !important; 
    }
    .badge-skill {
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card { 
        border: 2px solid currentColor !important; 
    }
    .badge-skill { 
        border: 2px solid currentColor !important; 
    }
    .btn {
        border: 2px solid currentColor !important;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .card:hover,
    .btn:hover,
    .badge-skill:hover,
    .contact-item:hover,
    .skill-section:hover {
        transform: none !important;
    }
    
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode focus contrast */
body.dark-mode :focus-visible { outline-color: var(--secondary-color); }
