/* ==========================================================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ========================================================================== */

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #161616;
    --bg-tertiary: #1d1d1d;
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --accent: #ff9060;
    --border: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: rgba(0, 0, 0, 0.9);
    --text-secondary: rgba(0, 0, 0, 0.6);
    --text-muted: rgba(0, 0, 0, 0.4);
    --accent: #ff9060;
    --border: rgba(0, 0, 0, 0.1);
    --hover-bg: rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.25;
    z-index: -1;
    pointer-events: none;
    background-image: url('Film_grain.jpg');
    background-size: 400px 400px;
    background-repeat: repeat;
    mix-blend-mode: screen;
    display: none;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, -10%); }
    90% { transform: translate(-10%, 5%); }
}

/* Show noise texture only in dark mode */
:root body::before {
    display: block;
}

[data-theme="light"] body::before {
    display: none;
}

/* Film light leaks - only in dark mode */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.08;
    z-index: -1;
    pointer-events: none;
    background: 
        linear-gradient(45deg, transparent 0%, transparent 95%, rgba(255, 100, 50, 0.4) 97%, rgba(255, 150, 80, 0.6) 100%),
        linear-gradient(180deg, rgba(255, 80, 40, 0.3) 0%, rgba(255, 120, 60, 0.2) 8%, transparent 15%),
        radial-gradient(ellipse at 5% 20%, rgba(255, 60, 30, 0.25) 0%, transparent 40%);
    display: none;
}

:root body::after {
    display: block;
}

[data-theme="light"] body::after {
    display: none;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */

.container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 0;
}

.section {
    display: none;
    padding: 4rem 3rem 4rem 4rem;
    max-width: none;
    margin: 0;
    min-height: 100vh;
}

.section.active {
    display: block;
}

.section-content {
    width: 100%;
    max-width: 800px;
}

/* ==========================================================================
   SIDEBAR NAVIGATION
   ========================================================================== */

.sidebar {
    width: 280px;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.25;
    z-index: -1;
    pointer-events: none;
    background-image: url('Film_grain.jpg');
    background-size: 400px 400px;
    background-repeat: repeat;
    mix-blend-mode: screen;
    display: none;
}

/* Show noise texture on sidebar only in dark mode */
:root .sidebar::before {
    display: block;
}

[data-theme="light"] .sidebar::before {
    display: none;
}



.nav-content {
    padding: 3rem 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.name {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0;
}



.nav-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-category {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-weight: 400;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-icon {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
    width: 14px;
    text-align: center;
}

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

.nav-link:hover .nav-icon {
    color: var(--text-secondary);
}

.nav-link.active {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.nav-link.active .nav-icon {
    color: var(--text-primary);
}

/* ==========================================================================
   THEME TOGGLE
   ========================================================================== */

.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.1);
    background-color: var(--bg-tertiary);
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
    position: relative;
    display: inline-block;
}

.section-subtitle::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, rgba(255, 160, 120, 0.9), rgba(255, 200, 170, 0.6), rgba(250, 245, 240, 0.3), transparent);
    border-radius: 2px;
}

/* ==========================================================================
   HOMEPAGE HERO SECTION
   ========================================================================== */

.hero {
    padding: 2rem 0 4rem 0;
    max-width: 680px;
    position: relative;
    z-index: 1;
}

.hero-background {
    position: absolute;
    top: 0;
    left: -200px;
    right: -200px;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
}

.gradient-orb {
    position: absolute;
    top: 20%;
    right: 10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 100, 50, 0.12) 0%, rgba(255, 150, 80, 0.08) 40%, rgba(255, 80, 40, 0.04) 70%, transparent 100%);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
    filter: blur(1px);
}

@keyframes float {
    0%, 100% { transform: translateY(0px) translateX(0px); }
    33% { transform: translateY(-10px) translateX(5px); }
    66% { transform: translateY(5px) translateX(-5px); }
}

[data-theme="light"] .gradient-orb {
    background: radial-gradient(circle, rgba(255, 100, 50, 0.12) 0%, rgba(255, 150, 80, 0.08) 40%, rgba(255, 80, 40, 0.04) 70%, transparent 100%);
}

.hero-title {
    font-size: 3rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.highlight {
    color: var(--text-primary);
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    opacity: 0.9;
}

.hero-description {
    margin-bottom: 2.5rem;
}

.hero-description p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    font-weight: 400;
    max-width: 85%;
}

