/* ==========================================================================
   MAIN STYLES - Core Layout, Typography, and Base Styles
   ========================================================================== */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

a {
    color: var(--construction-orange);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--construction-blue);
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-lg);
}

.section {
    padding: 5rem var(--spacing-lg);
}

.section-alt {
    background-color: var(--bg-secondary);
}

.section-stats {
    background: var(--bg-tertiary);
    padding: 3rem var(--spacing-lg);
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Flexbox Utilities */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.flex-column {
    flex-direction: column;
}

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* Navigation */
.nav-header {
    background: linear-gradient(135deg, var(--construction-blue) 0%, var(--dark-blue) 100%);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-normal);
}

.nav-header.scrolled {
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    color: white;
    font-size: var(--font-size-2xl);
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.nav-logo:hover {
    color: var(--construction-orange);
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-sm);
}

.nav-link {
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
    font-weight: 500;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--construction-orange);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
}

.nav-link:hover {
    color: var(--construction-orange);
    transform: translateY(-2px);
}

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

.nav-link.active {
    color: var(--construction-orange);
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    padding: var(--spacing-sm);
}

.mobile-menu {
    display: none;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--construction-blue) 0%, var(--dark-blue) 100%);
    color: white;
    min-height: 90vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Force white text inside any hero regardless of global heading color */
.hero-section h1,
.hero-section h2,
.hero-section h3,
.hero-section p {
    color: white;
}

/* Compact hero for sub-pages (research, publications, projects, blog) */
.hero-section.page-hero {
    min-height: 26vh;
    padding: var(--spacing-2xl) 0;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

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

.hero-content.hero-photo-bg {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
}

.hero-photo-layer {
    position: absolute;
    inset: 0;
    background-position: center 20%;
    background-size: cover;
    filter: saturate(1.15) contrast(1.05);
    opacity: 0.28;
}

.hero-photo-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(110deg, rgba(0, 27, 74, 0.92) 0%, rgba(0, 61, 165, 0.84) 55%, rgba(0, 61, 165, 0.56) 100%);
}

.hero-photo-content {
    position: relative;
    z-index: 2;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: var(--spacing-xl);
    align-items: center;
}

.hero-copy {
    max-width: 760px;
}

.hero-focus-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.hero-focus-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: var(--radius-full);
    color: white;
    font-size: var(--font-size-sm);
    padding: 0.35rem 0.8rem;
}

.hero-photo-frame {
    position: relative;
    justify-self: end;
    width: min(430px, 34vw);
    max-width: 430px;
    aspect-ratio: 4 / 5;
    border-radius: 2rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 36px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    transform: translateY(42px) rotate(-2deg);
    overflow: visible;
}

.hero-photo-frame::before {
    content: '';
    position: absolute;
    left: -16px;
    right: 16px;
    top: -16px;
    bottom: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 2rem;
    pointer-events: none;
}

.hero-cutout-img {
    width: 100%;
    height: 100%;
    border-radius: 1.35rem;
    border: 3px solid rgba(255, 255, 255, 0.82);
    object-fit: cover;
    object-position: center 18%;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.3);
    transform: translate(14px, -20px);
}

.hero-cutout-img:hover {
    transform: translate(14px, -20px) scale(1.02);
}

.profile-img {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 6px solid var(--construction-orange);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.profile-img:hover {
    transform: scale(1.05) rotate(5deg);
}

/* Ensure hero cutout overrides the default circular profile style */
.profile-img.hero-cutout-img {
    width: 100%;
    height: 100%;
    border-radius: 1.35rem;
    border: 3px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.3);
    transform: translate(14px, -20px);
}

.profile-img.hero-cutout-img:hover {
    transform: translate(14px, -20px) scale(1.02);
}

.about-summary {
    font-size: var(--font-size-lg);
    line-height: 1.8;
}

.about-glance-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: var(--spacing-sm);
}

.about-glance-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--construction-orange);
}

.about-glance-icon {
    color: var(--construction-orange);
    width: 1.4rem;
    text-align: center;
}

.about-glance-label {
    display: block;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Section Titles */
.section-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--construction-blue);
    margin-bottom: var(--spacing-3xl);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--construction-orange);
    border-radius: var(--radius-sm);
}

.section-title.center {
    display: block;
    text-align: center;
}

.section-title.center::after {
    left: 50%;
    transform: translateX(-50%);
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--construction-blue) 0%, var(--dark-blue) 100%);
    color: white;
    padding: var(--spacing-3xl) var(--spacing-lg) var(--spacing-xl);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-2xl);
}

.footer-section h3 {
    color: white;
    margin-bottom: var(--spacing-md);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: var(--spacing-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.social-links {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.social-link {
    color: white;
    font-size: var(--font-size-2xl);
    transition: all var(--transition-fast);
}

.social-link:hover {
    color: var(--construction-orange);
    transform: translateY(-5px) scale(1.2);
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 720px;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .section {
        padding: 3rem var(--spacing-md);
    }

    .nav-menu {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .mobile-menu.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--construction-blue);
        padding: var(--spacing-lg);
        box-shadow: var(--shadow-md);
    }

    .mobile-menu .nav-link {
        padding: var(--spacing-md);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hero-section {
        min-height: 70vh;
        text-align: center;
    }

    .hero-photo-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-copy {
        max-width: 100%;
        order: 2;
    }

    .hero-focus-tags {
        justify-content: center;
    }

    .hero-photo-frame {
        justify-self: center;
        width: min(320px, 80vw);
        transform: translateY(0) rotate(0);
        margin-bottom: var(--spacing-md);
        order: 1;
    }

    .hero-photo-frame::before {
        left: -10px;
        right: 10px;
        top: -10px;
        bottom: 10px;
    }

    .hero-cutout-img {
        width: 100%;
        height: 100%;
        transform: translate(8px, -10px);
    }

    .hero-cutout-img:hover {
        transform: translate(8px, -10px) scale(1.02);
    }

    .profile-img {
        width: 180px;
        height: 180px;
    }

    .profile-img.hero-cutout-img {
        width: 100%;
        height: 100%;
        transform: translate(8px, -10px);
    }

    .profile-img.hero-cutout-img:hover {
        transform: translate(8px, -10px) scale(1.02);
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 var(--spacing-md);
    }

    .section {
        padding: 2rem var(--spacing-md);
    }

    .section-title {
        font-size: var(--font-size-2xl);
    }
}

/* Print Styles */
@media print {
    .nav-header,
    .theme-toggle,
    footer {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

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

/* ==========================================================================
   SCROLL ANIMATIONS
   ========================================================================== */

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

.fade-in-up {
    opacity: 0;
}

.fade-in-up.is-visible {
    animation: fadeInUp 0.8s ease-out forwards;
}
