/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* 1. DEFINE VARIABLES (The "Brain" of the colors) */
:root {
    --bg-color: #0d1117;           /* Dark Background */
    --second-bg-color: #151c25;    /* Dark Card/Nav Background */
    --text-color: #ffffff;         /* White Text */
    --main-color: #ffb84d;         /* Amber Highlight */
    --text-secondary: #b9c2cc;     /* Grey Text */
    --shadow-color: rgba(0,0,0,0.5);
    --accent-color: #6ee7d2;
}

/* 2. DEFINE LIGHT MODE (The "Alternate" look) */
.light-mode {
    --bg-color: #f5f5f5;           /* Light Grey Background */
    --second-bg-color: #ffffff;    /* White Card/Nav Background */
    --text-color: #333333;         /* Dark Text */
    --main-color: #d87826;         /* Warm highlight for light mode */
    --text-secondary: #555;        /* Dark Grey Text */
    --shadow-color: rgba(0,0,0,0.1);
    --accent-color: #168f82;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'DM Sans', sans-serif; }

body {
    /* HERE IS THE FIX: Use variables, not #121212 */
    background-color: var(--bg-color);
    background-image: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s; /* Smooth transition */
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    padding: 20px 10%;
    /* Use Variable */
    background-color: var(--second-bg-color); 
    box-shadow: 0 2px 5px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    align-items: center;
}

/* Social Icons in Navbar */
.social-icons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.social-link {
    font-size: 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
}

.social-link:hover {
    color: var(--main-color);
    transform: translateY(-3px) scale(1.1);
    background: rgba(0, 217, 255, 0.1);
}

.social-link i {
    transition: 0.3s ease;
}

.logo { font-size: 24px; font-weight: bold; color: var(--text-color); }
.logo span { color: var(--main-color); }

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.15rem;
    font-weight: 600;
    transition: 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-links a:hover {
    color: var(--main-color);
}

/* Theme Toggle Icon */
#theme-toggle {
    font-size: 22px;
    cursor: pointer;
    margin-left: 20px;
    color: var(--text-color);
    transition: 0.3s;
}
#theme-toggle:hover { color: var(--main-color); transform: scale(1.1); }

/* Main Content Area */
#app {
    flex: 1;
    padding: 50px 10%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animation */
.fade-in { animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Content Styling */
h1 { font-family: 'Space Grotesk', sans-serif; font-size: 48px; margin-bottom: 20px; color: var(--text-color); }
h1 span { color: var(--main-color); }
p { font-size: 18px; color: var(--text-secondary); max-width: 600px; line-height: 1.6; }

.btn { 
    display: inline-block; 
    margin-top: 20px; 
    padding: 10px 20px; 
    background: var(--main-color); 
    color: var(--bg-color);
    text-decoration: none; 
    font-weight: bold; 
    border-radius: 5px; 
    transition: 0.3s;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn:hover { 
    opacity: 0.8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 217, 255, 0.3);
}

.btn:active {
    transform: translateY(0);
}

/* Button Variants */
.btn-primary {
    background: var(--main-color);
    color: var(--bg-color);
    margin-right: 10px;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--main-color);
    color: var(--main-color);
}

.btn-secondary:hover {
    background: rgba(0, 217, 255, 0.1);
}

.btn-card {
    padding: 8px 15px;
    font-size: 12px;
    margin-top: 10px;
}

/* Card Styling (For Projects) */
.card-style {
    background: var(--second-bg-color); 
    padding: 20px; 
    border-radius: 10px; 
    border: 1px solid var(--text-secondary);
    color: var(--text-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    background-color: var(--second-bg-color);
    font-size: 14px;
    color: var(--text-secondary);
    border-top: 1px solid rgba(0, 217, 255, 0.1);
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-social {
    display: flex;
    gap: 20px;
    justify-content: center;
}

/* Back-to-Top Button */
#back-to-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--main-color);
    color: var(--bg-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    z-index: 999;
    transition: 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

#back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.5);
}

#back-to-top:active {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* --- CONTACT FORM STYLES --- */
form {
    max-width: 600px;
    width: 100%;
    background: var(--second-bg-color);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--shadow-color);
    margin-top: 20px;
}

.contact-intro {
    max-width: 600px;
    margin-top: 10px;
    color: var(--accent-color);
}

.contact-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
    align-items: center;
    gap: clamp(45px, 8vw, 120px);
    width: 100%;
    max-width: 1050px;
}

.contact-copy h1 { margin-top: 12px; }

.contact-layout form {
    margin-top: 0;
}

