/* Components */

/* --- Navbar --- */
.site-header {
    background-color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    height: var(--header-height);
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-medium);
}

[data-theme="dark"] .site-header {
    background-color: rgba(15, 23, 42, 0.8);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    max-width: var(--max-width);
    padding: 0 var(--space-md);
    position: relative;
}

.branding .site-title {
    font-weight: var(--font-weight-heavy);
    font-size: 1.25rem;
    color: var(--color-text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.site-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-accent);
    background-color: var(--color-bg-surface);
    transition: all var(--transition-medium);
    box-shadow: var(--shadow-sm);
}

.site-logo:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: var(--shadow-md);
}

/* Mobile Menu Button - Hidden by default */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    color: var(--color-text-primary);
    /* FIX: SVG click events block karo taaki button har jagah se kaam kare */
    line-height: 0;
}

.mobile-menu-btn svg {
    pointer-events: none;
    display: block;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.main-nav .nav-list {
    display: flex;
    gap: var(--space-md);
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-list a {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    padding: var(--space-2xs) 0;
    position: relative;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-list a:hover,
.nav-list a.active,
.nav-list a.active-parent {
    color: var(--color-accent);
}

/* Underline animation for active link */
.nav-list>li>a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-accent);
    transform: scaleX(0);
    transition: transform var(--transition-medium);
    transform-origin: right;
}

.nav-list>li>a:hover::after,
.nav-list>li>a.active::after,
.nav-list>li>a.active-parent::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* --- Dropdowns --- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-fast);
    padding: var(--space-xs) 0;
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    padding: var(--space-xs) var(--space-md);
    display: block;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.dropdown-menu a:hover,
.dropdown-menu a.active {
    background-color: var(--color-accent-subtle);
    color: var(--color-accent);
}

/* Arrow icon */
.arrow-icon {
    display: inline-flex;
    align-items: center;
    transition: transform 0.3s ease;
    pointer-events: none; /* Click through to parent link */
}

.arrow-icon svg {
    pointer-events: none;
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--color-border);
    cursor: pointer;
    color: var(--color-text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: var(--space-md);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.theme-toggle:hover {
    background-color: var(--color-bg-surface);
    color: var(--color-accent);
    transform: rotate(15deg) scale(1.1);
    border-color: var(--color-accent);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke var(--transition-fast);
    pointer-events: none;
}

/* --- Buttons --- */
.btn,
.btn-primary,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-accent);
    border: 2px solid var(--color-accent);
    position: relative;
}

.btn-outline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity var(--transition-medium);
    z-index: -1;
}

