/* ============================================================
   CSS VARIABLES & THEMES
   ============================================================ */
:root {
    /* Light Theme (Default) */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --primary-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --bg-card: #f1f5f9;
    --bg-card-hover: #e2e8f0;
    --text: #0f172a;
    --text-gray: #475569;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-white: #1e293b;
    --bg-card: #334155;
    --bg-card-hover: #475569;
    --text: #f1f5f9;
    --text-gray: #cbd5e1;
    --text-light: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* ===== HEADER ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding: 12px 0;
    transition: var(--transition);
}
[data-theme="dark"] header {
    background: rgba(15, 23, 42, 0.9);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text);
    z-index: 1001;
    letter-spacing: -0.5px;
}
.logo span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1001;
}

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-gray);
    font-size: 1.1rem;
    transition: var(--transition);
}
.theme-toggle:hover {
    background: var(--primary);
    color: white;
    transform: rotate(30deg);
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    z-index: 1001;
}
.hamburger span {
    display: block;
    width: 28px;
    height: 3px;
    background: var(--text);
    border-radius: 3px;
    transition: var(--transition);
}
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Navigation */
nav ul {
    display: flex;
    gap: 32px;
    list-style: none;
    transition: var(--transition);
}
nav ul li a {
    color: var(--text-gray);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
}
nav ul li a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: var(--transition);
    border-radius: var(--radius-full);
}
nav ul li a:hover,
nav ul li a.active {
    color: var(--text);
}
nav ul li a:hover::after,
nav ul li a.active::after {
    width: 100%;
}

/* Mobile Nav */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .header-actions { gap: 8px; }
    .theme-toggle { width: 40px; height: 40px; font-size: 1rem; }

    nav ul {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        max-width: 320px;
        height: 100vh;
        background: var(--bg-white);
        flex-direction: column;
        padding: 80px 32px 32px;
        gap: 8px;
        box-shadow: var(--shadow-xl);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 1000;
        border-left: 1px solid var(--border);
    }
    nav ul.open { right: 0; }
    nav ul li a {
        font-size: 1.1rem;
        display: block;
        padding: 14px 0;
        border-bottom: 1px solid var(--border);
    }

    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .nav-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
    body.menu-open { overflow: hidden; }
}

/* ===== HERO ===== */
.hero {
    padding: 140px 0 80px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 16px;
    letter-spacing: -1px;
}
.hero-content h1 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-content .subtitle {
    font-size: 1.5rem;
    color: var(--text-gray);
    font-weight: 600;
    margin-bottom: 12px;
}
.hero-content .tagline {
    font-size: 1.15rem;
    color: var(--text-gray);
    max-width: 520px;
    margin-bottom: 32px;
    line-height: 1.8;
}

.cta-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 34px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2));
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}
.btn:hover::after { transform: translateX(0); }
.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.45);
}
.btn:active { transform: translateY(0); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}
.btn-outline::after { display: none; }
.btn-outline:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
.hero-image .image-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--primary);
    box-shadow: 0 0 60px rgba(37, 99, 235, 0.2);
    animation: float 6s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}
.hero-image .image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-image .ring {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    animation: spin 8s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== SECTIONS ===== */
section {
    padding: 80px 0;
    transition: background 0.3s ease;
}
section:nth-child(even) {
    background: var(--bg-white);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}
.section-title span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.section-subtitle {
    text-align: center;
    color: var(--text-gray);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 48px;
}
.section-divider {
    width: 60px;
    height: 4px;
    background: var(--primary-gradient);
    margin: 12px auto 0;
    border-radius: var(--radius-full);
}

/* ===== ABOUT ===== */
.about-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 48px;
    align-items: start;
}
.about-image img {
    width: 100%;
    max-width: 320px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    border: 3px solid var(--border);
}
.about-image img:hover {
    transform: scale(1.02);
    border-color: var(--primary);
}
.about-text p {
    color: var(--text-gray);
    margin-bottom: 16px;
    font-size: 1.05rem;
}
.about-text p strong { color: var(--text); }

