/* ========================================
   Global Styles & Reset
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2C5F7C;
    --secondary: #3A7CA5;
    --accent: #81C3D7;
    --dark: #0A0E27;
    --darker: #050814;
    --text-light: #E5E7EB;
    --text-gray: #9CA3AF;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--darker);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========================================
   Typography
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

.font-serif {
    font-family: 'Playfair Display', serif;
}

/* ========================================
   Navigation
   ======================================== */

#navbar {
    background: rgba(5, 8, 20, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(44, 95, 124, 0.2);
}

#navbar.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    background: rgba(5, 8, 20, 0.95);
}

.nav-link {
    position: relative;
    font-weight: 500;
    padding-bottom: 2px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ========================================
   Buttons
   ======================================== */

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(129, 195, 215, 0.3);
    background: linear-gradient(135deg, var(--secondary), var(--accent));
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--accent);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: var(--accent);
    color: var(--dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(129, 195, 215, 0.3);
}

/* ========================================
   Animations
   ======================================== */

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

@keyframes fadeInDelay {
    0%, 20% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDelay2 {
    0%, 40% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}

.animate-fade-in-delay {
    animation: fadeInDelay 1.5s ease-out forwards;
}

.animate-fade-in-delay-2 {
    animation: fadeInDelay2 2s ease-out forwards;
}

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

/* ========================================
   Hero Section
   ======================================== */

#home {
    position: relative;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
}

#gallery-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#gallery-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-content {
    z-index: 10;
    position: relative;
}

/* ========================================
   Section Styles
   ======================================== */

section {
    position: relative;
}

.section-title {
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), transparent);
    border-radius: 2px;
}

/* ========================================
   Profile Card
   ======================================== */

.profile-card {
    transition: all 0.3s ease;
}

.profile-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(129, 195, 215, 0.2);
}

/* ========================================
   Skills Section
   ======================================== */

.skill-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.skill-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(129, 195, 215, 0.1), transparent);
    transition: left 0.5s ease;
}

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

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(129, 195, 215, 0.2);
}

.skill-item {
    margin-bottom: 0.75rem;
}

.skill-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(44, 95, 124, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.skill-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 1s ease-out;
    animation: skillBarLoad 1.5s ease-out;
}

@keyframes skillBarLoad {
    from {
        width: 0;
    }
}

/* ========================================
   Experience Section
   ======================================== */

.experience-item {
    animation: fadeIn 0.6s ease-out;
}

.experience-item:hover .bg-darker {
    border-color: rgba(129, 195, 215, 0.5);
    transform: translateX(10px);
}

.experience-item .bg-darker {
    transition: all 0.3s ease;
}

/* ========================================
   Education Section
   ======================================== */

.education-card {
    transition: all 0.3s ease;
    animation: fadeIn 0.6s ease-out;
}

.education-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(129, 195, 215, 0.2);
}

/* ========================================
   Projects Section
   ======================================== */

.project-card {
    transition: all 0.3s ease;
    animation: fadeIn 0.6s ease-out;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(129, 195, 215, 0.3);
}

.project-card:hover .relative {
    transform: scale(1.05);
}

.project-card .relative {
    transition: transform 0.5s ease;
}

/* ========================================
   Contact Section
   ======================================== */

#contact-form input,
#contact-form textarea {
    background: var(--dark);
    border: 1px solid rgba(44, 95, 124, 0.3);
    color: var(--text-light);
    transition: all 0.3s ease;
}

#contact-form input:focus,
#contact-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(129, 195, 215, 0.1);
    outline: none;
}

#form-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10B981;
    display: block;
}

#form-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #EF4444;
    display: block;
}

/* ========================================
   Footer
   ======================================== */

footer a {
    transition: all 0.3s ease;
}

footer a:hover {
    transform: translateY(-3px);
}

/* ========================================
   Scroll to Top Button
   ======================================== */

#scroll-top {
    transition: all 0.3s ease;
}

#scroll-top.show {
    opacity: 1;
    pointer-events: all;
}

#scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(129, 195, 215, 0.4);
}

/* ========================================
   Loading Spinner
   ======================================== */

.loader {
    border: 3px solid rgba(129, 195, 215, 0.2);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   Scroll Animations
   ======================================== */

.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease-out;
}

.scroll-reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   Utility Classes
   ======================================== */

.gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-effect {
    background: rgba(10, 14, 39, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(129, 195, 215, 0.1);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .skill-card,
    .project-card,
    .education-card {
        margin-bottom: 1rem;
    }

    #navbar .container {
        padding: 1rem;
    }

    .experience-item .md\\:w-1\\/2 {
        width: 100%;
        text-align: left;
    }

    .experience-item .absolute {
        left: 0;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* ========================================
   Performance Optimizations
   ======================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* GPU acceleration for animations */
.skill-card,
.project-card,
.education-card,
.profile-card,
.btn-primary,
.btn-secondary {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    nav,
    #scroll-top,
    #gallery-container,
    .hero-content {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    section {
        page-break-inside: avoid;
    }
}

/* ========================================
   Accessibility
   ======================================== */

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: var(--dark);
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary: #1E4A5F;
        --secondary: #2A6080;
        --accent: #60B0C9;
    }

    .btn-primary,
    .btn-secondary {
        border: 2px solid currentColor;
    }
}

/* ========================================
   Custom Scrollbar
   ======================================== */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--darker);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 6px;
    border: 2px solid var(--darker);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--darker);
}

/* ========================================
   Text Selection
   ======================================== */

::selection {
    background: var(--accent);
    color: var(--dark);
}

::-moz-selection {
    background: var(--accent);
    color: var(--dark);
}

/* ========================================
   Gallery Specific Styles
   ======================================== */

#gallery-container {
    cursor: grab;
}

#gallery-container:active {
    cursor: grabbing;
}

/* Prevent text selection while dragging gallery */
#gallery-container * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* ========================================
   Loading State
   ======================================== */

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--darker);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading.hidden {
    opacity: 0;
    visibility: hidden;
}

/* ========================================
   Smooth Transitions
   ======================================== */

a,
button,
input,
textarea,
select {
    transition: all 0.3s ease;
}

/* ========================================
   Additional Enhancements
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hover glow effect */
.glow-on-hover:hover {
    box-shadow: 0 0 20px rgba(129, 195, 215, 0.5);
}
