/* ============================================= */
/* GLOBAL STYLES - JINHONGLJH PORTFOLIO */
/* ============================================= */

/* ===== CSS VARIABLES ===== */
:root {
    --primary-color: #46443F;
    --secondary-color: #7F7C78;
    --background-color: #FAFAF8;
}

/* ===== RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
  font-family: 'Roboto Condensed', sans-serif;
  color: var(--primary-color);
  background-color: var(--background-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: fadeInPage 0.3s ease-in forwards;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--primary-color);
}

a {
  text-decoration: none;
  color: var(--primary-color);
}

img {
  max-width: 100%;
  display: block;
}

/* ===== LAYOUT & CONTAINERS ===== */
.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
    flex: 1;
}

/* ===== PAGE TRANSITION ANIMATION ===== */
@keyframes fadeInPage {
    to {
        opacity: 1;
    }
}

/* ===== REDUCED MOTION PREFERENCE ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== HEADER & NAVIGATION ===== */
#header {
    padding: 20px 3%;
}

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

/* Logo Styles */
.logo svg {
    width: 150px;
    height: auto;
    fill: var(--primary-color);
}

/* ===== NAVIGATION STYLES ===== */
.nav {
    display: flex;
}

.nav-list {
    display: flex;
    gap: 25px;
    list-style: none;
}

.nav-link {
    color: var(--secondary-color);
    opacity: 0.6;
    font-weight: 450;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
}

.nav-item.active .nav-link,
.nav-link:hover {
    color: var(--primary-color);
    opacity: 1;
}

/* ===== HAMBURGER MENU ===== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 25px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -5px);
}

/* ===== FOOTER STYLES ===== */
footer .social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: fit-content;
    margin: 40px auto;
}

footer .social-links .icon {
    width: 18px;
    height: 18px;
    fill: var(--secondary-color);
    transition: opacity 0.3s ease;
}

/* Social Links Hover Effects */
footer .social-links:hover .social-link:not(:hover) .icon {
    opacity: 0.5;
}

/* Mobile: Active (tapped) one makes others 0.5 opacity */
footer .social-links.has-active .social-link:not(.active) .icon {
    opacity: 0.5;
}

footer .social-links .social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

footer .social-links .social-link .icon {
    transition: opacity 0.3s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
}

footer .social-link.active .icon {
    opacity: 1 !important;
}

/* Prevent flash during resize */
body.resize-active footer .social-links .social-link .icon {
    transition: none !important;
}

/* Force reset on page load */
footer .social-links:not(.has-active) .social-link .icon {
    opacity: 1;
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
body.resize-active * {
    transition: none !important;
    animation: none !important;
}

body.resize-active .project-image {
    opacity: 0.999 !important;
}

/* ===== MOBILE RESPONSIVE STYLES ===== */
@media (max-width: 1024px) {
    
    /* Mobile Body States */
    body.nav-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    /* Mobile Navigation */
    .nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--background-color);
        justify-content: center;
        align-items: center;
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        transform: translateZ(0); /* Prevent flash */
        will-change: transform, opacity;
    }
    
    .nav.nav-open {
        opacity: 1;
        visibility: visible;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .nav-link {
        font-size: 20px;
        font-weight: 400;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .nav-link:hover {
        transform: translateX(5px);
    }
    
    .nav:not(.nav-open) .nav-list {
        display: none;
    }

    /* Mobile Hamburger */
    .hamburger {
        display: flex !important;
        opacity: 1 !important;
        transition: none !important;
        animation: none !important;
        z-index: 10000;
    }

    .logo,
    .hamburger {
        z-index: 10000;
        position: relative;
    }
    
    /* Mobile Image Handling */
    body:not(.mobile-loaded) .project-image {
        opacity: 0.999;
    }
    
    body.mobile-loaded .project-image {
        opacity: 1;
        transition: opacity 0.1s ease;
    }
    
    /* Force hardware acceleration for mobile */
    main, .project, .project-image, .content-container {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
}

/* ===== SOCIAL LINKS JITTER FIX ===== */
.social-links .icon {
    transform: translateZ(0);
    backface-visibility: hidden;
}