/* ===================
   CSS Variables
   =================== */
:root {
    /* Colors */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    
    /* Backgrounds */
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --glass-bg: rgba(255, 255, 255, 0.7);
    
    /* Effects */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 25px 50px rgba(37, 99, 235, 0.15);
    --shadow-color: 0 8px 24px rgba(37, 99, 235, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    
    /* Layout */
    --section-spacing: clamp(3rem, 8vw, 6rem);
    --container-padding: clamp(1.5rem, 4vw, 4rem);
    --border-radius: 16px;
    --border-radius-lg: 24px;
    
    /* Typography */
    --font-small: clamp(0.875rem, 1.5vw, 1rem);
    --font-base: clamp(1rem, 2vw, 1.125rem);
    --font-large: clamp(1.125rem, 2.5vw, 1.25rem);
    --font-xl: clamp(1.5rem, 3vw, 2rem);
    --font-2xl: clamp(2rem, 4vw, 3rem);
    --font-3xl: clamp(2.5rem, 5vw, 4rem);
    
    /* Letter Spacing */
    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.05em;
    
    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.2;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
}

/* ===================
   Base Styles
   =================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px; /* Account for fixed header */
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    min-height: 100vh;
    position: relative;
    background: var(--bg-gradient);
    isolation: isolate; /* Create stacking context */
    overflow-x: hidden;
}

/* Layer 1: Ultra-subtle image */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-image: url('../assets/MasuiJagiya.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    opacity: 0.08;
    filter: blur(0.5px) brightness(1.2) contrast(0.8);
    pointer-events: none;
    background-repeat: no-repeat;
    filter: blur(15px);
    opacity: 0.25;
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%,
        rgba(200, 220, 255, 0.03) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.navbar {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    width: 95%;
    max-width: 1400px;
    z-index: 1000;
    padding: 0.75rem 0;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.37),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    height: 60px;
    display: flex;
    align-items: center;
    will-change: transform;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--container-padding);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.logo {
    font-size: var(--font-large);
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    letter-spacing: -0.02em;
    position: relative;
    padding: 0.5rem 0;
}

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

.logo:hover::after {
    width: 100%;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: var(--font-small);
    position: relative;
    background: transparent;
    transition: color 0.3s ease;
    transform: translateZ(0);
    will-change: transform;
}

/* Reserve space for font-weight change */
.nav-links a::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    height: 0;
    visibility: hidden;
    overflow: hidden;
    font-weight: 600;
    pointer-events: none;
}

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

.nav-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-color);
    border-radius: 8px;
    opacity: 0;
    transform: translateZ(0);
    transition: opacity 0.3s ease;
    will-change: opacity;
}

.nav-links a:hover::before {
    opacity: 0.1;
}

/* Mobile navigation */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    position: relative;
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    position: relative;
    transition: var(--transition);
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    transition: var(--transition);
}

.hamburger::before {
    transform: translateY(-8px);
}

.hamburger::after {
    transform: translateY(8px);
}

/* Mobile menu active state */
.menu-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
}

