/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    padding: var(--space-4) 0;
    transition: all var(--transition-base);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .navbar.scrolled {
    background: rgba(15, 23, 42, 0.8);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-bg-primary);
    /* White by default for Hero contrast */
    transition: transform var(--transition-fast), color var(--transition-base);
}

.navbar.scrolled .navbar-brand {
    color: var(--color-text-primary);
    /* Dark when scrolled */
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    gap: var(--space-8);
    align-items: center;
}

.nav-link {
    position: relative;
    font-weight: var(--font-medium);
    color: var(--color-bg-primary);
    /* White by default */
    padding: var(--space-2) var(--space-3);
    transition: color var(--transition-fast);
}

.navbar.scrolled .nav-link {
    color: var(--color-text-secondary);
    /* Dark grey when scrolled */
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-bg-primary);
    /* White underline by default */
    transform: translateX(-50%);
    transition: width var(--transition-base), background-color var(--transition-base);
}

.navbar.scrolled .nav-link::after {
    background: var(--gradient-primary);
    /* Gradient underline when scrolled */
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-accent);
    /* Brighter accent for dark background */
}

.navbar.scrolled .nav-link:hover,
.navbar.scrolled .nav-link.active {
    color: var(--color-primary);
    /* Original primary color for light background */
}

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

.theme-toggle {
    padding: var(--space-2);
    border-radius: var(--radius-full);
    background: var(--color-bg-tertiary);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--color-primary);
    color: white;
    transform: rotate(180deg);
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-2);
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--color-bg-primary);
    /* White by default */
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.navbar.scrolled .mobile-menu-toggle span {
    background: var(--color-text-primary);
    /* Dark when scrolled */
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--color-surface);
        padding: var(--space-6);
        box-shadow: var(--shadow-xl);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-link {
        color: var(--color-text-primary);
        /* Force dark text on mobile menu background */
        padding: var(--space-3) 0;
        /* Add vertical padding for better touch targets */
    }

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

    .nav-link::after {
        display: none;
        /* Remove underline effect on mobile if desired, or adjust */
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.btn-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: white;
}

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

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
}

/* Cards */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 1px solid var(--color-border);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .card-glass {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header {
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.card-description {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    max-height: 6rem;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: var(--space-2);
}

.card-description::-webkit-scrollbar {
    width: 4px;
}

.card-description::-webkit-scrollbar-thumb {
    background-color: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
}

.card-description::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-primary-light);
}

/* Project Cards */
.project-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure uniform height in grid */
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-2xl);
}

.project-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.project-card:hover .project-image {
    transform: scale(1.1);
}

.project-content {
    padding: var(--space-6);
    flex-grow: 1;
    /* Allow content to push actions down */
    display: flex;
    flex-direction: column;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: auto;
    /* Push to bottom of content area if description is short */
    margin-bottom: var(--space-4);
    max-height: 4.5rem;
    /* Limit to approx 2 rows */
    overflow: hidden;
    align-content: flex-start;
}

.tag {
    padding: var(--space-1) var(--space-3);
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

.tag-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-primary);
}

/* Skill Cards */
.skill-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    transition: all var(--transition-base);
    height: 100%;
}

.skill-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-xl);
    transform: translateY(-5px);
}

.skill-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-radius: var(--radius-lg);
    color: var(--color-primary);
    font-size: 2.5rem;
    transition: all var(--transition-base);
}

.skill-card:hover .skill-icon {
    background: var(--gradient-primary);
    color: white;
    transform: scale(1.1) rotate(5deg);
}

.skill-card h4 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

/* Forms */
.form-group {
    margin-bottom: var(--space-6);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: var(--space-16);
}

.section-title {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-4);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: var(--space-8);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Social Links */
.social-links {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
}

.social-link {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    transition: all var(--transition-base);
}

.social-link:hover {
    background: var(--gradient-primary);
    color: white;
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gradient-primary);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-8);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -35px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 3px solid var(--color-bg-primary);
}

.timeline-date {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-2);
}

.timeline-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
}

.timeline-description {
    color: var(--color-text-secondary);
}