/* ===================
   Variables
   =================== */
:root {
    --bg: #ffffff;
    --text: #0a0a0a;
    --text-secondary: #6b6b6b;
    --accent: #0a0a0a;
    --border: #e5e5e5;
    --card-bg: #fafafa;
    
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;
    
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --text: #f5f5f5;
    --text-secondary: #b0b0b0;
    --accent: #ffffff;
    --border: #2a2a2a;
    --card-bg: #161616;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
    cursor: none;
}

::selection {
    background: var(--text);
    color: var(--bg);
}

/* ===================
   Custom Cursor
   =================== */
.cursor,
.cursor-follower {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
}

.cursor {
    width: 8px;
    height: 8px;
    background: #fff;
    transform: translate(-50%, -50%);
}

.cursor-follower {
    width: 40px;
    height: 40px;
    border: 1px solid #fff;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

body.cursor-hover .cursor-follower {
    width: 60px;
    height: 60px;
}

@media (max-width: 768px) {
    .cursor,
    .cursor-follower {
        display: none;
    }
    body {
        cursor: auto;
    }
}

/* ===================
   Navigation
   =================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.navbar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--text-secondary);
}

.nav-links {
    display: flex;
    gap: 3rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--text);
    transition: width var(--transition);
}

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

.nav-links a:hover::after {
    width: 100%;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    position: relative;
}

.theme-btn svg {
    position: absolute;
    transition: all var(--transition);
}

.theme-btn .moon {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .theme-btn .sun {
    opacity: 0;
    transform: rotate(-180deg);
}

[data-theme="dark"] .theme-btn .moon {
    opacity: 1;
    transform: rotate(0);
}

.theme-btn:hover {
    border-color: var(--text);
    transform: scale(1.1);
}

/* ===================
   Hero
   =================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 8rem 3rem 4rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.hero-content {
    max-width: 800px;
    z-index: 1;
}

.hero-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.875rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

.hero-title .line {
    display: block;
    animation: fadeInUp 0.6s ease backwards;
}

.hero-title .line:nth-child(2) {
    animation-delay: 0.1s;
}

.hero-title .line:nth-child(3) {
    animation-delay: 0.2s;
}

.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 2.5rem;
    line-height: 1.8;
    animation: fadeInUp 0.6s ease 0.3s backwards;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    animation: fadeInUp 0.6s ease 0.4s backwards;
}

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

.hero-visual {
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    width: 400px;
    height: 400px;
    z-index: 0;
}

.visual-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    top: 0;
    left: 0;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    bottom: 50px;
    right: 0;
    animation-delay: -5s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    top: 50%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(20px, -20px); }
    50% { transform: translate(-20px, 20px); }
    75% { transform: translate(20px, 20px); }
}

/* ===================
   Buttons
   =================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 50px;
    transition: all var(--transition);
    border: 1px solid var(--text);
}

.btn-primary {
    background: var(--text);
    color: var(--bg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: transparent;
    color: var(--text);
}

.btn-outline:hover {
    background: var(--text);
    color: var(--bg);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn svg {
    transition: transform var(--transition);
}

.btn:hover svg {
    transform: translateX(4px);
}

/* ===================
   Sections
   =================== */
section {
    padding: 6rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 4rem;
}

.section-num {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.section-header h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ===================
   Projects
   =================== */
.projects {
    display: grid;
    gap: 6rem;
}

.project {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    align-items: center;
}

.project:nth-child(even) {
    grid-template-columns: 1fr 1.2fr;
}

.project:nth-child(even) .project-visual {
    order: 2;
}

.project-img {
    position: relative;
    aspect-ratio: 16/10;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-slow);
    background: var(--card-bg);
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project:hover .project-img {
    transform: scale(1.02);
}

.img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.mockup {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 1rem;
}

.mockup-bar {
    height: 30px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.mockup-content {
    height: calc(100% - 46px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.project-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.project-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

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

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.project-tech span {
    padding: 0.4rem 0.8rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.875rem;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: gap var(--transition);
}

.project-link:hover {
    gap: 1rem;
}

/* ===================
   About
   =================== */
.about-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
}

.about-text .lead {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

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

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 3rem;
}

.skill-group h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.skill-group ul {
    list-style: none;
}

.skill-group li {
    color: var(--text-secondary);
    padding: 0.4rem 0;
    font-size: 0.95rem;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stat-card {
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-num {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===================
   Contact
   =================== */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-text h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.contact-text > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 3rem;
}

.contact-method {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text);
    text-decoration: none;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all var(--transition);
}

.contact-method:hover {
    border-color: var(--text);
    transform: translateX(4px);
}

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

.social-links a {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    transition: all var(--transition);
}

.social-links a:hover {
    border-color: var(--text);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-field {
    position: relative;
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    transition: all var(--transition);
    outline: none;
}

.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--text);
}

.form-field label {
    position: absolute;
    left: 1rem;
    top: 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all var(--transition);
    pointer-events: none;
    background: var(--card-bg);
    padding: 0 0.5rem;
}

.form-field input:focus + label,
.form-field textarea:focus + label,
.form-field input:not(:placeholder-shown) + label,
.form-field textarea:not(:placeholder-shown) + label {
    top: -0.5rem;
    font-size: 0.875rem;
    color: var(--text);
}

.form-field input:not(:placeholder-shown),
.form-field textarea:not(:placeholder-shown) {
    border-color: var(--text);
}

.form-field textarea {
    resize: vertical;
    min-height: 120px;
}

/* ===================
   Footer
   =================== */
.footer {
    border-top: 1px solid var(--border);
    padding: 3rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 700;
}

.footer-logo span {
    color: var(--text-secondary);
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===================
   Responsive
   =================== */
@media (max-width: 968px) {
    .navbar {
        padding: 1.5rem 2rem;
    }
    
    .nav-links {
        display: none;
    }
    
    .hero {
        padding: 6rem 2rem 4rem;
    }
    
    .hero-visual {
        opacity: 0.3;
        width: 300px;
        height: 300px;
    }
    
    section {
        padding: 4rem 2rem;
    }
    
    .project {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .project:nth-child(even) {
        grid-template-columns: 1fr;
    }
    
    .project:nth-child(even) .project-visual {
        order: 1;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-desc {
        font-size: 1.1rem;
    }
    
    .hero-cta {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .section-header h2 {
        font-size: 1.75rem;
    }
    
    .about-stats {
        flex-direction: row;
    }
    
    .stat-card {
        flex: 1;
        padding: 1.5rem 1rem;
    }
    
    .stat-num {
        font-size: 2rem;
    }
}

/* ===================
   Scroll Progress
   =================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    z-index: 10000;
    transition: width 0.1s ease-out;
}

/* ===================
   Back to Top Button
   =================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition);
    z-index: 999;
    box-shadow: var(--shadow-lg);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top svg {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ===================
   Form Loading State
   =================== */
.btn {
    position: relative;
    overflow: hidden;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.loading .btn-text,
.btn.loading .btn-icon {
    display: none;
}

.btn.loading .btn-loading {
    display: flex;
}

.form-status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.form-status.success {
    display: block;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.form-status.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}

/* ===================
   Resume Button
   =================== */
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: var(--card-bg);
    border-color: var(--text);
    transform: translateY(-2px);
}

.btn-secondary svg {
    transition: transform var(--transition);
}

.btn-secondary:hover svg {
    transform: translateY(3px);
}

/* ===================
   Performance Optimizations
   =================== */
/* Lazy load images */
img {
    loading: lazy;
}

/* Optimize animations on lower-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* GPU acceleration for smoother animations */
.cursor,
.cursor-follower,
.back-to-top,
.visual-orb {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Optimize font loading */
@media screen {
    * {
        text-rendering: optimizeSpeed;
    }
}

/* Critical CSS loaded inline, defer non-critical */
.project-img img,
.visual-orb {
    content-visibility: auto;
}