/* ==========================================================================
   FEATURED PROJECTS SECTION
   ========================================================================== */

.featured-projects {
    margin-top: 5rem;
}

.featured-grid {
    display: grid;
    gap: 3rem;
    margin-bottom: 2.5rem;
}

.featured-project {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    padding: 2rem;
    border-radius: 16px;
    transition: all 0.4s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.featured-project::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--hover-bg);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.featured-project:hover::before {
    opacity: 1;
}

.featured-project:hover {
    border-color: var(--border);
    transform: translateY(-2px);
}

.project-image {
    flex-shrink: 0;
    width: 200px;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.featured-project:hover .project-image img {
    transform: scale(1.05);
}

.project-info {
    flex: 1;
    padding-top: 0.5rem;
}

.project-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.project-links {
    display: flex;
    gap: 1rem;
}

.project-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}

.project-link:hover {
    opacity: 0.8;
}

/* ==========================================================================
   CONTENT SECTIONS (About, Projects, Writing, Contact)
   ========================================================================== */

.intro {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.about-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
}

/* Project Cards */
.projects-grid {
    display: grid;
    gap: 2rem;
    margin-top: 2rem;
}

.project-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
    background-color: var(--bg-tertiary);
    transform: translateY(-2px);
}

[data-theme="light"] .project-card:hover {
    border-color: rgba(0, 0, 0, 0.2);
}

:root .project-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Writing Section */
.writing-list {
    margin-top: 2rem;
}

.writing-item {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border);
}

.writing-item:last-child {
    border-bottom: none;
}

.writing-title a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.writing-title a:hover {
    color: var(--accent);
}

.writing-description {
    color: var(--text-secondary);
    margin: 0.75rem 0;
    line-height: 1.6;
}

.writing-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Contact Section */
.contact-content {
    margin-top: 2rem;
}

.contact-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
    font-size: 1rem;
}

.contact-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.contact-link:hover {
    opacity: 0.8;
}

/* ==========================================================================
   COMPONENTS (Buttons, Tags, etc.)
   ========================================================================== */

.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.tag:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.tag:hover .tag-icon {
    color: var(--text-secondary);
}

.view-all {
    text-align: center;
    padding-top: 1rem;
}

.view-all-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: opacity 0.2s ease;
}

.view-all-link:hover {
    opacity: 0.8;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

/* Tablet & Small Desktop (1024px and down) */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
    }
    
    .section {
        padding: 3rem 2rem;
    }
}

/* Mobile & Tablet (768px and down) */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .nav-content {
        padding: 2rem;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .name {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .nav-section {
        gap: 0.75rem;
    }
    
    .nav-category {
        font-size: 0.75rem;
        text-align: center;
    }
    
    .nav-links {
        flex-direction: row;
        gap: 0.5rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        gap: 0.5rem;
    }
    
    .nav-icon {
        font-size: 0.9rem;
        width: 14px;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .section {
        padding: 2rem 1.5rem;
        min-height: auto;
    }
    
    .section-content {
        max-width: none;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-description p {
        max-width: 100%;
    }
    
    .featured-project {
        flex-direction: column;
        gap: 1.5rem;
        text-align: left;
    }
    
    .project-image {
        width: 100%;
        max-width: 300px;
        margin: 0;
    }
    
    .hero-actions {
        justify-content: flex-start;
    }
    
    .gradient-orb {
        width: 200px;
        height: 200px;
        top: 10%;
    }
    
    .featured-project {
        padding: 1.5rem;
    }
    
    .theme-toggle {
        display: none;
    }
    
    .contact-links {
        gap: 1.5rem;
    }
}

/* Small Mobile (480px and down) */
@media (max-width: 480px) {
    .nav-content {
        gap: 1rem;
    }
    
    .nav-section {
        gap: 0.5rem;
    }
    
    .nav-category {
        font-size: 0.7rem;
    }
    
    .section {
        padding: 2rem 1rem;
    }
    
    .section-content {
        max-width: none;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-description p {
        font-size: 0.95rem;
        max-width: 100%;
    }
    
    .section-subtitle {
        font-size: 1.5rem;
    }
    
    .featured-projects {
        margin-top: 3rem;
    }
    
    .featured-project {
        padding: 1rem;
    }
    
    .project-card {
        padding: 1.5rem;
    }
    
    .contact-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .gradient-orb {
        width: 150px;
        height: 150px;
        top: 5%;
        right: 5%;
    }
}