.menu-toggle[aria-expanded="true"] .hamburger::before {
    transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .hamburger::after {
    transform: rotate(-45deg);
}

/* ===================
   Gallery Styles
   =================== */
.gallery-section {
    padding-top: 120px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
    margin-top: 2rem;
}

.gallery-item {
    margin: 0;
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    transition: transform 0.3s ease;
}

.gallery-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: var(--border-radius);
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover figcaption {
    transform: translateY(0);
}

/* ===================
   Section Styles
   =================== */
section {
    padding: clamp(3rem, 10vh, 5rem) 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

section > .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: clamp(2rem, 5vh, 3rem);
}

.section-header {
    text-align: center;
    margin-bottom: clamp(2rem, 5vh, 3rem);
    max-width: 800px;
    position: relative;
}

.glass-container, .card {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.37),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.glass-container:hover, .card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 12px 40px rgba(31, 38, 135, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.card {
    padding: 2rem;
    margin: 1rem;
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.section-header .subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-family: 'Segoe UI', system-ui, sans-serif;
    letter-spacing: var(--tracking-tight);
}

h1 {
    font-size: var(--font-3xl);
    font-weight: 800;
    line-height: var(--leading-tight);
    background: linear-gradient(135deg, var(--text-dark) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    position: relative;
    text-align: center;
}

h2 {
    font-size: var(--font-2xl);
    font-weight: 700;
    line-height: var(--leading-tight);
    margin-bottom: 1.5rem;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -0.5rem;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    transform: translateX(-50%);
}

h3 {
    font-size: var(--font-xl);
    font-weight: 600;
    line-height: var(--leading-snug);
    color: var(--primary-color);
    margin-bottom: 1rem;
}

p {
    font-size: var(--font-base);
    line-height: var(--leading-relaxed);
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.subtitle {
    font-size: var(--font-large);
    color: var(--text-light);
    line-height: var(--leading-relaxed);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

/* ===================
   Hero Section
   =================== */
.hero {
    min-height: 60vh;
    padding: clamp(4rem, 15vh, 8rem) 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    position: relative;
    overflow: hidden;
    margin-top: 60px; /* Account for fixed navbar */
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(37, 99, 235, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
}

.hero .container {
    position: relative;
    z-index: 1;
    padding: clamp(2rem, 5vw, 4rem) 0;
}

.hero-subtitle {
    font-size: var(--font-large);
    color: var(--text-light);
    margin-top: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
}

/* ===================
   Photo Section
   =================== */
.photo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.profile-img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.profile-img:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.about-content {
    max-width: 600px;
    text-align: center;
}

.about-content p {
    margin-bottom: 1.5rem;
    color: var(--text-light);
    line-height: 1.8;
}

.merriweather {
    font-family: "Merriweather", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings:
        "wdth" 100;
}

#About {
    align-content: center;
    padding: 20px;
    size: 18px;
    font-weight: 200;
    color: rgb(15, 220, 22);
}

/* ===================
   Skills Section
   =================== */
.skills-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-color);
}

/* Webkit browsers custom scrollbar */
.skills-grid::-webkit-scrollbar {
    width: 8px;
}

.skills-grid::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.skills-grid::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
    border: 2px solid var(--bg-color);
}

.skill-category {
    background: white;
    padding: 20px;
    border-radius: 16px !important;
    box-shadow: var(--shadow);
    transition: var(--transition);
    height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
}

/* Ensure all child elements inherit border radius */
.skill-category * {
    border-radius: inherit;
}

/* Create scrollable content area that maintains rounded corners */
.skill-category .content {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    margin: -20px;
    padding: 20px;
    border-radius: inherit;
}

/* Scrollbar styling for skill categories */
.skill-category::-webkit-scrollbar {
    width: 8px;
}

.skill-category::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.skill-category::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    border: 2px solid #f1f1f1;
}

.skill-category::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Firefox scrollbar */
.skill-category {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Remove all list styling in skills section */
#skills ul,
#skills li,
.skill-category ul,
.skill-category li {
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0;
    margin: 0;
}

/* Specific skill category styling */
.skill-category h3 {
    margin: 0 0 1.5rem 0;
    color: var(--accent-color);
    font-size: 1.2rem;
    position: sticky;
    top: 0;
    background: white;
    padding-bottom: 10px;
    z-index: 1;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.skill-category ul {
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.skill-category li {
    padding: 0.5rem 0;
    margin-bottom: 8px;
}

/* Additional safety measure for nested lists */
#skills .skill-category ul,
#skills .skill-category li {
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0;
    margin-bottom: 8px;
    padding-left: 1.5rem;
}

.skill-category li:before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.skill-category:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.1);
}

.skill-category ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.skill-category li {
    padding: 0.5rem 0;
    color: var(--text-light);
    display: flex;
    align-items: center;
}

.skill-category li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 0.5rem;
}