.about-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
    padding: 24px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.about-info div {
    display: flex;
    gap: 8px;
    align-items: baseline;
}
.about-info strong {
    color: var(--text);
    min-width: 70px;
    font-weight: 600;
}
.about-info span { color: var(--text-gray); }

/* ===== SKILLS ===== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}
.skill-category {
    background: var(--bg-white);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.skill-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}
.skill-category:hover::before { transform: scaleX(1); }
.skill-category:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}
.skill-category h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.skill-category h3 i { color: var(--primary); font-size: 1.4rem; }
.skill-category ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.skill-category ul li {
    background: var(--bg);
    padding: 6px 18px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-gray);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.skill-category ul li:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ===== PROJECTS ===== */
.project-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}
.filter-btn {
    padding: 8px 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-gray);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}
.filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.filter-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
}
.project-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition-slow);
    opacity: 0;
    transform: translateY(40px);
    animation: fadeInUp 0.6s ease forwards;
}
.project-card:nth-child(1) { animation-delay: 0.05s; }
.project-card:nth-child(2) { animation-delay: 0.10s; }
.project-card:nth-child(3) { animation-delay: 0.15s; }
.project-card:nth-child(4) { animation-delay: 0.20s; }
.project-card:nth-child(5) { animation-delay: 0.25s; }
.project-card:nth-child(6) { animation-delay: 0.30s; }
.project-card:nth-child(7) { animation-delay: 0.35s; }
.project-card:nth-child(8) { animation-delay: 0.40s; }

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

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}
.project-card .image-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--bg);
    position: relative;
}
.project-card .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}
.project-card:hover .image-container img {
    transform: scale(1.08);
}
.project-card .image-container .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}
.project-card:hover .image-container .overlay { opacity: 1; }
.project-card .image-container .overlay a {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px 24px;
    border: 2px solid white;
    border-radius: var(--radius-full);
    transition: var(--transition);
}
.project-card .image-container .overlay a:hover {
    background: white;
    color: var(--text);
}

.project-card .content { padding: 24px; }
.project-card .content .category-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 12px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    color: white;
    margin-bottom: 10px;
}
.project-card .content h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}
.project-card .content p {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.6;
}
.project-card .content .tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.project-card .content .tech-stack span {
    background: var(--bg);
    padding: 3px 14px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-gray);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.project-card .content .tech-stack span:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.project-card .content .project-links {
    display: flex;
    gap: 12px;
}
.project-card .content .project-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-gray);
    transition: var(--transition);
}
.project-card .content .project-links a:hover {
    color: var(--primary);
}

/* ===== CONTACT ===== */
.contact { text-align: center; }
.contact .contact-info { max-width: 500px; margin: 0 auto; }
.contact .contact-info .email {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin: 8px 0;
}
.contact .contact-info .email a {
    color: var(--primary);
    transition: var(--transition);
}
.contact .contact-info .email a:hover { color: var(--primary-dark); }
.contact .contact-info p { color: var(--text-gray); margin-bottom: 8px; }
.contact .social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
}
.contact .social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--bg);
    border-radius: 50%;
    color: var(--text-gray);
    font-size: 1.3rem;
    transition: var(--transition);
    border: 1px solid var(--border);
}
.contact .social a:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-6px) scale(1.05);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