.input-box {
    position: relative;
    margin-bottom: 20px;
}

.input-box input,
.input-box textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-color); /* Slightly different from card bg */
    border: 1px solid var(--text-secondary);
    border-radius: 5px;
    color: var(--text-color);
    font-size: 16px;
    outline: none;
    transition: 0.3s ease;
}

/* Resize text area vertically only */
.input-box textarea {
    resize: vertical;
    min-height: 120px;
}

.form-honeypot {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.input-box input:focus,
.input-box textarea:focus {
    border-color: var(--main-color);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
    background: rgba(0, 217, 255, 0.05);
}

/* Success/Error Message Styling */
#form-status {
    margin-top: 15px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}
.success { color: #00e676; } /* Green */
.error { color: #ff5252; }   /* Red */

/* --- HOME PAGE PROFILE PHOTO STYLES --- */

/* Container to align Text and Image side-by-side */
.home-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(40px, 8vw, 130px);
    width: 100%;
    max-width: 1180px;
    min-height: 560px;
}

/* Ensure text takes up available space */
.home-content {
    max-width: 670px;
    flex: 1;
}

.home-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.home-eyebrow span { width: 32px; height: 2px; background: var(--main-color); }

.home-content h1 {
    font-size: clamp(48px, 6vw, 82px);
    line-height: 0.98;
    letter-spacing: -2px;
    margin-bottom: 26px;
}

.home-content h1 span { color: var(--main-color); }

.home-intro { max-width: 520px; font-size: 17px; line-height: 1.75; }

.home-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.home-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }

.home-details {
    display: flex;
    gap: 28px;
    margin-top: 58px;
    border-top: 1px solid rgba(255,255,255,0.14);
    padding-top: 20px;
}

.home-details div { display: flex; flex-direction: column; gap: 5px; }
.home-details strong { color: var(--main-color); font: 700 13px 'Space Grotesk', sans-serif; }
.home-details span { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }

/* Typewriter Subtitle */
.subtitle-typing {
    font-size: 20px;
    color: var(--main-color);
    margin: 15px 0;
    min-height: 30px;
}

.typing-text {
    font-weight: bold;
    border-right: 2px solid var(--main-color);
    padding-right: 5px;
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0%, 49% {
        border-right-color: var(--main-color);
    }
    50%, 100% {
        border-right-color: transparent;
    }
}

/* Image Container */
.home-img {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 390px;
    isolation: isolate;
}

/* The Profile Image Styling with Animations */
.profile-img-animated {
    width: clamp(260px, 28vw, 380px);
    height: clamp(260px, 28vw, 380px);
    border-radius: 50%;
    object-fit: cover;
    border: 8px solid var(--bg-color);
    outline: 2px solid var(--main-color);
    box-shadow: 18px 18px 0 var(--main-color);
    transition: 0.3s ease;
    animation: profileEntrance 0.8s ease-out;
}

@keyframes profileEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.profile-img-animated:hover {
    transform: scale(1.08);
    box-shadow: 0 0 30px var(--main-color), 0 0 50px var(--main-color);
    animation: pulse 0.6s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 30px var(--main-color), 0 0 50px var(--main-color);
    }
    50% {
        box-shadow: 0 0 40px var(--main-color), 0 0 60px var(--main-color);
    }
}

/* --- PROJECT CARDS STYLING --- */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.project-card {
    background: var(--second-bg-color);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid rgba(0, 217, 255, 0.2);
    transition: 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.1), transparent);
    transition: 0.5s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--main-color);
    box-shadow: 0 10px 30px rgba(0, 217, 255, 0.2);
}

.project-card:hover::before {
    left: 100%;
}

.project-card h3 {
    color: var(--main-color);
    margin-bottom: 10px;
    font-size: 18px;
}

.project-card p {
    font-size: 14px;
    margin: 10px 0;
    max-width: 100%;
}