.btn-outline:hover {
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-outline:hover::before {
    opacity: 1;
}

/* --- Cards --- */
.card,
.pub-item,
.timeline-item {
    background: var(--gradient-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    transition: all var(--transition-medium);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.card:hover,
.pub-item:hover,
.timeline-item:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card::before,
.pub-item::before,
.timeline-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.card:hover::before,
.pub-item:hover::before,
.timeline-item:hover::before {
    opacity: 1;
}

/* --- Lists --- */
ul,
ol {
    padding-left: var(--space-md);
    color: var(--color-text-secondary);
}

li {
    margin-bottom: var(--space-xs);
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: var(--space-lg) 0;
    margin-top: auto;
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 0.875rem;
}

/* --- Status Messages --- */
.status-message {
    text-align: center;
    color: var(--color-text-tertiary);
    font-style: italic;
    padding: var(--space-lg);
}

/* --- Profile Header (Desktop) --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-subtle);
    transition: all var(--transition-medium);
}

.profile-header:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.profile-image-wrapper {
    flex-shrink: 0;
    position: relative;
}

.profile-image-wrapper::before {
    content: '';
    position: absolute;
    inset: -4px;
    background: var(--gradient-accent);
    border-radius: var(--radius-md);
    opacity: 0;
    transition: opacity var(--transition-medium);
    z-index: -1;
}

.profile-image-wrapper:hover::before {
    opacity: 0.3;
}

.profile-image {
    width: 280px;
    height: 350px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 3px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-medium);
}

.profile-image:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}

.profile-details {
    flex: 1;
}

.profile-name {
    font-size: 2.75rem;
    margin-bottom: var(--space-xs);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-black);
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-title {
    font-size: 1.4rem;
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
    font-weight: var(--font-weight-bold);
    display: inline-block;
    padding: var(--space-2xs) var(--space-sm);
    background: var(--color-accent-subtle);
    border-radius: var(--radius-sm);
}

.profile-dept {
    font-size: 1rem;
    color: var(--color-text-secondary);
    font-style: italic;
    margin-bottom: var(--space-2xs);
}

.profile-inst {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
}

.profile-bio {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--color-text-primary);
}

.profile-bio-section {
    margin-bottom: var(--space-lg);
}

.profile-bio-section .profile-bio {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-text-secondary);
    text-align: justify;
}

.home-contact {
    margin-bottom: var(--space-xl);
}

/* =============================================
   MOBILE STYLES (max-width: 768px)
   
   SIRF YE 3 CHEEZEIN FIX KI HAIN:
   1. .main-nav → display:none default, display:flex active
      (translateX se nav items right pe leak hote the)
   2. .dropdown:hover → mobile pe disable
   3. .mobile-menu-btn → pointer-events:none on SVG
   ============================================= */
@media (max-width: 768px) {
    .nav-container {
        padding: var(--space-sm) var(--space-md);
    }

    .mobile-menu-btn {
        display: block;
    }

    /* 
     * ROOT FIX: 
     * Pehla issue: translateX(100%) use kiya tha — nav nav-container
     * ke flex layout me tha, isliye items right side pe "leak" ho rahe the.
     * 
     * FIX: display:none (hidden) → display:flex (.active pe open)
     * Yeh sabse clean solution hai — koi leak nahi, koi z-index issue nahi.
     */
    .main-nav {
        display: none;               /* Default: bilkul hide */
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100dvh;              /* dvh = mobile address bar ke saath sahi */
        background-color: var(--color-bg-body);
        z-index: 1100;               /* Header (1000) se upar */
        overflow-y: auto;
        overflow-x: hidden;
        border-top: 1px solid var(--color-border);
        /* Top padding taaki content header ke neeche se shuru ho */
        padding: calc(var(--header-height) + var(--space-md)) var(--space-lg) var(--space-xl);
        flex-direction: column;
    }

    /* Drawer open — dikhao */
    .main-nav.active {
        display: flex;
        animation: navFadeIn 0.22s ease-out;
    }

    @keyframes navFadeIn {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Override desktop styles */
    .main-nav .nav-list {
        flex-direction: column;
        width: 100%;
        gap: 0;
        align-items: stretch;
        text-align: left;
    }

    /* Item dividers */
    .main-nav .nav-list > li {
        border-bottom: 1px solid var(--color-border-subtle);
    }

    .main-nav .nav-list > li:last-child {
        border-bottom: none;
    }

    .nav-list a {
        font-size: 1.1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px var(--space-xs);
        width: 100%;
        min-height: 52px;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }

    /* Desktop underline animation mobile pe off */
    .main-nav .nav-list > li > a::after {
        display: none;
    }

    /* Arrow rotate when open */
    .dropdown.open .arrow-icon {
        transform: rotate(180deg);
    }

    /* Mobile Dropdown */
    .dropdown-menu {
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        background-color: var(--color-bg-surface);
        padding: 0 0 var(--space-xs) var(--space-md) !important;
        display: none;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        width: 100% !important;
        min-width: unset !important;
        list-style: none;
    }

    .dropdown.open > .dropdown-menu {
        display: block;
        animation: slideDown 0.22s ease-out;
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Desktop hover dropdown mobile pe disable */
    .dropdown:hover .dropdown-menu {
        display: none;
        opacity: 0;
        visibility: hidden;
    }

    .dropdown.open:hover > .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    /* Sub-menu links */
    .dropdown-menu li {
        border: none;
        margin: 0;
    }

    .dropdown-menu a {
        padding: 11px var(--space-sm);
        min-height: 46px;
        display: flex;
        align-items: center;
        white-space: normal;
        color: var(--color-text-secondary);
        border-radius: var(--radius-sm);
        -webkit-tap-highlight-color: transparent;
    }

    .dropdown-menu a:hover,
    .dropdown-menu a.active {
        background-color: var(--color-accent-subtle);
        color: var(--color-accent);
    }

    /* Adjust profile header for mobile */
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--space-md);
    }

    .profile-details {
        text-align: center;
    }

    .profile-socials {
        justify-content: center;
    }

    .profile-image {
        width: 100%;
        max-width: 300px;
        height: auto;
        aspect-ratio: 4/5;
        border-width: 2px;
    }

    .theme-toggle {
        margin-left: 0;
    }
}

/* --- Footer --- */
.site-footer {
    background: var(--color-bg-surface);
    color: var(--color-text-tertiary);
    padding: var(--space-lg) 0;
    margin-top: var(--space-xl);
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.site-footer p {
    margin: 0;
    font-size: 0.95rem;
}

.site-footer a {
    color: var(--color-accent);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.site-footer a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* --- Visual Enhancements --- */

/* Home Profile */
.intro-section {
    margin-bottom: var(--space-xl);
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.profile-photo-large {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--color-bg-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.intro-text .intro-headline {
    margin-top: 0;
}

@media (max-width: 768px) {
    .profile-hero {
        flex-direction: column;
        text-align: center;
    }
}

/* Education Visuals */
.edu-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.edu-logo {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    background-color: white;
    padding: 4px;
    border: 1px solid var(--color-border-subtle);
}

.edu-title {
    flex: 1;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.gallery-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    transition: transform var(--transition-fast);
    border: 1px solid var(--color-border-subtle);
}

.gallery-img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
