/* ================= ROOT ================= */
:root {
    --bg-color: #000000;
    --text-color: #e2e8f0;
    --primary-color: #38bdf8;
    --secondary-color: #818cf8;
    --accent-color: #f472b6;
    --card-bg: rgba(30, 41, 59, 0.7);
    --nav-bg: rgba(15, 23, 42, 0.8);
    --font-main: 'Outfit', sans-serif;
    --transition: all 0.3s ease;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Font Display Optimization */
@font-face {
    font-family: 'Outfit';
    font-display: swap;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    /* Prevent layout shifts */
    min-height: 100vh;
}

/* Prevent reflow - set dimensions early */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.hero-image img {
    width: clamp(320px, 42vw, 640px);
    max-width: 100%;
    height: auto;
    object-fit: cover;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

/* ================= CANVAS ================= */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

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

/* ================= HEADER & NAV ================= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 0;
    border-bottom: var(--glass-border);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

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

.nav-links a {
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

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

.nav-links a:hover {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.hamburger {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--text-color);
    transition: var(--transition);
}

/* ================= HERO SECTION ================= */
.hero {
    min-height: 100vh;
    /* full screen */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 2rem;
}

.hero-text {
    flex: 1;
    z-index: 1;
}

.greeting {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.name {
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.3));
}

.role {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.bio {
    font-size: 1.1rem;
    color: #cbd5e1;
    margin-bottom: 2rem;
    max-width: 500px;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    display: inline-block;
    backdrop-filter: blur(5px);
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
}

.btn-secondary:hover {
    background: rgba(129, 140, 248, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(129, 140, 248, 0.3);
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hero-image img {
    width: clamp(320px, 42vw, 640px);
    max-width: 100%;
    height: auto;
    object-fit: cover;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.blob {
    width: clamp(340px, 42vw, 640px);
    height: clamp(340px, 42vw, 640px);
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blob-bounce 10s infinite ease-in-out alternate;
    filter: blur(60px);
    opacity: 0.4;
    position: absolute;
    z-index: -1;
}

@keyframes blob-bounce {
    0% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
        transform: translate(20px, -20px) rotate(20deg);
    }
}

/* ================= SECTIONS GENERAL ================= */
section {
    padding: 6rem 0;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* ================= GLASSMORPHISM CARDS ================= */
.skill-card,
.project-card,
.contact-links a {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* ================= ABOUT SECTION ================= */
.about-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.3rem;
    color: #cbd5e1;
    padding: 2rem;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    border: var(--glass-border);
}

.education-timeline {
    margin-top: 3rem;
}

.education-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.education-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary-color);
}

.education-item .year {
    display: block;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.education-item h4 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.education-item .institution {
    color: #94a3b8;
}

/* ================= SKILLS SECTION ================= */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    text-align: center;
}

.skill-card {
    padding: 2rem;
    border-radius: 1rem;
    transition: var(--transition);
}

.skill-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.2);
    background: rgba(30, 41, 59, 0.9);
}

.skill-card i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.3));
}

.skill-card h3 {
    font-size: 1.2rem;
    font-weight: 500;
}

/* ================= PROJECTS SECTION ================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.project-card {
    border-radius: 1rem;
    overflow: hidden;
    transition: var(--transition);
    transform-style: preserve-3d;
}

.project-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.project-image {
    height: 220px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    /* Prevent layout shift */
    min-height: 220px;
    /* Optimize rendering */
    will-change: transform;
    contain: layout;
}

.project-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.8));
    opacity: 0.6;
}

.project-info {
    padding: 1.5rem;
    transform: translateZ(20px);
}

.project-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.project-info p {
    color: #94a3b8;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.btn-link {
    color: var(--primary-color);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-link:hover {
    gap: 0.8rem;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* ================= CONTACT SECTION ================= */
.contact {
    text-align: center;
}

.contact .section-title {
    left: auto;
    transform: none;
}

.contact-text {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #cbd5e1;
}

.contact-form {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-form .form-row {
    display: flex;
    gap: 14px;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    padding: 12px 14px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.contact-form button {
    align-self: flex-end;
    padding: 10px 28px;
}

.social-links {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.social-links a {
    font-size: 1.5rem;
    color: #94a3b8;
    padding: 1rem;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border: var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(5px);
}

.social-links a:hover {
    color: #fff;
    background: var(--primary-color);
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
}

/* ================= FOOTER ================= */
.footer {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: #64748b;
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
}

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

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    .name {
        font-size: 3.5rem;
    }

    .role {
        font-size: 1.8rem;
    }

    .bio {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .about-content {
        font-size: 1.2rem;
    }
}

/* Mobile Landscape & Small Tablets (768px and below) */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    /* Navigation */
    .hamburger {
        display: block;
        z-index: 1001;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 70%;
        background-color: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: var(--transition);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        gap: 3rem;
    }

    .nav-links.active {
        right: 0;
    }

    /* Hero Section */
    .hero {
        min-height: auto;
        padding: 100px 0 4rem;
    }

    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
        gap: 3rem;
    }

    .hero-text {
        margin-top: 0;
    }

    .greeting {
        font-size: 1rem;
    }

    .name {
        font-size: 3rem;
    }

    .role {
        font-size: 1.5rem;
    }

    .bio {
        font-size: 1rem;
        max-width: 100%;
    }

    .cta-buttons {
        justify-content: center;
    }

    .hero-image {
        max-width: 100%;
    }

    .blob {
        width: 300px;
        height: 300px;
    }

    /* Sections */
    section {
        padding: 4rem 0;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 3rem;
    }

    /* About */
    .about-content {
        font-size: 1.1rem;
        padding: 1.5rem;
    }

    .education-title {
        font-size: 1.5rem;
    }

    .education-item {
        padding: 1rem;
    }

    .education-item h4 {
        font-size: 1.1rem;
    }

    /* Skills */
    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 1.5rem;
    }

    .skill-card {
        padding: 1.5rem;
    }

    .skill-card i {
        font-size: 2.5rem;
    }

    .skill-card h3 {
        font-size: 1rem;
    }

    /* Projects */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .project-image {
        height: 200px;
    }

    /* Contact */
    .contact-text {
        font-size: 1.1rem;
    }

    .contact-form .form-row {
        flex-direction: column;
    }

    .contact-form button {
        align-self: center;
        width: 100%;
        max-width: 200px;
    }

    .social-links {
        gap: 1.5rem;
    }

    .social-links a {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .logo {
        font-size: 1.2rem;
    }

    .name {
        font-size: 2.5rem;
    }

    .role {
        font-size: 1.3rem;
    }

    .bio {
        font-size: 0.95rem;
    }

    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .about-content {
        font-size: 1rem;
        padding: 1.25rem;
    }

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

    .skill-card {
        padding: 1.25rem;
    }

    .skill-card i {
        font-size: 2rem;
    }

    .skill-card h3 {
        font-size: 0.9rem;
    }

    .project-info h3 {
        font-size: 1.3rem;
    }

    .project-info p {
        font-size: 0.9rem;
    }

    .contact-form {
        padding: 0 0.5rem;
    }

    .nav-links {
        width: 85%;
    }
}

/* Extra Small Devices (360px and below) */
@media (max-width: 360px) {
    .container {
        padding: 0 0.75rem;
    }

    .name {
        font-size: 2rem;
    }

    .role {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }
}

/* Landscape Orientation Fix for Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 120px 0 2rem;
    }

    .hero-content {
        flex-direction: row;
    }

    .name {
        font-size: 2.5rem;
    }

    .blob {
        width: 200px;
        height: 200px;
    }
}