.card-header {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-frontend {
    background: rgba(0, 217, 255, 0.2);
    color: #00d9ff;
}

.badge-fullstack {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.tech-stack {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 15px 0;
}

/* --- ABOUT SECTION STYLING --- */

.about-container {
    max-width: 800px;
}

.about-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
    align-items: center;
    gap: clamp(45px, 8vw, 110px);
    width: 100%;
    max-width: 1120px;
}

.about-copy h1 { margin-top: 12px; }
.about-secondary { margin-top: 20px; }

.achievements {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.achievement-item {
    background: var(--second-bg-color);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(0, 217, 255, 0.1);
    transition: 0.3s ease;
}

.achievement-item i {
    font-size: 32px;
    color: var(--main-color);
    margin-bottom: 15px;
    display: block;
}

.achievement-item h3 {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 16px;
}

.achievement-item p {
    font-size: 13px;
    max-width: 100%;
}

.achievement-item:hover {
    transform: translateY(-5px);
    border-color: var(--main-color);
    box-shadow: 0 8px 20px rgba(0, 217, 255, 0.15);
}

/* Scroll Animation */
.scroll-animate {
    animation: scrollFadeIn 0.6s ease-out forwards;
}

@keyframes scrollFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }

/* MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
    #app { padding: 35px 7%; }

    .home-container {
        flex-direction: column-reverse;
        text-align: center;
        gap: 35px;
    }

    .home-eyebrow { justify-content: center; }
    .home-content h1 { letter-spacing: -1px; }
    .home-intro { margin: 0 auto; }
    .home-actions { justify-content: center; }
    .home-details { justify-content: center; gap: 18px; margin-top: 42px; }
    .home-details span { white-space: normal; }

    .profile-img-animated {
        width: 235px;
        height: 235px;
        margin-bottom: 20px;
    }

    .home-img { min-height: 310px; width: 100%; }
    .image-orbit-one { width: 330px; height: 170px; }
    .image-orbit-two { width: 230px; height: 340px; }
    .image-label { right: 4%; bottom: 5px; }

    .contact-layout {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .contact-copy { text-align: center; }
    .contact-copy .home-eyebrow { justify-content: center; }
    .contact-intro { margin: 10px auto 0; }
    .contact-layout form { margin-top: 0; }

    .about-layout {
        grid-template-columns: 1fr;
        gap: 35px;
    }

    .about-copy { text-align: center; }
    .about-copy .home-eyebrow { justify-content: center; }
    .about-secondary { margin-left: auto; margin-right: auto; }

    .btn-secondary {
        margin-left: 0;
        display: block;
        margin-top: 10px;
        width: 100%;
    }

    .achievements {
        grid-template-columns: 1fr;
    }

    .social-icons {
        gap: 10px;
    }
}

.image-orbit {
    position: absolute;
    border: 1px solid var(--accent-color);
    border-radius: 50%;
    opacity: 0.5;
    z-index: -1;
    animation: orbitFloat 5s ease-in-out infinite;
}

.image-orbit-one { width: 430px; height: 210px; transform: rotate(-35deg); }
.image-orbit-two { width: 300px; height: 440px; transform: rotate(35deg); animation-delay: -2s; }

.image-label {
    position: absolute;
    right: 0;
    bottom: 24px;
    z-index: 2;
    padding: 11px 15px;
    background: var(--second-bg-color);
    color: var(--text-color);
    font-size: 12px;
    box-shadow: 0 10px 25px var(--shadow-color);
}

.image-label i { color: var(--main-color); margin-right: 6px; }

@keyframes orbitFloat {
    0%, 100% { transform: rotate(-35deg) translateY(0); }
    50% { transform: rotate(-35deg) translateY(-8px); }
}

/* --- DIGITAL STUDIO MAKEOVER --- */
:root {
    --bg-color: #080d13;
    --second-bg-color: rgba(17, 27, 37, 0.78);
    --text-color: #f5f7f2;
    --main-color: #ffb84d;
    --text-secondary: #aebbc4;
    --shadow-color: rgba(0, 0, 0, 0.42);
    --accent-color: #6ee7d2;
    --line-color: rgba(110, 231, 210, 0.18);
}

.light-mode {
    --bg-color: #edf2ef;
    --second-bg-color: rgba(255, 255, 255, 0.82);
    --text-color: #102027;
    --text-secondary: #53646a;
    --shadow-color: rgba(24, 44, 48, 0.15);
    --line-color: rgba(22, 143, 130, 0.2);
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 78% 28%, rgba(255,184,77,0.1), transparent 24%), linear-gradient(rgba(110,231,210,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(110,231,210,0.035) 1px, transparent 1px);
    background-size: auto, 42px 42px, 42px 42px;
}

.navbar {
    padding: 16px clamp(24px, 7vw, 100px);
    background: rgba(8, 13, 19, 0.82);
    border-bottom: 1px solid var(--line-color);
    box-shadow: 0 12px 35px var(--shadow-color);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.light-mode .navbar { background: rgba(237, 242, 239, 0.86); }
.brand { color: var(--text-color); text-decoration: none; font: 600 18px 'Space Grotesk', sans-serif; display: flex; align-items: center; gap: 10px; }
.brand span { display: grid; place-items: center; width: 34px; height: 34px; background: var(--main-color); color: var(--bg-color); font-size: 12px; }
.nav-links { gap: clamp(16px, 3vw, 34px); }
.nav-links a { font-size: 13px; letter-spacing: 0.4px; }
.nav-links a:hover { color: var(--main-color); }
.theme-toggle { border: 1px solid var(--line-color); background: transparent; color: var(--text-color); width: 38px; height: 38px; cursor: pointer; transition: 0.3s; }
.theme-toggle:hover { color: var(--main-color); border-color: var(--main-color); transform: rotate(15deg); }

#app { padding: clamp(40px, 7vw, 85px) clamp(24px, 8vw, 120px); }
h1 { font-size: clamp(42px, 5vw, 72px); letter-spacing: -1.8px; }
.fade-in { animation: fadeIn 0.7s ease-out; }
.btn { border-radius: 0; padding: 13px 20px; letter-spacing: 0.2px; }
.btn-primary { box-shadow: 5px 5px 0 var(--accent-color); }
.btn-primary:hover { opacity: 1; box-shadow: 2px 2px 0 var(--accent-color); }
.btn-secondary { border-width: 1px; }

.home-container { min-height: min(680px, calc(100vh - 150px)); max-width: 1240px; }
.home-content h1 { font-size: clamp(52px, 6.5vw, 94px); }
.home-eyebrow { font-family: 'Space Grotesk', sans-serif; }
.subtitle-typing { font: 500 18px 'Space Grotesk', sans-serif; letter-spacing: 0.3px; }
.home-intro { color: var(--text-secondary); }
.home-img { min-height: 480px; }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-fallback { position: absolute; width: 190px; height: 190px; border: 1px solid var(--accent-color); transform: rotateX(58deg) rotateZ(45deg); opacity: 0.22; animation: fallbackSpin 16s linear infinite; z-index: -1; }
.hero-fallback::before, .hero-fallback::after, .hero-fallback span { content: ''; position: absolute; inset: 20px; border: 1px solid var(--main-color); }
.hero-fallback::before { transform: translateZ(45px); }
.hero-fallback::after { transform: translateZ(-45px); }
.hero-fallback span { transform: rotateZ(90deg) translateZ(45px); }
@keyframes fallbackSpin { to { transform: rotateX(58deg) rotateZ(405deg); } }
.hero-image-frame { position: relative; z-index: 1; }
.profile-img-animated { border: 9px solid var(--bg-color); outline: 1px solid var(--main-color); box-shadow: 18px 18px 0 var(--main-color), 0 0 70px rgba(110,231,210,0.18); }
.image-label { right: -20px; bottom: 10px; border: 1px solid var(--line-color); }
.home-details { border-color: var(--line-color); }

.about-layout, .contact-layout { max-width: 1180px; }
.achievements { margin-top: 0; grid-template-columns: repeat(2, minmax(170px, 1fr)); }
.achievement-item, .project-card, form { border-radius: 0; border: 1px solid var(--line-color); background: var(--second-bg-color); box-shadow: 0 18px 40px var(--shadow-color); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.achievement-item { padding: 24px 18px; }
.achievement-item:hover, .project-card:hover { border-color: var(--main-color); box-shadow: 0 18px 40px var(--shadow-color); }
.project-card { border-top: 3px solid var(--main-color); }
.project-card::before { background: linear-gradient(90deg, transparent, rgba(110,231,210,0.12), transparent); }
.badge { border-radius: 0; }
.contact-layout form { padding: 30px; }
.input-box input, .input-box textarea { border-radius: 0; border-color: var(--line-color); }
.contact-copy .home-eyebrow { margin-bottom: 8px; }

footer { background: transparent; border-top: 1px solid var(--line-color); }
.footer-content { max-width: 1180px; }
.social-link { border-radius: 0; border: 1px solid var(--line-color); }

@media (max-width: 768px) {
    .navbar { padding: 13px 18px; }
    .brand { font-size: 15px; }
    .nav-links { gap: 12px; }
    .nav-links a { font-size: 11px; }
    .theme-toggle { width: 32px; height: 32px; }
    .home-img { min-height: 360px; }
    .profile-img-animated { width: 235px; height: 235px; }
    .image-label { right: -10px; }
    .home-content h1 { font-size: clamp(42px, 13vw, 62px); }
    .home-details { gap: 12px; }
    .home-details span { font-size: 11px; }
    .achievements { grid-template-columns: 1fr; }
}