/* ===== FOOTER ===== */
footer {
    background: var(--text);
    color: white;
    padding: 40px 0 32px;
    text-align: center;
    transition: background 0.3s ease;
}
[data-theme="dark"] footer { background: #0a0f1a; }
footer p { color: rgba(255,255,255,0.7); font-size: 0.9rem; }
footer .footer-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}
footer .footer-social a {
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    transition: var(--transition);
}
footer .footer-social a:hover {
    color: white;
    transform: translateY(-3px);
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 991px) {
    .hero .container { grid-template-columns: 1fr; text-align: center; }
    .hero-content .tagline { margin: 0 auto 32px; }
    .hero-content .cta-buttons { justify-content: center; }
    .hero-image .image-wrapper { width: 240px; height: 240px; }
    .hero-image .ring { width: 260px; height: 260px; }
    .hero h1 { font-size: 3.2rem; }
    .about-content { grid-template-columns: 1fr; text-align: center; }
    .about-image img { margin: 0 auto; }
    .about-info { grid-template-columns: 1fr; text-align: left; }
    .project-grid { grid-template-columns: repeat(2, 1fr); }
    .section-title { font-size: 2.2rem; }
}

@media (max-width: 767px) {
    .container { padding: 0 16px; }
    .hero { padding: 120px 0 60px; min-height: auto; }
    .hero h1 { font-size: 2.6rem; }
    .hero .subtitle { font-size: 1.1rem; }
    .hero .tagline { font-size: 1rem; }
    .hero-image .image-wrapper { width: 180px; height: 180px; }
    .hero-image .ring { width: 200px; height: 200px; }
    .section-title { font-size: 2rem; margin-bottom: 12px; }
    .section-subtitle { font-size: 1rem; margin-bottom: 32px; }
    .project-grid { grid-template-columns: 1fr; gap: 24px; }
    .project-card .image-container { height: 180px; }
    .skills-grid { grid-template-columns: 1fr; gap: 16px; }
    .about-info { grid-template-columns: 1fr; padding: 16px; }
    .about-text p { font-size: 0.95rem; }
    .cta-buttons { flex-direction: column; align-items: center; }
    .btn { width: 100%; max-width: 300px; justify-content: center; }
    .contact .social a { width: 44px; height: 44px; font-size: 1rem; }
    .project-filters { gap: 8px; }
    .filter-btn { padding: 6px 16px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .hero h1 { font-size: 2.2rem; }
    .hero .subtitle { font-size: 1rem; }
    .hero .tagline { font-size: 0.95rem; }
    .hero-image .image-wrapper { width: 150px; height: 150px; }
    .hero-image .ring { width: 170px; height: 170px; }
    .section-title { font-size: 1.7rem; }
    .project-card .content { padding: 16px; }
    .project-card .content h3 { font-size: 1.1rem; }
    .project-card .content p { font-size: 0.85rem; }
    .skill-category { padding: 20px; }
    .skill-category ul li { font-size: 0.8rem; padding: 4px 14px; }
    .about-info div { flex-direction: column; gap: 0; }
    .about-info strong { min-width: unset; }
    .contact .contact-info .email { font-size: 1rem; word-break: break-all; }
    footer p { font-size: 0.8rem; }
}

@media (max-width: 320px) {
    .hero h1 { font-size: 1.6rem; }
    .hero .subtitle { font-size: 0.85rem; }
    .hero .tagline { font-size: 0.8rem; }
    .hero-image .image-wrapper { width: 100px; height: 100px; }
    .hero-image .ring { width: 120px; height: 120px; }
    .btn { font-size: 0.8rem; padding: 10px 20px; }
    .section-title { font-size: 1.4rem; }
    .project-card .image-container { height: 140px; }
    .logo { font-size: 1.2rem; }
    .theme-toggle { width: 34px; height: 34px; font-size: 0.8rem; }
}

@media (min-width: 1400px) {
    .container { max-width: 1300px; }
    .hero h1 { font-size: 4.8rem; }
    .project-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== PRINT ===== */
@media print {
    header { position: static; backdrop-filter: none; background: white; }
    .hero { min-height: auto; padding: 40px 0; }
    .project-card:hover { transform: none; }
    .btn { box-shadow: none; }
    .theme-toggle, .hamburger, .nav-overlay { display: none !important; }
    nav ul { position: static !important; flex-direction: row !important; height: auto !important; padding: 0 !important; box-shadow: none !important; border: none !important; background: transparent !important; }
}