/* ===================
   Experience Section
   =================== */
.experience-grid {
    display: grid;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 20px;
    min-height: 400px; /* Ensure enough space for scrolling items */
}

.experience-item {
    background: var(--glass-bg);
    border-radius: 16px !important;
    box-shadow: var(--shadow);
    transition: var(--transition-bounce);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: perspective(1000px) rotateX(0) rotateY(0);
    transform-style: preserve-3d;
    max-height: 400px;
    overflow: hidden;
    padding: 0;
    /* Ensure child elements don't override border radius */
    position: relative;
    isolation: isolate;
}

.experience-item:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(-2deg) translateY(-5px);
    box-shadow: var(--shadow-lg),
                0 0 0 1px rgba(255, 255, 255, 0.3);
}

.experience-content {
    height: 100%;
    border-radius: inherit;
    overflow-y: auto;
    padding: 2rem;
    scrollbar-width: thin;
}

/* Custom Scrollbar Styling */
.experience-content::-webkit-scrollbar {
    width: 6px;
}

.experience-content::-webkit-scrollbar-track {
    background: transparent;
}

.experience-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.experience-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.experience-item::-webkit-scrollbar-track {
    background: rgba(241, 241, 241, 0.1);
    border-radius: 4px;
}

.experience-item::-webkit-scrollbar-thumb {
    background: rgba(136, 136, 136, 0.5);
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.experience-item::-webkit-scrollbar-thumb:hover {
    background: rgba(85, 85, 85, 0.7);
}

.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
/* Remove duplicate style block as we've consolidated the styles above */
#Experience .exp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px 0 20px;
}
#Experience .exp-title {
    font-weight: bold;
    font-size: 1.1em;
    color: #233cfa;
}
#Experience .exp-date {
    font-size: 0.98em;
    color: #888;
    font-style: italic;
}
#Experience .exp-desc {
    padding: 8px 20px 0 20px;
    color: #222;
    font-size: 1em;
}

/* ===================
   Connect Section
   =================== */
.connect-section {
    background: var(--card-bg);
    padding: 60px 0;
    text-align: center;
    margin-top: 40px;
}

.connect-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    padding: 0;
    list-style: none;
}

.connect-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: var(--transition);
    min-width: 200px;
    justify-content: center;
}

.connect-links a:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.4);
    background: #1d4ed8;
}
.connect-list li {
    font-size: 18px;
    font-weight: 200;
    color: rgb(35, 60, 250);
    list-style: none;
    display: flex;
    align-items: center;
}

/* ===================
   Media Queries
   =================== */

/* Small devices (576px and up) */
@media screen and (min-width: 576px) {
    .container {
        padding: 0 2rem;
    }

    .photo-section {
        padding: 3rem;
    }
}

/* Tablet (768px and up) */
@media screen and (min-width: 768px) {
    .nav-links {
        flex-direction: row;
        gap: 2rem;
    }
    
    .connect-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2rem;
        justify-content: center;
    }
    
    .experience-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .photo-section {
        flex-direction: row;
        text-align: left;
        padding: 4rem;
        gap: 4rem;
    }

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

    .about-content {
        text-align: left;
    }
    
    h2 {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
    }
    
    h3 {
        font-size: clamp(1.4rem, 3vw, 1.8rem);
    }

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

/* Desktop (1024px and up) */
@media screen and (min-width: 1024px) {
    .container {
        padding: 0 3rem;
    }
    
    .nav-container {
        padding: 0 3rem;
    }
    
    .experience-grid {
        gap: 3rem;
        grid-template-columns: repeat(3, 1fr);
    }

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

    .photo-section {
        padding: 5rem;
    }

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

/* Large Desktop (1440px and up) */
@media screen and (min-width: 1440px) {
    .container {
        max-width: 1400px;
        padding: 0 4rem;
    }
    
    .photo-section {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .skills-grid,
    .experience-grid {
        gap: 4rem;
    }
}
