/* ============================================
   Portfolio Website - Main Stylesheet (Optimized)
   ============================================ */

/* CSS Variables - Theme Support */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.5);
    --gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --border-color: rgba(255, 255, 255, 0.08);
    --cursor-size: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --border-color: rgba(0, 0, 0, 0.08);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-primary);
}

/* Body Border */
body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.5s ease;
    will-change: background, color;
    border: 1px solid var(--border-color);
    min-height: 100vh;
}

/* Custom Cursor */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    will-change: transform, opacity;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
}

.cursor-outline {
    width: var(--cursor-size);
    height: var(--cursor-size);
    border: 1px solid var(--accent);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

@media (hover: none) {
    .cursor-dot,
    .cursor-outline {
        display: none;
    }
}

/* 3D Background Canvas */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    will-change: transform;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: padding 0.3s ease, background 0.3s ease;
    will-change: padding, background;
}

.navbar.scrolled {
    background: rgba(10, 10, 15, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    padding: 1rem 5%;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .navbar.scrolled {
    background: rgba(248, 250, 252, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    will-change: transform, color;
}

.logo span {
    color: var(--accent);
}

.nav-list {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    will-change: color;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient);
    transition: width 0.3s ease;
    will-change: width;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link:hover::after {
    width: 100%;
}

/* Theme Switch Button */
#theme-switch {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    will-change: transform, background, border-color;
}

#theme-switch:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: rotate(15deg);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 1001;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.bar {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
    will-change: transform, opacity;
    position: relative;
}

.menu-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg) translateY(6px);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.menu-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg) translateY(-6px);
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .nav-list {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        justify-content: center;
        gap: 2rem;
        transition: right 0.3s ease;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
        will-change: right;
    }

    .nav-list.active {
        right: 0;
    }
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5%;
    position: relative;
}

.hero-content {
    text-align: center;
    max-width: 900px;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease forwards;
    will-change: opacity, transform;
}

.hero h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease 0.2s forwards;
    opacity: 0;
    will-change: opacity, transform;
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 550px;
    margin: 0 auto 2.5rem;
    animation: fadeInUp 0.8s ease 0.4s forwards;
    opacity: 0;
    will-change: opacity, transform;
}

/* CTA Buttons */
.cta-wrapper {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease 0.6s forwards;
    opacity: 0;
    will-change: opacity, transform;
}

.btn {
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    cursor: pointer;
    border: none;
    will-change: transform, box-shadow;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: border-color 0.3s ease, background 0.3s ease;
    will-change: border-color, background;
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: fadeInUp 0.8s ease 0.8s forwards, bounce 2s ease-in-out infinite 1.5s;
    opacity: 0;
    will-change: opacity, transform;
}

.scroll-indicator .line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--accent), transparent);
}

/* Sections */
.section {
    padding: 6rem 5%;
    min-height: 100vh;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.project-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    transform-style: preserve-3d;
    will-change: transform, box-shadow, border-color;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--accent);
}

.card-visual {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.card-visual video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;
}

.card-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    will-change: transform;
}

.project-card:hover .card-visual img {
    transform: scale(1.1);
}

.card-visual .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, var(--bg-card), transparent);
}

.card-info {
    padding: 1.5rem;
}

.card-info h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}

.card-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tags span {
    padding: 0.35rem 0.75rem;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* About Section */
#about {
    background: var(--bg-secondary);
}

.about-container {
    max-width: 1100px;
    margin: 0 auto;
}

.about-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 4rem;
    align-items: start;
}

.about-image {
    position: relative;
}

.about-image img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 20px;
    position: relative;
    z-index: 2;
}

.image-frame {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent);
    border-radius: 20px;
    z-index: 1;
}

.about-text h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.3;
    margin-bottom: 1.5rem;
}

.about-text .highlight {
    color: var(--accent);
}

.about-text p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.tech-item {
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-weight: 500;
    transition: border-color 0.3s ease, background 0.3s ease;
    will-change: border-color, background;
}

.tech-item:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

/* Resume Section */
.resume-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.resume-section h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.resume-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.resume-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: border-color 0.3s ease, transform 0.3s ease;
    will-change: border-color, transform;
}

.resume-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.resume-icon {
    width: 40px;
    height: 40px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.resume-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.resume-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn i {
    font-size: 0.9rem;
}

/* Contact Section */
.contact-wrapper {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-wrapper h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 2rem;
}

.email-link {
    display: inline-block;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    will-change: transform, text-shadow;
}

.email-link:hover {
    transform: scale(1.05);
    text-shadow: 0 0 30px var(--accent-glow);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.social-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    will-change: color;
}

.social-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
    will-change: width;
}

.social-links a:hover {
    color: var(--accent);
}

.social-links a:hover::after {
    width: 100%;
}

/* Contact Item (Phone) */
.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-item i {
    font-size: 0.9rem;
}

/* Phone Hover Effect */
.phone-link .phone-number {
    opacity: 0;
    max-width: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.phone-link:hover .phone-number {
    opacity: 1;
    max-width: 200px;
    margin-left: 0.5rem;
}

.phone-link i {
    transition: transform 0.3s ease;
}

.phone-link:hover i {
    transform: scale(1.2);
}

/* Certificates Section */
#certificates {
    background: var(--bg-secondary);
}

.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.certificate-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s ease;
    will-change: transform, border-color, box-shadow;
}

.certificate-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
}

.certificate-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.certificate-icon i {
    font-size: 1.25rem;
    color: var(--accent);
}

.certificate-info h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.certificate-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Mobile Responsive for Certificates */
@media (max-width: 768px) {
    .certificates-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    
    .certificate-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .certificate-icon {
        width: 45px;
        height: 45px;
    }
}

/* Hidden Certificates */
.hidden-cert {
    display: none;
}

.certificates-grid.show-all .hidden-cert {
    display: flex;
    animation: fadeInUp 0.5s ease forwards;
}

/* See More Button */
.see-more-wrapper {
    text-align: center;
    margin-top: 2.5rem;
}

.see-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
}

.see-more-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.see-more-btn i {
    transition: transform 0.3s ease;
}

.see-more-btn.active i {
    transform: rotate(180deg);
}

.see-more-btn.active {
    background: var(--accent);
    color: white;
}

/* Footer */
footer {
    padding: 2rem 5%;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(10px);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .section {
        padding: 4rem 5%;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-image {
        max-width: 280px;
        margin: 0 auto;
    }

    .about-image img {
        height: 280px;
    }

    .resume-grid {
        grid-template-columns: 1fr;
    }
}

/* Tilt.js Override Styles */
[data-tilt] {
    transform-style: preserve-3d;
    transform: perspective(1000px);
}

[data-tilt] > * {
    transform: translateZ(20px);
}
